}
public static void _deleteChildrenAssetsFromFolder(Folder folder, Set<Inode> objectsList) throws DotDataException, DotStateException, DotSecurityException {
PermissionAPI perAPI = APILocator.getPermissionAPI();
FolderAPI fapi = APILocator.getFolderAPI();
/****** begin *************/
List<HTMLPage> htmlPages = fapi.getHTMLPages(folder,APILocator.getUserAPI().getSystemUser(),false);
for (HTMLPage page: htmlPages) {
Identifier identifier = APILocator.getIdentifierAPI().find(page);
if(!InodeUtils.isSet(identifier.getInode())) {
Logger.warn(FolderFactory.class, "_deleteChildrenAssetsFromFolder: page inode = " + ((HTMLPage)page).getInode() + " doesn't have a valid identifier associated.");
continue;
}
perAPI.removePermissions((HTMLPage)page);
List<Versionable> versions = APILocator.getVersionableAPI().findAllVersions(identifier, APILocator.getUserAPI().getDefaultUser(),false);
for (Versionable versionV : versions) {
HTMLPage version = (HTMLPage) versionV;
if (version.isWorking()) {
//updating caches
WorkingCache.removeAssetFromCache(version);
CacheLocator.getIdentifierCache().removeFromCacheByVersionable(version);
}
if (version.isLive()) {
LiveCache.removeAssetFromCache(version);
}
InodeFactory.deleteInode(version);
}
APILocator.getIdentifierAPI().delete(identifier);
}
List<File> files = fapi.getFiles(folder,APILocator.getUserAPI().getDefaultUser(),false);
for (File file: files) {
Identifier identifier = APILocator.getIdentifierAPI().find(file);
if(!InodeUtils.isSet(identifier.getInode())) {
Logger.warn(FolderFactory.class, "_deleteChildrenAssetsFromFolder: file inode = " + ((File)file).getInode() + " doesn't have a valid identifier associated.");
continue;
}
perAPI.removePermissions((File)file);
List<Versionable> versions = APILocator.getVersionableAPI().findAllVersions(identifier, APILocator.getUserAPI().getDefaultUser(),false);
for (Versionable versionV : versions) {
File version = (File) versionV;
//assets cache
if (version.isLive())
LiveCache.removeAssetFromCache(version);
if (version.isWorking())
WorkingCache.removeAssetFromCache(version);
InodeFactory.deleteInode(version);
}
APILocator.getIdentifierAPI().delete(identifier);
}
List<Link> links = fapi.getLinks(folder,APILocator.getUserAPI().getSystemUser(),false);
for (Link link: links) {
if (link.isWorking()) {
Identifier identifier = APILocator.getIdentifierAPI().find(link);