1   /**
2    * Copyright (c) 2000-2009 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.persistence;
24  
25  /**
26   * <a href="MBDiscussionUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class MBDiscussionUtil {
32      public static void cacheResult(
33          com.liferay.portlet.messageboards.model.MBDiscussion mbDiscussion) {
34          getPersistence().cacheResult(mbDiscussion);
35      }
36  
37      public static void cacheResult(
38          java.util.List<com.liferay.portlet.messageboards.model.MBDiscussion> mbDiscussions) {
39          getPersistence().cacheResult(mbDiscussions);
40      }
41  
42      public static void clearCache() {
43          getPersistence().clearCache();
44      }
45  
46      public static com.liferay.portlet.messageboards.model.MBDiscussion create(
47          long discussionId) {
48          return getPersistence().create(discussionId);
49      }
50  
51      public static com.liferay.portlet.messageboards.model.MBDiscussion remove(
52          long discussionId)
53          throws com.liferay.portal.SystemException,
54              com.liferay.portlet.messageboards.NoSuchDiscussionException {
55          return getPersistence().remove(discussionId);
56      }
57  
58      public static com.liferay.portlet.messageboards.model.MBDiscussion remove(
59          com.liferay.portlet.messageboards.model.MBDiscussion mbDiscussion)
60          throws com.liferay.portal.SystemException {
61          return getPersistence().remove(mbDiscussion);
62      }
63  
64      /**
65       * @deprecated Use <code>update(MBDiscussion mbDiscussion, boolean merge)</code>.
66       */
67      public static com.liferay.portlet.messageboards.model.MBDiscussion update(
68          com.liferay.portlet.messageboards.model.MBDiscussion mbDiscussion)
69          throws com.liferay.portal.SystemException {
70          return getPersistence().update(mbDiscussion);
71      }
72  
73      /**
74       * Add, update, or merge, the entity. This method also calls the model
75       * listeners to trigger the proper events associated with adding, deleting,
76       * or updating an entity.
77       *
78       * @param        mbDiscussion the entity to add, update, or merge
79       * @param        merge boolean value for whether to merge the entity. The
80       *                default value is false. Setting merge to true is more
81       *                expensive and should only be true when mbDiscussion is
82       *                transient. See LEP-5473 for a detailed discussion of this
83       *                method.
84       * @return        true if the portlet can be displayed via Ajax
85       */
86      public static com.liferay.portlet.messageboards.model.MBDiscussion update(
87          com.liferay.portlet.messageboards.model.MBDiscussion mbDiscussion,
88          boolean merge) throws com.liferay.portal.SystemException {
89          return getPersistence().update(mbDiscussion, merge);
90      }
91  
92      public static com.liferay.portlet.messageboards.model.MBDiscussion updateImpl(
93          com.liferay.portlet.messageboards.model.MBDiscussion mbDiscussion,
94          boolean merge) throws com.liferay.portal.SystemException {
95          return getPersistence().updateImpl(mbDiscussion, merge);
96      }
97  
98      public static com.liferay.portlet.messageboards.model.MBDiscussion findByPrimaryKey(
99          long discussionId)
100         throws com.liferay.portal.SystemException,
101             com.liferay.portlet.messageboards.NoSuchDiscussionException {
102         return getPersistence().findByPrimaryKey(discussionId);
103     }
104 
105     public static com.liferay.portlet.messageboards.model.MBDiscussion fetchByPrimaryKey(
106         long discussionId) throws com.liferay.portal.SystemException {
107         return getPersistence().fetchByPrimaryKey(discussionId);
108     }
109 
110     public static java.util.List<com.liferay.portlet.messageboards.model.MBDiscussion> findByClassNameId(
111         long classNameId) throws com.liferay.portal.SystemException {
112         return getPersistence().findByClassNameId(classNameId);
113     }
114 
115     public static java.util.List<com.liferay.portlet.messageboards.model.MBDiscussion> findByClassNameId(
116         long classNameId, int start, int end)
117         throws com.liferay.portal.SystemException {
118         return getPersistence().findByClassNameId(classNameId, start, end);
119     }
120 
121     public static java.util.List<com.liferay.portlet.messageboards.model.MBDiscussion> findByClassNameId(
122         long classNameId, int start, int end,
123         com.liferay.portal.kernel.util.OrderByComparator obc)
124         throws com.liferay.portal.SystemException {
125         return getPersistence().findByClassNameId(classNameId, start, end, obc);
126     }
127 
128     public static com.liferay.portlet.messageboards.model.MBDiscussion findByClassNameId_First(
129         long classNameId, com.liferay.portal.kernel.util.OrderByComparator obc)
130         throws com.liferay.portal.SystemException,
131             com.liferay.portlet.messageboards.NoSuchDiscussionException {
132         return getPersistence().findByClassNameId_First(classNameId, obc);
133     }
134 
135     public static com.liferay.portlet.messageboards.model.MBDiscussion findByClassNameId_Last(
136         long classNameId, com.liferay.portal.kernel.util.OrderByComparator obc)
137         throws com.liferay.portal.SystemException,
138             com.liferay.portlet.messageboards.NoSuchDiscussionException {
139         return getPersistence().findByClassNameId_Last(classNameId, obc);
140     }
141 
142     public static com.liferay.portlet.messageboards.model.MBDiscussion[] findByClassNameId_PrevAndNext(
143         long discussionId, long classNameId,
144         com.liferay.portal.kernel.util.OrderByComparator obc)
145         throws com.liferay.portal.SystemException,
146             com.liferay.portlet.messageboards.NoSuchDiscussionException {
147         return getPersistence()
148                    .findByClassNameId_PrevAndNext(discussionId, classNameId, obc);
149     }
150 
151     public static com.liferay.portlet.messageboards.model.MBDiscussion findByThreadId(
152         long threadId)
153         throws com.liferay.portal.SystemException,
154             com.liferay.portlet.messageboards.NoSuchDiscussionException {
155         return getPersistence().findByThreadId(threadId);
156     }
157 
158     public static com.liferay.portlet.messageboards.model.MBDiscussion fetchByThreadId(
159         long threadId) throws com.liferay.portal.SystemException {
160         return getPersistence().fetchByThreadId(threadId);
161     }
162 
163     public static com.liferay.portlet.messageboards.model.MBDiscussion fetchByThreadId(
164         long threadId, boolean retrieveFromCache)
165         throws com.liferay.portal.SystemException {
166         return getPersistence().fetchByThreadId(threadId, retrieveFromCache);
167     }
168 
169     public static com.liferay.portlet.messageboards.model.MBDiscussion findByC_C(
170         long classNameId, long classPK)
171         throws com.liferay.portal.SystemException,
172             com.liferay.portlet.messageboards.NoSuchDiscussionException {
173         return getPersistence().findByC_C(classNameId, classPK);
174     }
175 
176     public static com.liferay.portlet.messageboards.model.MBDiscussion fetchByC_C(
177         long classNameId, long classPK)
178         throws com.liferay.portal.SystemException {
179         return getPersistence().fetchByC_C(classNameId, classPK);
180     }
181 
182     public static com.liferay.portlet.messageboards.model.MBDiscussion fetchByC_C(
183         long classNameId, long classPK, boolean retrieveFromCache)
184         throws com.liferay.portal.SystemException {
185         return getPersistence()
186                    .fetchByC_C(classNameId, classPK, retrieveFromCache);
187     }
188 
189     public static java.util.List<Object> findWithDynamicQuery(
190         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
191         throws com.liferay.portal.SystemException {
192         return getPersistence().findWithDynamicQuery(dynamicQuery);
193     }
194 
195     public static java.util.List<Object> findWithDynamicQuery(
196         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
197         int end) throws com.liferay.portal.SystemException {
198         return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
199     }
200 
201     public static java.util.List<com.liferay.portlet.messageboards.model.MBDiscussion> findAll()
202         throws com.liferay.portal.SystemException {
203         return getPersistence().findAll();
204     }
205 
206     public static java.util.List<com.liferay.portlet.messageboards.model.MBDiscussion> findAll(
207         int start, int end) throws com.liferay.portal.SystemException {
208         return getPersistence().findAll(start, end);
209     }
210 
211     public static java.util.List<com.liferay.portlet.messageboards.model.MBDiscussion> findAll(
212         int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
213         throws com.liferay.portal.SystemException {
214         return getPersistence().findAll(start, end, obc);
215     }
216 
217     public static void removeByClassNameId(long classNameId)
218         throws com.liferay.portal.SystemException {
219         getPersistence().removeByClassNameId(classNameId);
220     }
221 
222     public static void removeByThreadId(long threadId)
223         throws com.liferay.portal.SystemException,
224             com.liferay.portlet.messageboards.NoSuchDiscussionException {
225         getPersistence().removeByThreadId(threadId);
226     }
227 
228     public static void removeByC_C(long classNameId, long classPK)
229         throws com.liferay.portal.SystemException,
230             com.liferay.portlet.messageboards.NoSuchDiscussionException {
231         getPersistence().removeByC_C(classNameId, classPK);
232     }
233 
234     public static void removeAll() throws com.liferay.portal.SystemException {
235         getPersistence().removeAll();
236     }
237 
238     public static int countByClassNameId(long classNameId)
239         throws com.liferay.portal.SystemException {
240         return getPersistence().countByClassNameId(classNameId);
241     }
242 
243     public static int countByThreadId(long threadId)
244         throws com.liferay.portal.SystemException {
245         return getPersistence().countByThreadId(threadId);
246     }
247 
248     public static int countByC_C(long classNameId, long classPK)
249         throws com.liferay.portal.SystemException {
250         return getPersistence().countByC_C(classNameId, classPK);
251     }
252 
253     public static int countAll() throws com.liferay.portal.SystemException {
254         return getPersistence().countAll();
255     }
256 
257     public static MBDiscussionPersistence getPersistence() {
258         return _persistence;
259     }
260 
261     public void setPersistence(MBDiscussionPersistence persistence) {
262         _persistence = persistence;
263     }
264 
265     private static MBDiscussionPersistence _persistence;
266 }