{
if(!skipRelationCheck && !content.getIsDeleted())
{
List referenceBeanList = RegistryController.getController().getReferencingObjectsForContent(content.getId(), -1, true, false, db);
if(referenceBeanList != null && referenceBeanList.size() > 0 && !forceDelete)
throw new ConstraintException("ContentVersion.stateId", "3305", "<br/><br/>" + content.getName() + " (" + content.getId() + ")");
}
Collection children = content.getChildren();
Iterator childrenIterator = children.iterator();
while(childrenIterator.hasNext())
{
Content childContent = (Content)childrenIterator.next();
markForDeletionRecursive(childContent, childrenIterator, db, skipRelationCheck, skipServiceBindings, forceDelete, infogluePrincipal, contactPersons, notifyResponsibleOnReferenceChange);
}
boolean isDeletable = getIsDeletable(content, infogluePrincipal, db);
if(forceDelete || isDeletable)
{
List<ReferenceBean> contactList = RegistryController.getController().getReferencingObjectsForContent(content.getId(), 100, true, true);
//List<ReferenceBean> contactList = RegistryController.getController().deleteAllForContent(content.getId(), infoGluePrincipal, clean, CmsPropertyHandler.getOnlyShowReferenceIfLatestVersion(), db);
if (notifyResponsibleOnReferenceChange)
{
if (contactList != null)
{
contactPersons.put(content.getValueObject(), contactList);
}
}
//ContentVersionController.getContentVersionController().deleteVersionsForContent(content, db, forceDelete, infogluePrincipal);
//if(!skipServiceBindings)
// ServiceBindingController.deleteServiceBindingsReferencingContent(content, db);
//if(parentIterator != null)
// parentIterator.remove();
content.setIsDeleted(true);
}
else
{
throw new ConstraintException("ContentVersion.stateId", "3300", content.getName());
}
}