1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.service.impl;
16  
17  import com.liferay.portal.kernel.exception.PortalException;
18  import com.liferay.portal.kernel.exception.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  }