1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.service.impl;
16  
17  import com.liferay.portal.PortalException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.model.MembershipRequest;
20  import com.liferay.portal.security.permission.ActionKeys;
21  import com.liferay.portal.service.base.MembershipRequestServiceBaseImpl;
22  import com.liferay.portal.service.permission.GroupPermissionUtil;
23  
24  /**
25   * <a href="MembershipRequestServiceImpl.java.html"><b><i>View Source</i></b>
26   * </a>
27   *
28   * @author Jorge Ferrer
29   */
30  public class MembershipRequestServiceImpl
31      extends MembershipRequestServiceBaseImpl {
32  
33      public MembershipRequest addMembershipRequest(long groupId, String comments)
34          throws PortalException, SystemException {
35  
36          return membershipRequestLocalService.addMembershipRequest(
37              getUserId(), groupId, comments);
38      }
39  
40      public void deleteMembershipRequests(long groupId, int statusId)
41          throws PortalException, SystemException {
42  
43          GroupPermissionUtil.check(
44              getPermissionChecker(), groupId, ActionKeys.ASSIGN_MEMBERS);
45  
46          membershipRequestLocalService.deleteMembershipRequests(
47              groupId, statusId);
48      }
49  
50      public MembershipRequest getMembershipRequest(long membershipRequestId)
51          throws SystemException, PortalException {
52  
53          return membershipRequestLocalService.getMembershipRequest(
54              membershipRequestId);
55      }
56  
57      public void updateStatus(
58              long membershipRequestId, String reviewComments, int statusId)
59          throws PortalException, SystemException {
60  
61          MembershipRequest membershipRequest =
62              membershipRequestPersistence.findByPrimaryKey(membershipRequestId);
63  
64          GroupPermissionUtil.check(
65              getPermissionChecker(), membershipRequest.getGroupId(),
66              ActionKeys.ASSIGN_MEMBERS);
67  
68          membershipRequestLocalService.updateStatus(
69              getUserId(), membershipRequestId, reviewComments, statusId);
70      }
71  
72  }