Package org.springframework.data.neo4j.annotation

Examples of org.springframework.data.neo4j.annotation.Indexed


        public IndexProvider(GraphDatabaseContext graphDatabaseContext) {
            this.graphDatabaseContext = graphDatabaseContext;
        }

        private String getIndexKey(Neo4JPersistentProperty property) {
            Indexed indexed = property.getAnnotation(Indexed.class);
            if (indexed==null || indexed.fieldName().isEmpty()) return property.getNeo4jPropertyName();
            return indexed.fieldName();
        }
View Full Code Here


        private Indexed getIndexedAnnotation(AnnotatedElement element) {
            return element.getAnnotation(Indexed.class);
        }

        private Index<S> getIndex(Neo4JPersistentProperty property, GraphBacked instance) {
            final Indexed indexedAnnotation = property.getAnnotation(Indexed.class);
            final Class<T> type = (Class<T>) property.getOwner().getType();
            final String providedIndexName = indexedAnnotation.indexName().isEmpty() ? null : indexedAnnotation.indexName();
            String indexName = Indexed.Name.get(indexedAnnotation.level(), type, providedIndexName, instance.getClass());
            if (!property.getIndexInfo().isFulltext()) {
                return graphDatabaseContext.getIndex(type, indexName, false);
            }
            if (providedIndexName == null) throw new IllegalStateException("@Indexed(fullext=true) on "+property+" requires an providedIndexName too ");
            String defaultIndexName = Indexed.Name.get(indexedAnnotation.level(), type, null, instance.getClass());
            if (providedIndexName.equals(defaultIndexName)) throw new IllegalStateException("Full-index name for "+property+" must differ from the default name: "+defaultIndexName);
            return graphDatabaseContext.getIndex(type, indexName, true);
        }
View Full Code Here

    public Association<Neo4jPersistentProperty> getAssociation() {
        return myAssociation;
    }

    private IndexInfo extractIndexInfo() {
        final Indexed annotation = getAnnotation(Indexed.class);
        return annotation!=null ? new IndexInfo(annotation,this) : null;
    }
View Full Code Here

        return graphDatabase.createIndex(propertyContainerType, indexName, fullText);
    }

    @Override
    public <S extends PropertyContainer> Index<S> getIndex(Neo4jPersistentProperty property, final Class<?> instanceType) {
        final Indexed indexedAnnotation = property.findAnnotation(Indexed.class);
        final Neo4jPersistentEntity<?> declaringType = property.getOwner();
        final String providedIndexName = providedIndexName(indexedAnnotation);
        final Indexed.Level level = indexingLevel(indexedAnnotation);
        String indexName = customizeIndexName(Indexed.Name.get(level, declaringType.getType(), providedIndexName, instanceType), instanceType);
        if (!property.isIndexed() || property.getIndexInfo().getIndexType() == IndexType.SIMPLE) {
View Full Code Here

TOP

Related Classes of org.springframework.data.neo4j.annotation.Indexed

Copyright © 2018 www.massapicom. 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.