001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service.impl;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.model.Team;
020    import com.liferay.portal.security.permission.ActionKeys;
021    import com.liferay.portal.service.base.TeamServiceBaseImpl;
022    import com.liferay.portal.service.permission.GroupPermissionUtil;
023    import com.liferay.portal.service.permission.TeamPermissionUtil;
024    
025    /**
026     * @author Brian Wing Shun Chan
027     */
028    public class TeamServiceImpl extends TeamServiceBaseImpl {
029    
030            public Team addTeam(
031                            long groupId, String name, String description)
032                    throws PortalException, SystemException {
033    
034                    GroupPermissionUtil.check(
035                            getPermissionChecker(), groupId, ActionKeys.MANAGE_TEAMS);
036    
037                    return teamLocalService.addTeam(
038                            getUserId(), groupId, name, description);
039            }
040    
041            public void deleteTeam(long teamId)
042                    throws PortalException, SystemException {
043    
044                    TeamPermissionUtil.check(
045                            getPermissionChecker(), teamId, ActionKeys.DELETE);
046    
047                    teamLocalService.deleteTeam(teamId);
048            }
049    
050            public Team updateTeam(long teamId, String name, String description)
051                    throws PortalException, SystemException {
052    
053                    TeamPermissionUtil.check(
054                            getPermissionChecker(), teamId, ActionKeys.UPDATE);
055    
056                    return teamLocalService.updateTeam(teamId, name, description);
057            }
058    
059    }