use of org.apache.atlas.model.instance.AtlasRelationship in project atlas by apache.
the class AtlasRelationshipStoreV1 method getById.
@Override
@GraphTransaction
public AtlasRelationship getById(String guid) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> getById({})", guid);
}
AtlasRelationship ret;
AtlasEdge edge = graphHelper.getEdgeForGUID(guid);
ret = entityRetriever.mapEdgeToAtlasRelationship(edge);
if (LOG.isDebugEnabled()) {
LOG.debug("<== getById({}): {}", guid, ret);
}
return ret;
}
use of org.apache.atlas.model.instance.AtlasRelationship in project incubator-atlas by apache.
the class AtlasRelationshipStoreV1 method create.
@Override
@GraphTransaction
public AtlasRelationship create(AtlasRelationship relationship) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> create({})", relationship);
}
validateRelationship(relationship);
AtlasVertex end1Vertex = getVertexFromEndPoint(relationship.getEnd1());
AtlasVertex end2Vertex = getVertexFromEndPoint(relationship.getEnd2());
AtlasRelationship ret = createRelationship(relationship, end1Vertex, end2Vertex);
if (LOG.isDebugEnabled()) {
LOG.debug("<== create({}): {}", relationship, ret);
}
return ret;
}
use of org.apache.atlas.model.instance.AtlasRelationship in project incubator-atlas by apache.
the class AtlasRelationshipStoreV1 method getOrCreate.
public AtlasRelationship getOrCreate(AtlasRelationship relationship) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> getOrCreate({})", relationship);
}
validateRelationship(relationship);
AtlasVertex end1Vertex = getVertexFromEndPoint(relationship.getEnd1());
AtlasVertex end2Vertex = getVertexFromEndPoint(relationship.getEnd2());
AtlasRelationship ret;
// check if relationship exists
AtlasEdge relationshipEdge = getRelationshipEdge(end1Vertex, end2Vertex, relationship);
if (relationshipEdge != null) {
ret = mapEdgeToAtlasRelationship(relationshipEdge);
} else {
validateRelationship(relationship);
ret = createRelationship(relationship, end1Vertex, end2Vertex);
}
if (LOG.isDebugEnabled()) {
LOG.debug("<== getOrCreate({}): {}", relationship, ret);
}
return ret;
}
Aggregations