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 @Override
031 public void addFlag(long entryId, int value)
032 throws PortalException, SystemException {
033
034 announcementsFlagLocalService.addFlag(getUserId(), entryId, value);
035 }
036
037 @Override
038 public void deleteFlag(long flagId)
039 throws PortalException, SystemException {
040
041 AnnouncementsFlag flag = announcementsFlagPersistence.findByPrimaryKey(
042 flagId);
043
044 if (flag.getUserId() != getUserId()) {
045 throw new PrincipalException();
046 }
047
048 announcementsFlagLocalService.deleteFlag(flagId);
049 }
050
051 @Override
052 public AnnouncementsFlag getFlag(long entryId, int value)
053 throws PortalException, SystemException {
054
055 return announcementsFlagLocalService.getFlag(
056 getUserId(), entryId, value);
057 }
058
059 }