1
22
23 package com.liferay.portlet.journal.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 JournalArticleUtil {
40 public static com.liferay.portlet.journal.model.JournalArticle create(
41 long id) {
42 return getPersistence().create(id);
43 }
44
45 public static com.liferay.portlet.journal.model.JournalArticle remove(
46 long id)
47 throws com.liferay.portal.SystemException,
48 com.liferay.portlet.journal.NoSuchArticleException {
49 ModelListener listener = _getListener();
50
51 if (listener != null) {
52 listener.onBeforeRemove(findByPrimaryKey(id));
53 }
54
55 com.liferay.portlet.journal.model.JournalArticle journalArticle = getPersistence()
56 .remove(id);
57
58 if (listener != null) {
59 listener.onAfterRemove(journalArticle);
60 }
61
62 return journalArticle;
63 }
64
65 public static com.liferay.portlet.journal.model.JournalArticle remove(
66 com.liferay.portlet.journal.model.JournalArticle journalArticle)
67 throws com.liferay.portal.SystemException {
68 ModelListener listener = _getListener();
69
70 if (listener != null) {
71 listener.onBeforeRemove(journalArticle);
72 }
73
74 journalArticle = getPersistence().remove(journalArticle);
75
76 if (listener != null) {
77 listener.onAfterRemove(journalArticle);
78 }
79
80 return journalArticle;
81 }
82
83 public static com.liferay.portlet.journal.model.JournalArticle update(
84 com.liferay.portlet.journal.model.JournalArticle journalArticle)
85 throws com.liferay.portal.SystemException {
86 ModelListener listener = _getListener();
87 boolean isNew = journalArticle.isNew();
88
89 if (listener != null) {
90 if (isNew) {
91 listener.onBeforeCreate(journalArticle);
92 }
93 else {
94 listener.onBeforeUpdate(journalArticle);
95 }
96 }
97
98 journalArticle = getPersistence().update(journalArticle);
99
100 if (listener != null) {
101 if (isNew) {
102 listener.onAfterCreate(journalArticle);
103 }
104 else {
105 listener.onAfterUpdate(journalArticle);
106 }
107 }
108
109 return journalArticle;
110 }
111
112 public static com.liferay.portlet.journal.model.JournalArticle update(
113 com.liferay.portlet.journal.model.JournalArticle journalArticle,
114 boolean merge) throws com.liferay.portal.SystemException {
115 ModelListener listener = _getListener();
116 boolean isNew = journalArticle.isNew();
117
118 if (listener != null) {
119 if (isNew) {
120 listener.onBeforeCreate(journalArticle);
121 }
122 else {
123 listener.onBeforeUpdate(journalArticle);
124 }
125 }
126
127 journalArticle = getPersistence().update(journalArticle, merge);
128
129 if (listener != null) {
130 if (isNew) {
131 listener.onAfterCreate(journalArticle);
132 }
133 else {
134 listener.onAfterUpdate(journalArticle);
135 }
136 }
137
138 return journalArticle;
139 }
140
141 public static com.liferay.portlet.journal.model.JournalArticle findByPrimaryKey(
142 long id)
143 throws com.liferay.portal.SystemException,
144 com.liferay.portlet.journal.NoSuchArticleException {
145 return getPersistence().findByPrimaryKey(id);
146 }
147
148 public static com.liferay.portlet.journal.model.JournalArticle fetchByPrimaryKey(
149 long id) throws com.liferay.portal.SystemException {
150 return getPersistence().fetchByPrimaryKey(id);
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.journal.model.JournalArticle findByGroupId_First(
170 long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
171 throws com.liferay.portal.SystemException,
172 com.liferay.portlet.journal.NoSuchArticleException {
173 return getPersistence().findByGroupId_First(groupId, obc);
174 }
175
176 public static com.liferay.portlet.journal.model.JournalArticle findByGroupId_Last(
177 long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
178 throws com.liferay.portal.SystemException,
179 com.liferay.portlet.journal.NoSuchArticleException {
180 return getPersistence().findByGroupId_Last(groupId, obc);
181 }
182
183 public static com.liferay.portlet.journal.model.JournalArticle[] findByGroupId_PrevAndNext(
184 long id, long groupId,
185 com.liferay.portal.kernel.util.OrderByComparator obc)
186 throws com.liferay.portal.SystemException,
187 com.liferay.portlet.journal.NoSuchArticleException {
188 return getPersistence().findByGroupId_PrevAndNext(id, groupId, obc);
189 }
190
191 public static java.util.List findByCompanyId(long companyId)
192 throws com.liferay.portal.SystemException {
193 return getPersistence().findByCompanyId(companyId);
194 }
195
196 public static java.util.List findByCompanyId(long companyId, int begin,
197 int end) throws com.liferay.portal.SystemException {
198 return getPersistence().findByCompanyId(companyId, begin, end);
199 }
200
201 public static java.util.List findByCompanyId(long companyId, int begin,
202 int end, com.liferay.portal.kernel.util.OrderByComparator obc)
203 throws com.liferay.portal.SystemException {
204 return getPersistence().findByCompanyId(companyId, begin, end, obc);
205 }
206
207 public static com.liferay.portlet.journal.model.JournalArticle findByCompanyId_First(
208 long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
209 throws com.liferay.portal.SystemException,
210 com.liferay.portlet.journal.NoSuchArticleException {
211 return getPersistence().findByCompanyId_First(companyId, obc);
212 }
213
214 public static com.liferay.portlet.journal.model.JournalArticle findByCompanyId_Last(
215 long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
216 throws com.liferay.portal.SystemException,
217 com.liferay.portlet.journal.NoSuchArticleException {
218 return getPersistence().findByCompanyId_Last(companyId, obc);
219 }
220
221 public static com.liferay.portlet.journal.model.JournalArticle[] findByCompanyId_PrevAndNext(
222 long id, long companyId,
223 com.liferay.portal.kernel.util.OrderByComparator obc)
224 throws com.liferay.portal.SystemException,
225 com.liferay.portlet.journal.NoSuchArticleException {
226 return getPersistence().findByCompanyId_PrevAndNext(id, companyId, obc);
227 }
228
229 public static java.util.List findByG_A(long groupId,
230 java.lang.String articleId) throws com.liferay.portal.SystemException {
231 return getPersistence().findByG_A(groupId, articleId);
232 }
233
234 public static java.util.List findByG_A(long groupId,
235 java.lang.String articleId, int begin, int end)
236 throws com.liferay.portal.SystemException {
237 return getPersistence().findByG_A(groupId, articleId, begin, end);
238 }
239
240 public static java.util.List findByG_A(long groupId,
241 java.lang.String articleId, int begin, int end,
242 com.liferay.portal.kernel.util.OrderByComparator obc)
243 throws com.liferay.portal.SystemException {
244 return getPersistence().findByG_A(groupId, articleId, begin, end, obc);
245 }
246
247 public static com.liferay.portlet.journal.model.JournalArticle findByG_A_First(
248 long groupId, java.lang.String articleId,
249 com.liferay.portal.kernel.util.OrderByComparator obc)
250 throws com.liferay.portal.SystemException,
251 com.liferay.portlet.journal.NoSuchArticleException {
252 return getPersistence().findByG_A_First(groupId, articleId, obc);
253 }
254
255 public static com.liferay.portlet.journal.model.JournalArticle findByG_A_Last(
256 long groupId, java.lang.String articleId,
257 com.liferay.portal.kernel.util.OrderByComparator obc)
258 throws com.liferay.portal.SystemException,
259 com.liferay.portlet.journal.NoSuchArticleException {
260 return getPersistence().findByG_A_Last(groupId, articleId, obc);
261 }
262
263 public static com.liferay.portlet.journal.model.JournalArticle[] findByG_A_PrevAndNext(
264 long id, long groupId, java.lang.String articleId,
265 com.liferay.portal.kernel.util.OrderByComparator obc)
266 throws com.liferay.portal.SystemException,
267 com.liferay.portlet.journal.NoSuchArticleException {
268 return getPersistence().findByG_A_PrevAndNext(id, groupId, articleId,
269 obc);
270 }
271
272 public static java.util.List findByG_S(long groupId,
273 java.lang.String structureId) throws com.liferay.portal.SystemException {
274 return getPersistence().findByG_S(groupId, structureId);
275 }
276
277 public static java.util.List findByG_S(long groupId,
278 java.lang.String structureId, int begin, int end)
279 throws com.liferay.portal.SystemException {
280 return getPersistence().findByG_S(groupId, structureId, begin, end);
281 }
282
283 public static java.util.List findByG_S(long groupId,
284 java.lang.String structureId, int begin, int end,
285 com.liferay.portal.kernel.util.OrderByComparator obc)
286 throws com.liferay.portal.SystemException {
287 return getPersistence().findByG_S(groupId, structureId, begin, end, obc);
288 }
289
290 public static com.liferay.portlet.journal.model.JournalArticle findByG_S_First(
291 long groupId, java.lang.String structureId,
292 com.liferay.portal.kernel.util.OrderByComparator obc)
293 throws com.liferay.portal.SystemException,
294 com.liferay.portlet.journal.NoSuchArticleException {
295 return getPersistence().findByG_S_First(groupId, structureId, obc);
296 }
297
298 public static com.liferay.portlet.journal.model.JournalArticle findByG_S_Last(
299 long groupId, java.lang.String structureId,
300 com.liferay.portal.kernel.util.OrderByComparator obc)
301 throws com.liferay.portal.SystemException,
302 com.liferay.portlet.journal.NoSuchArticleException {
303 return getPersistence().findByG_S_Last(groupId, structureId, obc);
304 }
305
306 public static com.liferay.portlet.journal.model.JournalArticle[] findByG_S_PrevAndNext(
307 long id, long groupId, java.lang.String structureId,
308 com.liferay.portal.kernel.util.OrderByComparator obc)
309 throws com.liferay.portal.SystemException,
310 com.liferay.portlet.journal.NoSuchArticleException {
311 return getPersistence().findByG_S_PrevAndNext(id, groupId, structureId,
312 obc);
313 }
314
315 public static java.util.List findByG_T(long groupId,
316 java.lang.String templateId) throws com.liferay.portal.SystemException {
317 return getPersistence().findByG_T(groupId, templateId);
318 }
319
320 public static java.util.List findByG_T(long groupId,
321 java.lang.String templateId, int begin, int end)
322 throws com.liferay.portal.SystemException {
323 return getPersistence().findByG_T(groupId, templateId, begin, end);
324 }
325
326 public static java.util.List findByG_T(long groupId,
327 java.lang.String templateId, int begin, int end,
328 com.liferay.portal.kernel.util.OrderByComparator obc)
329 throws com.liferay.portal.SystemException {
330 return getPersistence().findByG_T(groupId, templateId, begin, end, obc);
331 }
332
333 public static com.liferay.portlet.journal.model.JournalArticle findByG_T_First(
334 long groupId, java.lang.String templateId,
335 com.liferay.portal.kernel.util.OrderByComparator obc)
336 throws com.liferay.portal.SystemException,
337 com.liferay.portlet.journal.NoSuchArticleException {
338 return getPersistence().findByG_T_First(groupId, templateId, obc);
339 }
340
341 public static com.liferay.portlet.journal.model.JournalArticle findByG_T_Last(
342 long groupId, java.lang.String templateId,
343 com.liferay.portal.kernel.util.OrderByComparator obc)
344 throws com.liferay.portal.SystemException,
345 com.liferay.portlet.journal.NoSuchArticleException {
346 return getPersistence().findByG_T_Last(groupId, templateId, obc);
347 }
348
349 public static com.liferay.portlet.journal.model.JournalArticle[] findByG_T_PrevAndNext(
350 long id, long groupId, java.lang.String templateId,
351 com.liferay.portal.kernel.util.OrderByComparator obc)
352 throws com.liferay.portal.SystemException,
353 com.liferay.portlet.journal.NoSuchArticleException {
354 return getPersistence().findByG_T_PrevAndNext(id, groupId, templateId,
355 obc);
356 }
357
358 public static com.liferay.portlet.journal.model.JournalArticle findByG_A_V(
359 long groupId, java.lang.String articleId, double version)
360 throws com.liferay.portal.SystemException,
361 com.liferay.portlet.journal.NoSuchArticleException {
362 return getPersistence().findByG_A_V(groupId, articleId, version);
363 }
364
365 public static com.liferay.portlet.journal.model.JournalArticle fetchByG_A_V(
366 long groupId, java.lang.String articleId, double version)
367 throws com.liferay.portal.SystemException {
368 return getPersistence().fetchByG_A_V(groupId, articleId, version);
369 }
370
371 public static java.util.List findByG_A_A(long groupId,
372 java.lang.String articleId, boolean approved)
373 throws com.liferay.portal.SystemException {
374 return getPersistence().findByG_A_A(groupId, articleId, approved);
375 }
376
377 public static java.util.List findByG_A_A(long groupId,
378 java.lang.String articleId, boolean approved, int begin, int end)
379 throws com.liferay.portal.SystemException {
380 return getPersistence().findByG_A_A(groupId, articleId, approved,
381 begin, end);
382 }
383
384 public static java.util.List findByG_A_A(long groupId,
385 java.lang.String articleId, boolean approved, int begin, int end,
386 com.liferay.portal.kernel.util.OrderByComparator obc)
387 throws com.liferay.portal.SystemException {
388 return getPersistence().findByG_A_A(groupId, articleId, approved,
389 begin, end, obc);
390 }
391
392 public static com.liferay.portlet.journal.model.JournalArticle findByG_A_A_First(
393 long groupId, java.lang.String articleId, boolean approved,
394 com.liferay.portal.kernel.util.OrderByComparator obc)
395 throws com.liferay.portal.SystemException,
396 com.liferay.portlet.journal.NoSuchArticleException {
397 return getPersistence().findByG_A_A_First(groupId, articleId, approved,
398 obc);
399 }
400
401 public static com.liferay.portlet.journal.model.JournalArticle findByG_A_A_Last(
402 long groupId, java.lang.String articleId, boolean approved,
403 com.liferay.portal.kernel.util.OrderByComparator obc)
404 throws com.liferay.portal.SystemException,
405 com.liferay.portlet.journal.NoSuchArticleException {
406 return getPersistence().findByG_A_A_Last(groupId, articleId, approved,
407 obc);
408 }
409
410 public static com.liferay.portlet.journal.model.JournalArticle[] findByG_A_A_PrevAndNext(
411 long id, long groupId, java.lang.String articleId, boolean approved,
412 com.liferay.portal.kernel.util.OrderByComparator obc)
413 throws com.liferay.portal.SystemException,
414 com.liferay.portlet.journal.NoSuchArticleException {
415 return getPersistence().findByG_A_A_PrevAndNext(id, groupId, articleId,
416 approved, obc);
417 }
418
419 public static java.util.List findWithDynamicQuery(
420 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
421 throws com.liferay.portal.SystemException {
422 return getPersistence().findWithDynamicQuery(queryInitializer);
423 }
424
425 public static java.util.List findWithDynamicQuery(
426 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
427 int begin, int end) throws com.liferay.portal.SystemException {
428 return getPersistence().findWithDynamicQuery(queryInitializer, begin,
429 end);
430 }
431
432 public static java.util.List findAll()
433 throws com.liferay.portal.SystemException {
434 return getPersistence().findAll();
435 }
436
437 public static java.util.List findAll(int begin, int end)
438 throws com.liferay.portal.SystemException {
439 return getPersistence().findAll(begin, end);
440 }
441
442 public static java.util.List findAll(int begin, int end,
443 com.liferay.portal.kernel.util.OrderByComparator obc)
444 throws com.liferay.portal.SystemException {
445 return getPersistence().findAll(begin, end, obc);
446 }
447
448 public static void removeByGroupId(long groupId)
449 throws com.liferay.portal.SystemException {
450 getPersistence().removeByGroupId(groupId);
451 }
452
453 public static void removeByCompanyId(long companyId)
454 throws com.liferay.portal.SystemException {
455 getPersistence().removeByCompanyId(companyId);
456 }
457
458 public static void removeByG_A(long groupId, java.lang.String articleId)
459 throws com.liferay.portal.SystemException {
460 getPersistence().removeByG_A(groupId, articleId);
461 }
462
463 public static void removeByG_S(long groupId, java.lang.String structureId)
464 throws com.liferay.portal.SystemException {
465 getPersistence().removeByG_S(groupId, structureId);
466 }
467
468 public static void removeByG_T(long groupId, java.lang.String templateId)
469 throws com.liferay.portal.SystemException {
470 getPersistence().removeByG_T(groupId, templateId);
471 }
472
473 public static void removeByG_A_V(long groupId, java.lang.String articleId,
474 double version)
475 throws com.liferay.portal.SystemException,
476 com.liferay.portlet.journal.NoSuchArticleException {
477 getPersistence().removeByG_A_V(groupId, articleId, version);
478 }
479
480 public static void removeByG_A_A(long groupId, java.lang.String articleId,
481 boolean approved) throws com.liferay.portal.SystemException {
482 getPersistence().removeByG_A_A(groupId, articleId, approved);
483 }
484
485 public static void removeAll() throws com.liferay.portal.SystemException {
486 getPersistence().removeAll();
487 }
488
489 public static int countByGroupId(long groupId)
490 throws com.liferay.portal.SystemException {
491 return getPersistence().countByGroupId(groupId);
492 }
493
494 public static int countByCompanyId(long companyId)
495 throws com.liferay.portal.SystemException {
496 return getPersistence().countByCompanyId(companyId);
497 }
498
499 public static int countByG_A(long groupId, java.lang.String articleId)
500 throws com.liferay.portal.SystemException {
501 return getPersistence().countByG_A(groupId, articleId);
502 }
503
504 public static int countByG_S(long groupId, java.lang.String structureId)
505 throws com.liferay.portal.SystemException {
506 return getPersistence().countByG_S(groupId, structureId);
507 }
508
509 public static int countByG_T(long groupId, java.lang.String templateId)
510 throws com.liferay.portal.SystemException {
511 return getPersistence().countByG_T(groupId, templateId);
512 }
513
514 public static int countByG_A_V(long groupId, java.lang.String articleId,
515 double version) throws com.liferay.portal.SystemException {
516 return getPersistence().countByG_A_V(groupId, articleId, version);
517 }
518
519 public static int countByG_A_A(long groupId, java.lang.String articleId,
520 boolean approved) throws com.liferay.portal.SystemException {
521 return getPersistence().countByG_A_A(groupId, articleId, approved);
522 }
523
524 public static int countAll() throws com.liferay.portal.SystemException {
525 return getPersistence().countAll();
526 }
527
528 public static JournalArticlePersistence getPersistence() {
529 return _getUtil()._persistence;
530 }
531
532 public void setPersistence(JournalArticlePersistence persistence) {
533 _persistence = persistence;
534 }
535
536 private static JournalArticleUtil _getUtil() {
537 if (_util == null) {
538 _util = (JournalArticleUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
539 }
540
541 return _util;
542 }
543
544 private static ModelListener _getListener() {
545 if (Validator.isNotNull(_LISTENER)) {
546 try {
547 return (ModelListener)Class.forName(_LISTENER).newInstance();
548 }
549 catch (Exception e) {
550 _log.error(e);
551 }
552 }
553
554 return null;
555 }
556
557 private static final String _UTIL = JournalArticleUtil.class.getName();
558 private static final String _LISTENER = GetterUtil.getString(PropsUtil.get(
559 "value.object.listener.com.liferay.portlet.journal.model.JournalArticle"));
560 private static Log _log = LogFactory.getLog(JournalArticleUtil.class);
561 private static JournalArticleUtil _util;
562 private JournalArticlePersistence _persistence;
563 }