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            public UserGroupImpl() {
028            }
029    
030            @Override
031            public Group getGroup() throws PortalException {
032                    return GroupLocalServiceUtil.getUserGroupGroup(
033                            getCompanyId(), getUserGroupId());
034            }
035    
036            @Override
037            public long getGroupId() throws PortalException {
038                    Group group = getGroup();
039    
040                    return group.getGroupId();
041            }
042    
043            @Override
044            public int getPrivateLayoutsPageCount() throws PortalException {
045                    Group group = getGroup();
046    
047                    return group.getPrivateLayoutsPageCount();
048            }
049    
050            @Override
051            public int getPublicLayoutsPageCount() throws PortalException {
052                    Group group = getGroup();
053    
054                    return group.getPublicLayoutsPageCount();
055            }
056    
057            @Override
058            public boolean hasPrivateLayouts() throws PortalException {
059                    if (getPrivateLayoutsPageCount() > 0) {
060                            return true;
061                    }
062                    else {
063                            return false;
064                    }
065            }
066    
067            @Override
068            public boolean hasPublicLayouts() throws PortalException {
069                    if (getPublicLayoutsPageCount() > 0) {
070                            return true;
071                    }
072                    else {
073                            return false;
074                    }
075            }
076    
077    }