Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DG-1682 - Fix: Ignore classification option validation when propogate is false #3311

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3590,6 +3590,7 @@ public void updateClassifications(EntityMutationContext context, String guid, Li
if (CollectionUtils.isEmpty(classifications)) {
throw new AtlasBaseException(AtlasErrorCode.INVALID_CLASSIFICATION_PARAMS, "update", guid);
}
entityRetriever.verifyClassificationsPropagationMode(classifications);

AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(this.graph, guid);

Expand Down Expand Up @@ -3711,7 +3712,21 @@ public void updateClassifications(EntityMutationContext context, String guid, Li
Boolean updatedRestrictPropagationThroughLineage = classification.getRestrictPropagationThroughLineage();
Boolean currentRestrictPropagationThroughHierarchy = currentClassification.getRestrictPropagationThroughHierarchy();
Boolean updatedRestrictPropagationThroughHierarchy = classification.getRestrictPropagationThroughHierarchy();
String propagationMode = entityRetriever.determinePropagationMode(updatedRestrictPropagationThroughLineage, updatedRestrictPropagationThroughHierarchy);
if (updatedRestrictPropagationThroughLineage == null) {
updatedRestrictPropagationThroughLineage = currentRestrictPropagationThroughLineage;
classification.setRestrictPropagationThroughLineage(updatedRestrictPropagationThroughLineage);
}
if (updatedRestrictPropagationThroughHierarchy == null) {
updatedRestrictPropagationThroughHierarchy = currentRestrictPropagationThroughHierarchy;
classification.setRestrictPropagationThroughHierarchy(updatedRestrictPropagationThroughHierarchy);
}

String propagationMode = CLASSIFICATION_PROPAGATION_MODE_DEFAULT;
if (updatedTagPropagation) {
// determinePropagationMode also validates the propagation restriction option values
propagationMode = entityRetriever.determinePropagationMode(updatedRestrictPropagationThroughLineage, updatedRestrictPropagationThroughHierarchy);
}

if ((!Objects.equals(updatedRemovePropagations, currentRemovePropagations) ||
!Objects.equals(currentTagPropagation, updatedTagPropagation) ||
!Objects.equals(currentRestrictPropagationThroughLineage, updatedRestrictPropagationThroughLineage)) &&
Expand All @@ -3733,7 +3748,6 @@ public void updateClassifications(EntityMutationContext context, String guid, Li
if (updatedTagPropagation) {
if (updatedRestrictPropagationThroughLineage != null && !currentRestrictPropagationThroughLineage && updatedRestrictPropagationThroughLineage) {
deleteDelegate.getHandler().removeTagPropagation(classificationVertex);

}
if (updatedRestrictPropagationThroughHierarchy != null && !currentRestrictPropagationThroughHierarchy && updatedRestrictPropagationThroughHierarchy) {
deleteDelegate.getHandler().removeTagPropagation(classificationVertex);
Expand Down
Loading