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 public MBDiscussion addDiscussion(
030 long classNameId, long classPK, long threadId)
031 throws SystemException {
032
033 long discussionId = counterLocalService.increment();
034
035 MBDiscussion discussion = mbDiscussionPersistence.create(discussionId);
036
037 discussion.setClassNameId(classNameId);
038 discussion.setClassPK(classPK);
039 discussion.setThreadId(threadId);
040
041 mbDiscussionPersistence.update(discussion, false);
042
043 return discussion;
044 }
045
046 public MBDiscussion getDiscussion(long discussionId)
047 throws PortalException, SystemException {
048
049 return mbDiscussionPersistence.findByPrimaryKey(discussionId);
050 }
051
052 public MBDiscussion getDiscussion(String className, long classPK)
053 throws PortalException, SystemException {
054
055 long classNameId = PortalUtil.getClassNameId(className);
056
057 return mbDiscussionPersistence.findByC_C(classNameId, classPK);
058 }
059
060 public MBDiscussion getThreadDiscussion(long threadId)
061 throws PortalException, SystemException {
062
063 return mbDiscussionPersistence.findByThreadId(threadId);
064 }
065
066 }