Commit 9c9eed27 by Madhan Neethiraj

ATLAS-3139: updated basic search to include relationship attributes as well in the result

parent a910609d
...@@ -744,19 +744,19 @@ public class AtlasStructType extends AtlasType { ...@@ -744,19 +744,19 @@ public class AtlasStructType extends AtlasType {
this.inverseRefAttributeName = inverseRefAttribute; this.inverseRefAttributeName = inverseRefAttribute;
this.relationshipEdgeDirection = AtlasRelationshipEdgeDirection.OUT; this.relationshipEdgeDirection = AtlasRelationshipEdgeDirection.OUT;
switch (attributeType.getTypeCategory()) { switch (this.attributeType.getTypeCategory()) {
case OBJECT_ID_TYPE: case OBJECT_ID_TYPE:
isObjectRef = true; isObjectRef = true;
break; break;
case MAP: case MAP:
AtlasMapType mapType = (AtlasMapType) attributeType; AtlasMapType mapType = (AtlasMapType) this.attributeType;
isObjectRef = mapType.getValueType().getTypeCategory() == OBJECT_ID_TYPE; isObjectRef = mapType.getValueType().getTypeCategory() == OBJECT_ID_TYPE;
break; break;
case ARRAY: case ARRAY:
AtlasArrayType arrayType = (AtlasArrayType) attributeType; AtlasArrayType arrayType = (AtlasArrayType) this.attributeType;
isObjectRef = arrayType.getElementType().getTypeCategory() == OBJECT_ID_TYPE; isObjectRef = arrayType.getElementType().getTypeCategory() == OBJECT_ID_TYPE;
break; break;
......
...@@ -451,6 +451,10 @@ public class EntityDiscoveryService implements AtlasDiscoveryService { ...@@ -451,6 +451,10 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
for (String resultAttribute : resultAttributes) { for (String resultAttribute : resultAttributes) {
AtlasAttribute attribute = entityType.getAttribute(resultAttribute); AtlasAttribute attribute = entityType.getAttribute(resultAttribute);
if (attribute == null) {
attribute = entityType.getRelationshipAttribute(resultAttribute, null);
}
if (attribute != null) { if (attribute != null) {
AtlasType attributeType = attribute.getAttributeType(); AtlasType attributeType = attribute.getAttributeType();
...@@ -536,6 +540,10 @@ public class EntityDiscoveryService implements AtlasDiscoveryService { ...@@ -536,6 +540,10 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
AtlasAttribute attribute = entityType.getAttribute(relation); AtlasAttribute attribute = entityType.getAttribute(relation);
if (attribute == null) {
attribute = entityType.getRelationshipAttribute(relation, null);
}
if (attribute != null) { if (attribute != null) {
if (attribute.isObjectRef()) { if (attribute.isObjectRef()) {
relation = attribute.getRelationshipEdgeLabel(); relation = attribute.getRelationshipEdgeLabel();
......
...@@ -533,7 +533,13 @@ public class EntityGraphRetriever { ...@@ -533,7 +533,13 @@ public class EntityGraphRetriever {
continue; continue;
} }
Object attrValue = getVertexAttribute(entityVertex, entityType.getAttribute(nonQualifiedAttrName)); AtlasAttribute attribute = entityType.getAttribute(nonQualifiedAttrName);
if (attribute == null) {
attribute = entityType.getRelationshipAttribute(nonQualifiedAttrName, null);
}
Object attrValue = getVertexAttribute(entityVertex, attribute);
if (attrValue != null) { if (attrValue != null) {
ret.setAttribute(nonQualifiedAttrName, attrValue); ret.setAttribute(nonQualifiedAttrName, attrValue);
......
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