1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.journal.service.persistence;
16  
17  import com.liferay.portal.NoSuchModelException;
18  import com.liferay.portal.kernel.annotation.BeanReference;
19  import com.liferay.portal.kernel.cache.CacheRegistry;
20  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
21  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
22  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
23  import com.liferay.portal.kernel.dao.orm.FinderPath;
24  import com.liferay.portal.kernel.dao.orm.Query;
25  import com.liferay.portal.kernel.dao.orm.QueryPos;
26  import com.liferay.portal.kernel.dao.orm.QueryUtil;
27  import com.liferay.portal.kernel.dao.orm.Session;
28  import com.liferay.portal.kernel.exception.SystemException;
29  import com.liferay.portal.kernel.log.Log;
30  import com.liferay.portal.kernel.log.LogFactoryUtil;
31  import com.liferay.portal.kernel.util.GetterUtil;
32  import com.liferay.portal.kernel.util.OrderByComparator;
33  import com.liferay.portal.kernel.util.StringBundler;
34  import com.liferay.portal.kernel.util.StringPool;
35  import com.liferay.portal.kernel.util.StringUtil;
36  import com.liferay.portal.kernel.util.Validator;
37  import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
38  import com.liferay.portal.model.ModelListener;
39  import com.liferay.portal.service.persistence.BatchSessionUtil;
40  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
41  
42  import com.liferay.portlet.journal.NoSuchArticleException;
43  import com.liferay.portlet.journal.model.JournalArticle;
44  import com.liferay.portlet.journal.model.impl.JournalArticleImpl;
45  import com.liferay.portlet.journal.model.impl.JournalArticleModelImpl;
46  
47  import java.io.Serializable;
48  
49  import java.util.ArrayList;
50  import java.util.Collections;
51  import java.util.List;
52  
53  /**
54   * <a href="JournalArticlePersistenceImpl.java.html"><b><i>View Source</i></b></a>
55   *
56   * <p>
57   * ServiceBuilder generated this class. Modifications in this class will be
58   * overwritten the next time is generated.
59   * </p>
60   *
61   * @author    Brian Wing Shun Chan
62   * @see       JournalArticlePersistence
63   * @see       JournalArticleUtil
64   * @generated
65   */
66  public class JournalArticlePersistenceImpl extends BasePersistenceImpl<JournalArticle>
67      implements JournalArticlePersistence {
68      public static final String FINDER_CLASS_NAME_ENTITY = JournalArticleImpl.class.getName();
69      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
70          ".List";
71      public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
72              JournalArticleModelImpl.FINDER_CACHE_ENABLED,
73              FINDER_CLASS_NAME_LIST, "findByUuid",
74              new String[] { String.class.getName() });
75      public static final FinderPath FINDER_PATH_FIND_BY_OBC_UUID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
76              JournalArticleModelImpl.FINDER_CACHE_ENABLED,
77              FINDER_CLASS_NAME_LIST, "findByUuid",
78              new String[] {
79                  String.class.getName(),
80                  
81              "java.lang.Integer", "java.lang.Integer",
82                  "com.liferay.portal.kernel.util.OrderByComparator"
83              });
84      public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
85              JournalArticleModelImpl.FINDER_CACHE_ENABLED,
86              FINDER_CLASS_NAME_LIST, "countByUuid",
87              new String[] { String.class.getName() });
88      public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
89              JournalArticleModelImpl.FINDER_CACHE_ENABLED,
90              FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
91              new String[] { String.class.getName(), Long.class.getName() });
92      public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
93              JournalArticleModelImpl.FINDER_CACHE_ENABLED,
94              FINDER_CLASS_NAME_LIST, "countByUUID_G",
95              new String[] { String.class.getName(), Long.class.getName() });
96      public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
97              JournalArticleModelImpl.FINDER_CACHE_ENABLED,
98              FINDER_CLASS_NAME_LIST, "findByGroupId",
99              new String[] { Long.class.getName() });
100     public static final FinderPath FINDER_PATH_FIND_BY_OBC_GROUPID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
101             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
102             FINDER_CLASS_NAME_LIST, "findByGroupId",
103             new String[] {
104                 Long.class.getName(),
105                 
106             "java.lang.Integer", "java.lang.Integer",
107                 "com.liferay.portal.kernel.util.OrderByComparator"
108             });
109     public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
110             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
111             FINDER_CLASS_NAME_LIST, "countByGroupId",
112             new String[] { Long.class.getName() });
113     public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
114             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
115             FINDER_CLASS_NAME_LIST, "findByCompanyId",
116             new String[] { Long.class.getName() });
117     public static final FinderPath FINDER_PATH_FIND_BY_OBC_COMPANYID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
118             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
119             FINDER_CLASS_NAME_LIST, "findByCompanyId",
120             new String[] {
121                 Long.class.getName(),
122                 
123             "java.lang.Integer", "java.lang.Integer",
124                 "com.liferay.portal.kernel.util.OrderByComparator"
125             });
126     public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
127             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
128             FINDER_CLASS_NAME_LIST, "countByCompanyId",
129             new String[] { Long.class.getName() });
130     public static final FinderPath FINDER_PATH_FIND_BY_SMALLIMAGEID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
131             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
132             FINDER_CLASS_NAME_LIST, "findBySmallImageId",
133             new String[] { Long.class.getName() });
134     public static final FinderPath FINDER_PATH_FIND_BY_OBC_SMALLIMAGEID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
135             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
136             FINDER_CLASS_NAME_LIST, "findBySmallImageId",
137             new String[] {
138                 Long.class.getName(),
139                 
140             "java.lang.Integer", "java.lang.Integer",
141                 "com.liferay.portal.kernel.util.OrderByComparator"
142             });
143     public static final FinderPath FINDER_PATH_COUNT_BY_SMALLIMAGEID = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
144             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
145             FINDER_CLASS_NAME_LIST, "countBySmallImageId",
146             new String[] { Long.class.getName() });
147     public static final FinderPath FINDER_PATH_FIND_BY_R_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
148             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
149             FINDER_CLASS_NAME_LIST, "findByR_S",
150             new String[] { Long.class.getName(), Integer.class.getName() });
151     public static final FinderPath FINDER_PATH_FIND_BY_OBC_R_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
152             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
153             FINDER_CLASS_NAME_LIST, "findByR_S",
154             new String[] {
155                 Long.class.getName(), Integer.class.getName(),
156                 
157             "java.lang.Integer", "java.lang.Integer",
158                 "com.liferay.portal.kernel.util.OrderByComparator"
159             });
160     public static final FinderPath FINDER_PATH_COUNT_BY_R_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
161             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
162             FINDER_CLASS_NAME_LIST, "countByR_S",
163             new String[] { Long.class.getName(), Integer.class.getName() });
164     public static final FinderPath FINDER_PATH_FIND_BY_G_A = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
165             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
166             FINDER_CLASS_NAME_LIST, "findByG_A",
167             new String[] { Long.class.getName(), String.class.getName() });
168     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_A = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
169             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
170             FINDER_CLASS_NAME_LIST, "findByG_A",
171             new String[] {
172                 Long.class.getName(), String.class.getName(),
173                 
174             "java.lang.Integer", "java.lang.Integer",
175                 "com.liferay.portal.kernel.util.OrderByComparator"
176             });
177     public static final FinderPath FINDER_PATH_COUNT_BY_G_A = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
178             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
179             FINDER_CLASS_NAME_LIST, "countByG_A",
180             new String[] { Long.class.getName(), String.class.getName() });
181     public static final FinderPath FINDER_PATH_FIND_BY_G_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
182             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
183             FINDER_CLASS_NAME_LIST, "findByG_S",
184             new String[] { Long.class.getName(), String.class.getName() });
185     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
186             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
187             FINDER_CLASS_NAME_LIST, "findByG_S",
188             new String[] {
189                 Long.class.getName(), String.class.getName(),
190                 
191             "java.lang.Integer", "java.lang.Integer",
192                 "com.liferay.portal.kernel.util.OrderByComparator"
193             });
194     public static final FinderPath FINDER_PATH_COUNT_BY_G_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
195             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
196             FINDER_CLASS_NAME_LIST, "countByG_S",
197             new String[] { Long.class.getName(), String.class.getName() });
198     public static final FinderPath FINDER_PATH_FIND_BY_G_T = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
199             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
200             FINDER_CLASS_NAME_LIST, "findByG_T",
201             new String[] { Long.class.getName(), String.class.getName() });
202     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_T = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
203             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
204             FINDER_CLASS_NAME_LIST, "findByG_T",
205             new String[] {
206                 Long.class.getName(), String.class.getName(),
207                 
208             "java.lang.Integer", "java.lang.Integer",
209                 "com.liferay.portal.kernel.util.OrderByComparator"
210             });
211     public static final FinderPath FINDER_PATH_COUNT_BY_G_T = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
212             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
213             FINDER_CLASS_NAME_LIST, "countByG_T",
214             new String[] { Long.class.getName(), String.class.getName() });
215     public static final FinderPath FINDER_PATH_FIND_BY_G_UT = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
216             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
217             FINDER_CLASS_NAME_LIST, "findByG_UT",
218             new String[] { Long.class.getName(), String.class.getName() });
219     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_UT = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
220             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
221             FINDER_CLASS_NAME_LIST, "findByG_UT",
222             new String[] {
223                 Long.class.getName(), String.class.getName(),
224                 
225             "java.lang.Integer", "java.lang.Integer",
226                 "com.liferay.portal.kernel.util.OrderByComparator"
227             });
228     public static final FinderPath FINDER_PATH_COUNT_BY_G_UT = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
229             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
230             FINDER_CLASS_NAME_LIST, "countByG_UT",
231             new String[] { Long.class.getName(), String.class.getName() });
232     public static final FinderPath FINDER_PATH_FIND_BY_C_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
233             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
234             FINDER_CLASS_NAME_LIST, "findByC_S",
235             new String[] { Long.class.getName(), Integer.class.getName() });
236     public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
237             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
238             FINDER_CLASS_NAME_LIST, "findByC_S",
239             new String[] {
240                 Long.class.getName(), Integer.class.getName(),
241                 
242             "java.lang.Integer", "java.lang.Integer",
243                 "com.liferay.portal.kernel.util.OrderByComparator"
244             });
245     public static final FinderPath FINDER_PATH_COUNT_BY_C_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
246             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
247             FINDER_CLASS_NAME_LIST, "countByC_S",
248             new String[] { Long.class.getName(), Integer.class.getName() });
249     public static final FinderPath FINDER_PATH_FETCH_BY_G_A_V = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
250             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
251             FINDER_CLASS_NAME_ENTITY, "fetchByG_A_V",
252             new String[] {
253                 Long.class.getName(), String.class.getName(),
254                 Double.class.getName()
255             });
256     public static final FinderPath FINDER_PATH_COUNT_BY_G_A_V = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
257             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
258             FINDER_CLASS_NAME_LIST, "countByG_A_V",
259             new String[] {
260                 Long.class.getName(), String.class.getName(),
261                 Double.class.getName()
262             });
263     public static final FinderPath FINDER_PATH_FIND_BY_G_A_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
264             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
265             FINDER_CLASS_NAME_LIST, "findByG_A_S",
266             new String[] {
267                 Long.class.getName(), String.class.getName(),
268                 Integer.class.getName()
269             });
270     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_A_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
271             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
272             FINDER_CLASS_NAME_LIST, "findByG_A_S",
273             new String[] {
274                 Long.class.getName(), String.class.getName(),
275                 Integer.class.getName(),
276                 
277             "java.lang.Integer", "java.lang.Integer",
278                 "com.liferay.portal.kernel.util.OrderByComparator"
279             });
280     public static final FinderPath FINDER_PATH_COUNT_BY_G_A_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
281             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
282             FINDER_CLASS_NAME_LIST, "countByG_A_S",
283             new String[] {
284                 Long.class.getName(), String.class.getName(),
285                 Integer.class.getName()
286             });
287     public static final FinderPath FINDER_PATH_FIND_BY_G_UT_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
288             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
289             FINDER_CLASS_NAME_LIST, "findByG_UT_S",
290             new String[] {
291                 Long.class.getName(), String.class.getName(),
292                 Integer.class.getName()
293             });
294     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_UT_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
295             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
296             FINDER_CLASS_NAME_LIST, "findByG_UT_S",
297             new String[] {
298                 Long.class.getName(), String.class.getName(),
299                 Integer.class.getName(),
300                 
301             "java.lang.Integer", "java.lang.Integer",
302                 "com.liferay.portal.kernel.util.OrderByComparator"
303             });
304     public static final FinderPath FINDER_PATH_COUNT_BY_G_UT_S = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
305             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
306             FINDER_CLASS_NAME_LIST, "countByG_UT_S",
307             new String[] {
308                 Long.class.getName(), String.class.getName(),
309                 Integer.class.getName()
310             });
311     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
312             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
313             FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
314     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
315             JournalArticleModelImpl.FINDER_CACHE_ENABLED,
316             FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
317 
318     public void cacheResult(JournalArticle journalArticle) {
319         EntityCacheUtil.putResult(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
320             JournalArticleImpl.class, journalArticle.getPrimaryKey(),
321             journalArticle);
322 
323         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
324             new Object[] {
325                 journalArticle.getUuid(), new Long(journalArticle.getGroupId())
326             }, journalArticle);
327 
328         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_V,
329             new Object[] {
330                 new Long(journalArticle.getGroupId()),
331                 
332             journalArticle.getArticleId(),
333                 new Double(journalArticle.getVersion())
334             }, journalArticle);
335     }
336 
337     public void cacheResult(List<JournalArticle> journalArticles) {
338         for (JournalArticle journalArticle : journalArticles) {
339             if (EntityCacheUtil.getResult(
340                         JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
341                         JournalArticleImpl.class,
342                         journalArticle.getPrimaryKey(), this) == null) {
343                 cacheResult(journalArticle);
344             }
345         }
346     }
347 
348     public void clearCache() {
349         CacheRegistry.clear(JournalArticleImpl.class.getName());
350         EntityCacheUtil.clearCache(JournalArticleImpl.class.getName());
351         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
352         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
353     }
354 
355     public JournalArticle create(long id) {
356         JournalArticle journalArticle = new JournalArticleImpl();
357 
358         journalArticle.setNew(true);
359         journalArticle.setPrimaryKey(id);
360 
361         String uuid = PortalUUIDUtil.generate();
362 
363         journalArticle.setUuid(uuid);
364 
365         return journalArticle;
366     }
367 
368     public JournalArticle remove(Serializable primaryKey)
369         throws NoSuchModelException, SystemException {
370         return remove(((Long)primaryKey).longValue());
371     }
372 
373     public JournalArticle remove(long id)
374         throws NoSuchArticleException, SystemException {
375         Session session = null;
376 
377         try {
378             session = openSession();
379 
380             JournalArticle journalArticle = (JournalArticle)session.get(JournalArticleImpl.class,
381                     new Long(id));
382 
383             if (journalArticle == null) {
384                 if (_log.isWarnEnabled()) {
385                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + id);
386                 }
387 
388                 throw new NoSuchArticleException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
389                     id);
390             }
391 
392             return remove(journalArticle);
393         }
394         catch (NoSuchArticleException nsee) {
395             throw nsee;
396         }
397         catch (Exception e) {
398             throw processException(e);
399         }
400         finally {
401             closeSession(session);
402         }
403     }
404 
405     public JournalArticle remove(JournalArticle journalArticle)
406         throws SystemException {
407         for (ModelListener<JournalArticle> listener : listeners) {
408             listener.onBeforeRemove(journalArticle);
409         }
410 
411         journalArticle = removeImpl(journalArticle);
412 
413         for (ModelListener<JournalArticle> listener : listeners) {
414             listener.onAfterRemove(journalArticle);
415         }
416 
417         return journalArticle;
418     }
419 
420     protected JournalArticle removeImpl(JournalArticle journalArticle)
421         throws SystemException {
422         journalArticle = toUnwrappedModel(journalArticle);
423 
424         Session session = null;
425 
426         try {
427             session = openSession();
428 
429             if (journalArticle.isCachedModel() || BatchSessionUtil.isEnabled()) {
430                 Object staleObject = session.get(JournalArticleImpl.class,
431                         journalArticle.getPrimaryKeyObj());
432 
433                 if (staleObject != null) {
434                     session.evict(staleObject);
435                 }
436             }
437 
438             session.delete(journalArticle);
439 
440             session.flush();
441         }
442         catch (Exception e) {
443             throw processException(e);
444         }
445         finally {
446             closeSession(session);
447         }
448 
449         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
450 
451         JournalArticleModelImpl journalArticleModelImpl = (JournalArticleModelImpl)journalArticle;
452 
453         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
454             new Object[] {
455                 journalArticleModelImpl.getOriginalUuid(),
456                 new Long(journalArticleModelImpl.getOriginalGroupId())
457             });
458 
459         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_A_V,
460             new Object[] {
461                 new Long(journalArticleModelImpl.getOriginalGroupId()),
462                 
463             journalArticleModelImpl.getOriginalArticleId(),
464                 new Double(journalArticleModelImpl.getOriginalVersion())
465             });
466 
467         EntityCacheUtil.removeResult(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
468             JournalArticleImpl.class, journalArticle.getPrimaryKey());
469 
470         return journalArticle;
471     }
472 
473     public JournalArticle updateImpl(
474         com.liferay.portlet.journal.model.JournalArticle journalArticle,
475         boolean merge) throws SystemException {
476         journalArticle = toUnwrappedModel(journalArticle);
477 
478         boolean isNew = journalArticle.isNew();
479 
480         JournalArticleModelImpl journalArticleModelImpl = (JournalArticleModelImpl)journalArticle;
481 
482         if (Validator.isNull(journalArticle.getUuid())) {
483             String uuid = PortalUUIDUtil.generate();
484 
485             journalArticle.setUuid(uuid);
486         }
487 
488         Session session = null;
489 
490         try {
491             session = openSession();
492 
493             BatchSessionUtil.update(session, journalArticle, merge);
494 
495             journalArticle.setNew(false);
496         }
497         catch (Exception e) {
498             throw processException(e);
499         }
500         finally {
501             closeSession(session);
502         }
503 
504         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
505 
506         EntityCacheUtil.putResult(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
507             JournalArticleImpl.class, journalArticle.getPrimaryKey(),
508             journalArticle);
509 
510         if (!isNew &&
511                 (!Validator.equals(journalArticle.getUuid(),
512                     journalArticleModelImpl.getOriginalUuid()) ||
513                 (journalArticle.getGroupId() != journalArticleModelImpl.getOriginalGroupId()))) {
514             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
515                 new Object[] {
516                     journalArticleModelImpl.getOriginalUuid(),
517                     new Long(journalArticleModelImpl.getOriginalGroupId())
518                 });
519         }
520 
521         if (isNew ||
522                 (!Validator.equals(journalArticle.getUuid(),
523                     journalArticleModelImpl.getOriginalUuid()) ||
524                 (journalArticle.getGroupId() != journalArticleModelImpl.getOriginalGroupId()))) {
525             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
526                 new Object[] {
527                     journalArticle.getUuid(),
528                     new Long(journalArticle.getGroupId())
529                 }, journalArticle);
530         }
531 
532         if (!isNew &&
533                 ((journalArticle.getGroupId() != journalArticleModelImpl.getOriginalGroupId()) ||
534                 !Validator.equals(journalArticle.getArticleId(),
535                     journalArticleModelImpl.getOriginalArticleId()) ||
536                 (journalArticle.getVersion() != journalArticleModelImpl.getOriginalVersion()))) {
537             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_A_V,
538                 new Object[] {
539                     new Long(journalArticleModelImpl.getOriginalGroupId()),
540                     
541                 journalArticleModelImpl.getOriginalArticleId(),
542                     new Double(journalArticleModelImpl.getOriginalVersion())
543                 });
544         }
545 
546         if (isNew ||
547                 ((journalArticle.getGroupId() != journalArticleModelImpl.getOriginalGroupId()) ||
548                 !Validator.equals(journalArticle.getArticleId(),
549                     journalArticleModelImpl.getOriginalArticleId()) ||
550                 (journalArticle.getVersion() != journalArticleModelImpl.getOriginalVersion()))) {
551             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_V,
552                 new Object[] {
553                     new Long(journalArticle.getGroupId()),
554                     
555                 journalArticle.getArticleId(),
556                     new Double(journalArticle.getVersion())
557                 }, journalArticle);
558         }
559 
560         return journalArticle;
561     }
562 
563     protected JournalArticle toUnwrappedModel(JournalArticle journalArticle) {
564         if (journalArticle instanceof JournalArticleImpl) {
565             return journalArticle;
566         }
567 
568         JournalArticleImpl journalArticleImpl = new JournalArticleImpl();
569 
570         journalArticleImpl.setNew(journalArticle.isNew());
571         journalArticleImpl.setPrimaryKey(journalArticle.getPrimaryKey());
572 
573         journalArticleImpl.setUuid(journalArticle.getUuid());
574         journalArticleImpl.setId(journalArticle.getId());
575         journalArticleImpl.setResourcePrimKey(journalArticle.getResourcePrimKey());
576         journalArticleImpl.setGroupId(journalArticle.getGroupId());
577         journalArticleImpl.setCompanyId(journalArticle.getCompanyId());
578         journalArticleImpl.setUserId(journalArticle.getUserId());
579         journalArticleImpl.setUserName(journalArticle.getUserName());
580         journalArticleImpl.setCreateDate(journalArticle.getCreateDate());
581         journalArticleImpl.setModifiedDate(journalArticle.getModifiedDate());
582         journalArticleImpl.setArticleId(journalArticle.getArticleId());
583         journalArticleImpl.setVersion(journalArticle.getVersion());
584         journalArticleImpl.setTitle(journalArticle.getTitle());
585         journalArticleImpl.setUrlTitle(journalArticle.getUrlTitle());
586         journalArticleImpl.setDescription(journalArticle.getDescription());
587         journalArticleImpl.setContent(journalArticle.getContent());
588         journalArticleImpl.setType(journalArticle.getType());
589         journalArticleImpl.setStructureId(journalArticle.getStructureId());
590         journalArticleImpl.setTemplateId(journalArticle.getTemplateId());
591         journalArticleImpl.setDisplayDate(journalArticle.getDisplayDate());
592         journalArticleImpl.setStatus(journalArticle.getStatus());
593         journalArticleImpl.setStatusByUserId(journalArticle.getStatusByUserId());
594         journalArticleImpl.setStatusByUserName(journalArticle.getStatusByUserName());
595         journalArticleImpl.setStatusDate(journalArticle.getStatusDate());
596         journalArticleImpl.setExpirationDate(journalArticle.getExpirationDate());
597         journalArticleImpl.setReviewDate(journalArticle.getReviewDate());
598         journalArticleImpl.setIndexable(journalArticle.isIndexable());
599         journalArticleImpl.setSmallImage(journalArticle.isSmallImage());
600         journalArticleImpl.setSmallImageId(journalArticle.getSmallImageId());
601         journalArticleImpl.setSmallImageURL(journalArticle.getSmallImageURL());
602 
603         return journalArticleImpl;
604     }
605 
606     public JournalArticle findByPrimaryKey(Serializable primaryKey)
607         throws NoSuchModelException, SystemException {
608         return findByPrimaryKey(((Long)primaryKey).longValue());
609     }
610 
611     public JournalArticle findByPrimaryKey(long id)
612         throws NoSuchArticleException, SystemException {
613         JournalArticle journalArticle = fetchByPrimaryKey(id);
614 
615         if (journalArticle == null) {
616             if (_log.isWarnEnabled()) {
617                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + id);
618             }
619 
620             throw new NoSuchArticleException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
621                 id);
622         }
623 
624         return journalArticle;
625     }
626 
627     public JournalArticle fetchByPrimaryKey(Serializable primaryKey)
628         throws SystemException {
629         return fetchByPrimaryKey(((Long)primaryKey).longValue());
630     }
631 
632     public JournalArticle fetchByPrimaryKey(long id) throws SystemException {
633         JournalArticle journalArticle = (JournalArticle)EntityCacheUtil.getResult(JournalArticleModelImpl.ENTITY_CACHE_ENABLED,
634                 JournalArticleImpl.class, id, this);
635 
636         if (journalArticle == null) {
637             Session session = null;
638 
639             try {
640                 session = openSession();
641 
642                 journalArticle = (JournalArticle)session.get(JournalArticleImpl.class,
643                         new Long(id));
644             }
645             catch (Exception e) {
646                 throw processException(e);
647             }
648             finally {
649                 if (journalArticle != null) {
650                     cacheResult(journalArticle);
651                 }
652 
653                 closeSession(session);
654             }
655         }
656 
657         return journalArticle;
658     }
659 
660     public List<JournalArticle> findByUuid(String uuid)
661         throws SystemException {
662         Object[] finderArgs = new Object[] { uuid };
663 
664         List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
665                 finderArgs, this);
666 
667         if (list == null) {
668             Session session = null;
669 
670             try {
671                 session = openSession();
672 
673                 StringBundler query = new StringBundler(3);
674 
675                 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
676 
677                 if (uuid == null) {
678                     query.append(_FINDER_COLUMN_UUID_UUID_1);
679                 }
680                 else {
681                     if (uuid.equals(StringPool.BLANK)) {
682                         query.append(_FINDER_COLUMN_UUID_UUID_3);
683                     }
684                     else {
685                         query.append(_FINDER_COLUMN_UUID_UUID_2);
686                     }
687                 }
688 
689                 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
690 
691                 String sql = query.toString();
692 
693                 Query q = session.createQuery(sql);
694 
695                 QueryPos qPos = QueryPos.getInstance(q);
696 
697                 if (uuid != null) {
698                     qPos.add(uuid);
699                 }
700 
701                 list = q.list();
702             }
703             catch (Exception e) {
704                 throw processException(e);
705             }
706             finally {
707                 if (list == null) {
708                     list = new ArrayList<JournalArticle>();
709                 }
710 
711                 cacheResult(list);
712 
713                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
714                     list);
715 
716                 closeSession(session);
717             }
718         }
719 
720         return list;
721     }
722 
723     public List<JournalArticle> findByUuid(String uuid, int start, int end)
724         throws SystemException {
725         return findByUuid(uuid, start, end, null);
726     }
727 
728     public List<JournalArticle> findByUuid(String uuid, int start, int end,
729         OrderByComparator obc) throws SystemException {
730         Object[] finderArgs = new Object[] {
731                 uuid,
732                 
733                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
734             };
735 
736         List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_UUID,
737                 finderArgs, this);
738 
739         if (list == null) {
740             Session session = null;
741 
742             try {
743                 session = openSession();
744 
745                 StringBundler query = null;
746 
747                 if (obc != null) {
748                     query = new StringBundler(3 +
749                             (obc.getOrderByFields().length * 3));
750                 }
751                 else {
752                     query = new StringBundler(3);
753                 }
754 
755                 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
756 
757                 if (uuid == null) {
758                     query.append(_FINDER_COLUMN_UUID_UUID_1);
759                 }
760                 else {
761                     if (uuid.equals(StringPool.BLANK)) {
762                         query.append(_FINDER_COLUMN_UUID_UUID_3);
763                     }
764                     else {
765                         query.append(_FINDER_COLUMN_UUID_UUID_2);
766                     }
767                 }
768 
769                 if (obc != null) {
770                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
771                 }
772 
773                 else {
774                     query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
775                 }
776 
777                 String sql = query.toString();
778 
779                 Query q = session.createQuery(sql);
780 
781                 QueryPos qPos = QueryPos.getInstance(q);
782 
783                 if (uuid != null) {
784                     qPos.add(uuid);
785                 }
786 
787                 list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
788                         start, end);
789             }
790             catch (Exception e) {
791                 throw processException(e);
792             }
793             finally {
794                 if (list == null) {
795                     list = new ArrayList<JournalArticle>();
796                 }
797 
798                 cacheResult(list);
799 
800                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_UUID,
801                     finderArgs, list);
802 
803                 closeSession(session);
804             }
805         }
806 
807         return list;
808     }
809 
810     public JournalArticle findByUuid_First(String uuid, OrderByComparator obc)
811         throws NoSuchArticleException, SystemException {
812         List<JournalArticle> list = findByUuid(uuid, 0, 1, obc);
813 
814         if (list.isEmpty()) {
815             StringBundler msg = new StringBundler(4);
816 
817             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
818 
819             msg.append("uuid=");
820             msg.append(uuid);
821 
822             msg.append(StringPool.CLOSE_CURLY_BRACE);
823 
824             throw new NoSuchArticleException(msg.toString());
825         }
826         else {
827             return list.get(0);
828         }
829     }
830 
831     public JournalArticle findByUuid_Last(String uuid, OrderByComparator obc)
832         throws NoSuchArticleException, SystemException {
833         int count = countByUuid(uuid);
834 
835         List<JournalArticle> list = findByUuid(uuid, count - 1, count, obc);
836 
837         if (list.isEmpty()) {
838             StringBundler msg = new StringBundler(4);
839 
840             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
841 
842             msg.append("uuid=");
843             msg.append(uuid);
844 
845             msg.append(StringPool.CLOSE_CURLY_BRACE);
846 
847             throw new NoSuchArticleException(msg.toString());
848         }
849         else {
850             return list.get(0);
851         }
852     }
853 
854     public JournalArticle[] findByUuid_PrevAndNext(long id, String uuid,
855         OrderByComparator obc) throws NoSuchArticleException, SystemException {
856         JournalArticle journalArticle = findByPrimaryKey(id);
857 
858         int count = countByUuid(uuid);
859 
860         Session session = null;
861 
862         try {
863             session = openSession();
864 
865             StringBundler query = null;
866 
867             if (obc != null) {
868                 query = new StringBundler(3 +
869                         (obc.getOrderByFields().length * 3));
870             }
871             else {
872                 query = new StringBundler(3);
873             }
874 
875             query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
876 
877             if (uuid == null) {
878                 query.append(_FINDER_COLUMN_UUID_UUID_1);
879             }
880             else {
881                 if (uuid.equals(StringPool.BLANK)) {
882                     query.append(_FINDER_COLUMN_UUID_UUID_3);
883                 }
884                 else {
885                     query.append(_FINDER_COLUMN_UUID_UUID_2);
886                 }
887             }
888 
889             if (obc != null) {
890                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
891             }
892 
893             else {
894                 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
895             }
896 
897             String sql = query.toString();
898 
899             Query q = session.createQuery(sql);
900 
901             QueryPos qPos = QueryPos.getInstance(q);
902 
903             if (uuid != null) {
904                 qPos.add(uuid);
905             }
906 
907             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
908                     journalArticle);
909 
910             JournalArticle[] array = new JournalArticleImpl[3];
911 
912             array[0] = (JournalArticle)objArray[0];
913             array[1] = (JournalArticle)objArray[1];
914             array[2] = (JournalArticle)objArray[2];
915 
916             return array;
917         }
918         catch (Exception e) {
919             throw processException(e);
920         }
921         finally {
922             closeSession(session);
923         }
924     }
925 
926     public JournalArticle findByUUID_G(String uuid, long groupId)
927         throws NoSuchArticleException, SystemException {
928         JournalArticle journalArticle = fetchByUUID_G(uuid, groupId);
929 
930         if (journalArticle == null) {
931             StringBundler msg = new StringBundler(6);
932 
933             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
934 
935             msg.append("uuid=");
936             msg.append(uuid);
937 
938             msg.append(", groupId=");
939             msg.append(groupId);
940 
941             msg.append(StringPool.CLOSE_CURLY_BRACE);
942 
943             if (_log.isWarnEnabled()) {
944                 _log.warn(msg.toString());
945             }
946 
947             throw new NoSuchArticleException(msg.toString());
948         }
949 
950         return journalArticle;
951     }
952 
953     public JournalArticle fetchByUUID_G(String uuid, long groupId)
954         throws SystemException {
955         return fetchByUUID_G(uuid, groupId, true);
956     }
957 
958     public JournalArticle fetchByUUID_G(String uuid, long groupId,
959         boolean retrieveFromCache) throws SystemException {
960         Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
961 
962         Object result = null;
963 
964         if (retrieveFromCache) {
965             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
966                     finderArgs, this);
967         }
968 
969         if (result == null) {
970             Session session = null;
971 
972             try {
973                 session = openSession();
974 
975                 StringBundler query = new StringBundler(4);
976 
977                 query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
978 
979                 if (uuid == null) {
980                     query.append(_FINDER_COLUMN_UUID_G_UUID_1);
981                 }
982                 else {
983                     if (uuid.equals(StringPool.BLANK)) {
984                         query.append(_FINDER_COLUMN_UUID_G_UUID_3);
985                     }
986                     else {
987                         query.append(_FINDER_COLUMN_UUID_G_UUID_2);
988                     }
989                 }
990 
991                 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
992 
993                 query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
994 
995                 String sql = query.toString();
996 
997                 Query q = session.createQuery(sql);
998 
999                 QueryPos qPos = QueryPos.getInstance(q);
1000
1001                if (uuid != null) {
1002                    qPos.add(uuid);
1003                }
1004
1005                qPos.add(groupId);
1006
1007                List<JournalArticle> list = q.list();
1008
1009                result = list;
1010
1011                JournalArticle journalArticle = null;
1012
1013                if (list.isEmpty()) {
1014                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1015                        finderArgs, list);
1016                }
1017                else {
1018                    journalArticle = list.get(0);
1019
1020                    cacheResult(journalArticle);
1021
1022                    if ((journalArticle.getUuid() == null) ||
1023                            !journalArticle.getUuid().equals(uuid) ||
1024                            (journalArticle.getGroupId() != groupId)) {
1025                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1026                            finderArgs, journalArticle);
1027                    }
1028                }
1029
1030                return journalArticle;
1031            }
1032            catch (Exception e) {
1033                throw processException(e);
1034            }
1035            finally {
1036                if (result == null) {
1037                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1038                        finderArgs, new ArrayList<JournalArticle>());
1039                }
1040
1041                closeSession(session);
1042            }
1043        }
1044        else {
1045            if (result instanceof List<?>) {
1046                return null;
1047            }
1048            else {
1049                return (JournalArticle)result;
1050            }
1051        }
1052    }
1053
1054    public List<JournalArticle> findByGroupId(long groupId)
1055        throws SystemException {
1056        Object[] finderArgs = new Object[] { new Long(groupId) };
1057
1058        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
1059                finderArgs, this);
1060
1061        if (list == null) {
1062            Session session = null;
1063
1064            try {
1065                session = openSession();
1066
1067                StringBundler query = new StringBundler(3);
1068
1069                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
1070
1071                query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1072
1073                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
1074
1075                String sql = query.toString();
1076
1077                Query q = session.createQuery(sql);
1078
1079                QueryPos qPos = QueryPos.getInstance(q);
1080
1081                qPos.add(groupId);
1082
1083                list = q.list();
1084            }
1085            catch (Exception e) {
1086                throw processException(e);
1087            }
1088            finally {
1089                if (list == null) {
1090                    list = new ArrayList<JournalArticle>();
1091                }
1092
1093                cacheResult(list);
1094
1095                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
1096                    finderArgs, list);
1097
1098                closeSession(session);
1099            }
1100        }
1101
1102        return list;
1103    }
1104
1105    public List<JournalArticle> findByGroupId(long groupId, int start, int end)
1106        throws SystemException {
1107        return findByGroupId(groupId, start, end, null);
1108    }
1109
1110    public List<JournalArticle> findByGroupId(long groupId, int start, int end,
1111        OrderByComparator obc) throws SystemException {
1112        Object[] finderArgs = new Object[] {
1113                new Long(groupId),
1114                
1115                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1116            };
1117
1118        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
1119                finderArgs, this);
1120
1121        if (list == null) {
1122            Session session = null;
1123
1124            try {
1125                session = openSession();
1126
1127                StringBundler query = null;
1128
1129                if (obc != null) {
1130                    query = new StringBundler(3 +
1131                            (obc.getOrderByFields().length * 3));
1132                }
1133                else {
1134                    query = new StringBundler(3);
1135                }
1136
1137                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
1138
1139                query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1140
1141                if (obc != null) {
1142                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1143                }
1144
1145                else {
1146                    query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
1147                }
1148
1149                String sql = query.toString();
1150
1151                Query q = session.createQuery(sql);
1152
1153                QueryPos qPos = QueryPos.getInstance(q);
1154
1155                qPos.add(groupId);
1156
1157                list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
1158                        start, end);
1159            }
1160            catch (Exception e) {
1161                throw processException(e);
1162            }
1163            finally {
1164                if (list == null) {
1165                    list = new ArrayList<JournalArticle>();
1166                }
1167
1168                cacheResult(list);
1169
1170                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
1171                    finderArgs, list);
1172
1173                closeSession(session);
1174            }
1175        }
1176
1177        return list;
1178    }
1179
1180    public JournalArticle findByGroupId_First(long groupId,
1181        OrderByComparator obc) throws NoSuchArticleException, SystemException {
1182        List<JournalArticle> list = findByGroupId(groupId, 0, 1, obc);
1183
1184        if (list.isEmpty()) {
1185            StringBundler msg = new StringBundler(4);
1186
1187            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1188
1189            msg.append("groupId=");
1190            msg.append(groupId);
1191
1192            msg.append(StringPool.CLOSE_CURLY_BRACE);
1193
1194            throw new NoSuchArticleException(msg.toString());
1195        }
1196        else {
1197            return list.get(0);
1198        }
1199    }
1200
1201    public JournalArticle findByGroupId_Last(long groupId, OrderByComparator obc)
1202        throws NoSuchArticleException, SystemException {
1203        int count = countByGroupId(groupId);
1204
1205        List<JournalArticle> list = findByGroupId(groupId, count - 1, count, obc);
1206
1207        if (list.isEmpty()) {
1208            StringBundler msg = new StringBundler(4);
1209
1210            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1211
1212            msg.append("groupId=");
1213            msg.append(groupId);
1214
1215            msg.append(StringPool.CLOSE_CURLY_BRACE);
1216
1217            throw new NoSuchArticleException(msg.toString());
1218        }
1219        else {
1220            return list.get(0);
1221        }
1222    }
1223
1224    public JournalArticle[] findByGroupId_PrevAndNext(long id, long groupId,
1225        OrderByComparator obc) throws NoSuchArticleException, SystemException {
1226        JournalArticle journalArticle = findByPrimaryKey(id);
1227
1228        int count = countByGroupId(groupId);
1229
1230        Session session = null;
1231
1232        try {
1233            session = openSession();
1234
1235            StringBundler query = null;
1236
1237            if (obc != null) {
1238                query = new StringBundler(3 +
1239                        (obc.getOrderByFields().length * 3));
1240            }
1241            else {
1242                query = new StringBundler(3);
1243            }
1244
1245            query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
1246
1247            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1248
1249            if (obc != null) {
1250                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1251            }
1252
1253            else {
1254                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
1255            }
1256
1257            String sql = query.toString();
1258
1259            Query q = session.createQuery(sql);
1260
1261            QueryPos qPos = QueryPos.getInstance(q);
1262
1263            qPos.add(groupId);
1264
1265            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1266                    journalArticle);
1267
1268            JournalArticle[] array = new JournalArticleImpl[3];
1269
1270            array[0] = (JournalArticle)objArray[0];
1271            array[1] = (JournalArticle)objArray[1];
1272            array[2] = (JournalArticle)objArray[2];
1273
1274            return array;
1275        }
1276        catch (Exception e) {
1277            throw processException(e);
1278        }
1279        finally {
1280            closeSession(session);
1281        }
1282    }
1283
1284    public List<JournalArticle> findByCompanyId(long companyId)
1285        throws SystemException {
1286        Object[] finderArgs = new Object[] { new Long(companyId) };
1287
1288        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
1289                finderArgs, this);
1290
1291        if (list == null) {
1292            Session session = null;
1293
1294            try {
1295                session = openSession();
1296
1297                StringBundler query = new StringBundler(3);
1298
1299                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
1300
1301                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1302
1303                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
1304
1305                String sql = query.toString();
1306
1307                Query q = session.createQuery(sql);
1308
1309                QueryPos qPos = QueryPos.getInstance(q);
1310
1311                qPos.add(companyId);
1312
1313                list = q.list();
1314            }
1315            catch (Exception e) {
1316                throw processException(e);
1317            }
1318            finally {
1319                if (list == null) {
1320                    list = new ArrayList<JournalArticle>();
1321                }
1322
1323                cacheResult(list);
1324
1325                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1326                    finderArgs, list);
1327
1328                closeSession(session);
1329            }
1330        }
1331
1332        return list;
1333    }
1334
1335    public List<JournalArticle> findByCompanyId(long companyId, int start,
1336        int end) throws SystemException {
1337        return findByCompanyId(companyId, start, end, null);
1338    }
1339
1340    public List<JournalArticle> findByCompanyId(long companyId, int start,
1341        int end, OrderByComparator obc) throws SystemException {
1342        Object[] finderArgs = new Object[] {
1343                new Long(companyId),
1344                
1345                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1346            };
1347
1348        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
1349                finderArgs, this);
1350
1351        if (list == null) {
1352            Session session = null;
1353
1354            try {
1355                session = openSession();
1356
1357                StringBundler query = null;
1358
1359                if (obc != null) {
1360                    query = new StringBundler(3 +
1361                            (obc.getOrderByFields().length * 3));
1362                }
1363                else {
1364                    query = new StringBundler(3);
1365                }
1366
1367                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
1368
1369                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1370
1371                if (obc != null) {
1372                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1373                }
1374
1375                else {
1376                    query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
1377                }
1378
1379                String sql = query.toString();
1380
1381                Query q = session.createQuery(sql);
1382
1383                QueryPos qPos = QueryPos.getInstance(q);
1384
1385                qPos.add(companyId);
1386
1387                list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
1388                        start, end);
1389            }
1390            catch (Exception e) {
1391                throw processException(e);
1392            }
1393            finally {
1394                if (list == null) {
1395                    list = new ArrayList<JournalArticle>();
1396                }
1397
1398                cacheResult(list);
1399
1400                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
1401                    finderArgs, list);
1402
1403                closeSession(session);
1404            }
1405        }
1406
1407        return list;
1408    }
1409
1410    public JournalArticle findByCompanyId_First(long companyId,
1411        OrderByComparator obc) throws NoSuchArticleException, SystemException {
1412        List<JournalArticle> list = findByCompanyId(companyId, 0, 1, obc);
1413
1414        if (list.isEmpty()) {
1415            StringBundler msg = new StringBundler(4);
1416
1417            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1418
1419            msg.append("companyId=");
1420            msg.append(companyId);
1421
1422            msg.append(StringPool.CLOSE_CURLY_BRACE);
1423
1424            throw new NoSuchArticleException(msg.toString());
1425        }
1426        else {
1427            return list.get(0);
1428        }
1429    }
1430
1431    public JournalArticle findByCompanyId_Last(long companyId,
1432        OrderByComparator obc) throws NoSuchArticleException, SystemException {
1433        int count = countByCompanyId(companyId);
1434
1435        List<JournalArticle> list = findByCompanyId(companyId, count - 1,
1436                count, obc);
1437
1438        if (list.isEmpty()) {
1439            StringBundler msg = new StringBundler(4);
1440
1441            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1442
1443            msg.append("companyId=");
1444            msg.append(companyId);
1445
1446            msg.append(StringPool.CLOSE_CURLY_BRACE);
1447
1448            throw new NoSuchArticleException(msg.toString());
1449        }
1450        else {
1451            return list.get(0);
1452        }
1453    }
1454
1455    public JournalArticle[] findByCompanyId_PrevAndNext(long id,
1456        long companyId, OrderByComparator obc)
1457        throws NoSuchArticleException, SystemException {
1458        JournalArticle journalArticle = findByPrimaryKey(id);
1459
1460        int count = countByCompanyId(companyId);
1461
1462        Session session = null;
1463
1464        try {
1465            session = openSession();
1466
1467            StringBundler query = null;
1468
1469            if (obc != null) {
1470                query = new StringBundler(3 +
1471                        (obc.getOrderByFields().length * 3));
1472            }
1473            else {
1474                query = new StringBundler(3);
1475            }
1476
1477            query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
1478
1479            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1480
1481            if (obc != null) {
1482                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1483            }
1484
1485            else {
1486                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
1487            }
1488
1489            String sql = query.toString();
1490
1491            Query q = session.createQuery(sql);
1492
1493            QueryPos qPos = QueryPos.getInstance(q);
1494
1495            qPos.add(companyId);
1496
1497            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1498                    journalArticle);
1499
1500            JournalArticle[] array = new JournalArticleImpl[3];
1501
1502            array[0] = (JournalArticle)objArray[0];
1503            array[1] = (JournalArticle)objArray[1];
1504            array[2] = (JournalArticle)objArray[2];
1505
1506            return array;
1507        }
1508        catch (Exception e) {
1509            throw processException(e);
1510        }
1511        finally {
1512            closeSession(session);
1513        }
1514    }
1515
1516    public List<JournalArticle> findBySmallImageId(long smallImageId)
1517        throws SystemException {
1518        Object[] finderArgs = new Object[] { new Long(smallImageId) };
1519
1520        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_SMALLIMAGEID,
1521                finderArgs, this);
1522
1523        if (list == null) {
1524            Session session = null;
1525
1526            try {
1527                session = openSession();
1528
1529                StringBundler query = new StringBundler(3);
1530
1531                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
1532
1533                query.append(_FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2);
1534
1535                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
1536
1537                String sql = query.toString();
1538
1539                Query q = session.createQuery(sql);
1540
1541                QueryPos qPos = QueryPos.getInstance(q);
1542
1543                qPos.add(smallImageId);
1544
1545                list = q.list();
1546            }
1547            catch (Exception e) {
1548                throw processException(e);
1549            }
1550            finally {
1551                if (list == null) {
1552                    list = new ArrayList<JournalArticle>();
1553                }
1554
1555                cacheResult(list);
1556
1557                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_SMALLIMAGEID,
1558                    finderArgs, list);
1559
1560                closeSession(session);
1561            }
1562        }
1563
1564        return list;
1565    }
1566
1567    public List<JournalArticle> findBySmallImageId(long smallImageId,
1568        int start, int end) throws SystemException {
1569        return findBySmallImageId(smallImageId, start, end, null);
1570    }
1571
1572    public List<JournalArticle> findBySmallImageId(long smallImageId,
1573        int start, int end, OrderByComparator obc) throws SystemException {
1574        Object[] finderArgs = new Object[] {
1575                new Long(smallImageId),
1576                
1577                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1578            };
1579
1580        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_SMALLIMAGEID,
1581                finderArgs, this);
1582
1583        if (list == null) {
1584            Session session = null;
1585
1586            try {
1587                session = openSession();
1588
1589                StringBundler query = null;
1590
1591                if (obc != null) {
1592                    query = new StringBundler(3 +
1593                            (obc.getOrderByFields().length * 3));
1594                }
1595                else {
1596                    query = new StringBundler(3);
1597                }
1598
1599                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
1600
1601                query.append(_FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2);
1602
1603                if (obc != null) {
1604                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1605                }
1606
1607                else {
1608                    query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
1609                }
1610
1611                String sql = query.toString();
1612
1613                Query q = session.createQuery(sql);
1614
1615                QueryPos qPos = QueryPos.getInstance(q);
1616
1617                qPos.add(smallImageId);
1618
1619                list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
1620                        start, end);
1621            }
1622            catch (Exception e) {
1623                throw processException(e);
1624            }
1625            finally {
1626                if (list == null) {
1627                    list = new ArrayList<JournalArticle>();
1628                }
1629
1630                cacheResult(list);
1631
1632                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_SMALLIMAGEID,
1633                    finderArgs, list);
1634
1635                closeSession(session);
1636            }
1637        }
1638
1639        return list;
1640    }
1641
1642    public JournalArticle findBySmallImageId_First(long smallImageId,
1643        OrderByComparator obc) throws NoSuchArticleException, SystemException {
1644        List<JournalArticle> list = findBySmallImageId(smallImageId, 0, 1, obc);
1645
1646        if (list.isEmpty()) {
1647            StringBundler msg = new StringBundler(4);
1648
1649            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1650
1651            msg.append("smallImageId=");
1652            msg.append(smallImageId);
1653
1654            msg.append(StringPool.CLOSE_CURLY_BRACE);
1655
1656            throw new NoSuchArticleException(msg.toString());
1657        }
1658        else {
1659            return list.get(0);
1660        }
1661    }
1662
1663    public JournalArticle findBySmallImageId_Last(long smallImageId,
1664        OrderByComparator obc) throws NoSuchArticleException, SystemException {
1665        int count = countBySmallImageId(smallImageId);
1666
1667        List<JournalArticle> list = findBySmallImageId(smallImageId, count - 1,
1668                count, obc);
1669
1670        if (list.isEmpty()) {
1671            StringBundler msg = new StringBundler(4);
1672
1673            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1674
1675            msg.append("smallImageId=");
1676            msg.append(smallImageId);
1677
1678            msg.append(StringPool.CLOSE_CURLY_BRACE);
1679
1680            throw new NoSuchArticleException(msg.toString());
1681        }
1682        else {
1683            return list.get(0);
1684        }
1685    }
1686
1687    public JournalArticle[] findBySmallImageId_PrevAndNext(long id,
1688        long smallImageId, OrderByComparator obc)
1689        throws NoSuchArticleException, SystemException {
1690        JournalArticle journalArticle = findByPrimaryKey(id);
1691
1692        int count = countBySmallImageId(smallImageId);
1693
1694        Session session = null;
1695
1696        try {
1697            session = openSession();
1698
1699            StringBundler query = null;
1700
1701            if (obc != null) {
1702                query = new StringBundler(3 +
1703                        (obc.getOrderByFields().length * 3));
1704            }
1705            else {
1706                query = new StringBundler(3);
1707            }
1708
1709            query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
1710
1711            query.append(_FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2);
1712
1713            if (obc != null) {
1714                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1715            }
1716
1717            else {
1718                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
1719            }
1720
1721            String sql = query.toString();
1722
1723            Query q = session.createQuery(sql);
1724
1725            QueryPos qPos = QueryPos.getInstance(q);
1726
1727            qPos.add(smallImageId);
1728
1729            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1730                    journalArticle);
1731
1732            JournalArticle[] array = new JournalArticleImpl[3];
1733
1734            array[0] = (JournalArticle)objArray[0];
1735            array[1] = (JournalArticle)objArray[1];
1736            array[2] = (JournalArticle)objArray[2];
1737
1738            return array;
1739        }
1740        catch (Exception e) {
1741            throw processException(e);
1742        }
1743        finally {
1744            closeSession(session);
1745        }
1746    }
1747
1748    public List<JournalArticle> findByR_S(long resourcePrimKey, int status)
1749        throws SystemException {
1750        Object[] finderArgs = new Object[] {
1751                new Long(resourcePrimKey), new Integer(status)
1752            };
1753
1754        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_R_S,
1755                finderArgs, this);
1756
1757        if (list == null) {
1758            Session session = null;
1759
1760            try {
1761                session = openSession();
1762
1763                StringBundler query = new StringBundler(4);
1764
1765                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
1766
1767                query.append(_FINDER_COLUMN_R_S_RESOURCEPRIMKEY_2);
1768
1769                query.append(_FINDER_COLUMN_R_S_STATUS_2);
1770
1771                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
1772
1773                String sql = query.toString();
1774
1775                Query q = session.createQuery(sql);
1776
1777                QueryPos qPos = QueryPos.getInstance(q);
1778
1779                qPos.add(resourcePrimKey);
1780
1781                qPos.add(status);
1782
1783                list = q.list();
1784            }
1785            catch (Exception e) {
1786                throw processException(e);
1787            }
1788            finally {
1789                if (list == null) {
1790                    list = new ArrayList<JournalArticle>();
1791                }
1792
1793                cacheResult(list);
1794
1795                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_R_S, finderArgs,
1796                    list);
1797
1798                closeSession(session);
1799            }
1800        }
1801
1802        return list;
1803    }
1804
1805    public List<JournalArticle> findByR_S(long resourcePrimKey, int status,
1806        int start, int end) throws SystemException {
1807        return findByR_S(resourcePrimKey, status, start, end, null);
1808    }
1809
1810    public List<JournalArticle> findByR_S(long resourcePrimKey, int status,
1811        int start, int end, OrderByComparator obc) throws SystemException {
1812        Object[] finderArgs = new Object[] {
1813                new Long(resourcePrimKey), new Integer(status),
1814                
1815                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1816            };
1817
1818        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_R_S,
1819                finderArgs, this);
1820
1821        if (list == null) {
1822            Session session = null;
1823
1824            try {
1825                session = openSession();
1826
1827                StringBundler query = null;
1828
1829                if (obc != null) {
1830                    query = new StringBundler(4 +
1831                            (obc.getOrderByFields().length * 3));
1832                }
1833                else {
1834                    query = new StringBundler(4);
1835                }
1836
1837                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
1838
1839                query.append(_FINDER_COLUMN_R_S_RESOURCEPRIMKEY_2);
1840
1841                query.append(_FINDER_COLUMN_R_S_STATUS_2);
1842
1843                if (obc != null) {
1844                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1845                }
1846
1847                else {
1848                    query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
1849                }
1850
1851                String sql = query.toString();
1852
1853                Query q = session.createQuery(sql);
1854
1855                QueryPos qPos = QueryPos.getInstance(q);
1856
1857                qPos.add(resourcePrimKey);
1858
1859                qPos.add(status);
1860
1861                list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
1862                        start, end);
1863            }
1864            catch (Exception e) {
1865                throw processException(e);
1866            }
1867            finally {
1868                if (list == null) {
1869                    list = new ArrayList<JournalArticle>();
1870                }
1871
1872                cacheResult(list);
1873
1874                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_R_S,
1875                    finderArgs, list);
1876
1877                closeSession(session);
1878            }
1879        }
1880
1881        return list;
1882    }
1883
1884    public JournalArticle findByR_S_First(long resourcePrimKey, int status,
1885        OrderByComparator obc) throws NoSuchArticleException, SystemException {
1886        List<JournalArticle> list = findByR_S(resourcePrimKey, status, 0, 1, obc);
1887
1888        if (list.isEmpty()) {
1889            StringBundler msg = new StringBundler(6);
1890
1891            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1892
1893            msg.append("resourcePrimKey=");
1894            msg.append(resourcePrimKey);
1895
1896            msg.append(", status=");
1897            msg.append(status);
1898
1899            msg.append(StringPool.CLOSE_CURLY_BRACE);
1900
1901            throw new NoSuchArticleException(msg.toString());
1902        }
1903        else {
1904            return list.get(0);
1905        }
1906    }
1907
1908    public JournalArticle findByR_S_Last(long resourcePrimKey, int status,
1909        OrderByComparator obc) throws NoSuchArticleException, SystemException {
1910        int count = countByR_S(resourcePrimKey, status);
1911
1912        List<JournalArticle> list = findByR_S(resourcePrimKey, status,
1913                count - 1, count, obc);
1914
1915        if (list.isEmpty()) {
1916            StringBundler msg = new StringBundler(6);
1917
1918            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1919
1920            msg.append("resourcePrimKey=");
1921            msg.append(resourcePrimKey);
1922
1923            msg.append(", status=");
1924            msg.append(status);
1925
1926            msg.append(StringPool.CLOSE_CURLY_BRACE);
1927
1928            throw new NoSuchArticleException(msg.toString());
1929        }
1930        else {
1931            return list.get(0);
1932        }
1933    }
1934
1935    public JournalArticle[] findByR_S_PrevAndNext(long id,
1936        long resourcePrimKey, int status, OrderByComparator obc)
1937        throws NoSuchArticleException, SystemException {
1938        JournalArticle journalArticle = findByPrimaryKey(id);
1939
1940        int count = countByR_S(resourcePrimKey, status);
1941
1942        Session session = null;
1943
1944        try {
1945            session = openSession();
1946
1947            StringBundler query = null;
1948
1949            if (obc != null) {
1950                query = new StringBundler(4 +
1951                        (obc.getOrderByFields().length * 3));
1952            }
1953            else {
1954                query = new StringBundler(4);
1955            }
1956
1957            query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
1958
1959            query.append(_FINDER_COLUMN_R_S_RESOURCEPRIMKEY_2);
1960
1961            query.append(_FINDER_COLUMN_R_S_STATUS_2);
1962
1963            if (obc != null) {
1964                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1965            }
1966
1967            else {
1968                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
1969            }
1970
1971            String sql = query.toString();
1972
1973            Query q = session.createQuery(sql);
1974
1975            QueryPos qPos = QueryPos.getInstance(q);
1976
1977            qPos.add(resourcePrimKey);
1978
1979            qPos.add(status);
1980
1981            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1982                    journalArticle);
1983
1984            JournalArticle[] array = new JournalArticleImpl[3];
1985
1986            array[0] = (JournalArticle)objArray[0];
1987            array[1] = (JournalArticle)objArray[1];
1988            array[2] = (JournalArticle)objArray[2];
1989
1990            return array;
1991        }
1992        catch (Exception e) {
1993            throw processException(e);
1994        }
1995        finally {
1996            closeSession(session);
1997        }
1998    }
1999
2000    public List<JournalArticle> findByG_A(long groupId, String articleId)
2001        throws SystemException {
2002        Object[] finderArgs = new Object[] { new Long(groupId), articleId };
2003
2004        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_A,
2005                finderArgs, this);
2006
2007        if (list == null) {
2008            Session session = null;
2009
2010            try {
2011                session = openSession();
2012
2013                StringBundler query = new StringBundler(4);
2014
2015                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2016
2017                query.append(_FINDER_COLUMN_G_A_GROUPID_2);
2018
2019                if (articleId == null) {
2020                    query.append(_FINDER_COLUMN_G_A_ARTICLEID_1);
2021                }
2022                else {
2023                    if (articleId.equals(StringPool.BLANK)) {
2024                        query.append(_FINDER_COLUMN_G_A_ARTICLEID_3);
2025                    }
2026                    else {
2027                        query.append(_FINDER_COLUMN_G_A_ARTICLEID_2);
2028                    }
2029                }
2030
2031                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2032
2033                String sql = query.toString();
2034
2035                Query q = session.createQuery(sql);
2036
2037                QueryPos qPos = QueryPos.getInstance(q);
2038
2039                qPos.add(groupId);
2040
2041                if (articleId != null) {
2042                    qPos.add(articleId);
2043                }
2044
2045                list = q.list();
2046            }
2047            catch (Exception e) {
2048                throw processException(e);
2049            }
2050            finally {
2051                if (list == null) {
2052                    list = new ArrayList<JournalArticle>();
2053                }
2054
2055                cacheResult(list);
2056
2057                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_A, finderArgs,
2058                    list);
2059
2060                closeSession(session);
2061            }
2062        }
2063
2064        return list;
2065    }
2066
2067    public List<JournalArticle> findByG_A(long groupId, String articleId,
2068        int start, int end) throws SystemException {
2069        return findByG_A(groupId, articleId, start, end, null);
2070    }
2071
2072    public List<JournalArticle> findByG_A(long groupId, String articleId,
2073        int start, int end, OrderByComparator obc) throws SystemException {
2074        Object[] finderArgs = new Object[] {
2075                new Long(groupId),
2076                
2077                articleId,
2078                
2079                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2080            };
2081
2082        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_A,
2083                finderArgs, this);
2084
2085        if (list == null) {
2086            Session session = null;
2087
2088            try {
2089                session = openSession();
2090
2091                StringBundler query = null;
2092
2093                if (obc != null) {
2094                    query = new StringBundler(4 +
2095                            (obc.getOrderByFields().length * 3));
2096                }
2097                else {
2098                    query = new StringBundler(4);
2099                }
2100
2101                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2102
2103                query.append(_FINDER_COLUMN_G_A_GROUPID_2);
2104
2105                if (articleId == null) {
2106                    query.append(_FINDER_COLUMN_G_A_ARTICLEID_1);
2107                }
2108                else {
2109                    if (articleId.equals(StringPool.BLANK)) {
2110                        query.append(_FINDER_COLUMN_G_A_ARTICLEID_3);
2111                    }
2112                    else {
2113                        query.append(_FINDER_COLUMN_G_A_ARTICLEID_2);
2114                    }
2115                }
2116
2117                if (obc != null) {
2118                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2119                }
2120
2121                else {
2122                    query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2123                }
2124
2125                String sql = query.toString();
2126
2127                Query q = session.createQuery(sql);
2128
2129                QueryPos qPos = QueryPos.getInstance(q);
2130
2131                qPos.add(groupId);
2132
2133                if (articleId != null) {
2134                    qPos.add(articleId);
2135                }
2136
2137                list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
2138                        start, end);
2139            }
2140            catch (Exception e) {
2141                throw processException(e);
2142            }
2143            finally {
2144                if (list == null) {
2145                    list = new ArrayList<JournalArticle>();
2146                }
2147
2148                cacheResult(list);
2149
2150                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_A,
2151                    finderArgs, list);
2152
2153                closeSession(session);
2154            }
2155        }
2156
2157        return list;
2158    }
2159
2160    public JournalArticle findByG_A_First(long groupId, String articleId,
2161        OrderByComparator obc) throws NoSuchArticleException, SystemException {
2162        List<JournalArticle> list = findByG_A(groupId, articleId, 0, 1, obc);
2163
2164        if (list.isEmpty()) {
2165            StringBundler msg = new StringBundler(6);
2166
2167            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2168
2169            msg.append("groupId=");
2170            msg.append(groupId);
2171
2172            msg.append(", articleId=");
2173            msg.append(articleId);
2174
2175            msg.append(StringPool.CLOSE_CURLY_BRACE);
2176
2177            throw new NoSuchArticleException(msg.toString());
2178        }
2179        else {
2180            return list.get(0);
2181        }
2182    }
2183
2184    public JournalArticle findByG_A_Last(long groupId, String articleId,
2185        OrderByComparator obc) throws NoSuchArticleException, SystemException {
2186        int count = countByG_A(groupId, articleId);
2187
2188        List<JournalArticle> list = findByG_A(groupId, articleId, count - 1,
2189                count, obc);
2190
2191        if (list.isEmpty()) {
2192            StringBundler msg = new StringBundler(6);
2193
2194            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2195
2196            msg.append("groupId=");
2197            msg.append(groupId);
2198
2199            msg.append(", articleId=");
2200            msg.append(articleId);
2201
2202            msg.append(StringPool.CLOSE_CURLY_BRACE);
2203
2204            throw new NoSuchArticleException(msg.toString());
2205        }
2206        else {
2207            return list.get(0);
2208        }
2209    }
2210
2211    public JournalArticle[] findByG_A_PrevAndNext(long id, long groupId,
2212        String articleId, OrderByComparator obc)
2213        throws NoSuchArticleException, SystemException {
2214        JournalArticle journalArticle = findByPrimaryKey(id);
2215
2216        int count = countByG_A(groupId, articleId);
2217
2218        Session session = null;
2219
2220        try {
2221            session = openSession();
2222
2223            StringBundler query = null;
2224
2225            if (obc != null) {
2226                query = new StringBundler(4 +
2227                        (obc.getOrderByFields().length * 3));
2228            }
2229            else {
2230                query = new StringBundler(4);
2231            }
2232
2233            query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2234
2235            query.append(_FINDER_COLUMN_G_A_GROUPID_2);
2236
2237            if (articleId == null) {
2238                query.append(_FINDER_COLUMN_G_A_ARTICLEID_1);
2239            }
2240            else {
2241                if (articleId.equals(StringPool.BLANK)) {
2242                    query.append(_FINDER_COLUMN_G_A_ARTICLEID_3);
2243                }
2244                else {
2245                    query.append(_FINDER_COLUMN_G_A_ARTICLEID_2);
2246                }
2247            }
2248
2249            if (obc != null) {
2250                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2251            }
2252
2253            else {
2254                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2255            }
2256
2257            String sql = query.toString();
2258
2259            Query q = session.createQuery(sql);
2260
2261            QueryPos qPos = QueryPos.getInstance(q);
2262
2263            qPos.add(groupId);
2264
2265            if (articleId != null) {
2266                qPos.add(articleId);
2267            }
2268
2269            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2270                    journalArticle);
2271
2272            JournalArticle[] array = new JournalArticleImpl[3];
2273
2274            array[0] = (JournalArticle)objArray[0];
2275            array[1] = (JournalArticle)objArray[1];
2276            array[2] = (JournalArticle)objArray[2];
2277
2278            return array;
2279        }
2280        catch (Exception e) {
2281            throw processException(e);
2282        }
2283        finally {
2284            closeSession(session);
2285        }
2286    }
2287
2288    public List<JournalArticle> findByG_S(long groupId, String structureId)
2289        throws SystemException {
2290        Object[] finderArgs = new Object[] { new Long(groupId), structureId };
2291
2292        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_S,
2293                finderArgs, this);
2294
2295        if (list == null) {
2296            Session session = null;
2297
2298            try {
2299                session = openSession();
2300
2301                StringBundler query = new StringBundler(4);
2302
2303                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2304
2305                query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2306
2307                if (structureId == null) {
2308                    query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
2309                }
2310                else {
2311                    if (structureId.equals(StringPool.BLANK)) {
2312                        query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
2313                    }
2314                    else {
2315                        query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
2316                    }
2317                }
2318
2319                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2320
2321                String sql = query.toString();
2322
2323                Query q = session.createQuery(sql);
2324
2325                QueryPos qPos = QueryPos.getInstance(q);
2326
2327                qPos.add(groupId);
2328
2329                if (structureId != null) {
2330                    qPos.add(structureId);
2331                }
2332
2333                list = q.list();
2334            }
2335            catch (Exception e) {
2336                throw processException(e);
2337            }
2338            finally {
2339                if (list == null) {
2340                    list = new ArrayList<JournalArticle>();
2341                }
2342
2343                cacheResult(list);
2344
2345                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_S, finderArgs,
2346                    list);
2347
2348                closeSession(session);
2349            }
2350        }
2351
2352        return list;
2353    }
2354
2355    public List<JournalArticle> findByG_S(long groupId, String structureId,
2356        int start, int end) throws SystemException {
2357        return findByG_S(groupId, structureId, start, end, null);
2358    }
2359
2360    public List<JournalArticle> findByG_S(long groupId, String structureId,
2361        int start, int end, OrderByComparator obc) throws SystemException {
2362        Object[] finderArgs = new Object[] {
2363                new Long(groupId),
2364                
2365                structureId,
2366                
2367                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2368            };
2369
2370        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_S,
2371                finderArgs, this);
2372
2373        if (list == null) {
2374            Session session = null;
2375
2376            try {
2377                session = openSession();
2378
2379                StringBundler query = null;
2380
2381                if (obc != null) {
2382                    query = new StringBundler(4 +
2383                            (obc.getOrderByFields().length * 3));
2384                }
2385                else {
2386                    query = new StringBundler(4);
2387                }
2388
2389                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2390
2391                query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2392
2393                if (structureId == null) {
2394                    query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
2395                }
2396                else {
2397                    if (structureId.equals(StringPool.BLANK)) {
2398                        query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
2399                    }
2400                    else {
2401                        query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
2402                    }
2403                }
2404
2405                if (obc != null) {
2406                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2407                }
2408
2409                else {
2410                    query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2411                }
2412
2413                String sql = query.toString();
2414
2415                Query q = session.createQuery(sql);
2416
2417                QueryPos qPos = QueryPos.getInstance(q);
2418
2419                qPos.add(groupId);
2420
2421                if (structureId != null) {
2422                    qPos.add(structureId);
2423                }
2424
2425                list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
2426                        start, end);
2427            }
2428            catch (Exception e) {
2429                throw processException(e);
2430            }
2431            finally {
2432                if (list == null) {
2433                    list = new ArrayList<JournalArticle>();
2434                }
2435
2436                cacheResult(list);
2437
2438                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_S,
2439                    finderArgs, list);
2440
2441                closeSession(session);
2442            }
2443        }
2444
2445        return list;
2446    }
2447
2448    public JournalArticle findByG_S_First(long groupId, String structureId,
2449        OrderByComparator obc) throws NoSuchArticleException, SystemException {
2450        List<JournalArticle> list = findByG_S(groupId, structureId, 0, 1, obc);
2451
2452        if (list.isEmpty()) {
2453            StringBundler msg = new StringBundler(6);
2454
2455            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2456
2457            msg.append("groupId=");
2458            msg.append(groupId);
2459
2460            msg.append(", structureId=");
2461            msg.append(structureId);
2462
2463            msg.append(StringPool.CLOSE_CURLY_BRACE);
2464
2465            throw new NoSuchArticleException(msg.toString());
2466        }
2467        else {
2468            return list.get(0);
2469        }
2470    }
2471
2472    public JournalArticle findByG_S_Last(long groupId, String structureId,
2473        OrderByComparator obc) throws NoSuchArticleException, SystemException {
2474        int count = countByG_S(groupId, structureId);
2475
2476        List<JournalArticle> list = findByG_S(groupId, structureId, count - 1,
2477                count, obc);
2478
2479        if (list.isEmpty()) {
2480            StringBundler msg = new StringBundler(6);
2481
2482            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2483
2484            msg.append("groupId=");
2485            msg.append(groupId);
2486
2487            msg.append(", structureId=");
2488            msg.append(structureId);
2489
2490            msg.append(StringPool.CLOSE_CURLY_BRACE);
2491
2492            throw new NoSuchArticleException(msg.toString());
2493        }
2494        else {
2495            return list.get(0);
2496        }
2497    }
2498
2499    public JournalArticle[] findByG_S_PrevAndNext(long id, long groupId,
2500        String structureId, OrderByComparator obc)
2501        throws NoSuchArticleException, SystemException {
2502        JournalArticle journalArticle = findByPrimaryKey(id);
2503
2504        int count = countByG_S(groupId, structureId);
2505
2506        Session session = null;
2507
2508        try {
2509            session = openSession();
2510
2511            StringBundler query = null;
2512
2513            if (obc != null) {
2514                query = new StringBundler(4 +
2515                        (obc.getOrderByFields().length * 3));
2516            }
2517            else {
2518                query = new StringBundler(4);
2519            }
2520
2521            query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2522
2523            query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2524
2525            if (structureId == null) {
2526                query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
2527            }
2528            else {
2529                if (structureId.equals(StringPool.BLANK)) {
2530                    query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
2531                }
2532                else {
2533                    query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
2534                }
2535            }
2536
2537            if (obc != null) {
2538                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2539            }
2540
2541            else {
2542                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2543            }
2544
2545            String sql = query.toString();
2546
2547            Query q = session.createQuery(sql);
2548
2549            QueryPos qPos = QueryPos.getInstance(q);
2550
2551            qPos.add(groupId);
2552
2553            if (structureId != null) {
2554                qPos.add(structureId);
2555            }
2556
2557            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2558                    journalArticle);
2559
2560            JournalArticle[] array = new JournalArticleImpl[3];
2561
2562            array[0] = (JournalArticle)objArray[0];
2563            array[1] = (JournalArticle)objArray[1];
2564            array[2] = (JournalArticle)objArray[2];
2565
2566            return array;
2567        }
2568        catch (Exception e) {
2569            throw processException(e);
2570        }
2571        finally {
2572            closeSession(session);
2573        }
2574    }
2575
2576    public List<JournalArticle> findByG_T(long groupId, String templateId)
2577        throws SystemException {
2578        Object[] finderArgs = new Object[] { new Long(groupId), templateId };
2579
2580        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_T,
2581                finderArgs, this);
2582
2583        if (list == null) {
2584            Session session = null;
2585
2586            try {
2587                session = openSession();
2588
2589                StringBundler query = new StringBundler(4);
2590
2591                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2592
2593                query.append(_FINDER_COLUMN_G_T_GROUPID_2);
2594
2595                if (templateId == null) {
2596                    query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
2597                }
2598                else {
2599                    if (templateId.equals(StringPool.BLANK)) {
2600                        query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
2601                    }
2602                    else {
2603                        query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
2604                    }
2605                }
2606
2607                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2608
2609                String sql = query.toString();
2610
2611                Query q = session.createQuery(sql);
2612
2613                QueryPos qPos = QueryPos.getInstance(q);
2614
2615                qPos.add(groupId);
2616
2617                if (templateId != null) {
2618                    qPos.add(templateId);
2619                }
2620
2621                list = q.list();
2622            }
2623            catch (Exception e) {
2624                throw processException(e);
2625            }
2626            finally {
2627                if (list == null) {
2628                    list = new ArrayList<JournalArticle>();
2629                }
2630
2631                cacheResult(list);
2632
2633                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_T, finderArgs,
2634                    list);
2635
2636                closeSession(session);
2637            }
2638        }
2639
2640        return list;
2641    }
2642
2643    public List<JournalArticle> findByG_T(long groupId, String templateId,
2644        int start, int end) throws SystemException {
2645        return findByG_T(groupId, templateId, start, end, null);
2646    }
2647
2648    public List<JournalArticle> findByG_T(long groupId, String templateId,
2649        int start, int end, OrderByComparator obc) throws SystemException {
2650        Object[] finderArgs = new Object[] {
2651                new Long(groupId),
2652                
2653                templateId,
2654                
2655                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2656            };
2657
2658        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_T,
2659                finderArgs, this);
2660
2661        if (list == null) {
2662            Session session = null;
2663
2664            try {
2665                session = openSession();
2666
2667                StringBundler query = null;
2668
2669                if (obc != null) {
2670                    query = new StringBundler(4 +
2671                            (obc.getOrderByFields().length * 3));
2672                }
2673                else {
2674                    query = new StringBundler(4);
2675                }
2676
2677                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2678
2679                query.append(_FINDER_COLUMN_G_T_GROUPID_2);
2680
2681                if (templateId == null) {
2682                    query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
2683                }
2684                else {
2685                    if (templateId.equals(StringPool.BLANK)) {
2686                        query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
2687                    }
2688                    else {
2689                        query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
2690                    }
2691                }
2692
2693                if (obc != null) {
2694                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2695                }
2696
2697                else {
2698                    query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2699                }
2700
2701                String sql = query.toString();
2702
2703                Query q = session.createQuery(sql);
2704
2705                QueryPos qPos = QueryPos.getInstance(q);
2706
2707                qPos.add(groupId);
2708
2709                if (templateId != null) {
2710                    qPos.add(templateId);
2711                }
2712
2713                list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
2714                        start, end);
2715            }
2716            catch (Exception e) {
2717                throw processException(e);
2718            }
2719            finally {
2720                if (list == null) {
2721                    list = new ArrayList<JournalArticle>();
2722                }
2723
2724                cacheResult(list);
2725
2726                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_T,
2727                    finderArgs, list);
2728
2729                closeSession(session);
2730            }
2731        }
2732
2733        return list;
2734    }
2735
2736    public JournalArticle findByG_T_First(long groupId, String templateId,
2737        OrderByComparator obc) throws NoSuchArticleException, SystemException {
2738        List<JournalArticle> list = findByG_T(groupId, templateId, 0, 1, obc);
2739
2740        if (list.isEmpty()) {
2741            StringBundler msg = new StringBundler(6);
2742
2743            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2744
2745            msg.append("groupId=");
2746            msg.append(groupId);
2747
2748            msg.append(", templateId=");
2749            msg.append(templateId);
2750
2751            msg.append(StringPool.CLOSE_CURLY_BRACE);
2752
2753            throw new NoSuchArticleException(msg.toString());
2754        }
2755        else {
2756            return list.get(0);
2757        }
2758    }
2759
2760    public JournalArticle findByG_T_Last(long groupId, String templateId,
2761        OrderByComparator obc) throws NoSuchArticleException, SystemException {
2762        int count = countByG_T(groupId, templateId);
2763
2764        List<JournalArticle> list = findByG_T(groupId, templateId, count - 1,
2765                count, obc);
2766
2767        if (list.isEmpty()) {
2768            StringBundler msg = new StringBundler(6);
2769
2770            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2771
2772            msg.append("groupId=");
2773            msg.append(groupId);
2774
2775            msg.append(", templateId=");
2776            msg.append(templateId);
2777
2778            msg.append(StringPool.CLOSE_CURLY_BRACE);
2779
2780            throw new NoSuchArticleException(msg.toString());
2781        }
2782        else {
2783            return list.get(0);
2784        }
2785    }
2786
2787    public JournalArticle[] findByG_T_PrevAndNext(long id, long groupId,
2788        String templateId, OrderByComparator obc)
2789        throws NoSuchArticleException, SystemException {
2790        JournalArticle journalArticle = findByPrimaryKey(id);
2791
2792        int count = countByG_T(groupId, templateId);
2793
2794        Session session = null;
2795
2796        try {
2797            session = openSession();
2798
2799            StringBundler query = null;
2800
2801            if (obc != null) {
2802                query = new StringBundler(4 +
2803                        (obc.getOrderByFields().length * 3));
2804            }
2805            else {
2806                query = new StringBundler(4);
2807            }
2808
2809            query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2810
2811            query.append(_FINDER_COLUMN_G_T_GROUPID_2);
2812
2813            if (templateId == null) {
2814                query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
2815            }
2816            else {
2817                if (templateId.equals(StringPool.BLANK)) {
2818                    query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
2819                }
2820                else {
2821                    query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
2822                }
2823            }
2824
2825            if (obc != null) {
2826                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2827            }
2828
2829            else {
2830                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2831            }
2832
2833            String sql = query.toString();
2834
2835            Query q = session.createQuery(sql);
2836
2837            QueryPos qPos = QueryPos.getInstance(q);
2838
2839            qPos.add(groupId);
2840
2841            if (templateId != null) {
2842                qPos.add(templateId);
2843            }
2844
2845            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2846                    journalArticle);
2847
2848            JournalArticle[] array = new JournalArticleImpl[3];
2849
2850            array[0] = (JournalArticle)objArray[0];
2851            array[1] = (JournalArticle)objArray[1];
2852            array[2] = (JournalArticle)objArray[2];
2853
2854            return array;
2855        }
2856        catch (Exception e) {
2857            throw processException(e);
2858        }
2859        finally {
2860            closeSession(session);
2861        }
2862    }
2863
2864    public List<JournalArticle> findByG_UT(long groupId, String urlTitle)
2865        throws SystemException {
2866        Object[] finderArgs = new Object[] { new Long(groupId), urlTitle };
2867
2868        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_UT,
2869                finderArgs, this);
2870
2871        if (list == null) {
2872            Session session = null;
2873
2874            try {
2875                session = openSession();
2876
2877                StringBundler query = new StringBundler(4);
2878
2879                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2880
2881                query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
2882
2883                if (urlTitle == null) {
2884                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
2885                }
2886                else {
2887                    if (urlTitle.equals(StringPool.BLANK)) {
2888                        query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
2889                    }
2890                    else {
2891                        query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
2892                    }
2893                }
2894
2895                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2896
2897                String sql = query.toString();
2898
2899                Query q = session.createQuery(sql);
2900
2901                QueryPos qPos = QueryPos.getInstance(q);
2902
2903                qPos.add(groupId);
2904
2905                if (urlTitle != null) {
2906                    qPos.add(urlTitle);
2907                }
2908
2909                list = q.list();
2910            }
2911            catch (Exception e) {
2912                throw processException(e);
2913            }
2914            finally {
2915                if (list == null) {
2916                    list = new ArrayList<JournalArticle>();
2917                }
2918
2919                cacheResult(list);
2920
2921                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_UT, finderArgs,
2922                    list);
2923
2924                closeSession(session);
2925            }
2926        }
2927
2928        return list;
2929    }
2930
2931    public List<JournalArticle> findByG_UT(long groupId, String urlTitle,
2932        int start, int end) throws SystemException {
2933        return findByG_UT(groupId, urlTitle, start, end, null);
2934    }
2935
2936    public List<JournalArticle> findByG_UT(long groupId, String urlTitle,
2937        int start, int end, OrderByComparator obc) throws SystemException {
2938        Object[] finderArgs = new Object[] {
2939                new Long(groupId),
2940                
2941                urlTitle,
2942                
2943                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2944            };
2945
2946        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_UT,
2947                finderArgs, this);
2948
2949        if (list == null) {
2950            Session session = null;
2951
2952            try {
2953                session = openSession();
2954
2955                StringBundler query = null;
2956
2957                if (obc != null) {
2958                    query = new StringBundler(4 +
2959                            (obc.getOrderByFields().length * 3));
2960                }
2961                else {
2962                    query = new StringBundler(4);
2963                }
2964
2965                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
2966
2967                query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
2968
2969                if (urlTitle == null) {
2970                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
2971                }
2972                else {
2973                    if (urlTitle.equals(StringPool.BLANK)) {
2974                        query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
2975                    }
2976                    else {
2977                        query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
2978                    }
2979                }
2980
2981                if (obc != null) {
2982                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2983                }
2984
2985                else {
2986                    query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
2987                }
2988
2989                String sql = query.toString();
2990
2991                Query q = session.createQuery(sql);
2992
2993                QueryPos qPos = QueryPos.getInstance(q);
2994
2995                qPos.add(groupId);
2996
2997                if (urlTitle != null) {
2998                    qPos.add(urlTitle);
2999                }
3000
3001                list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
3002                        start, end);
3003            }
3004            catch (Exception e) {
3005                throw processException(e);
3006            }
3007            finally {
3008                if (list == null) {
3009                    list = new ArrayList<JournalArticle>();
3010                }
3011
3012                cacheResult(list);
3013
3014                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_UT,
3015                    finderArgs, list);
3016
3017                closeSession(session);
3018            }
3019        }
3020
3021        return list;
3022    }
3023
3024    public JournalArticle findByG_UT_First(long groupId, String urlTitle,
3025        OrderByComparator obc) throws NoSuchArticleException, SystemException {
3026        List<JournalArticle> list = findByG_UT(groupId, urlTitle, 0, 1, obc);
3027
3028        if (list.isEmpty()) {
3029            StringBundler msg = new StringBundler(6);
3030
3031            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3032
3033            msg.append("groupId=");
3034            msg.append(groupId);
3035
3036            msg.append(", urlTitle=");
3037            msg.append(urlTitle);
3038
3039            msg.append(StringPool.CLOSE_CURLY_BRACE);
3040
3041            throw new NoSuchArticleException(msg.toString());
3042        }
3043        else {
3044            return list.get(0);
3045        }
3046    }
3047
3048    public JournalArticle findByG_UT_Last(long groupId, String urlTitle,
3049        OrderByComparator obc) throws NoSuchArticleException, SystemException {
3050        int count = countByG_UT(groupId, urlTitle);
3051
3052        List<JournalArticle> list = findByG_UT(groupId, urlTitle, count - 1,
3053                count, obc);
3054
3055        if (list.isEmpty()) {
3056            StringBundler msg = new StringBundler(6);
3057
3058            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3059
3060            msg.append("groupId=");
3061            msg.append(groupId);
3062
3063            msg.append(", urlTitle=");
3064            msg.append(urlTitle);
3065
3066            msg.append(StringPool.CLOSE_CURLY_BRACE);
3067
3068            throw new NoSuchArticleException(msg.toString());
3069        }
3070        else {
3071            return list.get(0);
3072        }
3073    }
3074
3075    public JournalArticle[] findByG_UT_PrevAndNext(long id, long groupId,
3076        String urlTitle, OrderByComparator obc)
3077        throws NoSuchArticleException, SystemException {
3078        JournalArticle journalArticle = findByPrimaryKey(id);
3079
3080        int count = countByG_UT(groupId, urlTitle);
3081
3082        Session session = null;
3083
3084        try {
3085            session = openSession();
3086
3087            StringBundler query = null;
3088
3089            if (obc != null) {
3090                query = new StringBundler(4 +
3091                        (obc.getOrderByFields().length * 3));
3092            }
3093            else {
3094                query = new StringBundler(4);
3095            }
3096
3097            query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
3098
3099            query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
3100
3101            if (urlTitle == null) {
3102                query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
3103            }
3104            else {
3105                if (urlTitle.equals(StringPool.BLANK)) {
3106                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
3107                }
3108                else {
3109                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
3110                }
3111            }
3112
3113            if (obc != null) {
3114                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
3115            }
3116
3117            else {
3118                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3119            }
3120
3121            String sql = query.toString();
3122
3123            Query q = session.createQuery(sql);
3124
3125            QueryPos qPos = QueryPos.getInstance(q);
3126
3127            qPos.add(groupId);
3128
3129            if (urlTitle != null) {
3130                qPos.add(urlTitle);
3131            }
3132
3133            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
3134                    journalArticle);
3135
3136            JournalArticle[] array = new JournalArticleImpl[3];
3137
3138            array[0] = (JournalArticle)objArray[0];
3139            array[1] = (JournalArticle)objArray[1];
3140            array[2] = (JournalArticle)objArray[2];
3141
3142            return array;
3143        }
3144        catch (Exception e) {
3145            throw processException(e);
3146        }
3147        finally {
3148            closeSession(session);
3149        }
3150    }
3151
3152    public List<JournalArticle> findByC_S(long companyId, int status)
3153        throws SystemException {
3154        Object[] finderArgs = new Object[] {
3155                new Long(companyId), new Integer(status)
3156            };
3157
3158        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_S,
3159                finderArgs, this);
3160
3161        if (list == null) {
3162            Session session = null;
3163
3164            try {
3165                session = openSession();
3166
3167                StringBundler query = new StringBundler(4);
3168
3169                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
3170
3171                query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
3172
3173                query.append(_FINDER_COLUMN_C_S_STATUS_2);
3174
3175                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3176
3177                String sql = query.toString();
3178
3179                Query q = session.createQuery(sql);
3180
3181                QueryPos qPos = QueryPos.getInstance(q);
3182
3183                qPos.add(companyId);
3184
3185                qPos.add(status);
3186
3187                list = q.list();
3188            }
3189            catch (Exception e) {
3190                throw processException(e);
3191            }
3192            finally {
3193                if (list == null) {
3194                    list = new ArrayList<JournalArticle>();
3195                }
3196
3197                cacheResult(list);
3198
3199                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_S, finderArgs,
3200                    list);
3201
3202                closeSession(session);
3203            }
3204        }
3205
3206        return list;
3207    }
3208
3209    public List<JournalArticle> findByC_S(long companyId, int status,
3210        int start, int end) throws SystemException {
3211        return findByC_S(companyId, status, start, end, null);
3212    }
3213
3214    public List<JournalArticle> findByC_S(long companyId, int status,
3215        int start, int end, OrderByComparator obc) throws SystemException {
3216        Object[] finderArgs = new Object[] {
3217                new Long(companyId), new Integer(status),
3218                
3219                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
3220            };
3221
3222        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_S,
3223                finderArgs, this);
3224
3225        if (list == null) {
3226            Session session = null;
3227
3228            try {
3229                session = openSession();
3230
3231                StringBundler query = null;
3232
3233                if (obc != null) {
3234                    query = new StringBundler(4 +
3235                            (obc.getOrderByFields().length * 3));
3236                }
3237                else {
3238                    query = new StringBundler(4);
3239                }
3240
3241                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
3242
3243                query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
3244
3245                query.append(_FINDER_COLUMN_C_S_STATUS_2);
3246
3247                if (obc != null) {
3248                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
3249                }
3250
3251                else {
3252                    query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3253                }
3254
3255                String sql = query.toString();
3256
3257                Query q = session.createQuery(sql);
3258
3259                QueryPos qPos = QueryPos.getInstance(q);
3260
3261                qPos.add(companyId);
3262
3263                qPos.add(status);
3264
3265                list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
3266                        start, end);
3267            }
3268            catch (Exception e) {
3269                throw processException(e);
3270            }
3271            finally {
3272                if (list == null) {
3273                    list = new ArrayList<JournalArticle>();
3274                }
3275
3276                cacheResult(list);
3277
3278                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_S,
3279                    finderArgs, list);
3280
3281                closeSession(session);
3282            }
3283        }
3284
3285        return list;
3286    }
3287
3288    public JournalArticle findByC_S_First(long companyId, int status,
3289        OrderByComparator obc) throws NoSuchArticleException, SystemException {
3290        List<JournalArticle> list = findByC_S(companyId, status, 0, 1, obc);
3291
3292        if (list.isEmpty()) {
3293            StringBundler msg = new StringBundler(6);
3294
3295            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3296
3297            msg.append("companyId=");
3298            msg.append(companyId);
3299
3300            msg.append(", status=");
3301            msg.append(status);
3302
3303            msg.append(StringPool.CLOSE_CURLY_BRACE);
3304
3305            throw new NoSuchArticleException(msg.toString());
3306        }
3307        else {
3308            return list.get(0);
3309        }
3310    }
3311
3312    public JournalArticle findByC_S_Last(long companyId, int status,
3313        OrderByComparator obc) throws NoSuchArticleException, SystemException {
3314        int count = countByC_S(companyId, status);
3315
3316        List<JournalArticle> list = findByC_S(companyId, status, count - 1,
3317                count, obc);
3318
3319        if (list.isEmpty()) {
3320            StringBundler msg = new StringBundler(6);
3321
3322            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3323
3324            msg.append("companyId=");
3325            msg.append(companyId);
3326
3327            msg.append(", status=");
3328            msg.append(status);
3329
3330            msg.append(StringPool.CLOSE_CURLY_BRACE);
3331
3332            throw new NoSuchArticleException(msg.toString());
3333        }
3334        else {
3335            return list.get(0);
3336        }
3337    }
3338
3339    public JournalArticle[] findByC_S_PrevAndNext(long id, long companyId,
3340        int status, OrderByComparator obc)
3341        throws NoSuchArticleException, SystemException {
3342        JournalArticle journalArticle = findByPrimaryKey(id);
3343
3344        int count = countByC_S(companyId, status);
3345
3346        Session session = null;
3347
3348        try {
3349            session = openSession();
3350
3351            StringBundler query = null;
3352
3353            if (obc != null) {
3354                query = new StringBundler(4 +
3355                        (obc.getOrderByFields().length * 3));
3356            }
3357            else {
3358                query = new StringBundler(4);
3359            }
3360
3361            query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
3362
3363            query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
3364
3365            query.append(_FINDER_COLUMN_C_S_STATUS_2);
3366
3367            if (obc != null) {
3368                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
3369            }
3370
3371            else {
3372                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3373            }
3374
3375            String sql = query.toString();
3376
3377            Query q = session.createQuery(sql);
3378
3379            QueryPos qPos = QueryPos.getInstance(q);
3380
3381            qPos.add(companyId);
3382
3383            qPos.add(status);
3384
3385            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
3386                    journalArticle);
3387
3388            JournalArticle[] array = new JournalArticleImpl[3];
3389
3390            array[0] = (JournalArticle)objArray[0];
3391            array[1] = (JournalArticle)objArray[1];
3392            array[2] = (JournalArticle)objArray[2];
3393
3394            return array;
3395        }
3396        catch (Exception e) {
3397            throw processException(e);
3398        }
3399        finally {
3400            closeSession(session);
3401        }
3402    }
3403
3404    public JournalArticle findByG_A_V(long groupId, String articleId,
3405        double version) throws NoSuchArticleException, SystemException {
3406        JournalArticle journalArticle = fetchByG_A_V(groupId, articleId, version);
3407
3408        if (journalArticle == null) {
3409            StringBundler msg = new StringBundler(8);
3410
3411            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3412
3413            msg.append("groupId=");
3414            msg.append(groupId);
3415
3416            msg.append(", articleId=");
3417            msg.append(articleId);
3418
3419            msg.append(", version=");
3420            msg.append(version);
3421
3422            msg.append(StringPool.CLOSE_CURLY_BRACE);
3423
3424            if (_log.isWarnEnabled()) {
3425                _log.warn(msg.toString());
3426            }
3427
3428            throw new NoSuchArticleException(msg.toString());
3429        }
3430
3431        return journalArticle;
3432    }
3433
3434    public JournalArticle fetchByG_A_V(long groupId, String articleId,
3435        double version) throws SystemException {
3436        return fetchByG_A_V(groupId, articleId, version, true);
3437    }
3438
3439    public JournalArticle fetchByG_A_V(long groupId, String articleId,
3440        double version, boolean retrieveFromCache) throws SystemException {
3441        Object[] finderArgs = new Object[] {
3442                new Long(groupId),
3443                
3444                articleId, new Double(version)
3445            };
3446
3447        Object result = null;
3448
3449        if (retrieveFromCache) {
3450            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_A_V,
3451                    finderArgs, this);
3452        }
3453
3454        if (result == null) {
3455            Session session = null;
3456
3457            try {
3458                session = openSession();
3459
3460                StringBundler query = new StringBundler(5);
3461
3462                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
3463
3464                query.append(_FINDER_COLUMN_G_A_V_GROUPID_2);
3465
3466                if (articleId == null) {
3467                    query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_1);
3468                }
3469                else {
3470                    if (articleId.equals(StringPool.BLANK)) {
3471                        query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_3);
3472                    }
3473                    else {
3474                        query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_2);
3475                    }
3476                }
3477
3478                query.append(_FINDER_COLUMN_G_A_V_VERSION_2);
3479
3480                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3481
3482                String sql = query.toString();
3483
3484                Query q = session.createQuery(sql);
3485
3486                QueryPos qPos = QueryPos.getInstance(q);
3487
3488                qPos.add(groupId);
3489
3490                if (articleId != null) {
3491                    qPos.add(articleId);
3492                }
3493
3494                qPos.add(version);
3495
3496                List<JournalArticle> list = q.list();
3497
3498                result = list;
3499
3500                JournalArticle journalArticle = null;
3501
3502                if (list.isEmpty()) {
3503                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_V,
3504                        finderArgs, list);
3505                }
3506                else {
3507                    journalArticle = list.get(0);
3508
3509                    cacheResult(journalArticle);
3510
3511                    if ((journalArticle.getGroupId() != groupId) ||
3512                            (journalArticle.getArticleId() == null) ||
3513                            !journalArticle.getArticleId().equals(articleId) ||
3514                            (journalArticle.getVersion() != version)) {
3515                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_V,
3516                            finderArgs, journalArticle);
3517                    }
3518                }
3519
3520                return journalArticle;
3521            }
3522            catch (Exception e) {
3523                throw processException(e);
3524            }
3525            finally {
3526                if (result == null) {
3527                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_V,
3528                        finderArgs, new ArrayList<JournalArticle>());
3529                }
3530
3531                closeSession(session);
3532            }
3533        }
3534        else {
3535            if (result instanceof List<?>) {
3536                return null;
3537            }
3538            else {
3539                return (JournalArticle)result;
3540            }
3541        }
3542    }
3543
3544    public List<JournalArticle> findByG_A_S(long groupId, String articleId,
3545        int status) throws SystemException {
3546        Object[] finderArgs = new Object[] {
3547                new Long(groupId),
3548                
3549                articleId, new Integer(status)
3550            };
3551
3552        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_A_S,
3553                finderArgs, this);
3554
3555        if (list == null) {
3556            Session session = null;
3557
3558            try {
3559                session = openSession();
3560
3561                StringBundler query = new StringBundler(5);
3562
3563                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
3564
3565                query.append(_FINDER_COLUMN_G_A_S_GROUPID_2);
3566
3567                if (articleId == null) {
3568                    query.append(_FINDER_COLUMN_G_A_S_ARTICLEID_1);
3569                }
3570                else {
3571                    if (articleId.equals(StringPool.BLANK)) {
3572                        query.append(_FINDER_COLUMN_G_A_S_ARTICLEID_3);
3573                    }
3574                    else {
3575                        query.append(_FINDER_COLUMN_G_A_S_ARTICLEID_2);
3576                    }
3577                }
3578
3579                query.append(_FINDER_COLUMN_G_A_S_STATUS_2);
3580
3581                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3582
3583                String sql = query.toString();
3584
3585                Query q = session.createQuery(sql);
3586
3587                QueryPos qPos = QueryPos.getInstance(q);
3588
3589                qPos.add(groupId);
3590
3591                if (articleId != null) {
3592                    qPos.add(articleId);
3593                }
3594
3595                qPos.add(status);
3596
3597                list = q.list();
3598            }
3599            catch (Exception e) {
3600                throw processException(e);
3601            }
3602            finally {
3603                if (list == null) {
3604                    list = new ArrayList<JournalArticle>();
3605                }
3606
3607                cacheResult(list);
3608
3609                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_A_S,
3610                    finderArgs, list);
3611
3612                closeSession(session);
3613            }
3614        }
3615
3616        return list;
3617    }
3618
3619    public List<JournalArticle> findByG_A_S(long groupId, String articleId,
3620        int status, int start, int end) throws SystemException {
3621        return findByG_A_S(groupId, articleId, status, start, end, null);
3622    }
3623
3624    public List<JournalArticle> findByG_A_S(long groupId, String articleId,
3625        int status, int start, int end, OrderByComparator obc)
3626        throws SystemException {
3627        Object[] finderArgs = new Object[] {
3628                new Long(groupId),
3629                
3630                articleId, new Integer(status),
3631                
3632                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
3633            };
3634
3635        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_A_S,
3636                finderArgs, this);
3637
3638        if (list == null) {
3639            Session session = null;
3640
3641            try {
3642                session = openSession();
3643
3644                StringBundler query = null;
3645
3646                if (obc != null) {
3647                    query = new StringBundler(5 +
3648                            (obc.getOrderByFields().length * 3));
3649                }
3650                else {
3651                    query = new StringBundler(5);
3652                }
3653
3654                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
3655
3656                query.append(_FINDER_COLUMN_G_A_S_GROUPID_2);
3657
3658                if (articleId == null) {
3659                    query.append(_FINDER_COLUMN_G_A_S_ARTICLEID_1);
3660                }
3661                else {
3662                    if (articleId.equals(StringPool.BLANK)) {
3663                        query.append(_FINDER_COLUMN_G_A_S_ARTICLEID_3);
3664                    }
3665                    else {
3666                        query.append(_FINDER_COLUMN_G_A_S_ARTICLEID_2);
3667                    }
3668                }
3669
3670                query.append(_FINDER_COLUMN_G_A_S_STATUS_2);
3671
3672                if (obc != null) {
3673                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
3674                }
3675
3676                else {
3677                    query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3678                }
3679
3680                String sql = query.toString();
3681
3682                Query q = session.createQuery(sql);
3683
3684                QueryPos qPos = QueryPos.getInstance(q);
3685
3686                qPos.add(groupId);
3687
3688                if (articleId != null) {
3689                    qPos.add(articleId);
3690                }
3691
3692                qPos.add(status);
3693
3694                list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
3695                        start, end);
3696            }
3697            catch (Exception e) {
3698                throw processException(e);
3699            }
3700            finally {
3701                if (list == null) {
3702                    list = new ArrayList<JournalArticle>();
3703                }
3704
3705                cacheResult(list);
3706
3707                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_A_S,
3708                    finderArgs, list);
3709
3710                closeSession(session);
3711            }
3712        }
3713
3714        return list;
3715    }
3716
3717    public JournalArticle findByG_A_S_First(long groupId, String articleId,
3718        int status, OrderByComparator obc)
3719        throws NoSuchArticleException, SystemException {
3720        List<JournalArticle> list = findByG_A_S(groupId, articleId, status, 0,
3721                1, obc);
3722
3723        if (list.isEmpty()) {
3724            StringBundler msg = new StringBundler(8);
3725
3726            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3727
3728            msg.append("groupId=");
3729            msg.append(groupId);
3730
3731            msg.append(", articleId=");
3732            msg.append(articleId);
3733
3734            msg.append(", status=");
3735            msg.append(status);
3736
3737            msg.append(StringPool.CLOSE_CURLY_BRACE);
3738
3739            throw new NoSuchArticleException(msg.toString());
3740        }
3741        else {
3742            return list.get(0);
3743        }
3744    }
3745
3746    public JournalArticle findByG_A_S_Last(long groupId, String articleId,
3747        int status, OrderByComparator obc)
3748        throws NoSuchArticleException, SystemException {
3749        int count = countByG_A_S(groupId, articleId, status);
3750
3751        List<JournalArticle> list = findByG_A_S(groupId, articleId, status,
3752                count - 1, count, obc);
3753
3754        if (list.isEmpty()) {
3755            StringBundler msg = new StringBundler(8);
3756
3757            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3758
3759            msg.append("groupId=");
3760            msg.append(groupId);
3761
3762            msg.append(", articleId=");
3763            msg.append(articleId);
3764
3765            msg.append(", status=");
3766            msg.append(status);
3767
3768            msg.append(StringPool.CLOSE_CURLY_BRACE);
3769
3770            throw new NoSuchArticleException(msg.toString());
3771        }
3772        else {
3773            return list.get(0);
3774        }
3775    }
3776
3777    public JournalArticle[] findByG_A_S_PrevAndNext(long id, long groupId,
3778        String articleId, int status, OrderByComparator obc)
3779        throws NoSuchArticleException, SystemException {
3780        JournalArticle journalArticle = findByPrimaryKey(id);
3781
3782        int count = countByG_A_S(groupId, articleId, status);
3783
3784        Session session = null;
3785
3786        try {
3787            session = openSession();
3788
3789            StringBundler query = null;
3790
3791            if (obc != null) {
3792                query = new StringBundler(5 +
3793                        (obc.getOrderByFields().length * 3));
3794            }
3795            else {
3796                query = new StringBundler(5);
3797            }
3798
3799            query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
3800
3801            query.append(_FINDER_COLUMN_G_A_S_GROUPID_2);
3802
3803            if (articleId == null) {
3804                query.append(_FINDER_COLUMN_G_A_S_ARTICLEID_1);
3805            }
3806            else {
3807                if (articleId.equals(StringPool.BLANK)) {
3808                    query.append(_FINDER_COLUMN_G_A_S_ARTICLEID_3);
3809                }
3810                else {
3811                    query.append(_FINDER_COLUMN_G_A_S_ARTICLEID_2);
3812                }
3813            }
3814
3815            query.append(_FINDER_COLUMN_G_A_S_STATUS_2);
3816
3817            if (obc != null) {
3818                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
3819            }
3820
3821            else {
3822                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3823            }
3824
3825            String sql = query.toString();
3826
3827            Query q = session.createQuery(sql);
3828
3829            QueryPos qPos = QueryPos.getInstance(q);
3830
3831            qPos.add(groupId);
3832
3833            if (articleId != null) {
3834                qPos.add(articleId);
3835            }
3836
3837            qPos.add(status);
3838
3839            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
3840                    journalArticle);
3841
3842            JournalArticle[] array = new JournalArticleImpl[3];
3843
3844            array[0] = (JournalArticle)objArray[0];
3845            array[1] = (JournalArticle)objArray[1];
3846            array[2] = (JournalArticle)objArray[2];
3847
3848            return array;
3849        }
3850        catch (Exception e) {
3851            throw processException(e);
3852        }
3853        finally {
3854            closeSession(session);
3855        }
3856    }
3857
3858    public List<JournalArticle> findByG_UT_S(long groupId, String urlTitle,
3859        int status) throws SystemException {
3860        Object[] finderArgs = new Object[] {
3861                new Long(groupId),
3862                
3863                urlTitle, new Integer(status)
3864            };
3865
3866        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_UT_S,
3867                finderArgs, this);
3868
3869        if (list == null) {
3870            Session session = null;
3871
3872            try {
3873                session = openSession();
3874
3875                StringBundler query = new StringBundler(5);
3876
3877                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
3878
3879                query.append(_FINDER_COLUMN_G_UT_S_GROUPID_2);
3880
3881                if (urlTitle == null) {
3882                    query.append(_FINDER_COLUMN_G_UT_S_URLTITLE_1);
3883                }
3884                else {
3885                    if (urlTitle.equals(StringPool.BLANK)) {
3886                        query.append(_FINDER_COLUMN_G_UT_S_URLTITLE_3);
3887                    }
3888                    else {
3889                        query.append(_FINDER_COLUMN_G_UT_S_URLTITLE_2);
3890                    }
3891                }
3892
3893                query.append(_FINDER_COLUMN_G_UT_S_STATUS_2);
3894
3895                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3896
3897                String sql = query.toString();
3898
3899                Query q = session.createQuery(sql);
3900
3901                QueryPos qPos = QueryPos.getInstance(q);
3902
3903                qPos.add(groupId);
3904
3905                if (urlTitle != null) {
3906                    qPos.add(urlTitle);
3907                }
3908
3909                qPos.add(status);
3910
3911                list = q.list();
3912            }
3913            catch (Exception e) {
3914                throw processException(e);
3915            }
3916            finally {
3917                if (list == null) {
3918                    list = new ArrayList<JournalArticle>();
3919                }
3920
3921                cacheResult(list);
3922
3923                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_UT_S,
3924                    finderArgs, list);
3925
3926                closeSession(session);
3927            }
3928        }
3929
3930        return list;
3931    }
3932
3933    public List<JournalArticle> findByG_UT_S(long groupId, String urlTitle,
3934        int status, int start, int end) throws SystemException {
3935        return findByG_UT_S(groupId, urlTitle, status, start, end, null);
3936    }
3937
3938    public List<JournalArticle> findByG_UT_S(long groupId, String urlTitle,
3939        int status, int start, int end, OrderByComparator obc)
3940        throws SystemException {
3941        Object[] finderArgs = new Object[] {
3942                new Long(groupId),
3943                
3944                urlTitle, new Integer(status),
3945                
3946                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
3947            };
3948
3949        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_UT_S,
3950                finderArgs, this);
3951
3952        if (list == null) {
3953            Session session = null;
3954
3955            try {
3956                session = openSession();
3957
3958                StringBundler query = null;
3959
3960                if (obc != null) {
3961                    query = new StringBundler(5 +
3962                            (obc.getOrderByFields().length * 3));
3963                }
3964                else {
3965                    query = new StringBundler(5);
3966                }
3967
3968                query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
3969
3970                query.append(_FINDER_COLUMN_G_UT_S_GROUPID_2);
3971
3972                if (urlTitle == null) {
3973                    query.append(_FINDER_COLUMN_G_UT_S_URLTITLE_1);
3974                }
3975                else {
3976                    if (urlTitle.equals(StringPool.BLANK)) {
3977                        query.append(_FINDER_COLUMN_G_UT_S_URLTITLE_3);
3978                    }
3979                    else {
3980                        query.append(_FINDER_COLUMN_G_UT_S_URLTITLE_2);
3981                    }
3982                }
3983
3984                query.append(_FINDER_COLUMN_G_UT_S_STATUS_2);
3985
3986                if (obc != null) {
3987                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
3988                }
3989
3990                else {
3991                    query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
3992                }
3993
3994                String sql = query.toString();
3995
3996                Query q = session.createQuery(sql);
3997
3998                QueryPos qPos = QueryPos.getInstance(q);
3999
4000                qPos.add(groupId);
4001
4002                if (urlTitle != null) {
4003                    qPos.add(urlTitle);
4004                }
4005
4006                qPos.add(status);
4007
4008                list = (List<JournalArticle>)QueryUtil.list(q, getDialect(),
4009                        start, end);
4010            }
4011            catch (Exception e) {
4012                throw processException(e);
4013            }
4014            finally {
4015                if (list == null) {
4016                    list = new ArrayList<JournalArticle>();
4017                }
4018
4019                cacheResult(list);
4020
4021                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_UT_S,
4022                    finderArgs, list);
4023
4024                closeSession(session);
4025            }
4026        }
4027
4028        return list;
4029    }
4030
4031    public JournalArticle findByG_UT_S_First(long groupId, String urlTitle,
4032        int status, OrderByComparator obc)
4033        throws NoSuchArticleException, SystemException {
4034        List<JournalArticle> list = findByG_UT_S(groupId, urlTitle, status, 0,
4035                1, obc);
4036
4037        if (list.isEmpty()) {
4038            StringBundler msg = new StringBundler(8);
4039
4040            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4041
4042            msg.append("groupId=");
4043            msg.append(groupId);
4044
4045            msg.append(", urlTitle=");
4046            msg.append(urlTitle);
4047
4048            msg.append(", status=");
4049            msg.append(status);
4050
4051            msg.append(StringPool.CLOSE_CURLY_BRACE);
4052
4053            throw new NoSuchArticleException(msg.toString());
4054        }
4055        else {
4056            return list.get(0);
4057        }
4058    }
4059
4060    public JournalArticle findByG_UT_S_Last(long groupId, String urlTitle,
4061        int status, OrderByComparator obc)
4062        throws NoSuchArticleException, SystemException {
4063        int count = countByG_UT_S(groupId, urlTitle, status);
4064
4065        List<JournalArticle> list = findByG_UT_S(groupId, urlTitle, status,
4066                count - 1, count, obc);
4067
4068        if (list.isEmpty()) {
4069            StringBundler msg = new StringBundler(8);
4070
4071            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4072
4073            msg.append("groupId=");
4074            msg.append(groupId);
4075
4076            msg.append(", urlTitle=");
4077            msg.append(urlTitle);
4078
4079            msg.append(", status=");
4080            msg.append(status);
4081
4082            msg.append(StringPool.CLOSE_CURLY_BRACE);
4083
4084            throw new NoSuchArticleException(msg.toString());
4085        }
4086        else {
4087            return list.get(0);
4088        }
4089    }
4090
4091    public JournalArticle[] findByG_UT_S_PrevAndNext(long id, long groupId,
4092        String urlTitle, int status, OrderByComparator obc)
4093        throws NoSuchArticleException, SystemException {
4094        JournalArticle journalArticle = findByPrimaryKey(id);
4095
4096        int count = countByG_UT_S(groupId, urlTitle, status);
4097
4098        Session session = null;
4099
4100        try {
4101            session = openSession();
4102
4103            StringBundler query = null;
4104
4105            if (obc != null) {
4106                query = new StringBundler(5 +
4107                        (obc.getOrderByFields().length * 3));
4108            }
4109            else {
4110                query = new StringBundler(5);
4111            }
4112
4113            query.append(_SQL_SELECT_JOURNALARTICLE_WHERE);
4114
4115            query.append(_FINDER_COLUMN_G_UT_S_GROUPID_2);
4116
4117            if (urlTitle == null) {
4118                query.append(_FINDER_COLUMN_G_UT_S_URLTITLE_1);
4119            }
4120            else {
4121                if (urlTitle.equals(StringPool.BLANK)) {
4122                    query.append(_FINDER_COLUMN_G_UT_S_URLTITLE_3);
4123                }
4124                else {
4125                    query.append(_FINDER_COLUMN_G_UT_S_URLTITLE_2);
4126                }
4127            }
4128
4129            query.append(_FINDER_COLUMN_G_UT_S_STATUS_2);
4130
4131            if (obc != null) {
4132                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
4133            }
4134
4135            else {
4136                query.append(JournalArticleModelImpl.ORDER_BY_JPQL);
4137            }
4138
4139            String sql = query.toString();
4140
4141            Query q = session.createQuery(sql);
4142
4143            QueryPos qPos = QueryPos.getInstance(q);
4144
4145            qPos.add(groupId);
4146
4147            if (urlTitle != null) {
4148                qPos.add(urlTitle);
4149            }
4150
4151            qPos.add(status);
4152
4153            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
4154                    journalArticle);
4155
4156            JournalArticle[] array = new JournalArticleImpl[3];
4157
4158            array[0] = (JournalArticle)objArray[0];
4159            array[1] = (JournalArticle)objArray[1];
4160            array[2] = (JournalArticle)objArray[2];
4161
4162            return array;
4163        }
4164        catch (Exception e) {
4165            throw processException(e);
4166        }
4167        finally {
4168            closeSession(session);
4169        }
4170    }
4171
4172    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
4173        throws SystemException {
4174        Session session = null;
4175
4176        try {
4177            session = openSession();
4178
4179            dynamicQuery.compile(session);
4180
4181            return dynamicQuery.list();
4182        }
4183        catch (Exception e) {
4184            throw processException(e);
4185        }
4186        finally {
4187            closeSession(session);
4188        }
4189    }
4190
4191    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
4192        int start, int end) throws SystemException {
4193        Session session = null;
4194
4195        try {
4196            session = openSession();
4197
4198            dynamicQuery.setLimit(start, end);
4199
4200            dynamicQuery.compile(session);
4201
4202            return dynamicQuery.list();
4203        }
4204        catch (Exception e) {
4205            throw processException(e);
4206        }
4207        finally {
4208            closeSession(session);
4209        }
4210    }
4211
4212    public List<JournalArticle> findAll() throws SystemException {
4213        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
4214    }
4215
4216    public List<JournalArticle> findAll(int start, int end)
4217        throws SystemException {
4218        return findAll(start, end, null);
4219    }
4220
4221    public List<JournalArticle> findAll(int start, int end,
4222        OrderByComparator obc) throws SystemException {
4223        Object[] finderArgs = new Object[] {
4224                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
4225            };
4226
4227        List<JournalArticle> list = (List<JournalArticle>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
4228                finderArgs, this);
4229
4230        if (list == null) {
4231            Session session = null;
4232
4233            try {
4234                session = openSession();
4235
4236                StringBundler query = null;
4237                String sql = null;
4238
4239                if (obc != null) {
4240                    query = new StringBundler(2 +
4241                            (obc.getOrderByFields().length * 3));
4242
4243                    query.append(_SQL_SELECT_JOURNALARTICLE);
4244
4245                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
4246
4247                    sql = query.toString();
4248                }
4249
4250                else {
4251                    sql = _SQL_SELECT_JOURNALARTICLE.concat(JournalArticleModelImpl.ORDER_BY_JPQL);
4252                }
4253
4254                Query q = session.createQuery(sql);
4255
4256                if (obc == null) {
4257                    list = (List<JournalArticle>)QueryUtil.list(q,
4258                            getDialect(), start, end, false);
4259
4260                    Collections.sort(list);
4261                }
4262                else {
4263                    list = (List<JournalArticle>)QueryUtil.list(q,
4264                            getDialect(), start, end);
4265                }
4266            }
4267            catch (Exception e) {
4268                throw processException(e);
4269            }
4270            finally {
4271                if (list == null) {
4272                    list = new ArrayList<JournalArticle>();
4273                }
4274
4275                cacheResult(list);
4276
4277                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
4278
4279                closeSession(session);
4280            }
4281        }
4282
4283        return list;
4284    }
4285
4286    public void removeByUuid(String uuid) throws SystemException {
4287        for (JournalArticle journalArticle : findByUuid(uuid)) {
4288            remove(journalArticle);
4289        }
4290    }
4291
4292    public void removeByUUID_G(String uuid, long groupId)
4293        throws NoSuchArticleException, SystemException {
4294        JournalArticle journalArticle = findByUUID_G(uuid, groupId);
4295
4296        remove(journalArticle);
4297    }
4298
4299    public void removeByGroupId(long groupId) throws SystemException {
4300        for (JournalArticle journalArticle : findByGroupId(groupId)) {
4301            remove(journalArticle);
4302        }
4303    }
4304
4305    public void removeByCompanyId(long companyId) throws SystemException {
4306        for (JournalArticle journalArticle : findByCompanyId(companyId)) {
4307            remove(journalArticle);
4308        }
4309    }
4310
4311    public void removeBySmallImageId(long smallImageId)
4312        throws SystemException {
4313        for (JournalArticle journalArticle : findBySmallImageId(smallImageId)) {
4314            remove(journalArticle);
4315        }
4316    }
4317
4318    public void removeByR_S(long resourcePrimKey, int status)
4319        throws SystemException {
4320        for (JournalArticle journalArticle : findByR_S(resourcePrimKey, status)) {
4321            remove(journalArticle);
4322        }
4323    }
4324
4325    public void removeByG_A(long groupId, String articleId)
4326        throws SystemException {
4327        for (JournalArticle journalArticle : findByG_A(groupId, articleId)) {
4328            remove(journalArticle);
4329        }
4330    }
4331
4332    public void removeByG_S(long groupId, String structureId)
4333        throws SystemException {
4334        for (JournalArticle journalArticle : findByG_S(groupId, structureId)) {
4335            remove(journalArticle);
4336        }
4337    }
4338
4339    public void removeByG_T(long groupId, String templateId)
4340        throws SystemException {
4341        for (JournalArticle journalArticle : findByG_T(groupId, templateId)) {
4342            remove(journalArticle);
4343        }
4344    }
4345
4346    public void removeByG_UT(long groupId, String urlTitle)
4347        throws SystemException {
4348        for (JournalArticle journalArticle : findByG_UT(groupId, urlTitle)) {
4349            remove(journalArticle);
4350        }
4351    }
4352
4353    public void removeByC_S(long companyId, int status)
4354        throws SystemException {
4355        for (JournalArticle journalArticle : findByC_S(companyId, status)) {
4356            remove(journalArticle);
4357        }
4358    }
4359
4360    public void removeByG_A_V(long groupId, String articleId, double version)
4361        throws NoSuchArticleException, SystemException {
4362        JournalArticle journalArticle = findByG_A_V(groupId, articleId, version);
4363
4364        remove(journalArticle);
4365    }
4366
4367    public void removeByG_A_S(long groupId, String articleId, int status)
4368        throws SystemException {
4369        for (JournalArticle journalArticle : findByG_A_S(groupId, articleId,
4370                status)) {
4371            remove(journalArticle);
4372        }
4373    }
4374
4375    public void removeByG_UT_S(long groupId, String urlTitle, int status)
4376        throws SystemException {
4377        for (JournalArticle journalArticle : findByG_UT_S(groupId, urlTitle,
4378                status)) {
4379            remove(journalArticle);
4380        }
4381    }
4382
4383    public void removeAll() throws SystemException {
4384        for (JournalArticle journalArticle : findAll()) {
4385            remove(journalArticle);
4386        }
4387    }
4388
4389    public int countByUuid(String uuid) throws SystemException {
4390        Object[] finderArgs = new Object[] { uuid };
4391
4392        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
4393                finderArgs, this);
4394
4395        if (count == null) {
4396            Session session = null;
4397
4398            try {
4399                session = openSession();
4400
4401                StringBundler query = new StringBundler(2);
4402
4403                query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
4404
4405                if (uuid == null) {
4406                    query.append(_FINDER_COLUMN_UUID_UUID_1);
4407                }
4408                else {
4409                    if (uuid.equals(StringPool.BLANK)) {
4410                        query.append(_FINDER_COLUMN_UUID_UUID_3);
4411                    }
4412                    else {
4413                        query.append(_FINDER_COLUMN_UUID_UUID_2);
4414                    }
4415                }
4416
4417                String sql = query.toString();
4418
4419                Query q = session.createQuery(sql);
4420
4421                QueryPos qPos = QueryPos.getInstance(q);
4422
4423                if (uuid != null) {
4424                    qPos.add(uuid);
4425                }
4426
4427                count = (Long)q.uniqueResult();
4428            }
4429            catch (Exception e) {
4430                throw processException(e);
4431            }
4432            finally {
4433                if (count == null) {
4434                    count = Long.valueOf(0);
4435                }
4436
4437                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
4438                    finderArgs, count);
4439
4440                closeSession(session);
4441            }
4442        }
4443
4444        return count.intValue();
4445    }
4446
4447    public int countByUUID_G(String uuid, long groupId)
4448        throws SystemException {
4449        Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
4450
4451        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
4452                finderArgs, this);
4453
4454        if (count == null) {
4455            Session session = null;
4456
4457            try {
4458                session = openSession();
4459
4460                StringBundler query = new StringBundler(3);
4461
4462                query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
4463
4464                if (uuid == null) {
4465                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
4466                }
4467                else {
4468                    if (uuid.equals(StringPool.BLANK)) {
4469                        query.append(_FINDER_COLUMN_UUID_G_UUID_3);
4470                    }
4471                    else {
4472                        query.append(_FINDER_COLUMN_UUID_G_UUID_2);
4473                    }
4474                }
4475
4476                query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
4477
4478                String sql = query.toString();
4479
4480                Query q = session.createQuery(sql);
4481
4482                QueryPos qPos = QueryPos.getInstance(q);
4483
4484                if (uuid != null) {
4485                    qPos.add(uuid);
4486                }
4487
4488                qPos.add(groupId);
4489
4490                count = (Long)q.uniqueResult();
4491            }
4492            catch (Exception e) {
4493                throw processException(e);
4494            }
4495            finally {
4496                if (count == null) {
4497                    count = Long.valueOf(0);
4498                }
4499
4500                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
4501                    finderArgs, count);
4502
4503                closeSession(session);
4504            }
4505        }
4506
4507        return count.intValue();
4508    }
4509
4510    public int countByGroupId(long groupId) throws SystemException {
4511        Object[] finderArgs = new Object[] { new Long(groupId) };
4512
4513        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
4514                finderArgs, this);
4515
4516        if (count == null) {
4517            Session session = null;
4518
4519            try {
4520                session = openSession();
4521
4522                StringBundler query = new StringBundler(2);
4523
4524                query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
4525
4526                query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
4527
4528                String sql = query.toString();
4529
4530                Query q = session.createQuery(sql);
4531
4532                QueryPos qPos = QueryPos.getInstance(q);
4533
4534                qPos.add(groupId);
4535
4536                count = (Long)q.uniqueResult();
4537            }
4538            catch (Exception e) {
4539                throw processException(e);
4540            }
4541            finally {
4542                if (count == null) {
4543                    count = Long.valueOf(0);
4544                }
4545
4546                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
4547                    finderArgs, count);
4548
4549                closeSession(session);
4550            }
4551        }
4552
4553        return count.intValue();
4554    }
4555
4556    public int countByCompanyId(long companyId) throws SystemException {
4557        Object[] finderArgs = new Object[] { new Long(companyId) };
4558
4559        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
4560                finderArgs, this);
4561
4562        if (count == null) {
4563            Session session = null;
4564
4565            try {
4566                session = openSession();
4567
4568                StringBundler query = new StringBundler(2);
4569
4570                query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
4571
4572                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
4573
4574                String sql = query.toString();
4575
4576                Query q = session.createQuery(sql);
4577
4578                QueryPos qPos = QueryPos.getInstance(q);
4579
4580                qPos.add(companyId);
4581
4582                count = (Long)q.uniqueResult();
4583            }
4584            catch (Exception e) {
4585                throw processException(e);
4586            }
4587            finally {
4588                if (count == null) {
4589                    count = Long.valueOf(0);
4590                }
4591
4592                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
4593                    finderArgs, count);
4594
4595                closeSession(session);
4596            }
4597        }
4598
4599        return count.intValue();
4600    }
4601
4602    public int countBySmallImageId(long smallImageId) throws SystemException {
4603        Object[] finderArgs = new Object[] { new Long(smallImageId) };
4604
4605        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
4606                finderArgs, this);
4607
4608        if (count == null) {
4609            Session session = null;
4610
4611            try {
4612                session = openSession();
4613
4614                StringBundler query = new StringBundler(2);
4615
4616                query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
4617
4618                query.append(_FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2);
4619
4620                String sql = query.toString();
4621
4622                Query q = session.createQuery(sql);
4623
4624                QueryPos qPos = QueryPos.getInstance(q);
4625
4626                qPos.add(smallImageId);
4627
4628                count = (Long)q.uniqueResult();
4629            }
4630            catch (Exception e) {
4631                throw processException(e);
4632            }
4633            finally {
4634                if (count == null) {
4635                    count = Long.valueOf(0);
4636                }
4637
4638                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
4639                    finderArgs, count);
4640
4641                closeSession(session);
4642            }
4643        }
4644
4645        return count.intValue();
4646    }
4647
4648    public int countByR_S(long resourcePrimKey, int status)
4649        throws SystemException {
4650        Object[] finderArgs = new Object[] {
4651                new Long(resourcePrimKey), new Integer(status)
4652            };
4653
4654        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_R_S,
4655                finderArgs, this);
4656
4657        if (count == null) {
4658            Session session = null;
4659
4660            try {
4661                session = openSession();
4662
4663                StringBundler query = new StringBundler(3);
4664
4665                query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
4666
4667                query.append(_FINDER_COLUMN_R_S_RESOURCEPRIMKEY_2);
4668
4669                query.append(_FINDER_COLUMN_R_S_STATUS_2);
4670
4671                String sql = query.toString();
4672
4673                Query q = session.createQuery(sql);
4674
4675                QueryPos qPos = QueryPos.getInstance(q);
4676
4677                qPos.add(resourcePrimKey);
4678
4679                qPos.add(status);
4680
4681                count = (Long)q.uniqueResult();
4682            }
4683            catch (Exception e) {
4684                throw processException(e);
4685            }
4686            finally {
4687                if (count == null) {
4688                    count = Long.valueOf(0);
4689                }
4690
4691                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_R_S, finderArgs,
4692                    count);
4693
4694                closeSession(session);
4695            }
4696        }
4697
4698        return count.intValue();
4699    }
4700
4701    public int countByG_A(long groupId, String articleId)
4702        throws SystemException {
4703        Object[] finderArgs = new Object[] { new Long(groupId), articleId };
4704
4705        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_A,
4706                finderArgs, this);
4707
4708        if (count == null) {
4709            Session session = null;
4710
4711            try {
4712                session = openSession();
4713
4714                StringBundler query = new StringBundler(3);
4715
4716                query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
4717
4718                query.append(_FINDER_COLUMN_G_A_GROUPID_2);
4719
4720                if (articleId == null) {
4721                    query.append(_FINDER_COLUMN_G_A_ARTICLEID_1);
4722                }
4723                else {
4724                    if (articleId.equals(StringPool.BLANK)) {
4725                        query.append(_FINDER_COLUMN_G_A_ARTICLEID_3);
4726                    }
4727                    else {
4728                        query.append(_FINDER_COLUMN_G_A_ARTICLEID_2);
4729                    }
4730                }
4731
4732                String sql = query.toString();
4733
4734                Query q = session.createQuery(sql);
4735
4736                QueryPos qPos = QueryPos.getInstance(q);
4737
4738                qPos.add(groupId);
4739
4740                if (articleId != null) {
4741                    qPos.add(articleId);
4742                }
4743
4744                count = (Long)q.uniqueResult();
4745            }
4746            catch (Exception e) {
4747                throw processException(e);
4748            }
4749            finally {
4750                if (count == null) {
4751                    count = Long.valueOf(0);
4752                }
4753
4754                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_A, finderArgs,
4755                    count);
4756
4757                closeSession(session);
4758            }
4759        }
4760
4761        return count.intValue();
4762    }
4763
4764    public int countByG_S(long groupId, String structureId)
4765        throws SystemException {
4766        Object[] finderArgs = new Object[] { new Long(groupId), structureId };
4767
4768        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_S,
4769                finderArgs, this);
4770
4771        if (count == null) {
4772            Session session = null;
4773
4774            try {
4775                session = openSession();
4776
4777                StringBundler query = new StringBundler(3);
4778
4779                query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
4780
4781                query.append(_FINDER_COLUMN_G_S_GROUPID_2);
4782
4783                if (structureId == null) {
4784                    query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
4785                }
4786                else {
4787                    if (structureId.equals(StringPool.BLANK)) {
4788                        query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
4789                    }
4790                    else {
4791                        query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
4792                    }
4793                }
4794
4795                String sql = query.toString();
4796
4797                Query q = session.createQuery(sql);
4798
4799                QueryPos qPos = QueryPos.getInstance(q);
4800
4801                qPos.add(groupId);
4802
4803                if (structureId != null) {
4804                    qPos.add(structureId);
4805                }
4806
4807                count = (Long)q.uniqueResult();
4808            }
4809            catch (Exception e) {
4810                throw processException(e);
4811            }
4812            finally {
4813                if (count == null) {
4814                    count = Long.valueOf(0);
4815                }
4816
4817                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_S, finderArgs,
4818                    count);
4819
4820                closeSession(session);
4821            }
4822        }
4823
4824        return count.intValue();
4825    }
4826
4827    public int countByG_T(long groupId, String templateId)
4828        throws SystemException {
4829        Object[] finderArgs = new Object[] { new Long(groupId), templateId };
4830
4831        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_T,
4832                finderArgs, this);
4833
4834        if (count == null) {
4835            Session session = null;
4836
4837            try {
4838                session = openSession();
4839
4840                StringBundler query = new StringBundler(3);
4841
4842                query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
4843
4844                query.append(_FINDER_COLUMN_G_T_GROUPID_2);
4845
4846                if (templateId == null) {
4847                    query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
4848                }
4849                else {
4850                    if (templateId.equals(StringPool.BLANK)) {
4851                        query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
4852                    }
4853                    else {
4854                        query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
4855                    }
4856                }
4857
4858                String sql = query.toString();
4859
4860                Query q = session.createQuery(sql);
4861
4862                QueryPos qPos = QueryPos.getInstance(q);
4863
4864                qPos.add(groupId);
4865
4866                if (templateId != null) {
4867                    qPos.add(templateId);
4868                }
4869
4870                count = (Long)q.uniqueResult();
4871            }
4872            catch (Exception e) {
4873                throw processException(e);
4874            }
4875            finally {
4876                if (count == null) {
4877                    count = Long.valueOf(0);
4878                }
4879
4880                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_T, finderArgs,
4881                    count);
4882
4883                closeSession(session);
4884            }
4885        }
4886
4887        return count.intValue();
4888    }
4889
4890    public int countByG_UT(long groupId, String urlTitle)
4891        throws SystemException {
4892        Object[] finderArgs = new Object[] { new Long(groupId), urlTitle };
4893
4894        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_UT,
4895                finderArgs, this);
4896
4897        if (count == null) {
4898            Session session = null;
4899
4900            try {
4901                session = openSession();
4902
4903                StringBundler query = new StringBundler(3);
4904
4905                query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
4906
4907                query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
4908
4909                if (urlTitle == null) {
4910                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
4911                }
4912                else {
4913                    if (urlTitle.equals(StringPool.BLANK)) {
4914                        query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
4915                    }
4916                    else {
4917                        query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
4918                    }
4919                }
4920
4921                String sql = query.toString();
4922
4923                Query q = session.createQuery(sql);
4924
4925                QueryPos qPos = QueryPos.getInstance(q);
4926
4927                qPos.add(groupId);
4928
4929                if (urlTitle != null) {
4930                    qPos.add(urlTitle);
4931                }
4932
4933                count = (Long)q.uniqueResult();
4934            }
4935            catch (Exception e) {
4936                throw processException(e);
4937            }
4938            finally {
4939                if (count == null) {
4940                    count = Long.valueOf(0);
4941                }
4942
4943                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_UT,
4944                    finderArgs, count);
4945
4946                closeSession(session);
4947            }
4948        }
4949
4950        return count.intValue();
4951    }
4952
4953    public int countByC_S(long companyId, int status) throws SystemException {
4954        Object[] finderArgs = new Object[] {
4955                new Long(companyId), new Integer(status)
4956            };
4957
4958        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_S,
4959                finderArgs, this);
4960
4961        if (count == null) {
4962            Session session = null;
4963
4964            try {
4965                session = openSession();
4966
4967                StringBundler query = new StringBundler(3);
4968
4969                query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
4970
4971                query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
4972
4973                query.append(_FINDER_COLUMN_C_S_STATUS_2);
4974
4975                String sql = query.toString();
4976
4977                Query q = session.createQuery(sql);
4978
4979                QueryPos qPos = QueryPos.getInstance(q);
4980
4981                qPos.add(companyId);
4982
4983                qPos.add(status);
4984
4985                count = (Long)q.uniqueResult();
4986            }
4987            catch (Exception e) {
4988                throw processException(e);
4989            }
4990            finally {
4991                if (count == null) {
4992                    count = Long.valueOf(0);
4993                }
4994
4995                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_S, finderArgs,
4996                    count);
4997
4998                closeSession(session);
4999            }
5000        }
5001
5002        return count.intValue();
5003    }
5004
5005    public int countByG_A_V(long groupId, String articleId, double version)
5006        throws SystemException {
5007        Object[] finderArgs = new Object[] {
5008                new Long(groupId),
5009                
5010                articleId, new Double(version)
5011            };
5012
5013        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_A_V,
5014                finderArgs, this);
5015
5016        if (count == null) {
5017            Session session = null;
5018
5019            try {
5020                session = openSession();
5021
5022                StringBundler query = new StringBundler(4);
5023
5024                query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
5025
5026                query.append(_FINDER_COLUMN_G_A_V_GROUPID_2);
5027
5028                if (articleId == null) {
5029                    query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_1);
5030                }
5031                else {
5032                    if (articleId.equals(StringPool.BLANK)) {
5033                        query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_3);
5034                    }
5035                    else {
5036                        query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_2);
5037                    }
5038                }
5039
5040                query.append(_FINDER_COLUMN_G_A_V_VERSION_2);
5041
5042                String sql = query.toString();
5043
5044                Query q = session.createQuery(sql);
5045
5046                QueryPos qPos = QueryPos.getInstance(q);
5047
5048                qPos.add(groupId);
5049
5050                if (articleId != null) {
5051                    qPos.add(articleId);
5052                }
5053
5054                qPos.add(version);
5055
5056                count = (Long)q.uniqueResult();
5057            }
5058            catch (Exception e) {
5059                throw processException(e);
5060            }
5061            finally {
5062                if (count == null) {
5063                    count = Long.valueOf(0);
5064                }
5065
5066                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_A_V,
5067                    finderArgs, count);
5068
5069                closeSession(session);
5070            }
5071        }
5072
5073        return count.intValue();
5074    }
5075
5076    public int countByG_A_S(long groupId, String articleId, int status)
5077        throws SystemException {
5078        Object[] finderArgs = new Object[] {
5079                new Long(groupId),
5080                
5081                articleId, new Integer(status)
5082            };
5083
5084        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_A_S,
5085                finderArgs, this);
5086
5087        if (count == null) {
5088            Session session = null;
5089
5090            try {
5091                session = openSession();
5092
5093                StringBundler query = new StringBundler(4);
5094
5095                query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
5096
5097                query.append(_FINDER_COLUMN_G_A_S_GROUPID_2);
5098
5099                if (articleId == null) {
5100                    query.append(_FINDER_COLUMN_G_A_S_ARTICLEID_1);
5101                }
5102                else {
5103                    if (articleId.equals(StringPool.BLANK)) {
5104                        query.append(_FINDER_COLUMN_G_A_S_ARTICLEID_3);
5105                    }
5106                    else {
5107                        query.append(_FINDER_COLUMN_G_A_S_ARTICLEID_2);
5108                    }
5109                }
5110
5111                query.append(_FINDER_COLUMN_G_A_S_STATUS_2);
5112
5113                String sql = query.toString();
5114
5115                Query q = session.createQuery(sql);
5116
5117                QueryPos qPos = QueryPos.getInstance(q);
5118
5119                qPos.add(groupId);
5120
5121                if (articleId != null) {
5122                    qPos.add(articleId);
5123                }
5124
5125                qPos.add(status);
5126
5127                count = (Long)q.uniqueResult();
5128            }
5129            catch (Exception e) {
5130                throw processException(e);
5131            }
5132            finally {
5133                if (count == null) {
5134                    count = Long.valueOf(0);
5135                }
5136
5137                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_A_S,
5138                    finderArgs, count);
5139
5140                closeSession(session);
5141            }
5142        }
5143
5144        return count.intValue();
5145    }
5146
5147    public int countByG_UT_S(long groupId, String urlTitle, int status)
5148        throws SystemException {
5149        Object[] finderArgs = new Object[] {
5150                new Long(groupId),
5151                
5152                urlTitle, new Integer(status)
5153            };
5154
5155        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_UT_S,
5156                finderArgs, this);
5157
5158        if (count == null) {
5159            Session session = null;
5160
5161            try {
5162                session = openSession();
5163
5164                StringBundler query = new StringBundler(4);
5165
5166                query.append(_SQL_COUNT_JOURNALARTICLE_WHERE);
5167
5168                query.append(_FINDER_COLUMN_G_UT_S_GROUPID_2);
5169
5170                if (urlTitle == null) {
5171                    query.append(_FINDER_COLUMN_G_UT_S_URLTITLE_1);
5172                }
5173                else {
5174                    if (urlTitle.equals(StringPool.BLANK)) {
5175                        query.append(_FINDER_COLUMN_G_UT_S_URLTITLE_3);
5176                    }
5177                    else {
5178                        query.append(_FINDER_COLUMN_G_UT_S_URLTITLE_2);
5179                    }
5180                }
5181
5182                query.append(_FINDER_COLUMN_G_UT_S_STATUS_2);
5183
5184                String sql = query.toString();
5185
5186                Query q = session.createQuery(sql);
5187
5188                QueryPos qPos = QueryPos.getInstance(q);
5189
5190                qPos.add(groupId);
5191
5192                if (urlTitle != null) {
5193                    qPos.add(urlTitle);
5194                }
5195
5196                qPos.add(status);
5197
5198                count = (Long)q.uniqueResult();
5199            }
5200            catch (Exception e) {
5201                throw processException(e);
5202            }
5203            finally {
5204                if (count == null) {
5205                    count = Long.valueOf(0);
5206                }
5207
5208                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_UT_S,
5209                    finderArgs, count);
5210
5211                closeSession(session);
5212            }
5213        }
5214
5215        return count.intValue();
5216    }
5217
5218    public int countAll() throws SystemException {
5219        Object[] finderArgs = new Object[0];
5220
5221        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
5222                finderArgs, this);
5223
5224        if (count == null) {
5225            Session session = null;
5226
5227            try {
5228                session = openSession();
5229
5230                Query q = session.createQuery(_SQL_COUNT_JOURNALARTICLE);
5231
5232                count = (Long)q.uniqueResult();
5233            }
5234            catch (Exception e) {
5235                throw processException(e);
5236            }
5237            finally {
5238                if (count == null) {
5239                    count = Long.valueOf(0);
5240                }
5241
5242                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
5243                    count);
5244
5245                closeSession(session);
5246            }
5247        }
5248
5249        return count.intValue();
5250    }
5251
5252    public void afterPropertiesSet() {
5253        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
5254                    com.liferay.portal.util.PropsUtil.get(
5255                        "value.object.listener.com.liferay.portlet.journal.model.JournalArticle")));
5256
5257        if (listenerClassNames.length > 0) {
5258            try {
5259                List<ModelListener<JournalArticle>> listenersList = new ArrayList<ModelListener<JournalArticle>>();
5260
5261                for (String listenerClassName : listenerClassNames) {
5262                    listenersList.add((ModelListener<JournalArticle>)Class.forName(
5263                            listenerClassName).newInstance());
5264                }
5265
5266                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
5267            }
5268            catch (Exception e) {
5269                _log.error(e);
5270            }
5271        }
5272    }
5273
5274    @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalArticlePersistence")
5275    protected com.liferay.portlet.journal.service.persistence.JournalArticlePersistence journalArticlePersistence;
5276    @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalArticleImagePersistence")
5277    protected com.liferay.portlet.journal.service.persistence.JournalArticleImagePersistence journalArticleImagePersistence;
5278    @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalArticleResourcePersistence")
5279    protected com.liferay.portlet.journal.service.persistence.JournalArticleResourcePersistence journalArticleResourcePersistence;
5280    @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalContentSearchPersistence")
5281    protected com.liferay.portlet.journal.service.persistence.JournalContentSearchPersistence journalContentSearchPersistence;
5282    @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalFeedPersistence")
5283    protected com.liferay.portlet.journal.service.persistence.JournalFeedPersistence journalFeedPersistence;
5284    @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalStructurePersistence")
5285    protected com.liferay.portlet.journal.service.persistence.JournalStructurePersistence journalStructurePersistence;
5286    @BeanReference(name = "com.liferay.portlet.journal.service.persistence.JournalTemplatePersistence")
5287    protected com.liferay.portlet.journal.service.persistence.JournalTemplatePersistence journalTemplatePersistence;
5288    @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence")
5289    protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
5290    @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence")
5291    protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
5292    @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence")
5293    protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
5294    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence")
5295    protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
5296    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
5297    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
5298    @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence")
5299    protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
5300    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
5301    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
5302    @BeanReference(name = "com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence")
5303    protected com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
5304    @BeanReference(name = "com.liferay.portlet.asset.service.persistence.AssetCategoryPersistence")
5305    protected com.liferay.portlet.asset.service.persistence.AssetCategoryPersistence assetCategoryPersistence;
5306    @BeanReference(name = "com.liferay.portlet.asset.service.persistence.AssetEntryPersistence")
5307    protected com.liferay.portlet.asset.service.persistence.AssetEntryPersistence assetEntryPersistence;
5308    @BeanReference(name = "com.liferay.portlet.asset.service.persistence.AssetTagPersistence")
5309    protected com.liferay.portlet.asset.service.persistence.AssetTagPersistence assetTagPersistence;
5310    @BeanReference(name = "com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence")
5311    protected com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence expandoValuePersistence;
5312    @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence")
5313    protected com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence mbMessagePersistence;
5314    @BeanReference(name = "com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence")
5315    protected com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence ratingsStatsPersistence;
5316    private static final String _SQL_SELECT_JOURNALARTICLE = "SELECT journalArticle FROM JournalArticle journalArticle";
5317    private static final String _SQL_SELECT_JOURNALARTICLE_WHERE = "SELECT journalArticle FROM JournalArticle journalArticle WHERE ";
5318    private static final String _SQL_COUNT_JOURNALARTICLE = "SELECT COUNT(journalArticle) FROM JournalArticle journalArticle";
5319    private static final String _SQL_COUNT_JOURNALARTICLE_WHERE = "SELECT COUNT(journalArticle) FROM JournalArticle journalArticle WHERE ";
5320    private static final String _FINDER_COLUMN_UUID_UUID_1 = "journalArticle.uuid IS NULL";
5321    private static final String _FINDER_COLUMN_UUID_UUID_2 = "journalArticle.uuid = ?";
5322    private static final String _FINDER_COLUMN_UUID_UUID_3 = "(journalArticle.uuid IS NULL OR journalArticle.uuid = ?)";
5323    private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "journalArticle.uuid IS NULL AND ";
5324    private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "journalArticle.uuid = ? AND ";
5325    private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(journalArticle.uuid IS NULL OR journalArticle.uuid = ?) AND ";
5326    private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "journalArticle.groupId = ?";
5327    private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "journalArticle.groupId = ?";
5328    private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "journalArticle.companyId = ?";
5329    private static final String _FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2 = "journalArticle.smallImageId = ?";
5330    private static final String _FINDER_COLUMN_R_S_RESOURCEPRIMKEY_2 = "journalArticle.resourcePrimKey = ? AND ";
5331    private static final String _FINDER_COLUMN_R_S_STATUS_2 = "journalArticle.status = ?";
5332    private static final String _FINDER_COLUMN_G_A_GROUPID_2 = "journalArticle.groupId = ? AND ";
5333    private static final String _FINDER_COLUMN_G_A_ARTICLEID_1 = "journalArticle.articleId IS NULL";
5334    private static final String _FINDER_COLUMN_G_A_ARTICLEID_2 = "journalArticle.articleId = ?";
5335    private static final String _FINDER_COLUMN_G_A_ARTICLEID_3 = "(journalArticle.articleId IS NULL OR journalArticle.articleId = ?)";
5336    private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "journalArticle.groupId = ? AND ";
5337    private static final String _FINDER_COLUMN_G_S_STRUCTUREID_1 = "journalArticle.structureId IS NULL";
5338    private static final String _FINDER_COLUMN_G_S_STRUCTUREID_2 = "journalArticle.structureId = ?";
5339    private static final String _FINDER_COLUMN_G_S_STRUCTUREID_3 = "(journalArticle.structureId IS NULL OR journalArticle.structureId = ?)";
5340    private static final String _FINDER_COLUMN_G_T_GROUPID_2 = "journalArticle.groupId = ? AND ";
5341    private static final String _FINDER_COLUMN_G_T_TEMPLATEID_1 = "journalArticle.templateId IS NULL";
5342    private static final String _FINDER_COLUMN_G_T_TEMPLATEID_2 = "journalArticle.templateId = ?";
5343    private static final String _FINDER_COLUMN_G_T_TEMPLATEID_3 = "(journalArticle.templateId IS NULL OR journalArticle.templateId = ?)";
5344    private static final String _FINDER_COLUMN_G_UT_GROUPID_2 = "journalArticle.groupId = ? AND ";
5345    private static final String _FINDER_COLUMN_G_UT_URLTITLE_1 = "journalArticle.urlTitle IS NULL";
5346    private static final String _FINDER_COLUMN_G_UT_URLTITLE_2 = "journalArticle.urlTitle = ?";
5347    private static final String _FINDER_COLUMN_G_UT_URLTITLE_3 = "(journalArticle.urlTitle IS NULL OR journalArticle.urlTitle = ?)";
5348    private static final String _FINDER_COLUMN_C_S_COMPANYID_2 = "journalArticle.companyId = ? AND ";
5349    private static final String _FINDER_COLUMN_C_S_STATUS_2 = "journalArticle.status = ?";
5350    private static final String _FINDER_COLUMN_G_A_V_GROUPID_2 = "journalArticle.groupId = ? AND ";
5351    private static final String _FINDER_COLUMN_G_A_V_ARTICLEID_1 = "journalArticle.articleId IS NULL AND ";
5352    private static final String _FINDER_COLUMN_G_A_V_ARTICLEID_2 = "journalArticle.articleId = ? AND ";
5353    private static final String _FINDER_COLUMN_G_A_V_ARTICLEID_3 = "(journalArticle.articleId IS NULL OR journalArticle.articleId = ?) AND ";
5354    private static final String _FINDER_COLUMN_G_A_V_VERSION_2 = "journalArticle.version = ?";
5355    private static final String _FINDER_COLUMN_G_A_S_GROUPID_2 = "journalArticle.groupId = ? AND ";
5356    private static final String _FINDER_COLUMN_G_A_S_ARTICLEID_1 = "journalArticle.articleId IS NULL AND ";
5357    private static final String _FINDER_COLUMN_G_A_S_ARTICLEID_2 = "journalArticle.articleId = ? AND ";
5358    private static final String _FINDER_COLUMN_G_A_S_ARTICLEID_3 = "(journalArticle.articleId IS NULL OR journalArticle.articleId = ?) AND ";
5359    private static final String _FINDER_COLUMN_G_A_S_STATUS_2 = "journalArticle.status = ?";
5360    private static final String _FINDER_COLUMN_G_UT_S_GROUPID_2 = "journalArticle.groupId = ? AND ";
5361    private static final String _FINDER_COLUMN_G_UT_S_URLTITLE_1 = "journalArticle.urlTitle IS NULL AND ";
5362    private static final String _FINDER_COLUMN_G_UT_S_URLTITLE_2 = "journalArticle.urlTitle = ? AND ";
5363    private static final String _FINDER_COLUMN_G_UT_S_URLTITLE_3 = "(journalArticle.urlTitle IS NULL OR journalArticle.urlTitle = ?) AND ";
5364    private static final String _FINDER_COLUMN_G_UT_S_STATUS_2 = "journalArticle.status = ?";
5365    private static final String _ORDER_BY_ENTITY_ALIAS = "journalArticle.";
5366    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No JournalArticle exists with the primary key ";
5367    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No JournalArticle exists with the key {";
5368    private static Log _log = LogFactoryUtil.getLog(JournalArticlePersistenceImpl.class);
5369}