* @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, ObjectCache objectsBeingAccessed) {
Graph database = service.getDatabase();
for (Map.Entry<Property, Collection<CascadeType>> entry : containedProperties.entrySet()) {
Property p = entry.getKey();
// Static properties are by design not written
if (!p.hasModifier(Modifier.STATIC) && !Annotations.TRANSIENT.is(p)) {
// Per default, no operation is cascaded
CascadeType used = null;
// However, if property supports that cascade type, we cascade operation
if (entry.getValue().contains(cascade)) {
used = cascade;
}
if(used!=null) {
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);
}