Skip to content

Commit

Permalink
Merge pull request #3337 from atlanhq/dg-1476
Browse files Browse the repository at this point in the history
DG-1476 Handle QN check and Archive Stakeholders in domain delete flow
  • Loading branch information
PRATHAM2002-DS authored Jul 15, 2024
2 parents cc4e327 + 8f41ce4 commit a20edee
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,11 @@ private void processUpdateStakeholderTitle(EntityMutationContext context, AtlasE
domainQualifiedNames = currentDomainQualifiedNames;
}
else{
// validation to check if any StakeholderTitle has reference to Stakeholder
Iterator<AtlasVertex> childrens = getActiveChildrenVertices(vertex, STAKEHOLDER_TITLE_EDGE_LABEL);
if (childrens.hasNext()) {
throw new AtlasBaseException(OPERATION_NOT_SUPPORTED, "Can not update StakeholderTitle as it has reference to Stakeholder");
if (hasRemovedItems(currentDomainQualifiedNames, domainQualifiedNames)) {
Iterator<AtlasVertex> childrens = getActiveChildrenVertices(vertex, STAKEHOLDER_TITLE_EDGE_LABEL);
if (childrens.hasNext()) {
throw new AtlasBaseException(OPERATION_NOT_SUPPORTED, "Cannot remove StakeholderTitle as it has reference to Stakeholder");
}
}
}
}
Expand Down Expand Up @@ -221,6 +222,10 @@ public void processDelete(AtlasVertex vertex) throws AtlasBaseException {
}
}

private boolean hasRemovedItems(List<String> oldList, List<String> newList) {
return oldList.stream().anyMatch(qName -> !newList.contains(qName));
}

private void authorizeDomainAccess(List<String> domainQualifiedNames) throws AtlasBaseException {
for (String domainQualifiedName: domainQualifiedNames) {
String domainQualifiedNameToAuth;
Expand Down

0 comments on commit a20edee

Please sign in to comment.