I just created a node with UniqueNodeFactory and his relationship with UniqueRelationshipFactory. I deleted the the node with the NeoEclipse and then I tried to recreate the same node and I get no exception and the node it's not recreated again. Anyone knows this is happening?
public Node getOrCreateNodeWithUniqueFactory(final Index<Node> nodeIndex, final String indexableKey,final String indexableValue) {
UniqueFactory<Node> factory = new UniqueFactory.UniqueNodeFactory( Global.graphDB.getGraphDbService(), nodeIndex.getName())
{
@Override
protected void initialize(Node created, Map<String, Object> properties) {
created.setProperty(indexableKey, properties.get(indexableKey));
}
};
return factory.getOrCreate( indexableKey, indexableValue );
}
public Relationship getOrCreateRelationshipTypeWithUniqueFactory(Index<Relationship> index, String indexableKey, final String indexableValue,
final RelationshipType type, final Node start, final Node end) {
UniqueFactory<Relationship> factory = new UniqueFactory.UniqueRelationshipFactory(index) {
@Override
protected Relationship create(Map<String, Object> properties) {
Relationship r = start.createRelationshipTo(end, type);
return r;
}
};
return factory.getOrCreate(indexableKey, indexableValue);
}