Search in sources :

Example 1 with EndNodeNotFoundException

use of org.neo4j.server.rest.domain.EndNodeNotFoundException in project neo4j by neo4j.

the class DatabaseActions method createRelationship.

public RelationshipRepresentation createRelationship(long startNodeId, long endNodeId, String type, Map<String, Object> properties) throws StartNodeNotFoundException, EndNodeNotFoundException, PropertyValueException {
    Node start, end;
    try {
        start = node(startNodeId);
    } catch (NodeNotFoundException e) {
        throw new StartNodeNotFoundException(e);
    }
    try {
        end = node(endNodeId);
    } catch (NodeNotFoundException e) {
        throw new EndNodeNotFoundException(e);
    }
    Relationship rel = start.createRelationshipTo(end, RelationshipType.withName(type));
    propertySetter.setProperties(rel, properties);
    return new RelationshipRepresentation(rel);
}
Also used : StartNodeNotFoundException(org.neo4j.server.rest.domain.StartNodeNotFoundException) EndNodeNotFoundException(org.neo4j.server.rest.domain.EndNodeNotFoundException) Node(org.neo4j.graphdb.Node) StartNodeNotFoundException(org.neo4j.server.rest.domain.StartNodeNotFoundException) EndNodeNotFoundException(org.neo4j.server.rest.domain.EndNodeNotFoundException) Relationship(org.neo4j.graphdb.Relationship) ScoredRelationshipRepresentation(org.neo4j.server.rest.repr.ScoredRelationshipRepresentation) RelationshipRepresentation(org.neo4j.server.rest.repr.RelationshipRepresentation)

Aggregations

Node (org.neo4j.graphdb.Node)1 Relationship (org.neo4j.graphdb.Relationship)1 EndNodeNotFoundException (org.neo4j.server.rest.domain.EndNodeNotFoundException)1 StartNodeNotFoundException (org.neo4j.server.rest.domain.StartNodeNotFoundException)1 RelationshipRepresentation (org.neo4j.server.rest.repr.RelationshipRepresentation)1 ScoredRelationshipRepresentation (org.neo4j.server.rest.repr.ScoredRelationshipRepresentation)1