Commit fa989919 by Sarath Subramanian

ATLAS-2590: Tag Propagation : Editing tag attributes without specifying propagate flag value

parent b03c2484
...@@ -54,7 +54,7 @@ public class AtlasClassification extends AtlasStruct implements Serializable { ...@@ -54,7 +54,7 @@ public class AtlasClassification extends AtlasStruct implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String entityGuid = null; private String entityGuid = null;
private boolean propagate = true; private Boolean propagate = null;
private List<TimeBoundary> validityPeriods = null; private List<TimeBoundary> validityPeriods = null;
public enum PropagationState { ACTIVE, DELETED } public enum PropagationState { ACTIVE, DELETED }
...@@ -94,11 +94,11 @@ public class AtlasClassification extends AtlasStruct implements Serializable { ...@@ -94,11 +94,11 @@ public class AtlasClassification extends AtlasStruct implements Serializable {
this.entityGuid = entityGuid; this.entityGuid = entityGuid;
} }
public boolean isPropagate() { public Boolean isPropagate() {
return propagate; return propagate;
} }
public void setPropagate(boolean propagate) { public void setPropagate(Boolean propagate) {
this.propagate = propagate; this.propagate = propagate;
} }
...@@ -129,7 +129,7 @@ public class AtlasClassification extends AtlasStruct implements Serializable { ...@@ -129,7 +129,7 @@ public class AtlasClassification extends AtlasStruct implements Serializable {
if (o == null || getClass() != o.getClass()) { return false; } if (o == null || getClass() != o.getClass()) { return false; }
if (!super.equals(o)) { return false; } if (!super.equals(o)) { return false; }
AtlasClassification that = (AtlasClassification) o; AtlasClassification that = (AtlasClassification) o;
return propagate == that.propagate && return Objects.equals(propagate, that.propagate) &&
Objects.equals(entityGuid, that.entityGuid) && Objects.equals(entityGuid, that.entityGuid) &&
Objects.equals(validityPeriods, that.validityPeriods); Objects.equals(validityPeriods, that.validityPeriods);
} }
......
...@@ -1328,7 +1328,11 @@ public class EntityGraphMapper { ...@@ -1328,7 +1328,11 @@ public class EntityGraphMapper {
for (AtlasClassification classification : classifications) { for (AtlasClassification classification : classifications) {
String classificationName = classification.getTypeName(); String classificationName = classification.getTypeName();
boolean propagateTags = classification.isPropagate(); Boolean propagateTags = classification.isPropagate();
if (propagateTags == null) {
propagateTags = true;
}
// set associated entity id to classification // set associated entity id to classification
classification.setEntityGuid(guid); classification.setEntityGuid(guid);
...@@ -1554,11 +1558,11 @@ public class EntityGraphMapper { ...@@ -1554,11 +1558,11 @@ public class EntityGraphMapper {
mapClassification(EntityOperation.UPDATE, context, classification, entityType, entityVertex, classificationVertex); mapClassification(EntityOperation.UPDATE, context, classification, entityType, entityVertex, classificationVertex);
// handle update of 'propagate' flag // handle update of 'propagate' flag
boolean currentTagPropagation = currentClassification.isPropagate(); Boolean currentTagPropagation = currentClassification.isPropagate();
boolean updatedTagPropagation = classification.isPropagate(); Boolean updatedTagPropagation = classification.isPropagate();
// compute propagatedEntityVertices once and use it for subsequent iterations and notifications // compute propagatedEntityVertices once and use it for subsequent iterations and notifications
if (currentTagPropagation != updatedTagPropagation) { if (updatedTagPropagation != null && currentTagPropagation != updatedTagPropagation) {
if (updatedTagPropagation) { if (updatedTagPropagation) {
if (CollectionUtils.isEmpty(entitiesToPropagateTo)) { if (CollectionUtils.isEmpty(entitiesToPropagateTo)) {
entitiesToPropagateTo = graphHelper.getImpactedVertices(guid); entitiesToPropagateTo = graphHelper.getImpactedVertices(guid);
...@@ -1687,7 +1691,9 @@ public class EntityGraphMapper { ...@@ -1687,7 +1691,9 @@ public class EntityGraphMapper {
// if 'null', don't update existing value in the classification // if 'null', don't update existing value in the classification
} }
AtlasGraphUtilsV1.setProperty(traitInstanceVertex, Constants.CLASSIFICATION_VERTEX_PROPAGATE_KEY, classification.isPropagate()); if (classification.isPropagate() != null) {
AtlasGraphUtilsV1.setProperty(traitInstanceVertex, Constants.CLASSIFICATION_VERTEX_PROPAGATE_KEY, classification.isPropagate());
}
// map all the attributes to this newly created AtlasVertex // map all the attributes to this newly created AtlasVertex
mapAttributes(classification, traitInstanceVertex, operation, context); mapAttributes(classification, traitInstanceVertex, operation, context);
......
...@@ -464,6 +464,7 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT { ...@@ -464,6 +464,7 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT {
classification.setEntityGuid(tableGuid); classification.setEntityGuid(tableGuid);
classification.addValityPeriod(validityPeriod); classification.addValityPeriod(validityPeriod);
classification.setPropagate(true);
atlasClientV2.addClassifications(tableGuid, Collections.singletonList(classification)); atlasClientV2.addClassifications(tableGuid, Collections.singletonList(classification));
......
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