* @param valueVertex value vertex to remove
* @param value object value
*/
private <Type> void deleteOutEdgeVertex(Vertex objectVertex, Vertex valueVertex, Type value, Map<String, Object> objectsBeingUpdated) {
// Locate vertex
Vertex knownValueVertex = getVertexFor(value, CascadeType.REFRESH, objectsBeingUpdated);
// Ensure vertex is our out one
if(valueVertex.equals(knownValueVertex)) {
// Delete vertex and other associated ones, only if they have no other input links (elsewhere delete is silently ignored)
if(valueVertex.getInEdges().iterator().hasNext()) {
// There are incoming edges to that vertex. Do nothing but log it
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "while deleting "+objectVertex.getProperty(Properties.vertexId.name())+"" +
" we tried to delete "+knownValueVertex.getProperty(Properties.vertexId.name())+"" +
" which has other incoming edges, so we didn't deleted it");
}
} else {
// OK, time to delete value vertex. Is it a managed node ?
if(repository.containsKey(value.getClass())) {
FinderCrudService<Type, ?> finderCrudService = (FinderCrudService<Type, ?>) repository.get(value.getClass());
finderCrudService.delete(value);
} else {
// Literal nodes can be deleted without any trouble
database.removeVertex(valueVertex);
}
}
} else {
if (logger.isLoggable(Level.WARNING)) {
logger.log(Level.WARNING, "that's strange : value "+value+" is associated to "+knownValueVertex.getProperty(Properties.vertexId.name())+"" +
" which blueprints says is different from "+valueVertex.getProperty(Properties.vertexId.name())+"." +
" Under those circumstances, we can delete neither of them");
}
}
}