Repository: atlas Updated Branches: refs/heads/master b03c24840 -> fa9899199
ATLAS-2590: Tag Propagation : Editing tag attributes without specifying propagate flag value Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/fa989919 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/fa989919 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/fa989919 Branch: refs/heads/master Commit: fa98991998efa9e18628c76a58ed37f6abbf2e99 Parents: b03c248 Author: Sarath Subramanian <[email protected]> Authored: Fri Apr 20 15:14:30 2018 -0700 Committer: Sarath Subramanian <[email protected]> Committed: Fri Apr 20 15:14:30 2018 -0700 ---------------------------------------------------------------------- .../atlas/model/instance/AtlasClassification.java | 8 ++++---- .../store/graph/v1/EntityGraphMapper.java | 16 +++++++++++----- .../web/integration/EntityV2JerseyResourceIT.java | 1 + 3 files changed, 16 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/atlas/blob/fa989919/intg/src/main/java/org/apache/atlas/model/instance/AtlasClassification.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/model/instance/AtlasClassification.java b/intg/src/main/java/org/apache/atlas/model/instance/AtlasClassification.java index bf4f469..f73f36e 100644 --- a/intg/src/main/java/org/apache/atlas/model/instance/AtlasClassification.java +++ b/intg/src/main/java/org/apache/atlas/model/instance/AtlasClassification.java @@ -54,7 +54,7 @@ public class AtlasClassification extends AtlasStruct implements Serializable { private static final long serialVersionUID = 1L; private String entityGuid = null; - private boolean propagate = true; + private Boolean propagate = null; private List<TimeBoundary> validityPeriods = null; public enum PropagationState { ACTIVE, DELETED } @@ -94,11 +94,11 @@ public class AtlasClassification extends AtlasStruct implements Serializable { this.entityGuid = entityGuid; } - public boolean isPropagate() { + public Boolean isPropagate() { return propagate; } - public void setPropagate(boolean propagate) { + public void setPropagate(Boolean propagate) { this.propagate = propagate; } @@ -129,7 +129,7 @@ public class AtlasClassification extends AtlasStruct implements Serializable { if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } AtlasClassification that = (AtlasClassification) o; - return propagate == that.propagate && + return Objects.equals(propagate, that.propagate) && Objects.equals(entityGuid, that.entityGuid) && Objects.equals(validityPeriods, that.validityPeriods); } http://git-wip-us.apache.org/repos/asf/atlas/blob/fa989919/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java index 33b5896..4225a80 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java @@ -1328,7 +1328,11 @@ public class EntityGraphMapper { for (AtlasClassification classification : classifications) { String classificationName = classification.getTypeName(); - boolean propagateTags = classification.isPropagate(); + Boolean propagateTags = classification.isPropagate(); + + if (propagateTags == null) { + propagateTags = true; + } // set associated entity id to classification classification.setEntityGuid(guid); @@ -1554,11 +1558,11 @@ public class EntityGraphMapper { mapClassification(EntityOperation.UPDATE, context, classification, entityType, entityVertex, classificationVertex); // handle update of 'propagate' flag - boolean currentTagPropagation = currentClassification.isPropagate(); - boolean updatedTagPropagation = classification.isPropagate(); + Boolean currentTagPropagation = currentClassification.isPropagate(); + Boolean updatedTagPropagation = classification.isPropagate(); // compute propagatedEntityVertices once and use it for subsequent iterations and notifications - if (currentTagPropagation != updatedTagPropagation) { + if (updatedTagPropagation != null && currentTagPropagation != updatedTagPropagation) { if (updatedTagPropagation) { if (CollectionUtils.isEmpty(entitiesToPropagateTo)) { entitiesToPropagateTo = graphHelper.getImpactedVertices(guid); @@ -1687,7 +1691,9 @@ public class EntityGraphMapper { // 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 mapAttributes(classification, traitInstanceVertex, operation, context); http://git-wip-us.apache.org/repos/asf/atlas/blob/fa989919/webapp/src/test/java/org/apache/atlas/web/integration/EntityV2JerseyResourceIT.java ---------------------------------------------------------------------- diff --git a/webapp/src/test/java/org/apache/atlas/web/integration/EntityV2JerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/EntityV2JerseyResourceIT.java index 483e4e2..d50db06 100755 --- a/webapp/src/test/java/org/apache/atlas/web/integration/EntityV2JerseyResourceIT.java +++ b/webapp/src/test/java/org/apache/atlas/web/integration/EntityV2JerseyResourceIT.java @@ -464,6 +464,7 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT { classification.setEntityGuid(tableGuid); classification.addValityPeriod(validityPeriod); + classification.setPropagate(true); atlasClientV2.addClassifications(tableGuid, Collections.singletonList(classification));
