Commit b9637b9a by Sarath Subramanian

ATLAS-2840: Regression - Tag Propagation, Deleted Entity : When an entity is…

ATLAS-2840: Regression - Tag Propagation, Deleted Entity : When an entity is deleted, tags propagated to it are removed
parent 9c45d2e8
...@@ -98,6 +98,7 @@ import static org.apache.atlas.repository.Constants.RELATIONSHIPTYPE_BLOCKED_PRO ...@@ -98,6 +98,7 @@ import static org.apache.atlas.repository.Constants.RELATIONSHIPTYPE_BLOCKED_PRO
import static org.apache.atlas.repository.Constants.RELATIONSHIPTYPE_TAG_PROPAGATION_KEY; import static org.apache.atlas.repository.Constants.RELATIONSHIPTYPE_TAG_PROPAGATION_KEY;
import static org.apache.atlas.repository.Constants.STATE_PROPERTY_KEY; import static org.apache.atlas.repository.Constants.STATE_PROPERTY_KEY;
import static org.apache.atlas.repository.Constants.SUPER_TYPES_PROPERTY_KEY; import static org.apache.atlas.repository.Constants.SUPER_TYPES_PROPERTY_KEY;
import static org.apache.atlas.repository.Constants.TERM_ASSIGNMENT_LABEL;
import static org.apache.atlas.repository.Constants.TIMESTAMP_PROPERTY_KEY; import static org.apache.atlas.repository.Constants.TIMESTAMP_PROPERTY_KEY;
import static org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2.isReference; import static org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2.isReference;
import static org.apache.atlas.type.AtlasStructType.AtlasAttribute.AtlasRelationshipEdgeDirection.BOTH; import static org.apache.atlas.type.AtlasStructType.AtlasAttribute.AtlasRelationshipEdgeDirection.BOTH;
...@@ -165,6 +166,9 @@ public final class GraphHelper { ...@@ -165,6 +166,9 @@ public final class GraphHelper {
return INSTANCE; return INSTANCE;
} }
public static boolean isTermEntityEdge(AtlasEdge edge) {
return StringUtils.equals(edge.getLabel(), TERM_ASSIGNMENT_LABEL);
}
public AtlasVertex createVertexWithIdentity(Referenceable typedInstance, Set<String> superTypeNames) { public AtlasVertex createVertexWithIdentity(Referenceable typedInstance, Set<String> superTypeNames) {
final String guid = UUID.randomUUID().toString(); final String guid = UUID.randomUUID().toString();
......
...@@ -29,7 +29,6 @@ import org.apache.atlas.model.instance.AtlasEntity.Status; ...@@ -29,7 +29,6 @@ import org.apache.atlas.model.instance.AtlasEntity.Status;
import org.apache.atlas.model.instance.AtlasObjectId; import org.apache.atlas.model.instance.AtlasObjectId;
import org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags; import org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
import org.apache.atlas.repository.Constants;
import org.apache.atlas.repository.graph.AtlasEdgeLabel; import org.apache.atlas.repository.graph.AtlasEdgeLabel;
import org.apache.atlas.repository.graph.GraphHelper; import org.apache.atlas.repository.graph.GraphHelper;
import org.apache.atlas.repository.graphdb.AtlasEdge; import org.apache.atlas.repository.graphdb.AtlasEdge;
...@@ -449,8 +448,14 @@ public abstract class DeleteHandlerV1 { ...@@ -449,8 +448,14 @@ public abstract class DeleteHandlerV1 {
} }
} }
boolean isTermEntityEdge = isTermEntityEdge(edge);
for (AtlasVertex classificationVertex : removePropagationsMap.keySet()) { for (AtlasVertex classificationVertex : removePropagationsMap.keySet()) {
removeTagPropagation(classificationVertex, removePropagationsMap.get(classificationVertex)); boolean removePropagations = getRemovePropagations(classificationVertex);
if (isTermEntityEdge || removePropagations) {
removeTagPropagation(classificationVertex, removePropagationsMap.get(classificationVertex));
}
} }
} }
......
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