Repository: atlas Updated Branches: refs/heads/master e4205b3b8 -> e7aec3354
ATLAS-2631: Tag Propagation : Change in behavior of tag propagation for DELETED entities Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/e7aec335 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/e7aec335 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/e7aec335 Branch: refs/heads/master Commit: e7aec3354168de2720f2435bee3febe002cef5f2 Parents: e4205b3 Author: Sarath Subramanian <[email protected]> Authored: Mon Apr 30 21:33:51 2018 -0700 Committer: Sarath Subramanian <[email protected]> Committed: Mon Apr 30 21:33:51 2018 -0700 ---------------------------------------------------------------------- .../repository/store/graph/v1/DeleteHandlerV1.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/atlas/blob/e7aec335/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java index abaf509..40154d9 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java @@ -59,6 +59,7 @@ import static org.apache.atlas.repository.Constants.PROPAGATED_TRAIT_NAMES_PROPE import static org.apache.atlas.repository.Constants.TRAIT_NAMES_PROPERTY_KEY; import static org.apache.atlas.repository.graph.GraphHelper.EDGE_LABEL_PREFIX; import static org.apache.atlas.repository.graph.GraphHelper.addToPropagatedTraitNames; +import static org.apache.atlas.repository.graph.GraphHelper.getAllClassificationEdges; import static org.apache.atlas.repository.graph.GraphHelper.getAssociatedEntityVertex; import static org.apache.atlas.repository.graph.GraphHelper.getClassificationEdge; import static org.apache.atlas.repository.graph.GraphHelper.getClassificationEdgeState; @@ -72,6 +73,7 @@ import static org.apache.atlas.repository.graph.GraphHelper.getPropagationEnable import static org.apache.atlas.repository.graph.GraphHelper.getRelationshipGuid; import static org.apache.atlas.repository.graph.GraphHelper.getTraitNames; import static org.apache.atlas.repository.graph.GraphHelper.getTypeName; +import static org.apache.atlas.repository.graph.GraphHelper.isPropagatedClassificationEdge; import static org.apache.atlas.repository.graph.GraphHelper.isRelationshipEdge; import static org.apache.atlas.repository.graph.GraphHelper.string; import static org.apache.atlas.repository.graph.GraphHelper.updateModificationMetadata; @@ -917,10 +919,19 @@ public abstract class DeleteHandlerV1 { * @throws AtlasException */ private void deleteAllClassifications(AtlasVertex instanceVertex) throws AtlasBaseException { - List<AtlasEdge> classificationEdges = getClassificationEdges(instanceVertex); + List<AtlasEdge> allClassificationEdges = getAllClassificationEdges(instanceVertex); - for (AtlasEdge edge : classificationEdges) { - deleteEdgeReference(edge, TypeCategory.CLASSIFICATION, false, false, instanceVertex); + for (AtlasEdge edge : allClassificationEdges) { + if (isPropagatedClassificationEdge(edge)) { + // when entity is deleted force delete its propagated classifications + deleteEdge(edge, true); + } else { + AtlasVertex classificationVertex = edge.getInVertex(); + + removeTagPropagation(classificationVertex); + + deleteEdgeReference(edge, TypeCategory.CLASSIFICATION, false, false, instanceVertex); + } } //remove traitNames and propagatedTraitNames property from instanceVertex
