001
014
015 package com.liferay.portlet.tasks.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.security.permission.ActionKeys;
020 import com.liferay.portal.service.permission.GroupPermissionUtil;
021 import com.liferay.portlet.tasks.model.TasksProposal;
022 import com.liferay.portlet.tasks.model.TasksReview;
023 import com.liferay.portlet.tasks.service.base.TasksReviewServiceBaseImpl;
024
025
029 public class TasksReviewServiceImpl extends TasksReviewServiceBaseImpl {
030
031 public TasksReview approveReview(long proposalId, int stage)
032 throws PortalException, SystemException {
033
034 TasksProposal proposal = tasksProposalPersistence.findByPrimaryKey(
035 proposalId);
036
037 GroupPermissionUtil.check(
038 getPermissionChecker(), proposal.getGroupId(),
039 ActionKeys.APPROVE_PROPOSAL);
040
041 return tasksReviewLocalService.approveReview(
042 getUserId(), proposalId, stage);
043 }
044
045 public TasksReview rejectReview(long proposalId, int stage)
046 throws PortalException, SystemException {
047
048 TasksProposal proposal = tasksProposalPersistence.findByPrimaryKey(
049 proposalId);
050
051 GroupPermissionUtil.check(
052 getPermissionChecker(), proposal.getGroupId(),
053 ActionKeys.APPROVE_PROPOSAL);
054
055 return tasksReviewLocalService.rejectReview(
056 getUserId(), proposalId, stage);
057 }
058
059 public void updateReviews(long proposalId, long[][] userIdsPerStage)
060 throws PortalException, SystemException {
061
062 TasksProposal proposal = tasksProposalPersistence.findByPrimaryKey(
063 proposalId);
064
065 GroupPermissionUtil.check(
066 getPermissionChecker(), proposal.getGroupId(),
067 ActionKeys.ASSIGN_REVIEWER);
068
069 tasksReviewLocalService.updateReviews(
070 proposalId, getUserId(), userIdsPerStage);
071 }
072
073 }