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