atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject incubator-atlas git commit: ATLAS-1635: fixed v1 lineage API return to return correct value in qualifiedName attribute
Date Mon, 06 Mar 2017 08:39:28 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 42a441aa6 -> fe86177a1


ATLAS-1635: fixed v1 lineage API return to return correct value in qualifiedName attribute


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/fe86177a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/fe86177a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/fe86177a

Branch: refs/heads/master
Commit: fe86177a1d55b18b9b1a205fcd1cae83c6b85606
Parents: 42a441a
Author: Madhan Neethiraj <madhan@apache.org>
Authored: Sun Mar 5 13:05:17 2017 -0800
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Mon Mar 6 00:38:41 2017 -0800

----------------------------------------------------------------------
 .../store/graph/v1/EntityGraphRetriever.java          | 14 +++++++++-----
 .../java/org/apache/atlas/web/util/LineageUtils.java  |  7 ++++++-
 2 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/fe86177a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
index 815c3d2..075b9b6 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
@@ -197,14 +197,18 @@ public final class EntityGraphRetriever {
         AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName);
 
         if (entityType != null) {
+            for (AtlasAttribute uniqueAttribute : entityType.getUniqAttributes().values())
{
+                Object attrValue = getVertexAttribute(entityVertex, uniqueAttribute);
+
+                if (attrValue != null) {
+                    ret.setAttribute(uniqueAttribute.getName(), attrValue);
+                }
+            }
+
             Object name        = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.NAME));
             Object description = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.DESCRIPTION));
             Object owner       = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.OWNER));
-            Object displayText = name;
-
-            if (displayText == null) {
-                displayText = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.QUALIFIED_NAME));
-            }
+            Object displayText = name != null ? name : ret.getAttribute(AtlasClient.QUALIFIED_NAME);
 
             ret.setAttribute(AtlasClient.NAME, name);
             ret.setAttribute(AtlasClient.DESCRIPTION, description);

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/fe86177a/webapp/src/main/java/org/apache/atlas/web/util/LineageUtils.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/util/LineageUtils.java b/webapp/src/main/java/org/apache/atlas/web/util/LineageUtils.java
index 58ddf8b..ad2a697 100644
--- a/webapp/src/main/java/org/apache/atlas/web/util/LineageUtils.java
+++ b/webapp/src/main/java/org/apache/atlas/web/util/LineageUtils.java
@@ -72,8 +72,13 @@ public final class LineageUtils {
                     vertexIdMap.put(idType.stateAttrName(), (entityHeader.getStatus() ==
AtlasEntity.Status.ACTIVE) ? "ACTIVE" : "DELETED");
                     vertexIdMap.put(idType.typeNameAttrName(), entityHeader.getTypeName());
 
+                    Object qualifiedName = entityHeader.getAttribute(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME);
+                    if (qualifiedName == null) {
+                        qualifiedName = entityHeader.getDisplayText();
+                    }
+
                     Map<String, Object> values = new HashMap<>();
-                    values.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, entityHeader.getDisplayText());
+                    values.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, qualifiedName);
                     values.put(VERTEX_ID_ATTR_NAME, constructResultStruct(vertexIdMap, true));
                     values.put(AtlasClient.NAME, entityHeader.getDisplayText());
                     verticesMap.put(guid, constructResultStruct(values, false));


Mime
View raw message