import static org.springframework.datastore.graph.neo4j.fieldaccess.PartialNodeEntityStateAccessors.getId;
public class NodeEntityStateAccessorsFactory {
<<<<<<< HEAD
@Autowired
private GraphDatabaseContext graphDatabaseContext;
@Autowired
private NodeDelegatingFieldAccessorFactory nodeDelegatingFieldAccessorFactory;
public EntityStateAccessors getEntityStateAccessors(final NodeBacked entity) {
return new DetachableEntityStateAccessors(
new NodeEntityStateAccessors(null,entity,entity.getClass(), graphDatabaseContext, nodeDelegatingFieldAccessorFactory),graphDatabaseContext);
}
=======
@Autowired
private GraphDatabaseContext graphDatabaseContext;
public EntityStateAccessors getEntityStateAccessors(final NodeBacked entity) {
final GraphEntity graphEntityAnnotation = entity.getClass().getAnnotation(GraphEntity.class);
if (graphEntityAnnotation!=null && graphEntityAnnotation.partial()) {
return new DetachableEntityStateAccessors(
new PartialNodeEntityStateAccessors(null, entity, entity.getClass(), graphDatabaseContext), graphDatabaseContext) {
@Override
protected boolean transactionIsRunning() {
return super.transactionIsRunning() && getId(entity, entity.getClass()) != null;
}
};
} else {
return new DetachableEntityStateAccessors(
new NodeEntityStateAccessors(null, entity, entity.getClass(), graphDatabaseContext), graphDatabaseContext);
}
}
>>>>>>> 7ae9634bbc97533c836c9324e4c302c9e58552ff
} |