From 39e04ea86cf46098660531ff6e08a69b7335c0e9 Mon Sep 17 00:00:00 2001 From: Suman Das <59254445+sumandas0@users.noreply.github.com> Date: Wed, 24 Jul 2024 19:56:17 +0530 Subject: [PATCH] fix: make all glossary queries at once --- .../atlas/repository/store/aliasstore/ESAliasStore.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/aliasstore/ESAliasStore.java b/repository/src/main/java/org/apache/atlas/repository/store/aliasstore/ESAliasStore.java index 2990bc1505..f10455208c 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/aliasstore/ESAliasStore.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/aliasstore/ESAliasStore.java @@ -179,6 +179,7 @@ private Map getFilterForPurpose(AtlasEntity purpose) throws Atla private void personaPolicyToESDslClauses(List policies, List> allowClauseList) throws AtlasBaseException { List terms = new ArrayList<>(); + Set glossaryQualifiedNames =new HashSet<>(); for (AtlasEntity policy: policies) { @@ -211,7 +212,7 @@ private void personaPolicyToESDslClauses(List 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) { @@ -249,6 +250,10 @@ private void personaPolicyToESDslClauses(List 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) {