1   /**
2    * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.messageboards.service.base;
24  
25  import com.liferay.portal.SystemException;
26  import com.liferay.portal.kernel.dao.DynamicQueryInitializer;
27  
28  import com.liferay.portlet.messageboards.model.MBMessage;
29  import com.liferay.portlet.messageboards.model.impl.MBMessageImpl;
30  import com.liferay.portlet.messageboards.service.MBMessageLocalService;
31  import com.liferay.portlet.messageboards.service.persistence.MBMessageUtil;
32  
33  import java.util.List;
34  
35  /**
36   * <a href="MBMessageLocalServiceBaseImpl.java.html"><b><i>View Source</i></b></a>
37   *
38   * @author Brian Wing Shun Chan
39   *
40   */
41  public abstract class MBMessageLocalServiceBaseImpl
42      implements MBMessageLocalService {
43      public MBMessage addMBMessage(MBMessage model) throws SystemException {
44          MBMessage mbMessage = new MBMessageImpl();
45          mbMessage.setNew(true);
46          mbMessage.setMessageId(model.getMessageId());
47          mbMessage.setCompanyId(model.getCompanyId());
48          mbMessage.setUserId(model.getUserId());
49          mbMessage.setUserName(model.getUserName());
50          mbMessage.setCreateDate(model.getCreateDate());
51          mbMessage.setModifiedDate(model.getModifiedDate());
52          mbMessage.setCategoryId(model.getCategoryId());
53          mbMessage.setThreadId(model.getThreadId());
54          mbMessage.setParentMessageId(model.getParentMessageId());
55          mbMessage.setSubject(model.getSubject());
56          mbMessage.setBody(model.getBody());
57          mbMessage.setAttachments(model.getAttachments());
58          mbMessage.setAnonymous(model.getAnonymous());
59  
60          return MBMessageUtil.update(mbMessage);
61      }
62  
63      public List dynamicQuery(DynamicQueryInitializer queryInitializer)
64          throws SystemException {
65          return MBMessageUtil.findWithDynamicQuery(queryInitializer);
66      }
67  
68      public List dynamicQuery(DynamicQueryInitializer queryInitializer,
69          int begin, int end) throws SystemException {
70          return MBMessageUtil.findWithDynamicQuery(queryInitializer, begin, end);
71      }
72  
73      public MBMessage updateMBMessage(MBMessage model) throws SystemException {
74          MBMessage mbMessage = new MBMessageImpl();
75          mbMessage.setNew(false);
76          mbMessage.setMessageId(model.getMessageId());
77          mbMessage.setCompanyId(model.getCompanyId());
78          mbMessage.setUserId(model.getUserId());
79          mbMessage.setUserName(model.getUserName());
80          mbMessage.setCreateDate(model.getCreateDate());
81          mbMessage.setModifiedDate(model.getModifiedDate());
82          mbMessage.setCategoryId(model.getCategoryId());
83          mbMessage.setThreadId(model.getThreadId());
84          mbMessage.setParentMessageId(model.getParentMessageId());
85          mbMessage.setSubject(model.getSubject());
86          mbMessage.setBody(model.getBody());
87          mbMessage.setAttachments(model.getAttachments());
88          mbMessage.setAnonymous(model.getAnonymous());
89  
90          return MBMessageUtil.update(mbMessage);
91      }
92  }