Commit fe86177a by Madhan Neethiraj

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

parent 42a441aa
...@@ -197,14 +197,18 @@ public final class EntityGraphRetriever { ...@@ -197,14 +197,18 @@ public final class EntityGraphRetriever {
AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName);
if (entityType != null) { 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 name = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.NAME));
Object description = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.DESCRIPTION)); Object description = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.DESCRIPTION));
Object owner = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.OWNER)); Object owner = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.OWNER));
Object displayText = name; Object displayText = name != null ? name : ret.getAttribute(AtlasClient.QUALIFIED_NAME);
if (displayText == null) {
displayText = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.QUALIFIED_NAME));
}
ret.setAttribute(AtlasClient.NAME, name); ret.setAttribute(AtlasClient.NAME, name);
ret.setAttribute(AtlasClient.DESCRIPTION, description); ret.setAttribute(AtlasClient.DESCRIPTION, description);
......
...@@ -72,8 +72,13 @@ public final class LineageUtils { ...@@ -72,8 +72,13 @@ public final class LineageUtils {
vertexIdMap.put(idType.stateAttrName(), (entityHeader.getStatus() == AtlasEntity.Status.ACTIVE) ? "ACTIVE" : "DELETED"); vertexIdMap.put(idType.stateAttrName(), (entityHeader.getStatus() == AtlasEntity.Status.ACTIVE) ? "ACTIVE" : "DELETED");
vertexIdMap.put(idType.typeNameAttrName(), entityHeader.getTypeName()); 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<>(); 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(VERTEX_ID_ATTR_NAME, constructResultStruct(vertexIdMap, true));
values.put(AtlasClient.NAME, entityHeader.getDisplayText()); values.put(AtlasClient.NAME, entityHeader.getDisplayText());
verticesMap.put(guid, constructResultStruct(values, false)); verticesMap.put(guid, constructResultStruct(values, false));
......
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