protected void deleteKBArticleAttachments(KBArticle kbArticle, long folderId) throws PortalException, SystemException { try { DLStoreUtil.deleteDirectory( kbArticle.getCompanyId(), CompanyConstants.SYSTEM, KBArticleConstants.DIR_NAME_PREFIX + folderId); } catch (NoSuchDirectoryException nsde) { _log.error("No directory found for " + nsde.getMessage()); } }
public void deleteAll(long groupId) throws PortalException, SystemException { Group group = groupLocalService.getGroup(groupId); List<DLFolder> dlFolders = dlFolderPersistence.findByG_P(groupId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID); for (DLFolder dlFolder : dlFolders) { dlFolderLocalService.deleteFolder(dlFolder); } dlFileEntryLocalService.deleteFileEntries(groupId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID); dlFileShortcutLocalService.deleteFileShortcuts( groupId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID); try { DLStoreUtil.deleteDirectory(group.getCompanyId(), groupId, StringPool.BLANK); } catch (NoSuchDirectoryException nsde) { if (_log.isDebugEnabled()) { _log.debug(nsde.getMessage()); } } }
@Indexable(type = IndexableType.DELETE) public DLFolder deleteFolder(DLFolder dlFolder, boolean includeTrashedEntries) throws PortalException, SystemException { // Folders List<DLFolder> dlFolders = dlFolderPersistence.findByG_P(dlFolder.getGroupId(), dlFolder.getFolderId()); for (DLFolder curDLFolder : dlFolders) { if (includeTrashedEntries || !curDLFolder.isInTrash()) { dlFolderLocalService.deleteFolder(curDLFolder, includeTrashedEntries); } } // Resources resourceLocalService.deleteResource( dlFolder.getCompanyId(), DLFolder.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, dlFolder.getFolderId()); // WebDAVProps webDAVPropsLocalService.deleteWebDAVProps(DLFolder.class.getName(), dlFolder.getFolderId()); // File entries dlFileEntryLocalService.deleteFileEntries( dlFolder.getGroupId(), dlFolder.getFolderId(), includeTrashedEntries); // File entry types dlFileEntryTypeLocalService.unsetFolderFileEntryTypes(dlFolder.getFolderId()); // File shortcuts dlFileShortcutLocalService.deleteFileShortcuts( dlFolder.getGroupId(), dlFolder.getFolderId(), includeTrashedEntries); // Expando expandoValueLocalService.deleteValues(DLFolder.class.getName(), dlFolder.getFolderId()); // App helper dlAppHelperLocalService.deleteFolder(new LiferayFolder(dlFolder)); // Folder dlFolderPersistence.remove(dlFolder); // Directory try { DLStoreUtil.deleteDirectory( dlFolder.getCompanyId(), dlFolder.getFolderId(), StringPool.BLANK); } catch (NoSuchDirectoryException nsde) { if (_log.isDebugEnabled()) { _log.debug(nsde.getMessage()); } } return dlFolder; }