001    /**
002     * Copyright (c) 2000-2013 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.kernel.exception.SystemException;
019    import com.liferay.portal.model.Group;
020    import com.liferay.portal.service.GroupLocalServiceUtil;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     * @author Jorge Ferrer
025     */
026    public class UserGroupImpl extends UserGroupBaseImpl {
027    
028            public UserGroupImpl() {
029            }
030    
031            @Override
032            public Group getGroup() throws PortalException, SystemException {
033                    return GroupLocalServiceUtil.getUserGroupGroup(
034                            getCompanyId(), getUserGroupId());
035            }
036    
037            @Override
038            public long getGroupId() throws PortalException, SystemException {
039                    Group group = getGroup();
040    
041                    return group.getGroupId();
042            }
043    
044            @Override
045            public int getPrivateLayoutsPageCount()
046                    throws PortalException, SystemException {
047    
048                    Group group = getGroup();
049    
050                    return group.getPrivateLayoutsPageCount();
051            }
052    
053            @Override
054            public int getPublicLayoutsPageCount()
055                    throws PortalException, SystemException {
056    
057                    Group group = getGroup();
058    
059                    return group.getPublicLayoutsPageCount();
060            }
061    
062            @Override
063            public boolean hasPrivateLayouts() throws PortalException, SystemException {
064                    if (getPrivateLayoutsPageCount() > 0) {
065                            return true;
066                    }
067                    else {
068                            return false;
069                    }
070            }
071    
072            @Override
073            public boolean hasPublicLayouts() throws PortalException, SystemException {
074                    if (getPublicLayoutsPageCount() > 0) {
075                            return true;
076                    }
077                    else {
078                            return false;
079                    }
080            }
081    
082    }