Skip to content

Commit

Permalink
MESH-40 Fixed the TODOs left by previous part of the task.
Browse files Browse the repository at this point in the history
  • Loading branch information
hr2904 committed Jul 10, 2024
1 parent 29440e0 commit 1cb3862
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,9 @@ private void processCreatePolicy(AtlasStruct entity) throws AtlasBaseException {
if (!POLICY_SUB_CATEGORY_DOMAIN.equals(policySubCategory)) {
validator.validate(policy, null, parentEntity, CREATE);
validateConnectionAdmin(policy);
} else {
validateAndReduce(policy);
}
// TODO : uncomment after FE release
// else {
// validateAndReduce(policy);
// }

policy.setAttribute(QUALIFIED_NAME, String.format("%s/%s", getEntityQualifiedName(parentEntity), getUUID()));

Expand Down Expand Up @@ -173,11 +171,11 @@ private void validateAndReduce(AtlasEntity policy) {
boolean hasAllDomainPattern = resources.stream().anyMatch(resource ->
resource.equals("entity:*") ||
resource.equals("entity:*/super") ||
resource.equals("entity:default/domain/*/super")
resource.equals(ENTITY_DEFAULT_DOMAIN_SUPER)
);

if (hasAllDomainPattern) {
policy.setAttribute(ATTR_POLICY_RESOURCES, Collections.singletonList("entity:default/domain/*/super"));
policy.setAttribute(ATTR_POLICY_RESOURCES, Collections.singletonList(ENTITY_DEFAULT_DOMAIN_SUPER));
}
}

Expand All @@ -199,11 +197,9 @@ private void processUpdatePolicy(AtlasStruct entity, AtlasVertex vertex) throws
if (!POLICY_SUB_CATEGORY_DOMAIN.equals(policySubCategory)) {
validator.validate(policy, existingPolicy, parentEntity, UPDATE);
validateConnectionAdmin(policy);
} else {
validateAndReduce(policy);
}
// TODO : uncomment after FE release
// else {
// validateAndReduce(policy);
// }

String qName = getEntityQualifiedName(existingPolicy);
policy.setAttribute(QUALIFIED_NAME, qName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,12 @@ private void processCreateStakeholderTitle(AtlasEntity entity) throws AtlasBaseE
}
if (domainQualifiedNames.contains(NEW_STAR) || domainQualifiedNames.contains(STAR)) {
if (domainQualifiedNames.size() > 1) {

domainQualifiedNames.clear();
// TODO : convert this to NEW_STAR after FE release
domainQualifiedNames.add(STAR);
domainQualifiedNames.add(NEW_STAR);
entity.setAttribute(ATTR_DOMAIN_QUALIFIED_NAMES, domainQualifiedNames);
} // TODO : uncomment this after FE release
// else {
// domainQualifiedNames.replaceAll(s -> s.equals(STAR) ? NEW_STAR : s);
// }
}else {
domainQualifiedNames.replaceAll(s -> s.equals(STAR) ? NEW_STAR : s);
}

String qualifiedName = format(PATTERN_QUALIFIED_NAME_ALL_DOMAINS, getUUID());
entity.setAttribute(QUALIFIED_NAME, qualifiedName);
Expand Down Expand Up @@ -216,8 +213,7 @@ private void authorizeDomainAccess(List<String> domainQualifiedNames) throws Atl
String domainQualifiedNameToAuth;

if (domainQualifiedNames.contains(STAR) || domainQualifiedNames.contains(NEW_STAR)) {
//TODO : Convert this to NEW_STAR
domainQualifiedNameToAuth = STAR;
domainQualifiedNameToAuth = NEW_STAR;
} else {
domainQualifiedNameToAuth = domainQualifiedName;
}
Expand Down

0 comments on commit 1cb3862

Please sign in to comment.