1
22
23 package com.liferay.portlet.messageboards.service.persistence;
24
25 import com.liferay.portal.kernel.util.GetterUtil;
26 import com.liferay.portal.kernel.util.Validator;
27 import com.liferay.portal.model.ModelListener;
28 import com.liferay.portal.util.PropsUtil;
29
30 import org.apache.commons.logging.Log;
31 import org.apache.commons.logging.LogFactory;
32
33
39 public class MBCategoryUtil {
40 public static com.liferay.portlet.messageboards.model.MBCategory create(
41 long categoryId) {
42 return getPersistence().create(categoryId);
43 }
44
45 public static com.liferay.portlet.messageboards.model.MBCategory remove(
46 long categoryId)
47 throws com.liferay.portal.SystemException,
48 com.liferay.portlet.messageboards.NoSuchCategoryException {
49 ModelListener listener = _getListener();
50
51 if (listener != null) {
52 listener.onBeforeRemove(findByPrimaryKey(categoryId));
53 }
54
55 com.liferay.portlet.messageboards.model.MBCategory mbCategory = getPersistence()
56 .remove(categoryId);
57
58 if (listener != null) {
59 listener.onAfterRemove(mbCategory);
60 }
61
62 return mbCategory;
63 }
64
65 public static com.liferay.portlet.messageboards.model.MBCategory remove(
66 com.liferay.portlet.messageboards.model.MBCategory mbCategory)
67 throws com.liferay.portal.SystemException {
68 ModelListener listener = _getListener();
69
70 if (listener != null) {
71 listener.onBeforeRemove(mbCategory);
72 }
73
74 mbCategory = getPersistence().remove(mbCategory);
75
76 if (listener != null) {
77 listener.onAfterRemove(mbCategory);
78 }
79
80 return mbCategory;
81 }
82
83 public static com.liferay.portlet.messageboards.model.MBCategory update(
84 com.liferay.portlet.messageboards.model.MBCategory mbCategory)
85 throws com.liferay.portal.SystemException {
86 ModelListener listener = _getListener();
87 boolean isNew = mbCategory.isNew();
88
89 if (listener != null) {
90 if (isNew) {
91 listener.onBeforeCreate(mbCategory);
92 }
93 else {
94 listener.onBeforeUpdate(mbCategory);
95 }
96 }
97
98 mbCategory = getPersistence().update(mbCategory);
99
100 if (listener != null) {
101 if (isNew) {
102 listener.onAfterCreate(mbCategory);
103 }
104 else {
105 listener.onAfterUpdate(mbCategory);
106 }
107 }
108
109 return mbCategory;
110 }
111
112 public static com.liferay.portlet.messageboards.model.MBCategory update(
113 com.liferay.portlet.messageboards.model.MBCategory mbCategory,
114 boolean merge) throws com.liferay.portal.SystemException {
115 ModelListener listener = _getListener();
116 boolean isNew = mbCategory.isNew();
117
118 if (listener != null) {
119 if (isNew) {
120 listener.onBeforeCreate(mbCategory);
121 }
122 else {
123 listener.onBeforeUpdate(mbCategory);
124 }
125 }
126
127 mbCategory = getPersistence().update(mbCategory, merge);
128
129 if (listener != null) {
130 if (isNew) {
131 listener.onAfterCreate(mbCategory);
132 }
133 else {
134 listener.onAfterUpdate(mbCategory);
135 }
136 }
137
138 return mbCategory;
139 }
140
141 public static com.liferay.portlet.messageboards.model.MBCategory findByPrimaryKey(
142 long categoryId)
143 throws com.liferay.portal.SystemException,
144 com.liferay.portlet.messageboards.NoSuchCategoryException {
145 return getPersistence().findByPrimaryKey(categoryId);
146 }
147
148 public static com.liferay.portlet.messageboards.model.MBCategory fetchByPrimaryKey(
149 long categoryId) throws com.liferay.portal.SystemException {
150 return getPersistence().fetchByPrimaryKey(categoryId);
151 }
152
153 public static java.util.List findByGroupId(long groupId)
154 throws com.liferay.portal.SystemException {
155 return getPersistence().findByGroupId(groupId);
156 }
157
158 public static java.util.List findByGroupId(long groupId, int begin, int end)
159 throws com.liferay.portal.SystemException {
160 return getPersistence().findByGroupId(groupId, begin, end);
161 }
162
163 public static java.util.List findByGroupId(long groupId, int begin,
164 int end, com.liferay.portal.kernel.util.OrderByComparator obc)
165 throws com.liferay.portal.SystemException {
166 return getPersistence().findByGroupId(groupId, begin, end, obc);
167 }
168
169 public static com.liferay.portlet.messageboards.model.MBCategory findByGroupId_First(
170 long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
171 throws com.liferay.portal.SystemException,
172 com.liferay.portlet.messageboards.NoSuchCategoryException {
173 return getPersistence().findByGroupId_First(groupId, obc);
174 }
175
176 public static com.liferay.portlet.messageboards.model.MBCategory findByGroupId_Last(
177 long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
178 throws com.liferay.portal.SystemException,
179 com.liferay.portlet.messageboards.NoSuchCategoryException {
180 return getPersistence().findByGroupId_Last(groupId, obc);
181 }
182
183 public static com.liferay.portlet.messageboards.model.MBCategory[] findByGroupId_PrevAndNext(
184 long categoryId, long groupId,
185 com.liferay.portal.kernel.util.OrderByComparator obc)
186 throws com.liferay.portal.SystemException,
187 com.liferay.portlet.messageboards.NoSuchCategoryException {
188 return getPersistence().findByGroupId_PrevAndNext(categoryId, groupId,
189 obc);
190 }
191
192 public static java.util.List findByCompanyId(long companyId)
193 throws com.liferay.portal.SystemException {
194 return getPersistence().findByCompanyId(companyId);
195 }
196
197 public static java.util.List findByCompanyId(long companyId, int begin,
198 int end) throws com.liferay.portal.SystemException {
199 return getPersistence().findByCompanyId(companyId, begin, end);
200 }
201
202 public static java.util.List findByCompanyId(long companyId, int begin,
203 int end, com.liferay.portal.kernel.util.OrderByComparator obc)
204 throws com.liferay.portal.SystemException {
205 return getPersistence().findByCompanyId(companyId, begin, end, obc);
206 }
207
208 public static com.liferay.portlet.messageboards.model.MBCategory findByCompanyId_First(
209 long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
210 throws com.liferay.portal.SystemException,
211 com.liferay.portlet.messageboards.NoSuchCategoryException {
212 return getPersistence().findByCompanyId_First(companyId, obc);
213 }
214
215 public static com.liferay.portlet.messageboards.model.MBCategory findByCompanyId_Last(
216 long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
217 throws com.liferay.portal.SystemException,
218 com.liferay.portlet.messageboards.NoSuchCategoryException {
219 return getPersistence().findByCompanyId_Last(companyId, obc);
220 }
221
222 public static com.liferay.portlet.messageboards.model.MBCategory[] findByCompanyId_PrevAndNext(
223 long categoryId, long companyId,
224 com.liferay.portal.kernel.util.OrderByComparator obc)
225 throws com.liferay.portal.SystemException,
226 com.liferay.portlet.messageboards.NoSuchCategoryException {
227 return getPersistence().findByCompanyId_PrevAndNext(categoryId,
228 companyId, obc);
229 }
230
231 public static java.util.List findByG_P(long groupId, long parentCategoryId)
232 throws com.liferay.portal.SystemException {
233 return getPersistence().findByG_P(groupId, parentCategoryId);
234 }
235
236 public static java.util.List findByG_P(long groupId, long parentCategoryId,
237 int begin, int end) throws com.liferay.portal.SystemException {
238 return getPersistence().findByG_P(groupId, parentCategoryId, begin, end);
239 }
240
241 public static java.util.List findByG_P(long groupId, long parentCategoryId,
242 int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
243 throws com.liferay.portal.SystemException {
244 return getPersistence().findByG_P(groupId, parentCategoryId, begin,
245 end, obc);
246 }
247
248 public static com.liferay.portlet.messageboards.model.MBCategory findByG_P_First(
249 long groupId, long parentCategoryId,
250 com.liferay.portal.kernel.util.OrderByComparator obc)
251 throws com.liferay.portal.SystemException,
252 com.liferay.portlet.messageboards.NoSuchCategoryException {
253 return getPersistence().findByG_P_First(groupId, parentCategoryId, obc);
254 }
255
256 public static com.liferay.portlet.messageboards.model.MBCategory findByG_P_Last(
257 long groupId, long parentCategoryId,
258 com.liferay.portal.kernel.util.OrderByComparator obc)
259 throws com.liferay.portal.SystemException,
260 com.liferay.portlet.messageboards.NoSuchCategoryException {
261 return getPersistence().findByG_P_Last(groupId, parentCategoryId, obc);
262 }
263
264 public static com.liferay.portlet.messageboards.model.MBCategory[] findByG_P_PrevAndNext(
265 long categoryId, long groupId, long parentCategoryId,
266 com.liferay.portal.kernel.util.OrderByComparator obc)
267 throws com.liferay.portal.SystemException,
268 com.liferay.portlet.messageboards.NoSuchCategoryException {
269 return getPersistence().findByG_P_PrevAndNext(categoryId, groupId,
270 parentCategoryId, obc);
271 }
272
273 public static java.util.List findWithDynamicQuery(
274 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
275 throws com.liferay.portal.SystemException {
276 return getPersistence().findWithDynamicQuery(queryInitializer);
277 }
278
279 public static java.util.List findWithDynamicQuery(
280 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
281 int begin, int end) throws com.liferay.portal.SystemException {
282 return getPersistence().findWithDynamicQuery(queryInitializer, begin,
283 end);
284 }
285
286 public static java.util.List findAll()
287 throws com.liferay.portal.SystemException {
288 return getPersistence().findAll();
289 }
290
291 public static java.util.List findAll(int begin, int end)
292 throws com.liferay.portal.SystemException {
293 return getPersistence().findAll(begin, end);
294 }
295
296 public static java.util.List findAll(int begin, int end,
297 com.liferay.portal.kernel.util.OrderByComparator obc)
298 throws com.liferay.portal.SystemException {
299 return getPersistence().findAll(begin, end, obc);
300 }
301
302 public static void removeByGroupId(long groupId)
303 throws com.liferay.portal.SystemException {
304 getPersistence().removeByGroupId(groupId);
305 }
306
307 public static void removeByCompanyId(long companyId)
308 throws com.liferay.portal.SystemException {
309 getPersistence().removeByCompanyId(companyId);
310 }
311
312 public static void removeByG_P(long groupId, long parentCategoryId)
313 throws com.liferay.portal.SystemException {
314 getPersistence().removeByG_P(groupId, parentCategoryId);
315 }
316
317 public static void removeAll() throws com.liferay.portal.SystemException {
318 getPersistence().removeAll();
319 }
320
321 public static int countByGroupId(long groupId)
322 throws com.liferay.portal.SystemException {
323 return getPersistence().countByGroupId(groupId);
324 }
325
326 public static int countByCompanyId(long companyId)
327 throws com.liferay.portal.SystemException {
328 return getPersistence().countByCompanyId(companyId);
329 }
330
331 public static int countByG_P(long groupId, long parentCategoryId)
332 throws com.liferay.portal.SystemException {
333 return getPersistence().countByG_P(groupId, parentCategoryId);
334 }
335
336 public static int countAll() throws com.liferay.portal.SystemException {
337 return getPersistence().countAll();
338 }
339
340 public static MBCategoryPersistence getPersistence() {
341 return _getUtil()._persistence;
342 }
343
344 public void setPersistence(MBCategoryPersistence persistence) {
345 _persistence = persistence;
346 }
347
348 private static MBCategoryUtil _getUtil() {
349 if (_util == null) {
350 _util = (MBCategoryUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
351 }
352
353 return _util;
354 }
355
356 private static ModelListener _getListener() {
357 if (Validator.isNotNull(_LISTENER)) {
358 try {
359 return (ModelListener)Class.forName(_LISTENER).newInstance();
360 }
361 catch (Exception e) {
362 _log.error(e);
363 }
364 }
365
366 return null;
367 }
368
369 private static final String _UTIL = MBCategoryUtil.class.getName();
370 private static final String _LISTENER = GetterUtil.getString(PropsUtil.get(
371 "value.object.listener.com.liferay.portlet.messageboards.model.MBCategory"));
372 private static Log _log = LogFactory.getLog(MBCategoryUtil.class);
373 private static MBCategoryUtil _util;
374 private MBCategoryPersistence _persistence;
375 }