List of usage examples for com.liferay.portal.kernel.util Constants DELETE
String DELETE
To view the source code for com.liferay.portal.kernel.util Constants DELETE.
Click Source Link
From source file:blade.servicebuilder.web.JSPPortlet.java
License:Apache License
@Override public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { try {//from w ww. ja v a 2s.c o m String cmd = ParamUtil.getString(actionRequest, Constants.CMD); if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { updateFoo(actionRequest); } else if (cmd.equals(Constants.DELETE)) { deleteFoo(actionRequest); } if (Validator.isNotNull(cmd)) { if (SessionErrors.isEmpty(actionRequest)) { SessionMessages.add(actionRequest, "requestProcessed"); } String redirect = ParamUtil.getString(actionRequest, "redirect"); actionResponse.sendRedirect(redirect); } } catch (Exception e) { throw new PortletException(e); } }
From source file:ca.efendi.datafeeds.web.internal.portlet.DatafeedsPortlet.java
License:Apache License
public void updateDiscussion(final ActionRequest actionRequest, final ActionResponse actionResponse) throws Exception { final String cmd = ParamUtil.getString(actionRequest, Constants.CMD); if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { updateMessage(actionRequest);//from w ww. ja v a 2s. c o m } else if (cmd.equals(Constants.DELETE)) { deleteMessage(actionRequest); } else if (cmd.equals(Constants.SUBSCRIBE_TO_COMMENTS)) { subscribeToComments(actionRequest, true); } else if (cmd.equals(Constants.UNSUBSCRIBE_FROM_COMMENTS)) { subscribeToComments(actionRequest, false); } }
From source file:ch.inofix.referencemanager.web.JSPPortlet.java
License:Apache License
@Override public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { try {//from ww w .j a va 2s.co m String cmd = ParamUtil.getString(actionRequest, Constants.CMD); if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { updateReference(actionRequest); } else if (cmd.equals(Constants.DELETE)) { deleteReference(actionRequest); } if (Validator.isNotNull(cmd)) { if (SessionErrors.isEmpty(actionRequest)) { SessionMessages.add(actionRequest, "requestProcessed"); } String redirect = ParamUtil.getString(actionRequest, "redirect"); actionResponse.sendRedirect(redirect); } } catch (Exception e) { throw new PortletException(e); } }
From source file:com.evozon.evoportal.myaccount.builder.AccountOperationBuilder.java
public static ActionAccountOperation buildAccountActionOperation(ActionPhaseParameters app) throws PortalException, SystemException { ActionAccountOperation operation = null; String command = ParamUtil.getString(app.getRequest(), Constants.CMD, AccountOperationBuilder.DEFAULT); if (Constants.ADD.equals(command)) { operation = AccountOperationBuilder.buildAddAccountActionOperation(app); } else if (Constants.UPDATE.equals(command)) { operation = AccountOperationBuilder.buildUpdateAccountActionOperation(app); } else if (Constants.DEACTIVATE.equals(command) || MyAccountConstants.CANCEL_DEACTIVATION.equals(command)) { operation = AccountOperationBuilder.buildDeactivateAccountOperation(app); } else if (Constants.RESTORE.equals(command) || MyAccountConstants.CANCEL_ACTIVATION.equals(command)) { operation = AccountOperationBuilder.buildActivateAccountOperation(app); } else if (Constants.DELETE.equals(command)) { operation = AccountOperationBuilder.buildDeleteAccountActionOperation(app); } else {//from w w w. jav a2s .com operation = new DefaultAccountActionOperation(app); } return operation; }
From source file:com.liferay.announcements.web.internal.portlet.action.EditEntryMVCActionCommand.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 w w. ja v a 2s. com*/ if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { updateEntry(actionRequest); } else if (cmd.equals(Constants.DELETE)) { deleteEntry(actionRequest); } } catch (EntryContentException | EntryDisplayDateException | EntryExpirationDateException | EntryTitleException | EntryURLException | NoSuchEntryException | PrincipalException e) { SessionErrors.add(actionRequest, e.getClass()); } }
From source file:com.liferay.announcements.web.internal.portlet.configuration.icon.DeleteEntryPortletConfigurationIcon.java
License:Open Source License
@Override public String getURL(PortletRequest portletRequest, PortletResponse portletResponse) { PortletURL portletURL = _portal.getControlPanelPortletURL(portletRequest, AnnouncementsPortletKeys.ANNOUNCEMENTS_ADMIN, PortletRequest.ACTION_PHASE); portletURL.setParameter(ActionRequest.ACTION_NAME, "/announcements/edit_entry"); portletURL.setParameter(Constants.CMD, Constants.DELETE); PortletURL redirectURL = _portal.getControlPanelPortletURL(portletRequest, AnnouncementsPortletKeys.ANNOUNCEMENTS_ADMIN, PortletRequest.RENDER_PHASE); portletURL.setParameter("redirect", redirectURL.toString()); AnnouncementsEntry entry = null;// w w w .j a v a 2 s. co m try { entry = ActionUtil.getEntry(portletRequest); } catch (PortalException pe) { throw new RuntimeException(pe); } portletURL.setParameter("entryId", String.valueOf(entry.getEntryId())); return portletURL.toString(); }
From source file:com.liferay.blade.samples.servicebuilder.adq.web.JSPPortlet.java
License:Apache License
@Override public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { try {/*ww w.ja va 2 s. c om*/ String cmd = ParamUtil.getString(actionRequest, Constants.CMD); if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { updateBar(actionRequest); } else if (cmd.equals(Constants.DELETE)) { deleteBar(actionRequest); } else if (cmd.equals(MASS_UPDATE)) { massUpdate(); } if (Validator.isNotNull(cmd)) { if (SessionErrors.isEmpty(actionRequest)) { SessionMessages.add(actionRequest, "requestProcessed"); } String redirect = ParamUtil.getString(actionRequest, "redirect"); actionResponse.sendRedirect(redirect); } } catch (Exception e) { throw new PortletException(e); } }
From source file:com.liferay.blogs.web.internal.portlet.action.EditEntryMVCActionCommand.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 w w .java2 s . c om BlogsEntry entry = null; List<BlogsEntryAttachmentFileEntryReference> blogsEntryAttachmentFileEntryReferences = null; UploadException uploadException = (UploadException) actionRequest .getAttribute(WebKeys.UPLOAD_EXCEPTION); if (uploadException != null) { Throwable cause = uploadException.getCause(); if (uploadException.isExceededFileSizeLimit()) { throw new FileSizeException(cause); } if (uploadException.isExceededLiferayFileItemSizeLimit()) { throw new LiferayFileItemException(cause); } if (uploadException.isExceededUploadRequestSizeLimit()) { throw new UploadRequestSizeException(cause); } throw new PortalException(cause); } else if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { Callable<Object[]> updateEntryCallable = new UpdateEntryCallable(actionRequest); Object[] returnValue = TransactionInvokerUtil.invoke(_transactionConfig, updateEntryCallable); entry = (BlogsEntry) returnValue[0]; blogsEntryAttachmentFileEntryReferences = (List<BlogsEntryAttachmentFileEntryReference>) returnValue[1]; } else if (cmd.equals(Constants.DELETE)) { deleteEntries(actionRequest, false); } else if (cmd.equals(Constants.MOVE_TO_TRASH)) { deleteEntries(actionRequest, true); } else if (cmd.equals(Constants.RESTORE)) { restoreTrashEntries(actionRequest); } else if (cmd.equals(Constants.SUBSCRIBE)) { subscribe(actionRequest); } else if (cmd.equals(Constants.UNSUBSCRIBE)) { unsubscribe(actionRequest); } String redirect = ParamUtil.getString(actionRequest, "redirect"); String portletId = HttpUtil.getParameter(redirect, "p_p_id", false); int workflowAction = ParamUtil.getInteger(actionRequest, "workflowAction", WorkflowConstants.ACTION_SAVE_DRAFT); boolean ajax = ParamUtil.getBoolean(actionRequest, "ajax"); if (ajax) { JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); for (BlogsEntryAttachmentFileEntryReference blogsEntryAttachmentFileEntryReference : blogsEntryAttachmentFileEntryReferences) { JSONObject blogsEntryFileEntryReferencesJSONObject = JSONFactoryUtil.createJSONObject(); blogsEntryFileEntryReferencesJSONObject.put("attributeDataImageId", EditorConstants.ATTRIBUTE_DATA_IMAGE_ID); blogsEntryFileEntryReferencesJSONObject.put("fileEntryId", String.valueOf( blogsEntryAttachmentFileEntryReference.getTempBlogsEntryAttachmentFileEntryId())); blogsEntryFileEntryReferencesJSONObject.put("fileEntryUrl", PortletFileRepositoryUtil.getPortletFileEntryURL(null, blogsEntryAttachmentFileEntryReference.getBlogsEntryAttachmentFileEntry(), StringPool.BLANK)); jsonArray.put(blogsEntryFileEntryReferencesJSONObject); } jsonObject.put("blogsEntryAttachmentReferences", jsonArray); jsonObject.put("coverImageFileEntryId", entry.getCoverImageFileEntryId()); jsonObject.put("entryId", entry.getEntryId()); jsonObject.put("redirect", redirect); JSONPortletResponseUtil.writeJSON(actionRequest, actionResponse, jsonObject); return; } if ((entry != null) && (workflowAction == WorkflowConstants.ACTION_SAVE_DRAFT)) { redirect = getSaveAndContinueRedirect(actionRequest, entry, redirect); sendRedirect(actionRequest, actionResponse, redirect); } else { WindowState windowState = actionRequest.getWindowState(); if (!windowState.equals(LiferayWindowState.POP_UP)) { sendRedirect(actionRequest, actionResponse, redirect); } else { redirect = PortalUtil.escapeRedirect(redirect); if (Validator.isNotNull(redirect)) { if (cmd.equals(Constants.ADD) && (entry != null)) { String namespace = PortalUtil.getPortletNamespace(portletId); redirect = HttpUtil.addParameter(redirect, namespace + "className", BlogsEntry.class.getName()); redirect = HttpUtil.addParameter(redirect, namespace + "classPK", entry.getEntryId()); } actionRequest.setAttribute(WebKeys.REDIRECT, redirect); } } } } catch (AssetCategoryException | AssetTagException e) { SessionErrors.add(actionRequest, e.getClass(), e); actionResponse.setRenderParameter("mvcRenderCommandName", "/blogs/edit_entry"); hideDefaultSuccessMessage(actionRequest); } catch (EntryContentException | EntryCoverImageCropException | EntryDescriptionException | EntryDisplayDateException | EntrySmallImageNameException | EntrySmallImageScaleException | EntryTitleException | EntryUrlTitleException | FileSizeException | LiferayFileItemException | SanitizerException | UploadRequestSizeException e) { SessionErrors.add(actionRequest, e.getClass()); actionResponse.setRenderParameter("mvcRenderCommandName", "/blogs/edit_entry"); hideDefaultSuccessMessage(actionRequest); } catch (NoSuchEntryException | PrincipalException e) { SessionErrors.add(actionRequest, e.getClass()); actionResponse.setRenderParameter("mvcPath", "/blogs/error.jsp"); hideDefaultSuccessMessage(actionRequest); } catch (Throwable t) { _log.error(t, t); actionResponse.setRenderParameter("mvcPath", "/blogs/error.jsp"); hideDefaultSuccessMessage(actionRequest); } }
From source file:com.liferay.blogs.web.internal.portlet.action.EditImageMVCActionCommand.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 w w.j a v a2s .c o m if (cmd.equals(Constants.DELETE)) { deleteImages(actionRequest); } sendRedirect(actionRequest, actionResponse); } catch (Exception e) { if (e instanceof NoSuchEntryException || e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass()); actionResponse.setRenderParameter("mvcPath", "/blogs/error.jsp"); } else { throw e; } } catch (Throwable t) { _log.error(t, t); actionResponse.setRenderParameter("mvcPath", "/blogs/error.jsp"); } }
From source file:com.liferay.bookmarks.web.internal.portlet.action.EditEntryMVCActionCommand.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 w w . j av a2 s .c o m*/ BookmarksEntry entry = null; if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { entry = updateEntry(actionRequest); } else if (cmd.equals(Constants.DELETE)) { deleteEntry(actionRequest, false); } else if (cmd.equals(Constants.MOVE)) { moveEntries(actionRequest); } else if (cmd.equals(Constants.MOVE_TO_TRASH)) { deleteEntry(actionRequest, true); } else if (cmd.equals(Constants.RESTORE)) { restoreTrashEntries(actionRequest); } else if (cmd.equals(Constants.SUBSCRIBE)) { subscribeEntry(actionRequest); } else if (cmd.equals(Constants.UNSUBSCRIBE)) { unsubscribeEntry(actionRequest); } WindowState windowState = actionRequest.getWindowState(); if (windowState.equals(LiferayWindowState.POP_UP)) { String redirect = PortalUtil.escapeRedirect(ParamUtil.getString(actionRequest, "redirect")); if (Validator.isNotNull(redirect)) { if (cmd.equals(Constants.ADD) && (entry != null)) { String portletId = HttpUtil.getParameter(redirect, "p_p_id", false); String namespace = PortalUtil.getPortletNamespace(portletId); redirect = HttpUtil.addParameter(redirect, namespace + "className", BookmarksEntry.class.getName()); redirect = HttpUtil.addParameter(redirect, namespace + "classPK", entry.getEntryId()); } actionRequest.setAttribute(WebKeys.REDIRECT, redirect); } } } catch (Exception e) { if (e instanceof NoSuchEntryException || e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass()); actionResponse.setRenderParameter("mvcPath", "/bookmarks/error.jsp"); } else if (e instanceof EntryURLException || e instanceof NoSuchFolderException) { SessionErrors.add(actionRequest, e.getClass()); } else if (e instanceof AssetCategoryException || e instanceof AssetTagException) { SessionErrors.add(actionRequest, e.getClass(), e); } else { throw e; } } }