Example usage for com.liferay.portal.kernel.util Constants OVERRIDE

List of usage examples for com.liferay.portal.kernel.util Constants OVERRIDE

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util Constants OVERRIDE.

Prototype

String OVERRIDE

To view the source code for com.liferay.portal.kernel.util Constants OVERRIDE.

Click Source Link

Usage

From source file:com.liferay.message.boards.web.internal.portlet.action.EditMessageAttachmentsMVCActionCommand.java

License:Open Source License

@Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);

    try {/*w ww .  ja  va 2s . c  o m*/
        if (cmd.equals(Constants.CHECK)) {
            JSONObject jsonObject = RestoreEntryUtil.checkEntry(actionRequest);

            JSONPortletResponseUtil.writeJSON(actionRequest, actionResponse, jsonObject);

            return;
        } else if (cmd.equals(Constants.DELETE)) {
            deleteAttachment(actionRequest);
        } else if (cmd.equals(Constants.EMPTY_TRASH)) {
            emptyTrash(actionRequest);
        } else if (cmd.equals(Constants.RENAME)) {
            restoreRename(actionRequest);
        } else if (cmd.equals(Constants.RESTORE)) {
            restoreEntries(actionRequest);
        } else if (cmd.equals(Constants.OVERRIDE)) {
            restoreOverride(actionRequest);
        }

        if (Validator.isNotNull(cmd)) {
            String redirect = ParamUtil.getString(actionRequest, "redirect");

            sendRedirect(actionRequest, actionResponse, redirect);
        }
    } catch (PrincipalException pe) {
        SessionErrors.add(actionRequest, pe.getClass());

        actionResponse.setRenderParameter("mvcPath", "/message_boards/error.jsp");
    }
}

From source file:com.liferay.trash.web.internal.portlet.TrashPortlet.java

License:Open Source License

public void restoreEntry(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);

    if (cmd.equals(Constants.RENAME)) {
        checkEntry(actionRequest, actionResponse);

        restoreRename(actionRequest, actionResponse);
    } else if (cmd.equals(Constants.OVERRIDE)) {
        restoreOverride(actionRequest, actionResponse);
    }//w  w w.j a v  a 2  s  .c o m
}

From source file:com.liferay.wiki.web.internal.portlet.action.EditPageAttachmentsMVCActionCommand.java

License:Open Source License

@Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);

    PortletConfig portletConfig = getPortletConfig(actionRequest);

    try {//from w  w w.  ja  va2s  .  c  om
        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)) {
            _wikiAttachmentsHelper.addAttachments(actionRequest);
        } else if (cmd.equals(Constants.CHECK)) {
            JSONObject jsonObject = RestoreEntryUtil.checkEntry(actionRequest);

            JSONPortletResponseUtil.writeJSON(actionRequest, actionResponse, jsonObject);

            return;
        } else if (cmd.equals(Constants.DELETE)) {
            deleteAttachment(actionRequest, false);
        } else if (cmd.equals(Constants.EMPTY_TRASH)) {
            _wikiAttachmentsHelper.emptyTrash(actionRequest);
        } else if (cmd.equals(Constants.MOVE_TO_TRASH)) {
            deleteAttachment(actionRequest, true);
        } else if (cmd.equals(Constants.RENAME)) {
            _wikiAttachmentsHelper.restoreRename(actionRequest);
        } else if (cmd.equals(Constants.RESTORE)) {
            _wikiAttachmentsHelper.restoreEntries(actionRequest);

            String redirect = ParamUtil.getString(actionRequest, "redirect");

            if (Validator.isNotNull(redirect)) {
                actionResponse.sendRedirect(redirect);
            }
        } else if (cmd.equals(Constants.OVERRIDE)) {
            _wikiAttachmentsHelper.restoreOverride(actionRequest);
        }
    } catch (NoSuchNodeException | NoSuchPageException | PrincipalException e) {

        SessionErrors.add(actionRequest, e.getClass());

        actionResponse.setRenderParameter("mvcPath", "/wiki/error.jsp");
    } catch (Exception e) {
        handleUploadException(portletConfig, actionRequest, actionResponse, cmd, e);
    }
}