001
014
015 package com.liferay.portlet.polls.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.ServiceContext;
021 import com.liferay.portlet.polls.model.PollsChoice;
022 import com.liferay.portlet.polls.model.PollsQuestion;
023 import com.liferay.portlet.polls.service.base.PollsQuestionServiceBaseImpl;
024 import com.liferay.portlet.polls.service.permission.PollsPermission;
025 import com.liferay.portlet.polls.service.permission.PollsQuestionPermission;
026
027 import java.util.List;
028 import java.util.Locale;
029 import java.util.Map;
030
031
035 public class PollsQuestionServiceImpl extends PollsQuestionServiceBaseImpl {
036
037 public PollsQuestion addQuestion(
038 Map<Locale, String> titleMap, Map<Locale, String> descriptionMap,
039 int expirationDateMonth, int expirationDateDay,
040 int expirationDateYear, int expirationDateHour,
041 int expirationDateMinute, boolean neverExpire,
042 List<PollsChoice> choices, ServiceContext serviceContext)
043 throws PortalException, SystemException {
044
045 PollsPermission.check(
046 getPermissionChecker(), serviceContext.getScopeGroupId(),
047 ActionKeys.ADD_QUESTION);
048
049 return pollsQuestionLocalService.addQuestion(
050 getUserId(), titleMap, descriptionMap, expirationDateMonth,
051 expirationDateDay, expirationDateYear, expirationDateHour,
052 expirationDateMinute, neverExpire, choices, serviceContext);
053 }
054
055 public void deleteQuestion(long questionId)
056 throws PortalException, SystemException {
057
058 PollsQuestionPermission.check(
059 getPermissionChecker(), questionId, ActionKeys.DELETE);
060
061 pollsQuestionLocalService.deleteQuestion(questionId);
062 }
063
064 public PollsQuestion getQuestion(long questionId)
065 throws PortalException, SystemException {
066
067 PollsQuestionPermission.check(
068 getPermissionChecker(), questionId, ActionKeys.VIEW);
069
070 return pollsQuestionLocalService.getQuestion(questionId);
071 }
072
073 public PollsQuestion updateQuestion(
074 long questionId, Map<Locale, String> titleMap,
075 Map<Locale, String> descriptionMap, int expirationDateMonth,
076 int expirationDateDay, int expirationDateYear,
077 int expirationDateHour, int expirationDateMinute,
078 boolean neverExpire, List<PollsChoice> choices,
079 ServiceContext serviceContext)
080 throws PortalException, SystemException {
081
082 PollsQuestionPermission.check(
083 getPermissionChecker(), questionId, ActionKeys.UPDATE);
084
085 return pollsQuestionLocalService.updateQuestion(
086 getUserId(), questionId, titleMap, descriptionMap,
087 expirationDateMonth, expirationDateDay, expirationDateYear,
088 expirationDateHour, expirationDateMinute, neverExpire, choices,
089 serviceContext);
090 }
091
092 }