/** * Get relationship information between entities using guid. */ @GET @Path("/guid/{guid}") public AtlasRelationshipWithExtInfo getById(@PathParam("guid") String guid, @QueryParam("extendedInfo") @DefaultValue("false") boolean extendedInfo) throws AtlasBaseException { Servlets.validateQueryParamLength("guid", guid); AtlasPerfTracer perf = null; AtlasRelationshipWithExtInfo ret; try { if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) { perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "RelationshipREST.getById(" + guid + ")"); } if (extendedInfo) { ret = relationshipStore.getExtInfoById(guid); } else { ret = new AtlasRelationshipWithExtInfo(relationshipStore.getById(guid)); } return ret; } finally { AtlasPerfTracer.log(perf); } }
AtlasRelationship relationship = relationshipWithExtInfo.getRelationship(); relationshipWithExtInfo.setRelationship(relationship);
AtlasRelationship relationship = relationshipWithExtInfo.getRelationship(); relationshipWithExtInfo.setRelationship(relationship);
private void readClassificationsFromEdge(AtlasEdge edge, AtlasRelationshipWithExtInfo relationshipWithExtInfo, boolean extendedInfo) throws AtlasBaseException { List<AtlasVertex> classificationVertices = getClassificationVertices(edge); List<String> blockedClassificationIds = getBlockedClassificationIds(edge); AtlasRelationship relationship = relationshipWithExtInfo.getRelationship(); Set<AtlasClassification> propagatedClassifications = new HashSet<>(); Set<AtlasClassification> blockedClassifications = new HashSet<>(); for (AtlasVertex classificationVertex : classificationVertices) { String classificationId = classificationVertex.getIdForDisplay(); AtlasClassification classification = toAtlasClassification(classificationVertex); String entityGuid = classification.getEntityGuid(); if (blockedClassificationIds.contains(classificationId)) { blockedClassifications.add(classification); } else { propagatedClassifications.add(classification); } // add entity headers to referred entities if (extendedInfo) { addToReferredEntities(relationshipWithExtInfo, entityGuid); } } relationship.setPropagatedClassifications(propagatedClassifications); relationship.setBlockedPropagatedClassifications(blockedClassifications); }
private void readClassificationsFromEdge(AtlasEdge edge, AtlasRelationshipWithExtInfo relationshipWithExtInfo, boolean extendedInfo) throws AtlasBaseException { List<AtlasVertex> classificationVertices = getClassificationVertices(edge); List<String> blockedClassificationIds = getBlockedClassificationIds(edge); AtlasRelationship relationship = relationshipWithExtInfo.getRelationship(); Set<AtlasClassification> propagatedClassifications = new HashSet<>(); Set<AtlasClassification> blockedClassifications = new HashSet<>(); for (AtlasVertex classificationVertex : classificationVertices) { String classificationId = classificationVertex.getIdForDisplay(); AtlasClassification classification = toAtlasClassification(classificationVertex); String entityGuid = classification.getEntityGuid(); if (blockedClassificationIds.contains(classificationId)) { blockedClassifications.add(classification); } else { propagatedClassifications.add(classification); } // add entity headers to referred entities if (extendedInfo) { addToReferredEntities(relationshipWithExtInfo, entityGuid); } } relationship.setPropagatedClassifications(propagatedClassifications); relationship.setBlockedPropagatedClassifications(blockedClassifications); }
private void mapAttributes(AtlasEdge edge, AtlasRelationshipWithExtInfo relationshipWithExtInfo) throws AtlasBaseException { AtlasRelationship relationship = relationshipWithExtInfo.getRelationship(); AtlasType objType = typeRegistry.getType(relationship.getTypeName()); if (!(objType instanceof AtlasRelationshipType)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, relationship.getTypeName()); } AtlasRelationshipType relationshipType = (AtlasRelationshipType) objType; for (AtlasAttribute attribute : relationshipType.getAllAttributes().values()) { // mapping only primitive attributes Object attrValue = mapVertexToPrimitive(edge, attribute.getVertexPropertyName(), attribute.getAttributeDef()); relationship.setAttribute(attribute.getName(), attrValue); } } }
public AtlasRelationship mapEdgeToAtlasRelationship(AtlasEdge edge) throws AtlasBaseException { return mapEdgeToAtlasRelationship(edge, false).getRelationship(); }
public AtlasRelationshipWithExtInfo(AtlasRelationship relationship) { setRelationship(relationship); }
public AtlasRelationship mapEdgeToAtlasRelationship(AtlasEdge edge) throws AtlasBaseException { return mapEdgeToAtlasRelationship(edge, false).getRelationship(); }
private void addToReferredEntities(AtlasRelationshipWithExtInfo relationshipWithExtInfo, String guid) throws AtlasBaseException { if (!relationshipWithExtInfo.referredEntitiesContains(guid)) { addToReferredEntities(relationshipWithExtInfo, getEntityVertex(guid)); } }
public AtlasRelationshipWithExtInfo mapEdgeToAtlasRelationship(AtlasEdge edge, boolean extendedInfo) throws AtlasBaseException { AtlasRelationshipWithExtInfo ret = new AtlasRelationshipWithExtInfo(); mapSystemAttributes(edge, ret, extendedInfo); mapAttributes(edge, ret); return ret; }
private void addToReferredEntities(AtlasRelationshipWithExtInfo relationshipWithExtInfo, AtlasVertex entityVertex) throws AtlasBaseException { String entityGuid = getGuid(entityVertex); if (!relationshipWithExtInfo.referredEntitiesContains(entityGuid)) { relationshipWithExtInfo.addReferredEntity(entityGuid, toAtlasEntityHeader(entityVertex)); } }
private void mapAttributes(AtlasEdge edge, AtlasRelationshipWithExtInfo relationshipWithExtInfo) throws AtlasBaseException { AtlasRelationship relationship = relationshipWithExtInfo.getRelationship(); AtlasType objType = typeRegistry.getType(relationship.getTypeName()); if (!(objType instanceof AtlasRelationshipType)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, relationship.getTypeName()); } AtlasRelationshipType relationshipType = (AtlasRelationshipType) objType; for (AtlasAttribute attribute : relationshipType.getAllAttributes().values()) { // mapping only primitive attributes Object attrValue = mapVertexToPrimitive(edge, attribute.getVertexPropertyName(), attribute.getAttributeDef()); relationship.setAttribute(attribute.getName(), attrValue); } } }
public AtlasRelationshipWithExtInfo mapEdgeToAtlasRelationship(AtlasEdge edge, boolean extendedInfo) throws AtlasBaseException { AtlasRelationshipWithExtInfo ret = new AtlasRelationshipWithExtInfo(); mapSystemAttributes(edge, ret, extendedInfo); mapAttributes(edge, ret); return ret; }
private void addToReferredEntities(AtlasRelationshipWithExtInfo relationshipWithExtInfo, String guid) throws AtlasBaseException { if (!relationshipWithExtInfo.referredEntitiesContains(guid)) { addToReferredEntities(relationshipWithExtInfo, getEntityVertex(guid)); } }
private void addToReferredEntities(AtlasRelationshipWithExtInfo relationshipWithExtInfo, AtlasVertex entityVertex) throws AtlasBaseException { String entityGuid = getGuid(entityVertex); if (!relationshipWithExtInfo.referredEntitiesContains(entityGuid)) { relationshipWithExtInfo.addReferredEntity(entityGuid, toAtlasEntityHeader(entityVertex)); } }