001
014
015 package com.liferay.portlet.announcements.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.auth.PrincipalException;
020 import com.liferay.portlet.announcements.model.AnnouncementsFlag;
021 import com.liferay.portlet.announcements.service.base.AnnouncementsFlagServiceBaseImpl;
022
023
027 public class AnnouncementsFlagServiceImpl
028 extends AnnouncementsFlagServiceBaseImpl {
029
030 public void addFlag(long entryId, int value)
031 throws PortalException, SystemException {
032
033 announcementsFlagLocalService.addFlag(getUserId(), entryId, value);
034 }
035
036 public void deleteFlag(long flagId)
037 throws PortalException, SystemException {
038
039 AnnouncementsFlag flag = announcementsFlagPersistence.findByPrimaryKey(
040 flagId);
041
042 if (flag.getUserId() != getUserId()) {
043 throw new PrincipalException();
044 }
045
046 announcementsFlagLocalService.deleteFlag(flagId);
047 }
048
049 public AnnouncementsFlag getFlag(long entryId, int value)
050 throws PortalException, SystemException {
051
052 return announcementsFlagLocalService.getFlag(
053 getUserId(), entryId, value);
054 }
055
056 }