You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by sa...@apache.org on 2019/04/09 20:45:52 UTC

[atlas] branch master updated: ATLAS-2458: RelationshipApi Delete doesnt remove relationshipAttributes from entity

This is an automated email from the ASF dual-hosted git repository.

sarath pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/master by this push:
     new fbabb8b  ATLAS-2458: RelationshipApi Delete doesnt remove relationshipAttributes from entity
fbabb8b is described below

commit fbabb8ba324e573cdcc5b914b1631417a6256283
Author: Kapildeo Nayak <ka...@freestoneinfotech.com>
AuthorDate: Tue Apr 9 13:39:45 2019 -0700

    ATLAS-2458: RelationshipApi Delete doesnt remove relationshipAttributes from entity
    
    Signed-off-by: Sarath Subramanian <ss...@hortonworks.com>
---
 .../repository/store/graph/v2/EntityGraphRetriever.java     | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
index 4bfb4ee..764b1e5 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
@@ -87,6 +87,7 @@ import static org.apache.atlas.glossary.GlossaryUtils.TERM_ASSIGNMENT_ATTR_EXPRE
 import static org.apache.atlas.glossary.GlossaryUtils.TERM_ASSIGNMENT_ATTR_SOURCE;
 import static org.apache.atlas.glossary.GlossaryUtils.TERM_ASSIGNMENT_ATTR_STATUS;
 import static org.apache.atlas.glossary.GlossaryUtils.TERM_ASSIGNMENT_ATTR_STEWARD;
+import static org.apache.atlas.model.instance.AtlasRelationship.Status.ACTIVE;
 import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_BIGDECIMAL;
 import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_BIGINTEGER;
 import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_BOOLEAN;
@@ -1088,13 +1089,19 @@ public class EntityGraphRetriever {
     private Object toAtlasObjectId(Object obj) {
         final Object ret;
 
-        if (obj instanceof AtlasObjectId) {
-            ret = new AtlasObjectId((AtlasObjectId) obj);
+        if (obj instanceof AtlasRelatedObjectId) {
+            AtlasRelatedObjectId relatedObjId = (AtlasRelatedObjectId) obj;
+
+            ret = relatedObjId.getRelationshipStatus() == ACTIVE ? new AtlasObjectId((AtlasObjectId) obj) : null;
         } else if (obj instanceof Collection) {
             List list = new ArrayList();
 
             for (Object elem : (Collection) obj) {
-                list.add(toAtlasObjectId(elem));
+                Object objId = toAtlasObjectId(elem);
+
+                if (objId != null) {
+                    list.add(objId);
+                }
             }
 
             ret = list;