Example usage for com.liferay.portal.kernel.model LayoutTypePortlet isCustomizedView

List of usage examples for com.liferay.portal.kernel.model LayoutTypePortlet isCustomizedView

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.model LayoutTypePortlet isCustomizedView.

Prototype

public boolean isCustomizedView();

Source Link

Usage

From source file:com.liferay.layout.admin.web.internal.control.menu.ToggleControlsProductNavigationControlMenuEntry.java

License:Open Source License

protected boolean hasCustomizePermission(ThemeDisplay themeDisplay) throws PortalException {

    Layout layout = themeDisplay.getLayout();
    LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet();

    if (!layout.isTypePortlet() || (layoutTypePortlet == null)) {
        return false;
    }/*from   w ww. jav a  2s . c o  m*/

    if (!layoutTypePortlet.isCustomizable() || !layoutTypePortlet.isCustomizedView()) {

        return false;
    }

    if (LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), layout, ActionKeys.CUSTOMIZE)) {

        return true;
    }

    return false;
}

From source file:com.liferay.layout.admin.web.internal.portlet.action.ResetCustomizationViewMVCActionCommand.java

License:Open Source License

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

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    if (!LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), themeDisplay.getLayout(),
            ActionKeys.CUSTOMIZE)) {// w  w  w. j  av  a2  s .  com

        throw new PrincipalException();
    }

    LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet();

    if ((layoutTypePortlet != null) && layoutTypePortlet.isCustomizable()
            && layoutTypePortlet.isCustomizedView()) {

        layoutTypePortlet.resetUserPreferences();
    }

    MultiSessionMessages.add(actionRequest, _portal.getPortletId(actionRequest) + "requestProcessed");

    Layout layout = themeDisplay.getLayout();

    actionResponse.sendRedirect(layout.getRegularURL(_portal.getHttpServletRequest(actionRequest)));
}