{
if(!skipRelationCheck)
{
List referenceBeanList = RegistryController.getController().getReferencingObjectsForContent(content.getId(), -1, false, false, db);
if(referenceBeanList != null && referenceBeanList.size() > 0)
throw new ConstraintException("ContentVersion.stateId", "3305");
}
Collection children = content.getChildren();
Iterator childrenIterator = children.iterator();
while(childrenIterator.hasNext())
{
Content childContent = (Content)childrenIterator.next();
deleteRecursive(childContent, childrenIterator, db, skipRelationCheck, skipServiceBindings, forceDelete, infogluePrincipal);
}
content.setChildren(new ArrayList());
boolean isDeletable = getIsDeletable(content, infogluePrincipal, db);
if(forceDelete || isDeletable)
{
ContentVersionController.getContentVersionController().deleteVersionsForContent(content, db, forceDelete, infogluePrincipal);
if(!skipServiceBindings)
ServiceBindingController.deleteServiceBindingsReferencingContent(content, db);
if(parentIterator != null)
parentIterator.remove();
db.remove(content);
Map args = new HashMap();
args.put("globalKey", "infoglue");
PropertySet ps = PropertySetManager.getInstance("jdbc", args);
ps.remove( "content_" + content.getContentId() + "_allowedContentTypeNames");
ps.remove( "content_" + content.getContentId() + "_defaultContentTypeName");
ps.remove( "content_" + content.getContentId() + "_initialLanguageId");
}
else
{
throw new ConstraintException("ContentVersion.stateId", "3300", content.getName());
}
}