List of usage examples for com.liferay.portal.kernel.servlet SessionErrors add
public static void add(PortletRequest portletRequest, String key)
From source file:com.liferay.document.library.web.internal.portlet.action.CompareVersionsMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { try {//www . jav a 2 s. c om compareVersions(renderRequest); } catch (Exception e) { if (e instanceof NoSuchFileEntryException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass()); return "/document_library/error.jsp"; } else { throw new PortletException(e); } } return "/document_library/compare_versions.jsp"; }
From source file:com.liferay.document.library.web.internal.portlet.action.DLConfigurationAction.java
License:Open Source License
protected void validateDisplayStyleViews(ActionRequest actionRequest) { String displayViews = GetterUtil.getString(getParameter(actionRequest, "displayViews")); if (Validator.isNull(displayViews)) { SessionErrors.add(actionRequest, "displayViewsInvalid"); }//from w w w.ja v a 2 s. co m }
From source file:com.liferay.document.library.web.internal.portlet.action.EditFileEntryTypeMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try {/* w w w. j a v a 2s .com*/ if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { updateFileEntryType(actionRequest, actionResponse); } else if (cmd.equals(Constants.DELETE)) { deleteFileEntryType(actionRequest, actionResponse); } else if (cmd.equals(Constants.SUBSCRIBE)) { subscribeFileEntryType(actionRequest); } else if (cmd.equals(Constants.UNSUBSCRIBE)) { unsubscribeFileEntryType(actionRequest); } if (SessionErrors.isEmpty(actionRequest)) { SessionMessages.add(actionRequest, _portal.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET, DLPortletKeys.DOCUMENT_LIBRARY); String redirect = _portal.escapeRedirect(ParamUtil.getString(actionRequest, "redirect")); if (Validator.isNotNull(redirect)) { sendRedirect(actionRequest, actionResponse, redirect); } } } catch (DuplicateFileEntryTypeException | NoSuchMetadataSetException | RequiredStructureException | StructureDefinitionException | StructureDuplicateElementException | StructureNameException e) { SessionErrors.add(actionRequest, e.getClass()); } catch (RequiredFileEntryTypeException rfete) { SessionErrors.add(actionRequest, rfete.getClass()); actionResponse.setRenderParameter("mvcPath", "/document_library/view_file_entry_types.jsp"); } catch (NoSuchFileEntryTypeException | NoSuchStructureException | PrincipalException e) { SessionErrors.add(actionRequest, e.getClass()); actionResponse.setRenderParameter("mvcPath", "/document_library/error.jsp"); } }
From source file:com.liferay.document.library.web.internal.portlet.action.EditFileEntryTypeMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { DLFileEntryType dlFileEntryType = null; try {// w ww. ja va2 s. c o m long fileEntryTypeId = ParamUtil.getLong(renderRequest, "fileEntryTypeId"); if (fileEntryTypeId > 0) { dlFileEntryType = _dlFileEntryTypeService.getFileEntryType(fileEntryTypeId); renderRequest.setAttribute(WebKeys.DOCUMENT_LIBRARY_FILE_ENTRY_TYPE, dlFileEntryType); DDMStructure ddmStructure = DDMStructureManagerUtil.fetchStructure(dlFileEntryType.getGroupId(), _portal.getClassNameId(DLFileEntryMetadata.class), DLUtil.getDDMStructureKey(dlFileEntryType)); if (ddmStructure == null) { ddmStructure = DDMStructureManagerUtil.fetchStructure(dlFileEntryType.getGroupId(), _portal.getClassNameId(DLFileEntryMetadata.class), DLUtil.getDeprecatedDDMStructureKey(dlFileEntryType)); } renderRequest.setAttribute(WebKeys.DOCUMENT_LIBRARY_DYNAMIC_DATA_MAPPING_STRUCTURE, ddmStructure); } } catch (Exception e) { if (e instanceof NoSuchFileEntryTypeException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass()); return "/document_library/error.jsp"; } else { throw new PortletException(e); } } return "/document_library/edit_file_entry_type.jsp"; }
From source file:com.liferay.document.library.web.internal.portlet.action.EditFileShortcutMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try {// w w w. ja v a 2 s . c o m if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { updateFileShortcut(actionRequest); } else if (cmd.equals(Constants.DELETE)) { deleteFileShortcut(actionRequest, false); } else if (cmd.equals(Constants.MOVE_TO_TRASH)) { deleteFileShortcut(actionRequest, true); } } catch (Exception e) { if (e instanceof NoSuchFileShortcutException || e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass()); actionResponse.setRenderParameter("mvcPath", "/document_library/error.jsp"); } else if (e instanceof FileShortcutPermissionException || e instanceof NoSuchFileEntryException) { SessionErrors.add(actionRequest, e.getClass()); } else { throw e; } } }
From source file:com.liferay.document.library.web.internal.portlet.action.EditFileShortcutMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { try {// w w w .j a v a 2 s .c om FileShortcut fileShortcut = ActionUtil.getFileShortcut(renderRequest); renderRequest.setAttribute(WebKeys.DOCUMENT_LIBRARY_FILE_SHORTCUT, fileShortcut); } catch (Exception e) { if (e instanceof NoSuchFileShortcutException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass()); return "/document_library/error.jsp"; } else { throw new PortletException(e); } } return "/document_library/edit_file_shortcut.jsp"; }
From source file:com.liferay.document.library.web.internal.portlet.action.EditFolderMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try {/*from ww w .ja v a 2s.c om*/ if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { updateFolder(actionRequest); } else if (cmd.equals(Constants.DELETE)) { deleteFolders(actionRequest, false); } else if (cmd.equals(Constants.MOVE_TO_TRASH)) { deleteFolders(actionRequest, true); } else if (cmd.equals(Constants.SUBSCRIBE)) { subscribeFolder(actionRequest); } else if (cmd.equals(Constants.UNSUBSCRIBE)) { unsubscribeFolder(actionRequest); } else if (cmd.equals("deleteExpiredTemporaryFileEntries")) { deleteExpiredTemporaryFileEntries(actionRequest); } else if (cmd.equals("updateWorkflowDefinitions")) { updateWorkflowDefinitions(actionRequest); } } catch (NoSuchFolderException | PrincipalException e) { SessionErrors.add(actionRequest, e.getClass()); actionResponse.setRenderParameter("mvcPath", "/document_library/error.jsp"); } catch (DuplicateFileEntryException | DuplicateFileException | DuplicateFolderNameException | FolderNameException | RequiredFileEntryTypeException e) { SessionErrors.add(actionRequest, e.getClass()); } catch (Exception e) { throw new PortletException(e); } }
From source file:com.liferay.document.library.web.internal.portlet.action.EditRepositoryMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try {//from w ww. j a va 2s.c o m if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { updateRepository(actionRequest); } else if (cmd.equals(Constants.DELETE)) { unmountRepository(actionRequest); } } catch (Exception e) { if (e instanceof NoSuchRepositoryException || e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass()); actionResponse.setRenderParameter("mvcPath", "/document_library/error.jsp"); } else if (e instanceof DuplicateFolderNameException || e instanceof DuplicateRepositoryNameException || e instanceof FolderNameException || e instanceof InvalidRepositoryException || e instanceof RepositoryNameException) { if (e instanceof InvalidRepositoryException) { _log.error(e, e); } SessionErrors.add(actionRequest, e.getClass()); } else { throw e; } } }
From source file:com.liferay.document.library.web.internal.portlet.action.EditRepositoryMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { try {//from w ww . j av a 2s . c om Repository repository = ActionUtil.getRepository(renderRequest); renderRequest.setAttribute(WebKeys.DOCUMENT_LIBRARY_REPOSITORY, repository); } catch (Exception e) { if (e instanceof NoSuchRepositoryException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass()); return "/document_library/error.jsp"; } else { throw new PortletException(e); } } return "/document_library/edit_repository.jsp"; }
From source file:com.liferay.document.library.web.internal.portlet.action.GetFileEntryMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { try {//from w ww .ja v a 2 s. co m FileEntry fileEntry = ActionUtil.getFileEntry(renderRequest); renderRequest.setAttribute(WebKeys.DOCUMENT_LIBRARY_FILE_ENTRY, fileEntry); FileVersion fileVersion = ActionUtil.getFileVersion(renderRequest, fileEntry); String version = ParamUtil.getString(renderRequest, "version"); if (Validator.isNotNull(version)) { renderRequest.setAttribute(WebKeys.DOCUMENT_LIBRARY_FILE_VERSION, fileVersion); } } catch (Exception e) { if (e instanceof NoSuchFileEntryException || e instanceof NoSuchFileVersionException || e instanceof NoSuchRepositoryEntryException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass()); return "/document_library/error.jsp"; } else { throw new PortletException(e); } } return getPath(); }