Example usage for com.liferay.portal.kernel.service LayoutLocalServiceUtil fetchLayout

List of usage examples for com.liferay.portal.kernel.service LayoutLocalServiceUtil fetchLayout

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.service LayoutLocalServiceUtil fetchLayout.

Prototype

public static com.liferay.portal.kernel.model.Layout fetchLayout(String uuid, long groupId,
            boolean privateLayout) 

Source Link

Usage

From source file:com.liferay.exportimport.content.processor.base.BaseTextExportImportContentProcessor.java

License:Open Source License

protected void validateLinksToLayoutsReferences(String content) throws PortalException {

    Matcher matcher = exportLinksToLayoutPattern.matcher(content);

    while (matcher.find()) {
        long groupId = GetterUtil.getLong(matcher.group(5));

        String type = matcher.group(2);

        boolean privateLayout = type.startsWith("private");

        long layoutId = GetterUtil.getLong(matcher.group(1));

        Layout layout = LayoutLocalServiceUtil.fetchLayout(groupId, privateLayout, layoutId);

        if (layout == null) {
            throw new NoSuchLayoutException();
        }/*from  w  ww . j a v a 2 s. c  o  m*/
    }
}

From source file:com.liferay.layout.taglib.servlet.taglib.LayoutsTreeTag.java

License:Open Source License

protected String getCheckedNodes() {
    JSONArray checkedNodesJSONArray = JSONFactoryUtil.createJSONArray();

    String checkedLayoutIds = GetterUtil.getString(_selectedLayoutIds,
            SessionTreeJSClicks.getOpenNodes(request, _treeId + "SelectedNode"));

    if (Validator.isNull(checkedLayoutIds)) {
        return checkedNodesJSONArray.toString();
    }//from w w  w .  j a v a  2  s  . com

    for (long checkedLayoutId : StringUtil.split(checkedLayoutIds, 0L)) {
        Layout checkedLayout = LayoutLocalServiceUtil.fetchLayout(_groupId, _privateLayout, checkedLayoutId);

        if (checkedLayout != null) {
            checkedNodesJSONArray.put(String.valueOf(checkedLayout.getPlid()));
        } else if (checkedLayoutId == LayoutConstants.DEFAULT_PLID) {
            checkedNodesJSONArray.put(String.valueOf(LayoutConstants.DEFAULT_PLID));
        }
    }

    return checkedNodesJSONArray.toString();
}

From source file:com.liferay.layout.type.controller.link.to.page.internal.display.context.LinkToPageLayoutTypeControllerDisplayContext.java

License:Open Source License

private void _setSelectedLayout() {
    Layout layout = (Layout) _liferayPortletRequest.getAttribute(WebKeys.SEL_LAYOUT);

    if (layout != null) {
        long linkToLayoutId = GetterUtil.getLong(layout.getTypeSettingsProperty("linkToLayoutId"));

        _selectedLayout = LayoutLocalServiceUtil.fetchLayout(layout.getGroupId(), layout.isPrivateLayout(),
                linkToLayoutId);/*w  w  w . ja  v  a  2 s.  c  om*/
    }
}