001
014
015 package com.liferay.portal.model.impl;
016
017 import com.liferay.portal.NoSuchLayoutException;
018 import com.liferay.portal.kernel.exception.PortalException;
019 import com.liferay.portal.kernel.exception.SystemException;
020 import com.liferay.portal.model.Group;
021 import com.liferay.portal.model.Layout;
022 import com.liferay.portal.service.GroupLocalServiceUtil;
023 import com.liferay.portal.service.LayoutLocalServiceUtil;
024
025 import java.util.List;
026
027
030 public class LayoutPrototypeImpl extends LayoutPrototypeBaseImpl {
031
032 public LayoutPrototypeImpl() {
033 }
034
035 public Group getGroup() throws PortalException, SystemException {
036 return GroupLocalServiceUtil.getLayoutPrototypeGroup(
037 getCompanyId(), getLayoutPrototypeId());
038 }
039
040 public long getGroupId() throws PortalException, SystemException {
041 Group group = getGroup();
042
043 return group.getGroupId();
044 }
045
046 public Layout getLayout() throws PortalException, SystemException {
047 Group group = getGroup();
048
049 if (group.getPrivateLayoutsPageCount() > 0) {
050 List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(
051 group.getGroupId(), true);
052
053 return layouts.get(0);
054 }
055
056 throw new NoSuchLayoutException();
057 }
058
059 }