* @param toDelete object to delete
* @param cascade kind of cascade used for dependent properties
* @param objectsBeingAccessed map containing subgraph of objects currently being delete, this is used to avoid loops, and NOT as a cache
*/
public <DataType> void performDelete(AbstractBluePrintsBackedFinderService<? extends Graph, DataType, ?> service, String objectVertexId, Vertex objectVertex, Class<?> valueClass, Map<Property, Collection<CascadeType>> containedProperties, DataType toDelete, CascadeType cascade, Map<String, Object> objectsBeingAccessed) {
Graph database = service.getDatabase();
for(Property p : containedProperties.keySet()) {
Class<?> rawPropertyType = p.getType();
Collection<CascadeType> toCascade = containedProperties.get(p);
if(Collection.class.isAssignableFrom(rawPropertyType)) {
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, "property "+p.getName()+" is considered a collection one");
}
deleteCollection(service, database, p, toDelete, objectVertex, toCascade, objectsBeingAccessed);
// each value should be written as an independant value
} else if(Map.class.isAssignableFrom(rawPropertyType)) {
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, "property "+p.getName()+" is considered a map one");
}
deleteMap(service, database, p, toDelete, objectVertex, toCascade, objectsBeingAccessed);
} else {
deleteSingle(service, database, p, toDelete, objectVertex, toCascade, objectsBeingAccessed);
}
}
// What to do with incoming edges ?
database.removeVertex(objectVertex);
}