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

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

commit 39ca642083d971fba4d78d588a0c8b9d7a0f1b1b
Author: Kapildeo Nayak <kapildeo.na...@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 <ssubraman...@hortonworks.com>
    (cherry picked from commit fbabb8ba324e573cdcc5b914b1631417a6256283)
---
 .../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;

Reply via email to