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.exportimport.web.internal.portlet.action.EditExportConfigurationMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { hideDefaultSuccessMessage(actionRequest); String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try {/*from ww w. jav a 2s .com*/ if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { setLayoutIdMap(actionRequest); updateExportConfiguration(actionRequest); } else if (cmd.equals(Constants.DELETE)) { deleteExportImportConfiguration(actionRequest, false); } else if (cmd.equals(Constants.MOVE_TO_TRASH)) { deleteExportImportConfiguration(actionRequest, true); } else if (cmd.equals(Constants.RESTORE)) { restoreTrashEntries(actionRequest); } else if (cmd.equals(Constants.RELAUNCH)) { relaunchExportLayoutConfiguration(actionRequest); } else if (Validator.isNull(cmd)) { addSessionMessages(actionRequest); } String redirect = ParamUtil.getString(actionRequest, "redirect"); sendRedirect(actionRequest, actionResponse, redirect); } catch (Exception e) { _log.error(e, e); SessionErrors.add(actionRequest, e.getClass()); } }
From source file:com.liferay.exportimport.web.internal.portlet.action.ExportImportMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { Portlet portlet = null;/*w ww.ja va2 s .c om*/ try { portlet = ActionUtil.getPortlet(actionRequest); } catch (PrincipalException pe) { SessionErrors.add(actionRequest, pe.getClass()); actionResponse.setRenderParameter("mvcPath", "/error.jsp"); return; } actionRequest = ActionUtil.getWrappedActionRequest(actionRequest, null); String cmd = ParamUtil.getString(actionRequest, Constants.CMD); if (Validator.isNull(cmd)) { SessionMessages.add(actionRequest, _portal.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_FORCE_SEND_REDIRECT); hideDefaultSuccessMessage(actionRequest); return; } try { if (cmd.equals(Constants.ADD_TEMP)) { _importLayoutsMVCActionCommand.addTempFileEntry(actionRequest, ExportImportHelper.TEMP_FOLDER_NAME + portlet.getPortletId()); validateFile(actionRequest, actionResponse, ExportImportHelper.TEMP_FOLDER_NAME + portlet.getPortletId()); hideDefaultSuccessMessage(actionRequest); } else if (cmd.equals(Constants.DELETE_TEMP)) { _importLayoutsMVCActionCommand.deleteTempFileEntry(actionRequest, actionResponse, ExportImportHelper.TEMP_FOLDER_NAME + portlet.getPortletId()); hideDefaultSuccessMessage(actionRequest); } else if (cmd.equals(Constants.EXPORT)) { hideDefaultSuccessMessage(actionRequest); exportData(actionRequest, portlet); sendRedirect(actionRequest, actionResponse); } else if (cmd.equals(Constants.IMPORT)) { hideDefaultSuccessMessage(actionRequest); importData(actionRequest, ExportImportHelper.TEMP_FOLDER_NAME + portlet.getPortletId()); SessionMessages.add(actionRequest, _portal.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_CLOSE_REFRESH_PORTLET, portlet.getPortletId()); sendRedirect(actionRequest, actionResponse); } } catch (Exception e) { if (cmd.equals(Constants.ADD_TEMP) || cmd.equals(Constants.DELETE_TEMP)) { hideDefaultSuccessMessage(actionRequest); _importLayoutsMVCActionCommand.handleUploadException(actionRequest, actionResponse, ExportImportHelper.TEMP_FOLDER_NAME + portlet.getPortletId(), e); } else { if (e instanceof LARFileException || e instanceof LARFileNameException || e instanceof LARFileSizeException || e instanceof LARTypeException || e instanceof LocaleException || e instanceof NoSuchLayoutException || e instanceof PortletIdException || e instanceof PrincipalException || e instanceof StructureDuplicateStructureKeyException) { SessionErrors.add(actionRequest, e.getClass()); } else { _log.error(e, e); SessionErrors.add(actionRequest, ExportImportMVCActionCommand.class.getName()); } } } }
From source file:com.liferay.exportimport.web.internal.portlet.action.ExportImportMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { Portlet portlet = null;/*www . j a v a2 s . c o m*/ try { portlet = ActionUtil.getPortlet(renderRequest); } catch (PrincipalException pe) { SessionErrors.add(renderRequest, pe.getClass()); return "/error.jsp"; } catch (Exception e) { throw new PortletException(e); } try { renderResponse.setTitle(ActionUtil.getTitle(portlet, renderRequest)); renderRequest = ActionUtil.getWrappedRenderRequest(renderRequest, null); return "/export_import.jsp"; } catch (Exception e) { SessionErrors.add(renderRequest, e.getClass()); return "/error.jsp"; } }
From source file:com.liferay.exportimport.web.internal.portlet.action.ExportLayoutsMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { hideDefaultSuccessMessage(actionRequest); String cmd = ParamUtil.getString(actionRequest, Constants.CMD); if (Validator.isNull(cmd)) { SessionMessages.add(actionRequest, _portal.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_FORCE_SEND_REDIRECT); hideDefaultSuccessMessage(actionRequest); return;//from w ww . jav a 2 s.co m } setLayoutIdMap(actionRequest); try { ExportImportConfiguration exportImportConfiguration = getExportImportConfiguration(actionRequest); _exportImportService.exportLayoutsAsFileInBackground(exportImportConfiguration); sendRedirect(actionRequest, actionResponse); } catch (Exception e) { SessionErrors.add(actionRequest, e.getClass()); if (!(e instanceof LARFileNameException)) { _log.error(e, e); } } }
From source file:com.liferay.exportimport.web.internal.portlet.action.GetGroupMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { try {/*from w w w .j ava 2 s .c o m*/ ActionUtil.getGroup(renderRequest); } catch (Exception e) { if (e instanceof NoSuchGroupException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass()); return "/error.jsp"; } else { throw new PortletException(e); } } return getPath(); }
From source file:com.liferay.exportimport.web.internal.portlet.action.ImportLayoutsMVCActionCommand.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. com*/ if (cmd.equals(Constants.ADD_TEMP)) { addTempFileEntry(actionRequest, ExportImportHelper.TEMP_FOLDER_NAME); validateFile(actionRequest, actionResponse, ExportImportHelper.TEMP_FOLDER_NAME); hideDefaultSuccessMessage(actionRequest); } else if (cmd.equals(Constants.DELETE_TEMP)) { deleteTempFileEntry(actionRequest, actionResponse, ExportImportHelper.TEMP_FOLDER_NAME); hideDefaultSuccessMessage(actionRequest); } else if (cmd.equals(Constants.IMPORT)) { hideDefaultSuccessMessage(actionRequest); importData(actionRequest, ExportImportHelper.TEMP_FOLDER_NAME); String redirect = ParamUtil.getString(actionRequest, "redirect"); sendRedirect(actionRequest, actionResponse, redirect); } } catch (Exception e) { if (cmd.equals(Constants.ADD_TEMP) || cmd.equals(Constants.DELETE_TEMP)) { hideDefaultSuccessMessage(actionRequest); handleUploadException(actionRequest, actionResponse, ExportImportHelper.TEMP_FOLDER_NAME, e); } else { if (e instanceof LARFileException || e instanceof LARFileSizeException || e instanceof LARTypeException) { SessionErrors.add(actionRequest, e.getClass()); } else if (e instanceof LayoutPrototypeException || e instanceof LocaleException) { SessionErrors.add(actionRequest, e.getClass(), e); } else { _log.error(e, e); SessionErrors.add(actionRequest, LayoutImportException.class.getName()); } } } }
From source file:com.liferay.exportimport.web.internal.portlet.action.PublishLayoutsMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); if (Validator.isNull(cmd)) { SessionMessages.add(actionRequest, _portal.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_FORCE_SEND_REDIRECT); hideDefaultSuccessMessage(actionRequest); return;/*www .ja v a2 s . co m*/ } try { if (cmd.equals("copy_from_live")) { setLayoutIdMap(actionRequest); _staging.copyFromLive(actionRequest); } else if (cmd.equals(Constants.PUBLISH_TO_LIVE)) { hideDefaultSuccessMessage(actionRequest); setLayoutIdMap(actionRequest); setRedirect(actionRequest, actionResponse, _staging.publishToLive(actionRequest)); } else if (cmd.equals(Constants.PUBLISH_TO_REMOTE)) { hideDefaultSuccessMessage(actionRequest); setLayoutIdMap(actionRequest); setRedirect(actionRequest, actionResponse, _staging.publishToRemote(actionRequest)); } else if (cmd.equals("schedule_copy_from_live")) { setLayoutIdMap(actionRequest); _staging.scheduleCopyFromLive(actionRequest); } else if (cmd.equals("schedule_publish_to_live")) { setLayoutIdMap(actionRequest); _staging.schedulePublishToLive(actionRequest); } else if (cmd.equals("schedule_publish_to_remote")) { setLayoutIdMap(actionRequest); _staging.schedulePublishToRemote(actionRequest); } else if (cmd.equals("unschedule_copy_from_live")) { _staging.unscheduleCopyFromLive(actionRequest); } else if (cmd.equals("unschedule_publish_to_live")) { _staging.unschedulePublishToLive(actionRequest); } else if (cmd.equals("unschedule_publish_to_remote")) { _staging.unschedulePublishToRemote(actionRequest); } sendRedirect(actionRequest, actionResponse); } catch (Exception e) { if (e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass()); actionResponse.setRenderParameter("mvcPath", "/error.jsp"); } else if (e instanceof AuthException || e instanceof DuplicateLockException || e instanceof LayoutPrototypeException || e instanceof RemoteAuthException || e instanceof RemoteExportException || e instanceof RemoteOptionsException || e instanceof SystemException) { if (e instanceof RemoteAuthException) { SessionErrors.add(actionRequest, AuthException.class, e); } else { SessionErrors.add(actionRequest, e.getClass(), e); } sendRedirect(actionRequest, actionResponse); } else { throw e; } } }
From source file:com.liferay.exportimport.web.internal.portlet.action.PublishLayoutsSimpleMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { try {/*from w w w . j a v a 2 s . c o m*/ long exportImportConfigurationId = ParamUtil.getLong(renderRequest, "exportImportConfigurationId"); if (exportImportConfigurationId <= 0) { createExportImportConfiguration(renderRequest); } ActionUtil.getGroup(renderRequest); } catch (Exception e) { if (e instanceof NoSuchGroupException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass()); return "/error.jsp"; } else { throw new PortletException(e); } } return "/publish/simple/publish_layouts_simple.jsp"; }
From source file:com.liferay.exportimport.web.internal.portlet.action.PublishPortletMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { Portlet portlet = null;//from w w w . ja va 2 s.com try { portlet = ActionUtil.getPortlet(actionRequest); } catch (PrincipalException pe) { SessionErrors.add(actionRequest, pe.getClass()); actionResponse.setRenderParameter("mvcPath", "/error.jsp"); return; } actionRequest = ActionUtil.getWrappedActionRequest(actionRequest, null); String cmd = ParamUtil.getString(actionRequest, Constants.CMD); if (Validator.isNull(cmd)) { SessionMessages.add(actionRequest, _portal.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_FORCE_SEND_REDIRECT); hideDefaultSuccessMessage(actionRequest); return; } try { if (cmd.equals("copy_from_live")) { _staging.copyFromLive(actionRequest, portlet); } else if (cmd.equals(Constants.PUBLISH_TO_LIVE)) { hideDefaultSuccessMessage(actionRequest); _staging.publishToLive(actionRequest, portlet); } } catch (Exception e) { if (e instanceof LARFileException || e instanceof LARFileNameException || e instanceof LARFileSizeException || e instanceof LARTypeException || e instanceof LocaleException || e instanceof NoSuchLayoutException || e instanceof PortletIdException || e instanceof PrincipalException || e instanceof StructureDuplicateStructureKeyException) { SessionErrors.add(actionRequest, e.getClass()); } else { _log.error(e, e); SessionErrors.add(actionRequest, PublishPortletMVCActionCommand.class.getName()); } } }
From source file:com.liferay.exportimport.web.internal.portlet.action.PublishPortletMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { Portlet portlet = null;/*from w w w . j a v a2 s . c o m*/ try { portlet = ActionUtil.getPortlet(renderRequest); } catch (PrincipalException pe) { SessionErrors.add(renderRequest, pe.getClass()); return "/error.jsp"; } catch (Exception e) { throw new PortletException(e); } try { renderResponse.setTitle(ActionUtil.getTitle(portlet, renderRequest)); renderRequest = ActionUtil.getWrappedRenderRequest(renderRequest, null); String portletId = _portal.getPortletId(renderRequest); SessionMessages.add(renderRequest, portletId + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_SUCCESS_MESSAGE); return "/publish_portlet.jsp"; } catch (Exception e) { SessionErrors.add(renderRequest, e.getClass()); return "/error.jsp"; } }