001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.model.impl;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.model.Group;
019    import com.liferay.portal.service.GroupLocalServiceUtil;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     * @author Jorge Ferrer
024     */
025    public class UserGroupImpl extends UserGroupBaseImpl {
026    
027            @Override
028            public Group getGroup() throws PortalException {
029                    return GroupLocalServiceUtil.getUserGroupGroup(
030                            getCompanyId(), getUserGroupId());
031            }
032    
033            @Override
034            public long getGroupId() throws PortalException {
035                    Group group = getGroup();
036    
037                    return group.getGroupId();
038            }
039    
040            @Override
041            public int getPrivateLayoutsPageCount() throws PortalException {
042                    Group group = getGroup();
043    
044                    return group.getPrivateLayoutsPageCount();
045            }
046    
047            @Override
048            public int getPublicLayoutsPageCount() throws PortalException {
049                    Group group = getGroup();
050    
051                    return group.getPublicLayoutsPageCount();
052            }
053    
054            @Override
055            public boolean hasPrivateLayouts() throws PortalException {
056                    if (getPrivateLayoutsPageCount() > 0) {
057                            return true;
058                    }
059                    else {
060                            return false;
061                    }
062            }
063    
064            @Override
065            public boolean hasPublicLayouts() throws PortalException {
066                    if (getPublicLayoutsPageCount() > 0) {
067                            return true;
068                    }
069                    else {
070                            return false;
071                    }
072            }
073    
074    }