1   /**
2    * Copyright (c) 2000-2008 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="MBThreadUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class MBThreadUtil {
32      public static com.liferay.portlet.messageboards.model.MBThread create(
33          long threadId) {
34          return getPersistence().create(threadId);
35      }
36  
37      public static com.liferay.portlet.messageboards.model.MBThread remove(
38          long threadId)
39          throws com.liferay.portal.SystemException,
40              com.liferay.portlet.messageboards.NoSuchThreadException {
41          return getPersistence().remove(threadId);
42      }
43  
44      public static com.liferay.portlet.messageboards.model.MBThread remove(
45          com.liferay.portlet.messageboards.model.MBThread mbThread)
46          throws com.liferay.portal.SystemException {
47          return getPersistence().remove(mbThread);
48      }
49  
50      /**
51       * @deprecated Use <code>update(MBThread mbThread, boolean merge)</code>.
52       */
53      public static com.liferay.portlet.messageboards.model.MBThread update(
54          com.liferay.portlet.messageboards.model.MBThread mbThread)
55          throws com.liferay.portal.SystemException {
56          return getPersistence().update(mbThread);
57      }
58  
59      /**
60       * Add, update, or merge, the entity. This method also calls the model
61       * listeners to trigger the proper events associated with adding, deleting,
62       * or updating an entity.
63       *
64       * @param        mbThread the entity to add, update, or merge
65       * @param        merge boolean value for whether to merge the entity. The
66       *                default value is false. Setting merge to true is more
67       *                expensive and should only be true when mbThread is
68       *                transient. See LEP-5473 for a detailed discussion of this
69       *                method.
70       * @return        true if the portlet can be displayed via Ajax
71       */
72      public static com.liferay.portlet.messageboards.model.MBThread update(
73          com.liferay.portlet.messageboards.model.MBThread mbThread, boolean merge)
74          throws com.liferay.portal.SystemException {
75          return getPersistence().update(mbThread, merge);
76      }
77  
78      public static com.liferay.portlet.messageboards.model.MBThread updateImpl(
79          com.liferay.portlet.messageboards.model.MBThread mbThread, boolean merge)
80          throws com.liferay.portal.SystemException {
81          return getPersistence().updateImpl(mbThread, merge);
82      }
83  
84      public static com.liferay.portlet.messageboards.model.MBThread findByPrimaryKey(
85          long threadId)
86          throws com.liferay.portal.SystemException,
87              com.liferay.portlet.messageboards.NoSuchThreadException {
88          return getPersistence().findByPrimaryKey(threadId);
89      }
90  
91      public static com.liferay.portlet.messageboards.model.MBThread fetchByPrimaryKey(
92          long threadId) throws com.liferay.portal.SystemException {
93          return getPersistence().fetchByPrimaryKey(threadId);
94      }
95  
96      public static java.util.List<com.liferay.portlet.messageboards.model.MBThread> findByCategoryId(
97          long categoryId) throws com.liferay.portal.SystemException {
98          return getPersistence().findByCategoryId(categoryId);
99      }
100 
101     public static java.util.List<com.liferay.portlet.messageboards.model.MBThread> findByCategoryId(
102         long categoryId, int begin, int end)
103         throws com.liferay.portal.SystemException {
104         return getPersistence().findByCategoryId(categoryId, begin, end);
105     }
106 
107     public static java.util.List<com.liferay.portlet.messageboards.model.MBThread> findByCategoryId(
108         long categoryId, int begin, int end,
109         com.liferay.portal.kernel.util.OrderByComparator obc)
110         throws com.liferay.portal.SystemException {
111         return getPersistence().findByCategoryId(categoryId, begin, end, obc);
112     }
113 
114     public static com.liferay.portlet.messageboards.model.MBThread findByCategoryId_First(
115         long categoryId, com.liferay.portal.kernel.util.OrderByComparator obc)
116         throws com.liferay.portal.SystemException,
117             com.liferay.portlet.messageboards.NoSuchThreadException {
118         return getPersistence().findByCategoryId_First(categoryId, obc);
119     }
120 
121     public static com.liferay.portlet.messageboards.model.MBThread findByCategoryId_Last(
122         long categoryId, com.liferay.portal.kernel.util.OrderByComparator obc)
123         throws com.liferay.portal.SystemException,
124             com.liferay.portlet.messageboards.NoSuchThreadException {
125         return getPersistence().findByCategoryId_Last(categoryId, obc);
126     }
127 
128     public static com.liferay.portlet.messageboards.model.MBThread[] findByCategoryId_PrevAndNext(
129         long threadId, long categoryId,
130         com.liferay.portal.kernel.util.OrderByComparator obc)
131         throws com.liferay.portal.SystemException,
132             com.liferay.portlet.messageboards.NoSuchThreadException {
133         return getPersistence()
134                    .findByCategoryId_PrevAndNext(threadId, categoryId, obc);
135     }
136 
137     public static java.util.List<com.liferay.portlet.messageboards.model.MBThread> findWithDynamicQuery(
138         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
139         throws com.liferay.portal.SystemException {
140         return getPersistence().findWithDynamicQuery(queryInitializer);
141     }
142 
143     public static java.util.List<com.liferay.portlet.messageboards.model.MBThread> findWithDynamicQuery(
144         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
145         int begin, int end) throws com.liferay.portal.SystemException {
146         return getPersistence()
147                    .findWithDynamicQuery(queryInitializer, begin, end);
148     }
149 
150     public static java.util.List<com.liferay.portlet.messageboards.model.MBThread> findAll()
151         throws com.liferay.portal.SystemException {
152         return getPersistence().findAll();
153     }
154 
155     public static java.util.List<com.liferay.portlet.messageboards.model.MBThread> findAll(
156         int begin, int end) throws com.liferay.portal.SystemException {
157         return getPersistence().findAll(begin, end);
158     }
159 
160     public static java.util.List<com.liferay.portlet.messageboards.model.MBThread> findAll(
161         int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
162         throws com.liferay.portal.SystemException {
163         return getPersistence().findAll(begin, end, obc);
164     }
165 
166     public static void removeByCategoryId(long categoryId)
167         throws com.liferay.portal.SystemException {
168         getPersistence().removeByCategoryId(categoryId);
169     }
170 
171     public static void removeAll() throws com.liferay.portal.SystemException {
172         getPersistence().removeAll();
173     }
174 
175     public static int countByCategoryId(long categoryId)
176         throws com.liferay.portal.SystemException {
177         return getPersistence().countByCategoryId(categoryId);
178     }
179 
180     public static int countAll() throws com.liferay.portal.SystemException {
181         return getPersistence().countAll();
182     }
183 
184     public static MBThreadPersistence getPersistence() {
185         return _getUtil()._persistence;
186     }
187 
188     public void setPersistence(MBThreadPersistence persistence) {
189         _persistence = persistence;
190     }
191 
192     private static MBThreadUtil _getUtil() {
193         if (_util == null) {
194             _util = (MBThreadUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
195         }
196 
197         return _util;
198     }
199 
200     private static final String _UTIL = MBThreadUtil.class.getName();
201     private static MBThreadUtil _util;
202     private MBThreadPersistence _persistence;
203 }