Skip to content

Commit

Permalink
Merge pull request #3367 from atlanhq/disc-367-glossary-filter
Browse files Browse the repository at this point in the history
fix: make all glossary queries at once
  • Loading branch information
sumandas0 authored Jul 24, 2024
2 parents 976baa3 + 39e04ea commit 93f70e5
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ private Map<String, Object> getFilterForPurpose(AtlasEntity purpose) throws Atla
private void personaPolicyToESDslClauses(List<AtlasEntity> policies,
List<Map<String, Object>> allowClauseList) throws AtlasBaseException {
List<String> terms = new ArrayList<>();
Set<String> glossaryQualifiedNames =new HashSet<>();

for (AtlasEntity policy: policies) {

Expand Down Expand Up @@ -211,7 +212,7 @@ private void personaPolicyToESDslClauses(List<AtlasEntity> policies,
} else if (getPolicyActions(policy).contains(ACCESS_READ_PERSONA_GLOSSARY)) {
if (CollectionUtils.isNotEmpty(assets)) {
terms.addAll(assets);
allowClauseList.add(mapOf("terms", mapOf(GLOSSARY_PROPERTY_KEY, assets)));
glossaryQualifiedNames.addAll(assets);
}
} else if (getPolicyActions(policy).contains(ACCESS_READ_PERSONA_DOMAIN)) {
for (String asset : assets) {
Expand Down Expand Up @@ -249,6 +250,10 @@ private void personaPolicyToESDslClauses(List<AtlasEntity> policies,
}

allowClauseList.add(mapOf("terms", mapOf(QUALIFIED_NAME, terms)));

if (CollectionUtils.isNotEmpty(glossaryQualifiedNames)) {
allowClauseList.add(mapOf("terms", mapOf(GLOSSARY_PROPERTY_KEY, new ArrayList<>(glossaryQualifiedNames))));
}
}

private boolean isAllDomain(String asset) {
Expand Down

0 comments on commit 93f70e5

Please sign in to comment.