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.portlet.tasks.service.impl;
16  
17  import com.liferay.portal.PortalException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.security.permission.ActionKeys;
20  import com.liferay.portal.service.permission.GroupPermissionUtil;
21  import com.liferay.portlet.tasks.model.TasksProposal;
22  import com.liferay.portlet.tasks.model.TasksReview;
23  import com.liferay.portlet.tasks.service.base.TasksReviewServiceBaseImpl;
24  
25  /**
26   * <a href="TasksReviewServiceImpl.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Raymond Augé
29   * @author Brian Wing Shun Chan
30   */
31  public class TasksReviewServiceImpl extends TasksReviewServiceBaseImpl {
32  
33      public TasksReview approveReview(long proposalId, int stage)
34          throws PortalException, SystemException {
35  
36          TasksProposal proposal = tasksProposalPersistence.findByPrimaryKey(
37              proposalId);
38  
39          GroupPermissionUtil.check(
40              getPermissionChecker(), proposal.getGroupId(),
41              ActionKeys.APPROVE_PROPOSAL);
42  
43          return tasksReviewLocalService.approveReview(
44              getUserId(), proposalId, stage);
45      }
46  
47      public TasksReview rejectReview(long proposalId, int stage)
48          throws PortalException, SystemException {
49  
50          TasksProposal proposal = tasksProposalPersistence.findByPrimaryKey(
51              proposalId);
52  
53          GroupPermissionUtil.check(
54              getPermissionChecker(), proposal.getGroupId(),
55              ActionKeys.APPROVE_PROPOSAL);
56  
57          return tasksReviewLocalService.rejectReview(
58              getUserId(), proposalId, stage);
59      }
60  
61      public void updateReviews(long proposalId, long[][] userIdsPerStage)
62          throws PortalException, SystemException {
63  
64          TasksProposal proposal = tasksProposalPersistence.findByPrimaryKey(
65              proposalId);
66  
67          GroupPermissionUtil.check(
68              getPermissionChecker(), proposal.getGroupId(),
69              ActionKeys.ASSIGN_REVIEWER);
70  
71          tasksReviewLocalService.updateReviews(
72              proposalId, getUserId(), userIdsPerStage);
73      }
74  
75  }