Examples of Neo4jPersistentProperty


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

                }
            });
            persistentEntity.doWithAssociations(new AssociationHandler<Neo4jPersistentProperty>() {
                @Override
                public void doWithAssociation(Association<Neo4jPersistentProperty> association) {
                    final Neo4jPersistentProperty property = association.getInverse();
                    copyEntityStatePropertyValue(property, entityState, wrapper, property.getMappingPolicy())// TODO intelligent mappingPolicy.combineWith(property.getMappingPolicy())
                }
            });
            return entity;
    }
View Full Code Here

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

            }
            // todo take mapping policies for relationships into account
            persistentEntity.doWithAssociations(new AssociationHandler<Neo4jPersistentProperty>() {
                @Override
                public void doWithAssociation(Association<Neo4jPersistentProperty> association) {
                    final Neo4jPersistentProperty property = association.getInverse();
                    setEntityStateValue(property, entityState, wrapper, property.getMappingPolicy());
                }
            });
            tx.success();
        } catch(Throwable t) {
      tx.failure();
View Full Code Here

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

        }
    }

    @Override
    public <T> Result<T> findByIndexedValue(final Class<? extends T> indexedType, String propertyName, Object value) {
        Neo4jPersistentProperty persistentProperty = getPersistentProperty(indexedType, propertyName);
        if (persistentProperty==null) throw new InvalidDataAccessApiUsageException("Unknown Property "+propertyName+" for "+indexedType);
        return getSchemaIndexProvider().findByIndexedValue(persistentProperty, value);
    }
View Full Code Here

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

        return getIndexProvider().getIndex(persistentEntity, indexName);
    }

    @Override
    public <T extends PropertyContainer> Index<T> getIndex(Class<?> indexedType, String propertyName) {
        final Neo4jPersistentProperty property = getPersistentProperty(indexedType, propertyName);
        if (property == null) return getIndexProvider().getIndex(getPersistentEntity(indexedType), null);
        if (property.isIndexed() && property.getIndexInfo().isLabelBased()) {
            throw new InvalidDataAccessApiUsageException("Can lookup label based property from legacy index");
        }
        return getIndexProvider().getIndex(property, indexedType);
    }
View Full Code Here

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

        return infrastructure.getMappingContext();
    }

    public Node createUniqueNode(Object entity)  {
        final Neo4jPersistentEntityImpl<?> persistentEntity = getPersistentEntity(entity.getClass());
        final Neo4jPersistentProperty uniqueProperty = persistentEntity.getUniqueProperty();
        Object value = uniqueProperty.getValueFromEntity(entity, MappingPolicy.MAP_FIELD_DIRECT_POLICY);
        if (value == null) return createNode();
        final IndexInfo indexInfo = uniqueProperty.getIndexInfo();
        if (indexInfo.isLabelBased()) {
            return (indexInfo.isFailOnDuplicate())
                ? getGraphDatabase().createNode(map(uniqueProperty.getName(),value),persistentEntity.getAllLabels())
                : getGraphDatabase().merge(indexInfo.getIndexName(),indexInfo.getIndexKey(),value, Collections.<String,Object>emptyMap(), persistentEntity.getAllLabels());
        } else {
            if (value instanceof Number && indexInfo.isNumeric()) value = ValueContext.numeric((Number) value);
            return getGraphDatabase().getOrCreateNode(indexInfo.getIndexName(), indexInfo.getIndexKey(), value, Collections.<String, Object>emptyMap(), persistentEntity.getAllLabels());
        }
View Full Code Here

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

            listener.valueChanged(entity, null, result); // todo oldValue
        }
    }

    protected Object getIdFromEntity() {
        final Neo4jPersistentProperty idProperty = fieldAccessorFactoryProviders.getIdProperty();
        if (idProperty==null) return null;
        return idProperty.getValue(entity, idProperty.getMappingPolicy());
    }
View Full Code Here

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

            this.indexHits.close();
        }
    }

    private IndexHits<S> getIndexHits(String indexName, String propertyName, Object value) {
        final Neo4jPersistentProperty property = template.getPersistentProperty(clazz, propertyName);
        if (value instanceof Number && (property==null || property.getIndexInfo().isNumeric())) {
            Number number = (Number) value;
            return getIndex(indexName, propertyName).query(propertyName, createInclusiveRangeQuery(propertyName, number,number));
        }
        return getIndex(indexName, propertyName).get(propertyName, 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.