Skip to content

Commit ee17588

Browse files
authored
Merge pull request #3311 from atlanhq/ns/fix/DG-1682-propogate-classification
DG-1682 - Fix: Ignore classification option validation when propogate is false
2 parents c1147c0 + e31e6b9 commit ee17588

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3590,6 +3590,7 @@ public void updateClassifications(EntityMutationContext context, String guid, Li
35903590
if (CollectionUtils.isEmpty(classifications)) {
35913591
throw new AtlasBaseException(AtlasErrorCode.INVALID_CLASSIFICATION_PARAMS, "update", guid);
35923592
}
3593+
entityRetriever.verifyClassificationsPropagationMode(classifications);
35933594

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

@@ -3711,7 +3712,21 @@ public void updateClassifications(EntityMutationContext context, String guid, Li
37113712
Boolean updatedRestrictPropagationThroughLineage = classification.getRestrictPropagationThroughLineage();
37123713
Boolean currentRestrictPropagationThroughHierarchy = currentClassification.getRestrictPropagationThroughHierarchy();
37133714
Boolean updatedRestrictPropagationThroughHierarchy = classification.getRestrictPropagationThroughHierarchy();
3714-
String propagationMode = entityRetriever.determinePropagationMode(updatedRestrictPropagationThroughLineage, updatedRestrictPropagationThroughHierarchy);
3715+
if (updatedRestrictPropagationThroughLineage == null) {
3716+
updatedRestrictPropagationThroughLineage = currentRestrictPropagationThroughLineage;
3717+
classification.setRestrictPropagationThroughLineage(updatedRestrictPropagationThroughLineage);
3718+
}
3719+
if (updatedRestrictPropagationThroughHierarchy == null) {
3720+
updatedRestrictPropagationThroughHierarchy = currentRestrictPropagationThroughHierarchy;
3721+
classification.setRestrictPropagationThroughHierarchy(updatedRestrictPropagationThroughHierarchy);
3722+
}
3723+
3724+
String propagationMode = CLASSIFICATION_PROPAGATION_MODE_DEFAULT;
3725+
if (updatedTagPropagation) {
3726+
// determinePropagationMode also validates the propagation restriction option values
3727+
propagationMode = entityRetriever.determinePropagationMode(updatedRestrictPropagationThroughLineage, updatedRestrictPropagationThroughHierarchy);
3728+
}
3729+
37153730
if ((!Objects.equals(updatedRemovePropagations, currentRemovePropagations) ||
37163731
!Objects.equals(currentTagPropagation, updatedTagPropagation) ||
37173732
!Objects.equals(currentRestrictPropagationThroughLineage, updatedRestrictPropagationThroughLineage)) &&
@@ -3733,7 +3748,6 @@ public void updateClassifications(EntityMutationContext context, String guid, Li
37333748
if (updatedTagPropagation) {
37343749
if (updatedRestrictPropagationThroughLineage != null && !currentRestrictPropagationThroughLineage && updatedRestrictPropagationThroughLineage) {
37353750
deleteDelegate.getHandler().removeTagPropagation(classificationVertex);
3736-
37373751
}
37383752
if (updatedRestrictPropagationThroughHierarchy != null && !currentRestrictPropagationThroughHierarchy && updatedRestrictPropagationThroughHierarchy) {
37393753
deleteDelegate.getHandler().removeTagPropagation(classificationVertex);

0 commit comments

Comments
 (0)