Example usage for com.liferay.portal.kernel.servlet SessionMessages KEY_SUFFIX_REFRESH_PORTLET_DATA

List of usage examples for com.liferay.portal.kernel.servlet SessionMessages KEY_SUFFIX_REFRESH_PORTLET_DATA

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.servlet SessionMessages KEY_SUFFIX_REFRESH_PORTLET_DATA.

Prototype

String KEY_SUFFIX_REFRESH_PORTLET_DATA

To view the source code for com.liferay.portal.kernel.servlet SessionMessages KEY_SUFFIX_REFRESH_PORTLET_DATA.

Click Source Link

Usage

From source file:com.liferay.portlet.stagingbar.action.EditLayoutBranchAction.java

License:Open Source License

@Override
public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
        ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    try {/*from   w  w  w  . j a va 2  s.  c o  m*/
        checkPermissions(actionRequest);
    } catch (PrincipalException pe) {
        return;
    }

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

    try {
        if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) {
            updateLayoutBranch(actionRequest);
        } else if (cmd.equals(Constants.DELETE)) {
            deleteLayoutBranch(actionRequest, portletConfig);
        }

        if (SessionErrors.isEmpty(actionRequest)) {
            SessionMessages.add(actionRequest,
                    portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET,
                    PortletKeys.STAGING_BAR);

            Map<String, String> data = new HashMap<String, String>();

            data.put("preventNotification", Boolean.TRUE.toString());

            SessionMessages.add(actionRequest,
                    portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET_DATA, data);
        }

        sendRedirect(actionRequest, actionResponse);
    } catch (Exception e) {
        if (e instanceof LayoutBranchNameException) {
            SessionErrors.add(actionRequest, e.getClass().getName(), e);

            sendRedirect(actionRequest, actionResponse);
        } else if (e instanceof PrincipalException || e instanceof SystemException) {

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

            setForward(actionRequest, "portlet.staging_bar.error");
        } else {
            throw e;
        }
    }
}

From source file:com.liferay.portlet.stagingbar.action.EditLayoutSetBranchAction.java

License:Open Source License

@Override
public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
        ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    try {/*from w  w w.  ja v a  2 s. c o  m*/
        checkPermissions(actionRequest);
    } catch (PrincipalException pe) {
        return;
    }

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

    try {
        if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) {
            updateLayoutSetBranch(actionRequest);
        } else if (cmd.equals(Constants.DELETE)) {
            deleteLayoutSetBranch(actionRequest, portletConfig);
        } else if (cmd.equals("merge_layout_set_branch")) {
            mergeLayoutSetBranch(actionRequest);
        }

        if (SessionErrors.isEmpty(actionRequest)) {
            SessionMessages.add(actionRequest,
                    portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET,
                    PortletKeys.STAGING_BAR);

            Map<String, String> data = new HashMap<String, String>();

            data.put("preventNotification", Boolean.TRUE.toString());

            SessionMessages.add(actionRequest,
                    portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET_DATA, data);
        }

        sendRedirect(actionRequest, actionResponse);
    } catch (Exception e) {
        if (e instanceof LayoutSetBranchNameException) {
            SessionErrors.add(actionRequest, e.getClass().getName(), e);

            sendRedirect(actionRequest, actionResponse);
        } else if (e instanceof PrincipalException || e instanceof SystemException) {

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

            setForward(actionRequest, "portlet.staging_bar.error");
        } else {
            throw e;
        }
    }
}

From source file:com.liferay.staging.bar.web.internal.portlet.action.ActionUtil.java

License:Open Source License

public static void addLayoutBranchSessionMessages(ActionRequest actionRequest, ActionResponse actionResponse)
        throws IOException {

    if (SessionErrors.isEmpty(actionRequest)) {
        SessionMessages.add(actionRequest,
                PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET,
                StagingBarPortletKeys.STAGING_BAR);

        Map<String, String> data = new HashMap<>();

        data.put("preventNotification", Boolean.TRUE.toString());

        SessionMessages.add(actionRequest,
                PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET_DATA, data);
    }/*ww  w . ja  va  2  s  . c om*/

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

    actionResponse.sendRedirect(redirect);
}