protected void deleteFolders( LiferayPortletConfig liferayPortletConfig, ActionRequest actionRequest, boolean moveToTrash) throws Exception { long[] deleteFolderIds = null; long folderId = ParamUtil.getLong(actionRequest, "folderId"); if (folderId > 0) { deleteFolderIds = new long[] {folderId}; } else { deleteFolderIds = StringUtil.split(ParamUtil.getString(actionRequest, "folderIds"), 0L); } for (long deleteFolderId : deleteFolderIds) { if (moveToTrash) { JournalFolderServiceUtil.moveFolderToTrash(deleteFolderId); } else { JournalFolderServiceUtil.deleteFolder(deleteFolderId); } AssetPublisherUtil.removeRecentFolderId( actionRequest, JournalArticle.class.getName(), deleteFolderId); } if (moveToTrash && (deleteFolderIds.length > 0)) { Map<String, String[]> data = new HashMap<String, String[]>(); data.put("restoreFolderIds", ArrayUtil.toStringArray(deleteFolderIds)); SessionMessages.add( actionRequest, liferayPortletConfig.getPortletId() + SessionMessages.KEY_SUFFIX_DELETE_SUCCESS_DATA, data); SessionMessages.add( actionRequest, liferayPortletConfig.getPortletId() + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_SUCCESS_MESSAGE); } }
protected void deleteEntries(ActionRequest actionRequest, boolean moveToTrash) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); List<TrashedModel> trashedModels = new ArrayList<TrashedModel>(); long[] deleteFolderIds = StringUtil.split(ParamUtil.getString(actionRequest, "folderIds"), 0L); for (long deleteFolderId : deleteFolderIds) { if (moveToTrash) { JournalFolder folder = JournalFolderServiceUtil.moveFolderToTrash(deleteFolderId); trashedModels.add(folder); } else { JournalFolderServiceUtil.deleteFolder(deleteFolderId); } } String[] deleteArticleIds = StringUtil.split(ParamUtil.getString(actionRequest, "articleIds")); for (String deleteArticleId : deleteArticleIds) { if (moveToTrash) { JournalArticle article = JournalArticleServiceUtil.moveArticleToTrash( themeDisplay.getScopeGroupId(), deleteArticleId); trashedModels.add(article); } else { ActionUtil.deleteArticle(actionRequest, deleteArticleId); } } if (moveToTrash && !trashedModels.isEmpty()) { TrashUtil.addTrashSessionMessages(actionRequest, trashedModels); hideDefaultSuccessMessage(actionRequest); } }