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.portlet.announcements.model.AnnouncementsFlag;
020 import com.liferay.portlet.announcements.service.base.AnnouncementsFlagLocalServiceBaseImpl;
021
022 import java.util.Date;
023
024
028 public class AnnouncementsFlagLocalServiceImpl
029 extends AnnouncementsFlagLocalServiceBaseImpl {
030
031 public AnnouncementsFlag addFlag(long userId, long entryId, int value)
032 throws SystemException {
033
034 long flagId = counterLocalService.increment();
035
036 AnnouncementsFlag flag = announcementsFlagPersistence.create(flagId);
037
038 flag.setUserId(userId);
039 flag.setCreateDate(new Date());
040 flag.setEntryId(entryId);
041 flag.setValue(value);
042
043 announcementsFlagPersistence.update(flag, false);
044
045 return flag;
046 }
047
048 public void deleteFlag(long flagId)
049 throws PortalException, SystemException {
050
051 announcementsFlagPersistence.remove(flagId);
052 }
053
054 public void deleteFlags(long entryId) throws SystemException {
055 announcementsFlagPersistence.removeByEntryId(entryId);
056 }
057
058 public AnnouncementsFlag getFlag(long userId, long entryId, int value)
059 throws PortalException, SystemException {
060
061 return announcementsFlagPersistence.findByU_E_V(
062 userId, entryId, value);
063 }
064
065 }