Example usage for com.liferay.portal.kernel.model LayoutType getConfigurationActionDelete

List of usage examples for com.liferay.portal.kernel.model LayoutType getConfigurationActionDelete

Introduction

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

Prototype

public String[] getConfigurationActionDelete();

Source Link

Usage

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

License:Open Source License

protected void deleteLayout(long selPlid, ActionRequest actionRequest, ActionResponse actionResponse)
        throws PortalException {

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

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    Layout layout = _layoutLocalService.getLayout(selPlid);

    Group group = layout.getGroup();

    if (group.isStagingGroup()
            && !GroupPermissionUtil.contains(permissionChecker, group, ActionKeys.MANAGE_STAGING)
            && !GroupPermissionUtil.contains(permissionChecker, group, ActionKeys.PUBLISH_STAGING)) {

        throw new PrincipalException.MustHavePermission(permissionChecker, Group.class.getName(),
                group.getGroupId(), ActionKeys.MANAGE_STAGING, ActionKeys.PUBLISH_STAGING);
    }/* w  w w .j a  va  2 s. com*/

    if (LayoutPermissionUtil.contains(permissionChecker, layout, ActionKeys.DELETE)) {

        LayoutType layoutType = layout.getLayoutType();

        EventsProcessorUtil.process(PropsKeys.LAYOUT_CONFIGURATION_ACTION_DELETE,
                layoutType.getConfigurationActionDelete(), _portal.getHttpServletRequest(actionRequest),
                _portal.getHttpServletResponse(actionResponse));
    }

    if (group.isGuest() && !layout.isPrivateLayout() && layout.isRootLayout() && (_layoutLocalService
            .getLayoutsCount(group, false, LayoutConstants.DEFAULT_PARENT_LAYOUT_ID) == 1)) {

        throw new RequiredLayoutException(RequiredLayoutException.AT_LEAST_ONE);
    }

    ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);

    _layoutService.deleteLayout(selPlid, serviceContext);
}