001
014
015 package com.liferay.portlet.journal.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portlet.journal.model.JournalArticleResource;
020 import com.liferay.portlet.journal.service.base.JournalArticleResourceLocalServiceBaseImpl;
021
022 import java.util.List;
023
024
027 public class JournalArticleResourceLocalServiceImpl
028 extends JournalArticleResourceLocalServiceBaseImpl {
029
030 public void deleteArticleResource(long groupId, String articleId)
031 throws PortalException, SystemException {
032
033 journalArticleResourcePersistence.removeByG_A(groupId, articleId);
034 }
035
036 public JournalArticleResource getArticleResource(
037 long articleResourcePrimKey)
038 throws PortalException, SystemException {
039
040 return journalArticleResourcePersistence.findByPrimaryKey(
041 articleResourcePrimKey);
042 }
043
044 public long getArticleResourcePrimKey(long groupId, String articleId)
045 throws SystemException {
046
047 JournalArticleResource articleResource =
048 journalArticleResourcePersistence.fetchByG_A(groupId, articleId);
049
050 if (articleResource == null) {
051 long articleResourcePrimKey = counterLocalService.increment();
052
053 articleResource = journalArticleResourcePersistence.create(
054 articleResourcePrimKey);
055
056 articleResource.setGroupId(groupId);
057 articleResource.setArticleId(articleId);
058
059 journalArticleResourcePersistence.update(articleResource, false);
060 }
061
062 return articleResource.getResourcePrimKey();
063 }
064
065 public List<JournalArticleResource> getArticleResources(long groupId)
066 throws SystemException {
067
068 return journalArticleResourcePersistence.findByGroupId(groupId);
069 }
070
071 }