Examples of RelationshipProperties


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

        return value;
    }

    @SuppressWarnings("unchecked")
    private <S extends PropertyContainer> S getOrCreateRelationship( Object entity, Neo4jPersistentEntity<?> persistentEntity, RelationshipType annotationProvidedRelationshipType ) {
        final RelationshipProperties relationshipProperties = persistentEntity.getRelationshipProperties();
        final Neo4jPersistentProperty startNodeProperty = relationshipProperties.getStartNodeProperty();
        Node startNode = (Node) getPersistentState(startNodeProperty.getValue(entity, startNodeProperty.getMappingPolicy()));
        final Neo4jPersistentProperty endNodeProperty = relationshipProperties.getEndNodeProperty();
        Node endNode = (Node) getPersistentState(endNodeProperty.getValue(entity, endNodeProperty.getMappingPolicy()));
        RelationshipType relationshipType = getRelationshipType(persistentEntity,entity, annotationProvidedRelationshipType );
        if (persistentEntity.isUnique()) {
            final Neo4jPersistentProperty uniqueProperty = persistentEntity.getUniqueProperty();
            final IndexInfo indexInfo = uniqueProperty.getIndexInfo();
View Full Code Here

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

    }

    private RelationshipType getRelationshipType( Neo4jPersistentEntity persistentEntity, Object entity,
                                                  RelationshipType annotationProvidedRelationshipType )
    {
        final RelationshipProperties relationshipProperties = persistentEntity.getRelationshipProperties();
        final Neo4jPersistentProperty typeProperty = relationshipProperties.getTypeProperty();

        if ( typeProperty != null )
        {
            Object value = typeProperty.getValue( entity, typeProperty.getMappingPolicy() );

            if ( value != null )
            {
                return value instanceof RelationshipType ? (RelationshipType) value : DynamicRelationshipType
                        .withName( value.toString() );
            }
        }

        if ( annotationProvidedRelationshipType != null )
        {
            return annotationProvidedRelationshipType;
        }

        String relationshipTypeAsString = relationshipProperties.getRelationshipType();

        if ( relationshipTypeAsString == null )
        {
            throw new MappingException( "Could not determine relationship-type for " + persistentEntity.getName() );
        }
View Full Code Here

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

            throw new InvalidDataAccessResourceUsageException("Not in a Neo4j transaction.", e);
        }
    }

    private Relationship createRelationshipFromEntity() {
        final RelationshipProperties relationshipProperties = getPersistentEntity().getRelationshipProperties();
        final Node startNode = template.getPersistentState(relationshipProperties.getStartNodeProperty().getValue(entity, mappingPolicy));
        final Node endNode = template.getPersistentState(relationshipProperties.getEndNodeProperty().getValue(entity, mappingPolicy));
        final String type = getRelationshipTypeFromEntity(getPersistentEntity());
        ParameterCheck.notNull(startNode,"start node property",endNode,"end node property",type, "relationship type property from field or annotation");
        return template.createRelationshipBetween(startNode, endNode,type,null);
    }
View Full Code Here

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

        ParameterCheck.notNull(startNode,"start node property",endNode,"end node property",type, "relationship type property from field or annotation");
        return template.createRelationshipBetween(startNode, endNode,type,null);
    }

    private String getRelationshipTypeFromEntity(Neo4jPersistentEntity<?> persistentEntity) {
        final RelationshipProperties relationshipProperties = persistentEntity.getRelationshipProperties();
        final Neo4jPersistentProperty typeProperty = relationshipProperties.getTypeProperty();
        final Object value = typeProperty!=null ? typeProperty.getValue(entity, mappingPolicy) : null;
        if (value==null) {
            return relationshipProperties.getRelationshipType();
        }
        if (value instanceof RelationshipType) {
            return ((RelationshipType)value).name();
        }
        return (String) value;
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.