public static void deleteInode(Object o) throws DotHibernateException {
if(Identifier.class.equals(o.getClass())){
throw new DotStateException("Identifiers are no longer Inodes!");
}
Inode inode = (Inode) o;
if(inode ==null || !UtilMethods.isSet(inode.getInode())){
Logger.error(Inode.class, "Empty Inode Passed in");
return;
}
if(o instanceof Permissionable){
try {
APILocator.getPermissionAPI().removePermissions((Permissionable)o);
} catch (DotDataException e) {
Logger.error(InodeFactory.class,"Cannot delete object because permissions not deleted : " + e.getMessage(),e);
return;
}
}
// workaround for dbs where we can't have more than one constraint
// or triggers
DotConnect db = new DotConnect();
db.setSQL("delete from tree where child = ? or parent =?");
db.addParam(inode.getInode());
db.addParam(inode.getInode());
db.getResult();
// workaround for dbs where we can't have more than one constraint
// or triggers
db.setSQL("delete from multi_tree where child = ? or parent1 =? or parent2 = ?");
db.addParam(inode.getInode());
db.addParam(inode.getInode());
db.addParam(inode.getInode());
db.getResult();
HibernateUtil.delete(o);
db.setSQL("delete from inode where inode = ?");
db.addParam(inode.getInode());
db.getResult();
}