List of usage examples for com.liferay.portal.model.impl LayoutImpl LayoutImpl
LayoutImpl
From source file:com.liferay.exportimport.lar.ExportImportHelperImpl.java
License:Open Source License
@Override public long[] getLayoutIds(Map<Long, Boolean> layoutIdMap, long targetGroupId) throws PortalException { if (MapUtil.isEmpty(layoutIdMap)) { return new long[0]; }//from w w w. j a va 2s. com List<Layout> layouts = new ArrayList<>(); for (Map.Entry<Long, Boolean> entry : layoutIdMap.entrySet()) { long plid = GetterUtil.getLong(String.valueOf(entry.getKey())); Layout layout = new LayoutImpl(); if (plid == 0) { layout.setPlid(LayoutConstants.DEFAULT_PLID); layout.setLayoutId(LayoutConstants.DEFAULT_PLID); layout.setParentLayoutId(LayoutConstants.DEFAULT_PARENT_LAYOUT_ID); } else { layout = _layoutLocalService.getLayout(plid); } if (!layouts.contains(layout)) { layouts.add(layout); } if (layout.getPlid() == LayoutConstants.DEFAULT_PLID) { continue; } List<Layout> parentLayouts = Collections.emptyList(); if (targetGroupId != GroupConstants.DEFAULT_LIVE_GROUP_ID) { parentLayouts = getMissingParentLayouts(layout, targetGroupId); } for (Layout parentLayout : parentLayouts) { if (!layouts.contains(parentLayout)) { layouts.add(parentLayout); } } boolean includeChildren = entry.getValue(); if (includeChildren) { for (Layout childLayout : layout.getAllChildren()) { if (!layouts.contains(childLayout)) { layouts.add(childLayout); } } } } return getLayoutIds(layouts); }