Package org.springframework.data.neo4j.support.mapping

Examples of org.springframework.data.neo4j.support.mapping.Neo4jMappingContext


  @Bean public Neo4jTemplate neo4jTemplate() throws IOException {
    return new Neo4jTemplate(graphDatabaseService());
  }

  @Bean public Neo4jMappingContext neo4jMappingContext() {
    return new Neo4jMappingContext();
  }
View Full Code Here


    private Neo4jMappingContext mappingContext;
    private Neo4jPersistentEntityImpl<?> personType;

    @Before
    public void setUp() throws Exception {
        mappingContext = new Neo4jMappingContext();
        personType = mappingContext.getPersistentEntity(Person.class);
    }
View Full Code Here

  AuditingEventListener listener;

  @Before
  public void setUp() {

    handler = spy(new IsNewAwareAuditingHandler(new Neo4jMappingContext()));
    listener = new AuditingEventListener(new ObjectFactory<IsNewAwareAuditingHandler>() {

      @Override
      public IsNewAwareAuditingHandler getObject() throws BeansException {
        return handler;
View Full Code Here

    final static String CLASS_NAME = Person.class.getSimpleName();

    @Before
    public void setUp() {
        Neo4jMappingContext context = new Neo4jMappingContext();
        Neo4jTemplate template = Mockito.mock(Neo4jTemplate.class);
        finishMock(template);
        this.query = new CypherQueryBuilder(context, Person.class, template);
        this.trsSpecificExpectedQuery = null;
    }
View Full Code Here

    @Override
    public void afterPropertiesSet() {
        Assert.notNull(template, "Neo4jTemplate must not be null!");

        if (neo4jMappingContext == null) {
            Neo4jMappingContext context = new Neo4jMappingContext();
            context.initialize();
            this.neo4jMappingContext = context;
        }
        setMappingContext(neo4jMappingContext);

        super.afterPropertiesSet();
View Full Code Here

   * @see org.springframework.data.repository.cdi.CdiRepositoryBean#create(javax.enterprise.context.spi.CreationalContext, java.lang.Class)
   */
  @Override
  protected T create(CreationalContext<T> creationalContext, Class<T> repositoryType, Object customImplementation) {

    Neo4jMappingContext neo4jMapCtx = new Neo4jMappingContext();
    Neo4jTemplate neo4jTemplate = new Neo4jTemplate(getDependencyInstance(graphDatabase, GraphDatabase.class));

    GraphRepositoryFactory factory = new GraphRepositoryFactory(neo4jTemplate, neo4jMapCtx);
    return factory.getRepository(repositoryType, customImplementation);
  }
View Full Code Here

    @Override
    public void afterPropertiesSet() {
        try {
        if (this.mappingContext == null) {
            this.mappingContext = new Neo4jMappingContext();
        }
        if (this.isNewStrategyFactory == null) {
            this.isNewStrategyFactory = new MappingContextIsNewStrategyFactory(mappingContext);
        }
        if (this.graphDatabaseService == null && graphDatabase instanceof DelegatingGraphDatabase) {
View Full Code Here

    Neo4jMappingContext context;
    private VariableContext variableContext;

    @Before
    public void setUp() {
        context = new Neo4jMappingContext();
        context.setInitialEntitySet(Collections.singleton(Person.class));
        context.initialize();
        variableContext = new VariableContext();
    }
View Full Code Here

     */
    protected void removeMissingRelationshipsInStoreAndKeepOnlyNewRelationShipsInSet( Node node,
                                                                                      Set<Node> targetNodes,
                                                                                      Class<?> targetType ) {
        Neo4jMappingContext mappingContext = template.getInfrastructure().getMappingContext();
        for ( Relationship relationship : node.getRelationships( type, direction ) ) {
            Node otherNode = relationship.getOtherNode(node);
            if ( !targetNodes.remove(otherNode) ) {
                if ( targetType != null ) {
                    Object actualTargetType = determineEndNodeType(otherNode);
                    try {
                        Neo4jPersistentEntity<?> persistentEntity = mappingContext.getPersistentEntity(actualTargetType);
                        if (! targetType.isAssignableFrom(persistentEntity.getType())) continue;
                    } catch (Exception e) {
                        throw new IllegalStateException(format("Could not read type '%s' - type does not exist", actualTargetType), e);
                    }
                }
View Full Code Here

        @RelatedTo TestRelationship test;
    }

    @Test(expected = MappingException.class)
    public void testFailInvalidRelatedTo() throws Exception {
        MappingContext context = new Neo4jMappingContext();
        context.getPersistentEntity(TestEntityRelatedTo.class);
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.neo4j.support.mapping.Neo4jMappingContext

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.