001
014
015 package com.liferay.portlet.messageboards.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.util.PortalUtil;
020 import com.liferay.portlet.messageboards.model.MBDiscussion;
021 import com.liferay.portlet.messageboards.service.base.MBDiscussionLocalServiceBaseImpl;
022
023
026 public class MBDiscussionLocalServiceImpl
027 extends MBDiscussionLocalServiceBaseImpl {
028
029 @Override
030 public MBDiscussion addDiscussion(
031 long classNameId, long classPK, long threadId)
032 throws SystemException {
033
034 long discussionId = counterLocalService.increment();
035
036 MBDiscussion discussion = mbDiscussionPersistence.create(discussionId);
037
038 discussion.setClassNameId(classNameId);
039 discussion.setClassPK(classPK);
040 discussion.setThreadId(threadId);
041
042 mbDiscussionPersistence.update(discussion, false);
043
044 return discussion;
045 }
046
047 @Override
048 public MBDiscussion getDiscussion(long discussionId)
049 throws PortalException, SystemException {
050
051 return mbDiscussionPersistence.findByPrimaryKey(discussionId);
052 }
053
054 @Override
055 public MBDiscussion getDiscussion(String className, long classPK)
056 throws PortalException, SystemException {
057
058 long classNameId = PortalUtil.getClassNameId(className);
059
060 return mbDiscussionPersistence.findByC_C(classNameId, classPK);
061 }
062
063 @Override
064 public MBDiscussion getThreadDiscussion(long threadId)
065 throws PortalException, SystemException {
066
067 return mbDiscussionPersistence.findByThreadId(threadId);
068 }
069
070 }