Examples of RelationshipResult


Examples of org.springframework.data.neo4j.mapping.RelationshipResult

        final Node sourceNode = getPersistentState(source, Node.class);
        final Node targetNode = getPersistentState(target, Node.class);

        if (!allowDuplicates) {
            Relationship relationship = getRelationshipBetween(sourceNode, targetNode, type);
            if (relationship != null) return new RelationshipResult(relationship, RelationshipResult.Type.EXISTING);
        }


        if (sourceNode == null) throw new IllegalArgumentException("Source Node  is null");
        if (targetNode == null) throw new IllegalArgumentException("Target Node is null");

        final Relationship relationship = sourceNode.createRelationshipTo(targetNode, DynamicRelationshipType.withName(type));
        return new RelationshipResult(relationship, RelationshipResult.Type.NEW);
    }
View Full Code Here

Examples of org.springframework.data.neo4j.mapping.RelationshipResult

    public RelationshipResult removeRelationshipTo(Object source, Object target, String relationshipType) {
        final Relationship relationship = getRelationshipBetween(source, target, relationshipType);
        if (relationship!=null) {
           graphDatabase.remove(relationship);
           return new RelationshipResult(relationship, RelationshipResult.Type.DELETED);
        }
        return null;
    }
View Full Code Here

Examples of org.springframework.data.neo4j.mapping.RelationshipResult

        relationshipTypeRepresentationStrategy.preEntityRemoval(relationship);
        graphDatabase.remove(relationship);
    }

    public void removeRelationshipBetween(Object start, Object target, String type) {
        final RelationshipResult result = entityStateHandler.removeRelationshipTo(start, target, type);
        if (result!=null && result.type == RelationshipResult.Type.DELETED) {
            relationshipTypeRepresentationStrategy.preEntityRemoval(result.relationship);
        }
    }
View Full Code Here

Examples of org.springframework.data.neo4j.mapping.RelationshipResult

    }

    @Override
    public <R> R createRelationshipBetween(Object start, Object end, Class<R> relationshipEntityClass, String relationshipType, boolean allowDuplicates) {
        notNull(start, "start", end, "end", relationshipEntityClass, "relationshipEntityClass", relationshipType, "relationshipType");
        final RelationshipResult result = infrastructure.getEntityStateHandler().createRelationshipBetween(start, end, relationshipType, allowDuplicates);
        if (result.type == RelationshipResult.Type.NEW) {
            // TODO
            postEntityCreation(result.relationship, relationshipEntityClass);
        }
        return createEntityFromState(result.relationship, relationshipEntityClass, getMappingPolicy(relationshipEntityClass));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.