Commit e7aec335 by Sarath Subramanian

ATLAS-2631: Tag Propagation : Change in behavior of tag propagation for DELETED entities

parent e4205b3b
...@@ -59,6 +59,7 @@ import static org.apache.atlas.repository.Constants.PROPAGATED_TRAIT_NAMES_PROPE ...@@ -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.Constants.TRAIT_NAMES_PROPERTY_KEY;
import static org.apache.atlas.repository.graph.GraphHelper.EDGE_LABEL_PREFIX; 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.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.getAssociatedEntityVertex;
import static org.apache.atlas.repository.graph.GraphHelper.getClassificationEdge; import static org.apache.atlas.repository.graph.GraphHelper.getClassificationEdge;
import static org.apache.atlas.repository.graph.GraphHelper.getClassificationEdgeState; import static org.apache.atlas.repository.graph.GraphHelper.getClassificationEdgeState;
...@@ -72,6 +73,7 @@ import static org.apache.atlas.repository.graph.GraphHelper.getPropagationEnable ...@@ -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.getRelationshipGuid;
import static org.apache.atlas.repository.graph.GraphHelper.getTraitNames; 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.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.isRelationshipEdge;
import static org.apache.atlas.repository.graph.GraphHelper.string; import static org.apache.atlas.repository.graph.GraphHelper.string;
import static org.apache.atlas.repository.graph.GraphHelper.updateModificationMetadata; import static org.apache.atlas.repository.graph.GraphHelper.updateModificationMetadata;
...@@ -917,10 +919,19 @@ public abstract class DeleteHandlerV1 { ...@@ -917,10 +919,19 @@ public abstract class DeleteHandlerV1 {
* @throws AtlasException * @throws AtlasException
*/ */
private void deleteAllClassifications(AtlasVertex instanceVertex) throws AtlasBaseException { private void deleteAllClassifications(AtlasVertex instanceVertex) throws AtlasBaseException {
List<AtlasEdge> classificationEdges = getClassificationEdges(instanceVertex); List<AtlasEdge> allClassificationEdges = getAllClassificationEdges(instanceVertex);
for (AtlasEdge edge : classificationEdges) { for (AtlasEdge edge : allClassificationEdges) {
deleteEdgeReference(edge, TypeCategory.CLASSIFICATION, false, false, instanceVertex); 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 //remove traitNames and propagatedTraitNames property from instanceVertex
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment