1
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.EntityCacheUtil;
21 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
22 import com.liferay.portal.kernel.dao.orm.FinderPath;
23 import com.liferay.portal.kernel.dao.orm.Query;
24 import com.liferay.portal.kernel.dao.orm.QueryPos;
25 import com.liferay.portal.kernel.dao.orm.QueryUtil;
26 import com.liferay.portal.kernel.dao.orm.SQLQuery;
27 import com.liferay.portal.kernel.dao.orm.Session;
28 import com.liferay.portal.kernel.dao.orm.Type;
29 import com.liferay.portal.kernel.exception.SystemException;
30 import com.liferay.portal.kernel.log.Log;
31 import com.liferay.portal.kernel.log.LogFactoryUtil;
32 import com.liferay.portal.kernel.util.GetterUtil;
33 import com.liferay.portal.kernel.util.InstanceFactory;
34 import com.liferay.portal.kernel.util.OrderByComparator;
35 import com.liferay.portal.kernel.util.StringBundler;
36 import com.liferay.portal.kernel.util.StringPool;
37 import com.liferay.portal.kernel.util.StringUtil;
38 import com.liferay.portal.kernel.util.Validator;
39 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
40 import com.liferay.portal.model.ModelListener;
41 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
42 import com.liferay.portal.service.persistence.BatchSessionUtil;
43 import com.liferay.portal.service.persistence.ImagePersistence;
44 import com.liferay.portal.service.persistence.ResourcePersistence;
45 import com.liferay.portal.service.persistence.UserPersistence;
46 import com.liferay.portal.service.persistence.WebDAVPropsPersistence;
47 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
48
49 import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
50 import com.liferay.portlet.journal.NoSuchTemplateException;
51 import com.liferay.portlet.journal.model.JournalTemplate;
52 import com.liferay.portlet.journal.model.impl.JournalTemplateImpl;
53 import com.liferay.portlet.journal.model.impl.JournalTemplateModelImpl;
54
55 import java.io.Serializable;
56
57 import java.util.ArrayList;
58 import java.util.Collections;
59 import java.util.List;
60
61
74 public class JournalTemplatePersistenceImpl extends BasePersistenceImpl<JournalTemplate>
75 implements JournalTemplatePersistence {
76 public static final String FINDER_CLASS_NAME_ENTITY = JournalTemplateImpl.class.getName();
77 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
78 ".List";
79 public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
80 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
81 FINDER_CLASS_NAME_LIST, "findByUuid",
82 new String[] {
83 String.class.getName(),
84
85 "java.lang.Integer", "java.lang.Integer",
86 "com.liferay.portal.kernel.util.OrderByComparator"
87 });
88 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
89 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
90 FINDER_CLASS_NAME_LIST, "countByUuid",
91 new String[] { String.class.getName() });
92 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
93 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
94 FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
95 new String[] { String.class.getName(), Long.class.getName() });
96 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
97 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
98 FINDER_CLASS_NAME_LIST, "countByUUID_G",
99 new String[] { String.class.getName(), Long.class.getName() });
100 public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
101 JournalTemplateModelImpl.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(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
110 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
111 FINDER_CLASS_NAME_LIST, "countByGroupId",
112 new String[] { Long.class.getName() });
113 public static final FinderPath FINDER_PATH_FIND_BY_TEMPLATEID = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
114 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
115 FINDER_CLASS_NAME_LIST, "findByTemplateId",
116 new String[] {
117 String.class.getName(),
118
119 "java.lang.Integer", "java.lang.Integer",
120 "com.liferay.portal.kernel.util.OrderByComparator"
121 });
122 public static final FinderPath FINDER_PATH_COUNT_BY_TEMPLATEID = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
123 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
124 FINDER_CLASS_NAME_LIST, "countByTemplateId",
125 new String[] { String.class.getName() });
126 public static final FinderPath FINDER_PATH_FETCH_BY_SMALLIMAGEID = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
127 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
128 FINDER_CLASS_NAME_ENTITY, "fetchBySmallImageId",
129 new String[] { Long.class.getName() });
130 public static final FinderPath FINDER_PATH_COUNT_BY_SMALLIMAGEID = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
131 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
132 FINDER_CLASS_NAME_LIST, "countBySmallImageId",
133 new String[] { Long.class.getName() });
134 public static final FinderPath FINDER_PATH_FETCH_BY_G_T = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
135 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
136 FINDER_CLASS_NAME_ENTITY, "fetchByG_T",
137 new String[] { Long.class.getName(), String.class.getName() });
138 public static final FinderPath FINDER_PATH_COUNT_BY_G_T = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
139 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
140 FINDER_CLASS_NAME_LIST, "countByG_T",
141 new String[] { Long.class.getName(), String.class.getName() });
142 public static final FinderPath FINDER_PATH_FIND_BY_G_S = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
143 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
144 FINDER_CLASS_NAME_LIST, "findByG_S",
145 new String[] {
146 Long.class.getName(), String.class.getName(),
147
148 "java.lang.Integer", "java.lang.Integer",
149 "com.liferay.portal.kernel.util.OrderByComparator"
150 });
151 public static final FinderPath FINDER_PATH_COUNT_BY_G_S = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
152 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
153 FINDER_CLASS_NAME_LIST, "countByG_S",
154 new String[] { Long.class.getName(), String.class.getName() });
155 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
156 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
157 FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
158 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
159 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
160 FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
161
162 public void cacheResult(JournalTemplate journalTemplate) {
163 EntityCacheUtil.putResult(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
164 JournalTemplateImpl.class, journalTemplate.getPrimaryKey(),
165 journalTemplate);
166
167 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
168 new Object[] {
169 journalTemplate.getUuid(),
170 new Long(journalTemplate.getGroupId())
171 }, journalTemplate);
172
173 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
174 new Object[] { new Long(journalTemplate.getSmallImageId()) },
175 journalTemplate);
176
177 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_T,
178 new Object[] {
179 new Long(journalTemplate.getGroupId()),
180
181 journalTemplate.getTemplateId()
182 }, journalTemplate);
183 }
184
185 public void cacheResult(List<JournalTemplate> journalTemplates) {
186 for (JournalTemplate journalTemplate : journalTemplates) {
187 if (EntityCacheUtil.getResult(
188 JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
189 JournalTemplateImpl.class,
190 journalTemplate.getPrimaryKey(), this) == null) {
191 cacheResult(journalTemplate);
192 }
193 }
194 }
195
196 public void clearCache() {
197 CacheRegistry.clear(JournalTemplateImpl.class.getName());
198 EntityCacheUtil.clearCache(JournalTemplateImpl.class.getName());
199 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
200 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
201 }
202
203 public void clearCache(JournalTemplate journalTemplate) {
204 EntityCacheUtil.removeResult(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
205 JournalTemplateImpl.class, journalTemplate.getPrimaryKey());
206
207 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
208 new Object[] {
209 journalTemplate.getUuid(),
210 new Long(journalTemplate.getGroupId())
211 });
212
213 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
214 new Object[] { new Long(journalTemplate.getSmallImageId()) });
215
216 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_T,
217 new Object[] {
218 new Long(journalTemplate.getGroupId()),
219
220 journalTemplate.getTemplateId()
221 });
222 }
223
224 public JournalTemplate create(long id) {
225 JournalTemplate journalTemplate = new JournalTemplateImpl();
226
227 journalTemplate.setNew(true);
228 journalTemplate.setPrimaryKey(id);
229
230 String uuid = PortalUUIDUtil.generate();
231
232 journalTemplate.setUuid(uuid);
233
234 return journalTemplate;
235 }
236
237 public JournalTemplate remove(Serializable primaryKey)
238 throws NoSuchModelException, SystemException {
239 return remove(((Long)primaryKey).longValue());
240 }
241
242 public JournalTemplate remove(long id)
243 throws NoSuchTemplateException, SystemException {
244 Session session = null;
245
246 try {
247 session = openSession();
248
249 JournalTemplate journalTemplate = (JournalTemplate)session.get(JournalTemplateImpl.class,
250 new Long(id));
251
252 if (journalTemplate == null) {
253 if (_log.isWarnEnabled()) {
254 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + id);
255 }
256
257 throw new NoSuchTemplateException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
258 id);
259 }
260
261 return remove(journalTemplate);
262 }
263 catch (NoSuchTemplateException nsee) {
264 throw nsee;
265 }
266 catch (Exception e) {
267 throw processException(e);
268 }
269 finally {
270 closeSession(session);
271 }
272 }
273
274 public JournalTemplate remove(JournalTemplate journalTemplate)
275 throws SystemException {
276 for (ModelListener<JournalTemplate> listener : listeners) {
277 listener.onBeforeRemove(journalTemplate);
278 }
279
280 journalTemplate = removeImpl(journalTemplate);
281
282 for (ModelListener<JournalTemplate> listener : listeners) {
283 listener.onAfterRemove(journalTemplate);
284 }
285
286 return journalTemplate;
287 }
288
289 protected JournalTemplate removeImpl(JournalTemplate journalTemplate)
290 throws SystemException {
291 journalTemplate = toUnwrappedModel(journalTemplate);
292
293 Session session = null;
294
295 try {
296 session = openSession();
297
298 if (journalTemplate.isCachedModel() ||
299 BatchSessionUtil.isEnabled()) {
300 Object staleObject = session.get(JournalTemplateImpl.class,
301 journalTemplate.getPrimaryKeyObj());
302
303 if (staleObject != null) {
304 session.evict(staleObject);
305 }
306 }
307
308 session.delete(journalTemplate);
309
310 session.flush();
311 }
312 catch (Exception e) {
313 throw processException(e);
314 }
315 finally {
316 closeSession(session);
317 }
318
319 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
320
321 JournalTemplateModelImpl journalTemplateModelImpl = (JournalTemplateModelImpl)journalTemplate;
322
323 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
324 new Object[] {
325 journalTemplateModelImpl.getOriginalUuid(),
326 new Long(journalTemplateModelImpl.getOriginalGroupId())
327 });
328
329 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
330 new Object[] {
331 new Long(journalTemplateModelImpl.getOriginalSmallImageId())
332 });
333
334 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_T,
335 new Object[] {
336 new Long(journalTemplateModelImpl.getOriginalGroupId()),
337
338 journalTemplateModelImpl.getOriginalTemplateId()
339 });
340
341 EntityCacheUtil.removeResult(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
342 JournalTemplateImpl.class, journalTemplate.getPrimaryKey());
343
344 return journalTemplate;
345 }
346
347 public JournalTemplate updateImpl(
348 com.liferay.portlet.journal.model.JournalTemplate journalTemplate,
349 boolean merge) throws SystemException {
350 journalTemplate = toUnwrappedModel(journalTemplate);
351
352 boolean isNew = journalTemplate.isNew();
353
354 JournalTemplateModelImpl journalTemplateModelImpl = (JournalTemplateModelImpl)journalTemplate;
355
356 if (Validator.isNull(journalTemplate.getUuid())) {
357 String uuid = PortalUUIDUtil.generate();
358
359 journalTemplate.setUuid(uuid);
360 }
361
362 Session session = null;
363
364 try {
365 session = openSession();
366
367 BatchSessionUtil.update(session, journalTemplate, merge);
368
369 journalTemplate.setNew(false);
370 }
371 catch (Exception e) {
372 throw processException(e);
373 }
374 finally {
375 closeSession(session);
376 }
377
378 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
379
380 EntityCacheUtil.putResult(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
381 JournalTemplateImpl.class, journalTemplate.getPrimaryKey(),
382 journalTemplate);
383
384 if (!isNew &&
385 (!Validator.equals(journalTemplate.getUuid(),
386 journalTemplateModelImpl.getOriginalUuid()) ||
387 (journalTemplate.getGroupId() != journalTemplateModelImpl.getOriginalGroupId()))) {
388 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
389 new Object[] {
390 journalTemplateModelImpl.getOriginalUuid(),
391 new Long(journalTemplateModelImpl.getOriginalGroupId())
392 });
393 }
394
395 if (isNew ||
396 (!Validator.equals(journalTemplate.getUuid(),
397 journalTemplateModelImpl.getOriginalUuid()) ||
398 (journalTemplate.getGroupId() != journalTemplateModelImpl.getOriginalGroupId()))) {
399 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
400 new Object[] {
401 journalTemplate.getUuid(),
402 new Long(journalTemplate.getGroupId())
403 }, journalTemplate);
404 }
405
406 if (!isNew &&
407 (journalTemplate.getSmallImageId() != journalTemplateModelImpl.getOriginalSmallImageId())) {
408 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
409 new Object[] {
410 new Long(journalTemplateModelImpl.getOriginalSmallImageId())
411 });
412 }
413
414 if (isNew ||
415 (journalTemplate.getSmallImageId() != journalTemplateModelImpl.getOriginalSmallImageId())) {
416 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
417 new Object[] { new Long(journalTemplate.getSmallImageId()) },
418 journalTemplate);
419 }
420
421 if (!isNew &&
422 ((journalTemplate.getGroupId() != journalTemplateModelImpl.getOriginalGroupId()) ||
423 !Validator.equals(journalTemplate.getTemplateId(),
424 journalTemplateModelImpl.getOriginalTemplateId()))) {
425 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_T,
426 new Object[] {
427 new Long(journalTemplateModelImpl.getOriginalGroupId()),
428
429 journalTemplateModelImpl.getOriginalTemplateId()
430 });
431 }
432
433 if (isNew ||
434 ((journalTemplate.getGroupId() != journalTemplateModelImpl.getOriginalGroupId()) ||
435 !Validator.equals(journalTemplate.getTemplateId(),
436 journalTemplateModelImpl.getOriginalTemplateId()))) {
437 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_T,
438 new Object[] {
439 new Long(journalTemplate.getGroupId()),
440
441 journalTemplate.getTemplateId()
442 }, journalTemplate);
443 }
444
445 return journalTemplate;
446 }
447
448 protected JournalTemplate toUnwrappedModel(JournalTemplate journalTemplate) {
449 if (journalTemplate instanceof JournalTemplateImpl) {
450 return journalTemplate;
451 }
452
453 JournalTemplateImpl journalTemplateImpl = new JournalTemplateImpl();
454
455 journalTemplateImpl.setNew(journalTemplate.isNew());
456 journalTemplateImpl.setPrimaryKey(journalTemplate.getPrimaryKey());
457
458 journalTemplateImpl.setUuid(journalTemplate.getUuid());
459 journalTemplateImpl.setId(journalTemplate.getId());
460 journalTemplateImpl.setGroupId(journalTemplate.getGroupId());
461 journalTemplateImpl.setCompanyId(journalTemplate.getCompanyId());
462 journalTemplateImpl.setUserId(journalTemplate.getUserId());
463 journalTemplateImpl.setUserName(journalTemplate.getUserName());
464 journalTemplateImpl.setCreateDate(journalTemplate.getCreateDate());
465 journalTemplateImpl.setModifiedDate(journalTemplate.getModifiedDate());
466 journalTemplateImpl.setTemplateId(journalTemplate.getTemplateId());
467 journalTemplateImpl.setStructureId(journalTemplate.getStructureId());
468 journalTemplateImpl.setName(journalTemplate.getName());
469 journalTemplateImpl.setDescription(journalTemplate.getDescription());
470 journalTemplateImpl.setXsl(journalTemplate.getXsl());
471 journalTemplateImpl.setLangType(journalTemplate.getLangType());
472 journalTemplateImpl.setCacheable(journalTemplate.isCacheable());
473 journalTemplateImpl.setSmallImage(journalTemplate.isSmallImage());
474 journalTemplateImpl.setSmallImageId(journalTemplate.getSmallImageId());
475 journalTemplateImpl.setSmallImageURL(journalTemplate.getSmallImageURL());
476
477 return journalTemplateImpl;
478 }
479
480 public JournalTemplate findByPrimaryKey(Serializable primaryKey)
481 throws NoSuchModelException, SystemException {
482 return findByPrimaryKey(((Long)primaryKey).longValue());
483 }
484
485 public JournalTemplate findByPrimaryKey(long id)
486 throws NoSuchTemplateException, SystemException {
487 JournalTemplate journalTemplate = fetchByPrimaryKey(id);
488
489 if (journalTemplate == null) {
490 if (_log.isWarnEnabled()) {
491 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + id);
492 }
493
494 throw new NoSuchTemplateException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
495 id);
496 }
497
498 return journalTemplate;
499 }
500
501 public JournalTemplate fetchByPrimaryKey(Serializable primaryKey)
502 throws SystemException {
503 return fetchByPrimaryKey(((Long)primaryKey).longValue());
504 }
505
506 public JournalTemplate fetchByPrimaryKey(long id) throws SystemException {
507 JournalTemplate journalTemplate = (JournalTemplate)EntityCacheUtil.getResult(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
508 JournalTemplateImpl.class, id, this);
509
510 if (journalTemplate == null) {
511 Session session = null;
512
513 try {
514 session = openSession();
515
516 journalTemplate = (JournalTemplate)session.get(JournalTemplateImpl.class,
517 new Long(id));
518 }
519 catch (Exception e) {
520 throw processException(e);
521 }
522 finally {
523 if (journalTemplate != null) {
524 cacheResult(journalTemplate);
525 }
526
527 closeSession(session);
528 }
529 }
530
531 return journalTemplate;
532 }
533
534 public List<JournalTemplate> findByUuid(String uuid)
535 throws SystemException {
536 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
537 }
538
539 public List<JournalTemplate> findByUuid(String uuid, int start, int end)
540 throws SystemException {
541 return findByUuid(uuid, start, end, null);
542 }
543
544 public List<JournalTemplate> findByUuid(String uuid, int start, int end,
545 OrderByComparator orderByComparator) throws SystemException {
546 Object[] finderArgs = new Object[] {
547 uuid,
548
549 String.valueOf(start), String.valueOf(end),
550 String.valueOf(orderByComparator)
551 };
552
553 List<JournalTemplate> list = (List<JournalTemplate>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
554 finderArgs, this);
555
556 if (list == null) {
557 Session session = null;
558
559 try {
560 session = openSession();
561
562 StringBundler query = null;
563
564 if (orderByComparator != null) {
565 query = new StringBundler(3 +
566 (orderByComparator.getOrderByFields().length * 3));
567 }
568 else {
569 query = new StringBundler(3);
570 }
571
572 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
573
574 if (uuid == null) {
575 query.append(_FINDER_COLUMN_UUID_UUID_1);
576 }
577 else {
578 if (uuid.equals(StringPool.BLANK)) {
579 query.append(_FINDER_COLUMN_UUID_UUID_3);
580 }
581 else {
582 query.append(_FINDER_COLUMN_UUID_UUID_2);
583 }
584 }
585
586 if (orderByComparator != null) {
587 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
588 orderByComparator);
589 }
590
591 else {
592 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
593 }
594
595 String sql = query.toString();
596
597 Query q = session.createQuery(sql);
598
599 QueryPos qPos = QueryPos.getInstance(q);
600
601 if (uuid != null) {
602 qPos.add(uuid);
603 }
604
605 list = (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
606 start, end);
607 }
608 catch (Exception e) {
609 throw processException(e);
610 }
611 finally {
612 if (list == null) {
613 list = new ArrayList<JournalTemplate>();
614 }
615
616 cacheResult(list);
617
618 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
619 list);
620
621 closeSession(session);
622 }
623 }
624
625 return list;
626 }
627
628 public JournalTemplate findByUuid_First(String uuid,
629 OrderByComparator orderByComparator)
630 throws NoSuchTemplateException, SystemException {
631 List<JournalTemplate> list = findByUuid(uuid, 0, 1, orderByComparator);
632
633 if (list.isEmpty()) {
634 StringBundler msg = new StringBundler(4);
635
636 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
637
638 msg.append("uuid=");
639 msg.append(uuid);
640
641 msg.append(StringPool.CLOSE_CURLY_BRACE);
642
643 throw new NoSuchTemplateException(msg.toString());
644 }
645 else {
646 return list.get(0);
647 }
648 }
649
650 public JournalTemplate findByUuid_Last(String uuid,
651 OrderByComparator orderByComparator)
652 throws NoSuchTemplateException, SystemException {
653 int count = countByUuid(uuid);
654
655 List<JournalTemplate> list = findByUuid(uuid, count - 1, count,
656 orderByComparator);
657
658 if (list.isEmpty()) {
659 StringBundler msg = new StringBundler(4);
660
661 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
662
663 msg.append("uuid=");
664 msg.append(uuid);
665
666 msg.append(StringPool.CLOSE_CURLY_BRACE);
667
668 throw new NoSuchTemplateException(msg.toString());
669 }
670 else {
671 return list.get(0);
672 }
673 }
674
675 public JournalTemplate[] findByUuid_PrevAndNext(long id, String uuid,
676 OrderByComparator orderByComparator)
677 throws NoSuchTemplateException, SystemException {
678 JournalTemplate journalTemplate = findByPrimaryKey(id);
679
680 Session session = null;
681
682 try {
683 session = openSession();
684
685 JournalTemplate[] array = new JournalTemplateImpl[3];
686
687 array[0] = getByUuid_PrevAndNext(session, journalTemplate, uuid,
688 orderByComparator, true);
689
690 array[1] = journalTemplate;
691
692 array[2] = getByUuid_PrevAndNext(session, journalTemplate, uuid,
693 orderByComparator, false);
694
695 return array;
696 }
697 catch (Exception e) {
698 throw processException(e);
699 }
700 finally {
701 closeSession(session);
702 }
703 }
704
705 protected JournalTemplate getByUuid_PrevAndNext(Session session,
706 JournalTemplate journalTemplate, String uuid,
707 OrderByComparator orderByComparator, boolean previous) {
708 StringBundler query = null;
709
710 if (orderByComparator != null) {
711 query = new StringBundler(6 +
712 (orderByComparator.getOrderByFields().length * 6));
713 }
714 else {
715 query = new StringBundler(3);
716 }
717
718 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
719
720 if (uuid == null) {
721 query.append(_FINDER_COLUMN_UUID_UUID_1);
722 }
723 else {
724 if (uuid.equals(StringPool.BLANK)) {
725 query.append(_FINDER_COLUMN_UUID_UUID_3);
726 }
727 else {
728 query.append(_FINDER_COLUMN_UUID_UUID_2);
729 }
730 }
731
732 if (orderByComparator != null) {
733 String[] orderByFields = orderByComparator.getOrderByFields();
734
735 if (orderByFields.length > 0) {
736 query.append(WHERE_AND);
737 }
738
739 for (int i = 0; i < orderByFields.length; i++) {
740 query.append(_ORDER_BY_ENTITY_ALIAS);
741 query.append(orderByFields[i]);
742
743 if ((i + 1) < orderByFields.length) {
744 if (orderByComparator.isAscending() ^ previous) {
745 query.append(WHERE_GREATER_THAN_HAS_NEXT);
746 }
747 else {
748 query.append(WHERE_LESSER_THAN_HAS_NEXT);
749 }
750 }
751 else {
752 if (orderByComparator.isAscending() ^ previous) {
753 query.append(WHERE_GREATER_THAN);
754 }
755 else {
756 query.append(WHERE_LESSER_THAN);
757 }
758 }
759 }
760
761 query.append(ORDER_BY_CLAUSE);
762
763 for (int i = 0; i < orderByFields.length; i++) {
764 query.append(_ORDER_BY_ENTITY_ALIAS);
765 query.append(orderByFields[i]);
766
767 if ((i + 1) < orderByFields.length) {
768 if (orderByComparator.isAscending() ^ previous) {
769 query.append(ORDER_BY_ASC_HAS_NEXT);
770 }
771 else {
772 query.append(ORDER_BY_DESC_HAS_NEXT);
773 }
774 }
775 else {
776 if (orderByComparator.isAscending() ^ previous) {
777 query.append(ORDER_BY_ASC);
778 }
779 else {
780 query.append(ORDER_BY_DESC);
781 }
782 }
783 }
784 }
785
786 else {
787 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
788 }
789
790 String sql = query.toString();
791
792 Query q = session.createQuery(sql);
793
794 q.setFirstResult(0);
795 q.setMaxResults(2);
796
797 QueryPos qPos = QueryPos.getInstance(q);
798
799 if (uuid != null) {
800 qPos.add(uuid);
801 }
802
803 if (orderByComparator != null) {
804 Object[] values = orderByComparator.getOrderByValues(journalTemplate);
805
806 for (Object value : values) {
807 qPos.add(value);
808 }
809 }
810
811 List<JournalTemplate> list = q.list();
812
813 if (list.size() == 2) {
814 return list.get(1);
815 }
816 else {
817 return null;
818 }
819 }
820
821 public JournalTemplate findByUUID_G(String uuid, long groupId)
822 throws NoSuchTemplateException, SystemException {
823 JournalTemplate journalTemplate = fetchByUUID_G(uuid, groupId);
824
825 if (journalTemplate == null) {
826 StringBundler msg = new StringBundler(6);
827
828 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
829
830 msg.append("uuid=");
831 msg.append(uuid);
832
833 msg.append(", groupId=");
834 msg.append(groupId);
835
836 msg.append(StringPool.CLOSE_CURLY_BRACE);
837
838 if (_log.isWarnEnabled()) {
839 _log.warn(msg.toString());
840 }
841
842 throw new NoSuchTemplateException(msg.toString());
843 }
844
845 return journalTemplate;
846 }
847
848 public JournalTemplate fetchByUUID_G(String uuid, long groupId)
849 throws SystemException {
850 return fetchByUUID_G(uuid, groupId, true);
851 }
852
853 public JournalTemplate fetchByUUID_G(String uuid, long groupId,
854 boolean retrieveFromCache) throws SystemException {
855 Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
856
857 Object result = null;
858
859 if (retrieveFromCache) {
860 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
861 finderArgs, this);
862 }
863
864 if (result == null) {
865 Session session = null;
866
867 try {
868 session = openSession();
869
870 StringBundler query = new StringBundler(4);
871
872 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
873
874 if (uuid == null) {
875 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
876 }
877 else {
878 if (uuid.equals(StringPool.BLANK)) {
879 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
880 }
881 else {
882 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
883 }
884 }
885
886 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
887
888 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
889
890 String sql = query.toString();
891
892 Query q = session.createQuery(sql);
893
894 QueryPos qPos = QueryPos.getInstance(q);
895
896 if (uuid != null) {
897 qPos.add(uuid);
898 }
899
900 qPos.add(groupId);
901
902 List<JournalTemplate> list = q.list();
903
904 result = list;
905
906 JournalTemplate journalTemplate = null;
907
908 if (list.isEmpty()) {
909 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
910 finderArgs, list);
911 }
912 else {
913 journalTemplate = list.get(0);
914
915 cacheResult(journalTemplate);
916
917 if ((journalTemplate.getUuid() == null) ||
918 !journalTemplate.getUuid().equals(uuid) ||
919 (journalTemplate.getGroupId() != groupId)) {
920 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
921 finderArgs, journalTemplate);
922 }
923 }
924
925 return journalTemplate;
926 }
927 catch (Exception e) {
928 throw processException(e);
929 }
930 finally {
931 if (result == null) {
932 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
933 finderArgs, new ArrayList<JournalTemplate>());
934 }
935
936 closeSession(session);
937 }
938 }
939 else {
940 if (result instanceof List<?>) {
941 return null;
942 }
943 else {
944 return (JournalTemplate)result;
945 }
946 }
947 }
948
949 public List<JournalTemplate> findByGroupId(long groupId)
950 throws SystemException {
951 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
952 }
953
954 public List<JournalTemplate> findByGroupId(long groupId, int start, int end)
955 throws SystemException {
956 return findByGroupId(groupId, start, end, null);
957 }
958
959 public List<JournalTemplate> findByGroupId(long groupId, int start,
960 int end, OrderByComparator orderByComparator) throws SystemException {
961 Object[] finderArgs = new Object[] {
962 new Long(groupId),
963
964 String.valueOf(start), String.valueOf(end),
965 String.valueOf(orderByComparator)
966 };
967
968 List<JournalTemplate> list = (List<JournalTemplate>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
969 finderArgs, this);
970
971 if (list == null) {
972 Session session = null;
973
974 try {
975 session = openSession();
976
977 StringBundler query = null;
978
979 if (orderByComparator != null) {
980 query = new StringBundler(3 +
981 (orderByComparator.getOrderByFields().length * 3));
982 }
983 else {
984 query = new StringBundler(3);
985 }
986
987 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
988
989 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
990
991 if (orderByComparator != null) {
992 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
993 orderByComparator);
994 }
995
996 else {
997 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
998 }
999
1000 String sql = query.toString();
1001
1002 Query q = session.createQuery(sql);
1003
1004 QueryPos qPos = QueryPos.getInstance(q);
1005
1006 qPos.add(groupId);
1007
1008 list = (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
1009 start, end);
1010 }
1011 catch (Exception e) {
1012 throw processException(e);
1013 }
1014 finally {
1015 if (list == null) {
1016 list = new ArrayList<JournalTemplate>();
1017 }
1018
1019 cacheResult(list);
1020
1021 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
1022 finderArgs, list);
1023
1024 closeSession(session);
1025 }
1026 }
1027
1028 return list;
1029 }
1030
1031 public JournalTemplate findByGroupId_First(long groupId,
1032 OrderByComparator orderByComparator)
1033 throws NoSuchTemplateException, SystemException {
1034 List<JournalTemplate> list = findByGroupId(groupId, 0, 1,
1035 orderByComparator);
1036
1037 if (list.isEmpty()) {
1038 StringBundler msg = new StringBundler(4);
1039
1040 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1041
1042 msg.append("groupId=");
1043 msg.append(groupId);
1044
1045 msg.append(StringPool.CLOSE_CURLY_BRACE);
1046
1047 throw new NoSuchTemplateException(msg.toString());
1048 }
1049 else {
1050 return list.get(0);
1051 }
1052 }
1053
1054 public JournalTemplate findByGroupId_Last(long groupId,
1055 OrderByComparator orderByComparator)
1056 throws NoSuchTemplateException, SystemException {
1057 int count = countByGroupId(groupId);
1058
1059 List<JournalTemplate> list = findByGroupId(groupId, count - 1, count,
1060 orderByComparator);
1061
1062 if (list.isEmpty()) {
1063 StringBundler msg = new StringBundler(4);
1064
1065 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1066
1067 msg.append("groupId=");
1068 msg.append(groupId);
1069
1070 msg.append(StringPool.CLOSE_CURLY_BRACE);
1071
1072 throw new NoSuchTemplateException(msg.toString());
1073 }
1074 else {
1075 return list.get(0);
1076 }
1077 }
1078
1079 public JournalTemplate[] findByGroupId_PrevAndNext(long id, long groupId,
1080 OrderByComparator orderByComparator)
1081 throws NoSuchTemplateException, SystemException {
1082 JournalTemplate journalTemplate = findByPrimaryKey(id);
1083
1084 Session session = null;
1085
1086 try {
1087 session = openSession();
1088
1089 JournalTemplate[] array = new JournalTemplateImpl[3];
1090
1091 array[0] = getByGroupId_PrevAndNext(session, journalTemplate,
1092 groupId, orderByComparator, true);
1093
1094 array[1] = journalTemplate;
1095
1096 array[2] = getByGroupId_PrevAndNext(session, journalTemplate,
1097 groupId, orderByComparator, false);
1098
1099 return array;
1100 }
1101 catch (Exception e) {
1102 throw processException(e);
1103 }
1104 finally {
1105 closeSession(session);
1106 }
1107 }
1108
1109 protected JournalTemplate getByGroupId_PrevAndNext(Session session,
1110 JournalTemplate journalTemplate, long groupId,
1111 OrderByComparator orderByComparator, boolean previous) {
1112 StringBundler query = null;
1113
1114 if (orderByComparator != null) {
1115 query = new StringBundler(6 +
1116 (orderByComparator.getOrderByFields().length * 6));
1117 }
1118 else {
1119 query = new StringBundler(3);
1120 }
1121
1122 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1123
1124 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1125
1126 if (orderByComparator != null) {
1127 String[] orderByFields = orderByComparator.getOrderByFields();
1128
1129 if (orderByFields.length > 0) {
1130 query.append(WHERE_AND);
1131 }
1132
1133 for (int i = 0; i < orderByFields.length; i++) {
1134 query.append(_ORDER_BY_ENTITY_ALIAS);
1135 query.append(orderByFields[i]);
1136
1137 if ((i + 1) < orderByFields.length) {
1138 if (orderByComparator.isAscending() ^ previous) {
1139 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1140 }
1141 else {
1142 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1143 }
1144 }
1145 else {
1146 if (orderByComparator.isAscending() ^ previous) {
1147 query.append(WHERE_GREATER_THAN);
1148 }
1149 else {
1150 query.append(WHERE_LESSER_THAN);
1151 }
1152 }
1153 }
1154
1155 query.append(ORDER_BY_CLAUSE);
1156
1157 for (int i = 0; i < orderByFields.length; i++) {
1158 query.append(_ORDER_BY_ENTITY_ALIAS);
1159 query.append(orderByFields[i]);
1160
1161 if ((i + 1) < orderByFields.length) {
1162 if (orderByComparator.isAscending() ^ previous) {
1163 query.append(ORDER_BY_ASC_HAS_NEXT);
1164 }
1165 else {
1166 query.append(ORDER_BY_DESC_HAS_NEXT);
1167 }
1168 }
1169 else {
1170 if (orderByComparator.isAscending() ^ previous) {
1171 query.append(ORDER_BY_ASC);
1172 }
1173 else {
1174 query.append(ORDER_BY_DESC);
1175 }
1176 }
1177 }
1178 }
1179
1180 else {
1181 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1182 }
1183
1184 String sql = query.toString();
1185
1186 Query q = session.createQuery(sql);
1187
1188 q.setFirstResult(0);
1189 q.setMaxResults(2);
1190
1191 QueryPos qPos = QueryPos.getInstance(q);
1192
1193 qPos.add(groupId);
1194
1195 if (orderByComparator != null) {
1196 Object[] values = orderByComparator.getOrderByValues(journalTemplate);
1197
1198 for (Object value : values) {
1199 qPos.add(value);
1200 }
1201 }
1202
1203 List<JournalTemplate> list = q.list();
1204
1205 if (list.size() == 2) {
1206 return list.get(1);
1207 }
1208 else {
1209 return null;
1210 }
1211 }
1212
1213 public List<JournalTemplate> filterFindByGroupId(long groupId)
1214 throws SystemException {
1215 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1216 QueryUtil.ALL_POS, null);
1217 }
1218
1219 public List<JournalTemplate> filterFindByGroupId(long groupId, int start,
1220 int end) throws SystemException {
1221 return filterFindByGroupId(groupId, start, end, null);
1222 }
1223
1224 public List<JournalTemplate> filterFindByGroupId(long groupId, int start,
1225 int end, OrderByComparator orderByComparator) throws SystemException {
1226 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1227 return findByGroupId(groupId, start, end, orderByComparator);
1228 }
1229
1230 Session session = null;
1231
1232 try {
1233 session = openSession();
1234
1235 StringBundler query = null;
1236
1237 if (orderByComparator != null) {
1238 query = new StringBundler(3 +
1239 (orderByComparator.getOrderByFields().length * 3));
1240 }
1241 else {
1242 query = new StringBundler(3);
1243 }
1244
1245 query.append(_FILTER_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1246
1247 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1248
1249 if (orderByComparator != null) {
1250 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1251 orderByComparator);
1252 }
1253
1254 else {
1255 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1256 }
1257
1258 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1259 JournalTemplate.class.getName(), _FILTER_COLUMN_ID,
1260 _FILTER_COLUMN_USERID, groupId);
1261
1262 SQLQuery q = session.createSQLQuery(sql);
1263
1264 q.addEntity(_FILTER_ENTITY_ALIAS, JournalTemplateImpl.class);
1265
1266 QueryPos qPos = QueryPos.getInstance(q);
1267
1268 qPos.add(groupId);
1269
1270 return (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
1271 start, end);
1272 }
1273 catch (Exception e) {
1274 throw processException(e);
1275 }
1276 finally {
1277 closeSession(session);
1278 }
1279 }
1280
1281 public List<JournalTemplate> findByTemplateId(String templateId)
1282 throws SystemException {
1283 return findByTemplateId(templateId, QueryUtil.ALL_POS,
1284 QueryUtil.ALL_POS, null);
1285 }
1286
1287 public List<JournalTemplate> findByTemplateId(String templateId, int start,
1288 int end) throws SystemException {
1289 return findByTemplateId(templateId, start, end, null);
1290 }
1291
1292 public List<JournalTemplate> findByTemplateId(String templateId, int start,
1293 int end, OrderByComparator orderByComparator) throws SystemException {
1294 Object[] finderArgs = new Object[] {
1295 templateId,
1296
1297 String.valueOf(start), String.valueOf(end),
1298 String.valueOf(orderByComparator)
1299 };
1300
1301 List<JournalTemplate> list = (List<JournalTemplate>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_TEMPLATEID,
1302 finderArgs, this);
1303
1304 if (list == null) {
1305 Session session = null;
1306
1307 try {
1308 session = openSession();
1309
1310 StringBundler query = null;
1311
1312 if (orderByComparator != null) {
1313 query = new StringBundler(3 +
1314 (orderByComparator.getOrderByFields().length * 3));
1315 }
1316 else {
1317 query = new StringBundler(3);
1318 }
1319
1320 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1321
1322 if (templateId == null) {
1323 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1);
1324 }
1325 else {
1326 if (templateId.equals(StringPool.BLANK)) {
1327 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3);
1328 }
1329 else {
1330 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2);
1331 }
1332 }
1333
1334 if (orderByComparator != null) {
1335 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1336 orderByComparator);
1337 }
1338
1339 else {
1340 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1341 }
1342
1343 String sql = query.toString();
1344
1345 Query q = session.createQuery(sql);
1346
1347 QueryPos qPos = QueryPos.getInstance(q);
1348
1349 if (templateId != null) {
1350 qPos.add(templateId);
1351 }
1352
1353 list = (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
1354 start, end);
1355 }
1356 catch (Exception e) {
1357 throw processException(e);
1358 }
1359 finally {
1360 if (list == null) {
1361 list = new ArrayList<JournalTemplate>();
1362 }
1363
1364 cacheResult(list);
1365
1366 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_TEMPLATEID,
1367 finderArgs, list);
1368
1369 closeSession(session);
1370 }
1371 }
1372
1373 return list;
1374 }
1375
1376 public JournalTemplate findByTemplateId_First(String templateId,
1377 OrderByComparator orderByComparator)
1378 throws NoSuchTemplateException, SystemException {
1379 List<JournalTemplate> list = findByTemplateId(templateId, 0, 1,
1380 orderByComparator);
1381
1382 if (list.isEmpty()) {
1383 StringBundler msg = new StringBundler(4);
1384
1385 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1386
1387 msg.append("templateId=");
1388 msg.append(templateId);
1389
1390 msg.append(StringPool.CLOSE_CURLY_BRACE);
1391
1392 throw new NoSuchTemplateException(msg.toString());
1393 }
1394 else {
1395 return list.get(0);
1396 }
1397 }
1398
1399 public JournalTemplate findByTemplateId_Last(String templateId,
1400 OrderByComparator orderByComparator)
1401 throws NoSuchTemplateException, SystemException {
1402 int count = countByTemplateId(templateId);
1403
1404 List<JournalTemplate> list = findByTemplateId(templateId, count - 1,
1405 count, orderByComparator);
1406
1407 if (list.isEmpty()) {
1408 StringBundler msg = new StringBundler(4);
1409
1410 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1411
1412 msg.append("templateId=");
1413 msg.append(templateId);
1414
1415 msg.append(StringPool.CLOSE_CURLY_BRACE);
1416
1417 throw new NoSuchTemplateException(msg.toString());
1418 }
1419 else {
1420 return list.get(0);
1421 }
1422 }
1423
1424 public JournalTemplate[] findByTemplateId_PrevAndNext(long id,
1425 String templateId, OrderByComparator orderByComparator)
1426 throws NoSuchTemplateException, SystemException {
1427 JournalTemplate journalTemplate = findByPrimaryKey(id);
1428
1429 Session session = null;
1430
1431 try {
1432 session = openSession();
1433
1434 JournalTemplate[] array = new JournalTemplateImpl[3];
1435
1436 array[0] = getByTemplateId_PrevAndNext(session, journalTemplate,
1437 templateId, orderByComparator, true);
1438
1439 array[1] = journalTemplate;
1440
1441 array[2] = getByTemplateId_PrevAndNext(session, journalTemplate,
1442 templateId, orderByComparator, false);
1443
1444 return array;
1445 }
1446 catch (Exception e) {
1447 throw processException(e);
1448 }
1449 finally {
1450 closeSession(session);
1451 }
1452 }
1453
1454 protected JournalTemplate getByTemplateId_PrevAndNext(Session session,
1455 JournalTemplate journalTemplate, String templateId,
1456 OrderByComparator orderByComparator, boolean previous) {
1457 StringBundler query = null;
1458
1459 if (orderByComparator != null) {
1460 query = new StringBundler(6 +
1461 (orderByComparator.getOrderByFields().length * 6));
1462 }
1463 else {
1464 query = new StringBundler(3);
1465 }
1466
1467 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1468
1469 if (templateId == null) {
1470 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1);
1471 }
1472 else {
1473 if (templateId.equals(StringPool.BLANK)) {
1474 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3);
1475 }
1476 else {
1477 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2);
1478 }
1479 }
1480
1481 if (orderByComparator != null) {
1482 String[] orderByFields = orderByComparator.getOrderByFields();
1483
1484 if (orderByFields.length > 0) {
1485 query.append(WHERE_AND);
1486 }
1487
1488 for (int i = 0; i < orderByFields.length; i++) {
1489 query.append(_ORDER_BY_ENTITY_ALIAS);
1490 query.append(orderByFields[i]);
1491
1492 if ((i + 1) < orderByFields.length) {
1493 if (orderByComparator.isAscending() ^ previous) {
1494 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1495 }
1496 else {
1497 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1498 }
1499 }
1500 else {
1501 if (orderByComparator.isAscending() ^ previous) {
1502 query.append(WHERE_GREATER_THAN);
1503 }
1504 else {
1505 query.append(WHERE_LESSER_THAN);
1506 }
1507 }
1508 }
1509
1510 query.append(ORDER_BY_CLAUSE);
1511
1512 for (int i = 0; i < orderByFields.length; i++) {
1513 query.append(_ORDER_BY_ENTITY_ALIAS);
1514 query.append(orderByFields[i]);
1515
1516 if ((i + 1) < orderByFields.length) {
1517 if (orderByComparator.isAscending() ^ previous) {
1518 query.append(ORDER_BY_ASC_HAS_NEXT);
1519 }
1520 else {
1521 query.append(ORDER_BY_DESC_HAS_NEXT);
1522 }
1523 }
1524 else {
1525 if (orderByComparator.isAscending() ^ previous) {
1526 query.append(ORDER_BY_ASC);
1527 }
1528 else {
1529 query.append(ORDER_BY_DESC);
1530 }
1531 }
1532 }
1533 }
1534
1535 else {
1536 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1537 }
1538
1539 String sql = query.toString();
1540
1541 Query q = session.createQuery(sql);
1542
1543 q.setFirstResult(0);
1544 q.setMaxResults(2);
1545
1546 QueryPos qPos = QueryPos.getInstance(q);
1547
1548 if (templateId != null) {
1549 qPos.add(templateId);
1550 }
1551
1552 if (orderByComparator != null) {
1553 Object[] values = orderByComparator.getOrderByValues(journalTemplate);
1554
1555 for (Object value : values) {
1556 qPos.add(value);
1557 }
1558 }
1559
1560 List<JournalTemplate> list = q.list();
1561
1562 if (list.size() == 2) {
1563 return list.get(1);
1564 }
1565 else {
1566 return null;
1567 }
1568 }
1569
1570 public JournalTemplate findBySmallImageId(long smallImageId)
1571 throws NoSuchTemplateException, SystemException {
1572 JournalTemplate journalTemplate = fetchBySmallImageId(smallImageId);
1573
1574 if (journalTemplate == null) {
1575 StringBundler msg = new StringBundler(4);
1576
1577 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1578
1579 msg.append("smallImageId=");
1580 msg.append(smallImageId);
1581
1582 msg.append(StringPool.CLOSE_CURLY_BRACE);
1583
1584 if (_log.isWarnEnabled()) {
1585 _log.warn(msg.toString());
1586 }
1587
1588 throw new NoSuchTemplateException(msg.toString());
1589 }
1590
1591 return journalTemplate;
1592 }
1593
1594 public JournalTemplate fetchBySmallImageId(long smallImageId)
1595 throws SystemException {
1596 return fetchBySmallImageId(smallImageId, true);
1597 }
1598
1599 public JournalTemplate fetchBySmallImageId(long smallImageId,
1600 boolean retrieveFromCache) throws SystemException {
1601 Object[] finderArgs = new Object[] { new Long(smallImageId) };
1602
1603 Object result = null;
1604
1605 if (retrieveFromCache) {
1606 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
1607 finderArgs, this);
1608 }
1609
1610 if (result == null) {
1611 Session session = null;
1612
1613 try {
1614 session = openSession();
1615
1616 StringBundler query = new StringBundler(3);
1617
1618 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1619
1620 query.append(_FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2);
1621
1622 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1623
1624 String sql = query.toString();
1625
1626 Query q = session.createQuery(sql);
1627
1628 QueryPos qPos = QueryPos.getInstance(q);
1629
1630 qPos.add(smallImageId);
1631
1632 List<JournalTemplate> list = q.list();
1633
1634 result = list;
1635
1636 JournalTemplate journalTemplate = null;
1637
1638 if (list.isEmpty()) {
1639 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
1640 finderArgs, list);
1641 }
1642 else {
1643 journalTemplate = list.get(0);
1644
1645 cacheResult(journalTemplate);
1646
1647 if ((journalTemplate.getSmallImageId() != smallImageId)) {
1648 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
1649 finderArgs, journalTemplate);
1650 }
1651 }
1652
1653 return journalTemplate;
1654 }
1655 catch (Exception e) {
1656 throw processException(e);
1657 }
1658 finally {
1659 if (result == null) {
1660 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
1661 finderArgs, new ArrayList<JournalTemplate>());
1662 }
1663
1664 closeSession(session);
1665 }
1666 }
1667 else {
1668 if (result instanceof List<?>) {
1669 return null;
1670 }
1671 else {
1672 return (JournalTemplate)result;
1673 }
1674 }
1675 }
1676
1677 public JournalTemplate findByG_T(long groupId, String templateId)
1678 throws NoSuchTemplateException, SystemException {
1679 JournalTemplate journalTemplate = fetchByG_T(groupId, templateId);
1680
1681 if (journalTemplate == null) {
1682 StringBundler msg = new StringBundler(6);
1683
1684 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1685
1686 msg.append("groupId=");
1687 msg.append(groupId);
1688
1689 msg.append(", templateId=");
1690 msg.append(templateId);
1691
1692 msg.append(StringPool.CLOSE_CURLY_BRACE);
1693
1694 if (_log.isWarnEnabled()) {
1695 _log.warn(msg.toString());
1696 }
1697
1698 throw new NoSuchTemplateException(msg.toString());
1699 }
1700
1701 return journalTemplate;
1702 }
1703
1704 public JournalTemplate fetchByG_T(long groupId, String templateId)
1705 throws SystemException {
1706 return fetchByG_T(groupId, templateId, true);
1707 }
1708
1709 public JournalTemplate fetchByG_T(long groupId, String templateId,
1710 boolean retrieveFromCache) throws SystemException {
1711 Object[] finderArgs = new Object[] { new Long(groupId), templateId };
1712
1713 Object result = null;
1714
1715 if (retrieveFromCache) {
1716 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_T,
1717 finderArgs, this);
1718 }
1719
1720 if (result == null) {
1721 Session session = null;
1722
1723 try {
1724 session = openSession();
1725
1726 StringBundler query = new StringBundler(4);
1727
1728 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1729
1730 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
1731
1732 if (templateId == null) {
1733 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
1734 }
1735 else {
1736 if (templateId.equals(StringPool.BLANK)) {
1737 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
1738 }
1739 else {
1740 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
1741 }
1742 }
1743
1744 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1745
1746 String sql = query.toString();
1747
1748 Query q = session.createQuery(sql);
1749
1750 QueryPos qPos = QueryPos.getInstance(q);
1751
1752 qPos.add(groupId);
1753
1754 if (templateId != null) {
1755 qPos.add(templateId);
1756 }
1757
1758 List<JournalTemplate> list = q.list();
1759
1760 result = list;
1761
1762 JournalTemplate journalTemplate = null;
1763
1764 if (list.isEmpty()) {
1765 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_T,
1766 finderArgs, list);
1767 }
1768 else {
1769 journalTemplate = list.get(0);
1770
1771 cacheResult(journalTemplate);
1772
1773 if ((journalTemplate.getGroupId() != groupId) ||
1774 (journalTemplate.getTemplateId() == null) ||
1775 !journalTemplate.getTemplateId().equals(templateId)) {
1776 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_T,
1777 finderArgs, journalTemplate);
1778 }
1779 }
1780
1781 return journalTemplate;
1782 }
1783 catch (Exception e) {
1784 throw processException(e);
1785 }
1786 finally {
1787 if (result == null) {
1788 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_T,
1789 finderArgs, new ArrayList<JournalTemplate>());
1790 }
1791
1792 closeSession(session);
1793 }
1794 }
1795 else {
1796 if (result instanceof List<?>) {
1797 return null;
1798 }
1799 else {
1800 return (JournalTemplate)result;
1801 }
1802 }
1803 }
1804
1805 public List<JournalTemplate> findByG_S(long groupId, String structureId)
1806 throws SystemException {
1807 return findByG_S(groupId, structureId, QueryUtil.ALL_POS,
1808 QueryUtil.ALL_POS, null);
1809 }
1810
1811 public List<JournalTemplate> findByG_S(long groupId, String structureId,
1812 int start, int end) throws SystemException {
1813 return findByG_S(groupId, structureId, start, end, null);
1814 }
1815
1816 public List<JournalTemplate> findByG_S(long groupId, String structureId,
1817 int start, int end, OrderByComparator orderByComparator)
1818 throws SystemException {
1819 Object[] finderArgs = new Object[] {
1820 new Long(groupId),
1821
1822 structureId,
1823
1824 String.valueOf(start), String.valueOf(end),
1825 String.valueOf(orderByComparator)
1826 };
1827
1828 List<JournalTemplate> list = (List<JournalTemplate>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_S,
1829 finderArgs, this);
1830
1831 if (list == null) {
1832 Session session = null;
1833
1834 try {
1835 session = openSession();
1836
1837 StringBundler query = null;
1838
1839 if (orderByComparator != null) {
1840 query = new StringBundler(4 +
1841 (orderByComparator.getOrderByFields().length * 3));
1842 }
1843 else {
1844 query = new StringBundler(4);
1845 }
1846
1847 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1848
1849 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
1850
1851 if (structureId == null) {
1852 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
1853 }
1854 else {
1855 if (structureId.equals(StringPool.BLANK)) {
1856 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
1857 }
1858 else {
1859 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
1860 }
1861 }
1862
1863 if (orderByComparator != null) {
1864 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1865 orderByComparator);
1866 }
1867
1868 else {
1869 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1870 }
1871
1872 String sql = query.toString();
1873
1874 Query q = session.createQuery(sql);
1875
1876 QueryPos qPos = QueryPos.getInstance(q);
1877
1878 qPos.add(groupId);
1879
1880 if (structureId != null) {
1881 qPos.add(structureId);
1882 }
1883
1884 list = (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
1885 start, end);
1886 }
1887 catch (Exception e) {
1888 throw processException(e);
1889 }
1890 finally {
1891 if (list == null) {
1892 list = new ArrayList<JournalTemplate>();
1893 }
1894
1895 cacheResult(list);
1896
1897 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_S, finderArgs,
1898 list);
1899
1900 closeSession(session);
1901 }
1902 }
1903
1904 return list;
1905 }
1906
1907 public JournalTemplate findByG_S_First(long groupId, String structureId,
1908 OrderByComparator orderByComparator)
1909 throws NoSuchTemplateException, SystemException {
1910 List<JournalTemplate> list = findByG_S(groupId, structureId, 0, 1,
1911 orderByComparator);
1912
1913 if (list.isEmpty()) {
1914 StringBundler msg = new StringBundler(6);
1915
1916 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1917
1918 msg.append("groupId=");
1919 msg.append(groupId);
1920
1921 msg.append(", structureId=");
1922 msg.append(structureId);
1923
1924 msg.append(StringPool.CLOSE_CURLY_BRACE);
1925
1926 throw new NoSuchTemplateException(msg.toString());
1927 }
1928 else {
1929 return list.get(0);
1930 }
1931 }
1932
1933 public JournalTemplate findByG_S_Last(long groupId, String structureId,
1934 OrderByComparator orderByComparator)
1935 throws NoSuchTemplateException, SystemException {
1936 int count = countByG_S(groupId, structureId);
1937
1938 List<JournalTemplate> list = findByG_S(groupId, structureId, count - 1,
1939 count, orderByComparator);
1940
1941 if (list.isEmpty()) {
1942 StringBundler msg = new StringBundler(6);
1943
1944 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1945
1946 msg.append("groupId=");
1947 msg.append(groupId);
1948
1949 msg.append(", structureId=");
1950 msg.append(structureId);
1951
1952 msg.append(StringPool.CLOSE_CURLY_BRACE);
1953
1954 throw new NoSuchTemplateException(msg.toString());
1955 }
1956 else {
1957 return list.get(0);
1958 }
1959 }
1960
1961 public JournalTemplate[] findByG_S_PrevAndNext(long id, long groupId,
1962 String structureId, OrderByComparator orderByComparator)
1963 throws NoSuchTemplateException, SystemException {
1964 JournalTemplate journalTemplate = findByPrimaryKey(id);
1965
1966 Session session = null;
1967
1968 try {
1969 session = openSession();
1970
1971 JournalTemplate[] array = new JournalTemplateImpl[3];
1972
1973 array[0] = getByG_S_PrevAndNext(session, journalTemplate, groupId,
1974 structureId, orderByComparator, true);
1975
1976 array[1] = journalTemplate;
1977
1978 array[2] = getByG_S_PrevAndNext(session, journalTemplate, groupId,
1979 structureId, orderByComparator, false);
1980
1981 return array;
1982 }
1983 catch (Exception e) {
1984 throw processException(e);
1985 }
1986 finally {
1987 closeSession(session);
1988 }
1989 }
1990
1991 protected JournalTemplate getByG_S_PrevAndNext(Session session,
1992 JournalTemplate journalTemplate, long groupId, String structureId,
1993 OrderByComparator orderByComparator, boolean previous) {
1994 StringBundler query = null;
1995
1996 if (orderByComparator != null) {
1997 query = new StringBundler(6 +
1998 (orderByComparator.getOrderByFields().length * 6));
1999 }
2000 else {
2001 query = new StringBundler(3);
2002 }
2003
2004 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
2005
2006 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2007
2008 if (structureId == null) {
2009 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
2010 }
2011 else {
2012 if (structureId.equals(StringPool.BLANK)) {
2013 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
2014 }
2015 else {
2016 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
2017 }
2018 }
2019
2020 if (orderByComparator != null) {
2021 String[] orderByFields = orderByComparator.getOrderByFields();
2022
2023 if (orderByFields.length > 0) {
2024 query.append(WHERE_AND);
2025 }
2026
2027 for (int i = 0; i < orderByFields.length; i++) {
2028 query.append(_ORDER_BY_ENTITY_ALIAS);
2029 query.append(orderByFields[i]);
2030
2031 if ((i + 1) < orderByFields.length) {
2032 if (orderByComparator.isAscending() ^ previous) {
2033 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2034 }
2035 else {
2036 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2037 }
2038 }
2039 else {
2040 if (orderByComparator.isAscending() ^ previous) {
2041 query.append(WHERE_GREATER_THAN);
2042 }
2043 else {
2044 query.append(WHERE_LESSER_THAN);
2045 }
2046 }
2047 }
2048
2049 query.append(ORDER_BY_CLAUSE);
2050
2051 for (int i = 0; i < orderByFields.length; i++) {
2052 query.append(_ORDER_BY_ENTITY_ALIAS);
2053 query.append(orderByFields[i]);
2054
2055 if ((i + 1) < orderByFields.length) {
2056 if (orderByComparator.isAscending() ^ previous) {
2057 query.append(ORDER_BY_ASC_HAS_NEXT);
2058 }
2059 else {
2060 query.append(ORDER_BY_DESC_HAS_NEXT);
2061 }
2062 }
2063 else {
2064 if (orderByComparator.isAscending() ^ previous) {
2065 query.append(ORDER_BY_ASC);
2066 }
2067 else {
2068 query.append(ORDER_BY_DESC);
2069 }
2070 }
2071 }
2072 }
2073
2074 else {
2075 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
2076 }
2077
2078 String sql = query.toString();
2079
2080 Query q = session.createQuery(sql);
2081
2082 q.setFirstResult(0);
2083 q.setMaxResults(2);
2084
2085 QueryPos qPos = QueryPos.getInstance(q);
2086
2087 qPos.add(groupId);
2088
2089 if (structureId != null) {
2090 qPos.add(structureId);
2091 }
2092
2093 if (orderByComparator != null) {
2094 Object[] values = orderByComparator.getOrderByValues(journalTemplate);
2095
2096 for (Object value : values) {
2097 qPos.add(value);
2098 }
2099 }
2100
2101 List<JournalTemplate> list = q.list();
2102
2103 if (list.size() == 2) {
2104 return list.get(1);
2105 }
2106 else {
2107 return null;
2108 }
2109 }
2110
2111 public List<JournalTemplate> filterFindByG_S(long groupId,
2112 String structureId) throws SystemException {
2113 return filterFindByG_S(groupId, structureId, QueryUtil.ALL_POS,
2114 QueryUtil.ALL_POS, null);
2115 }
2116
2117 public List<JournalTemplate> filterFindByG_S(long groupId,
2118 String structureId, int start, int end) throws SystemException {
2119 return filterFindByG_S(groupId, structureId, start, end, null);
2120 }
2121
2122 public List<JournalTemplate> filterFindByG_S(long groupId,
2123 String structureId, int start, int end,
2124 OrderByComparator orderByComparator) throws SystemException {
2125 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2126 return findByG_S(groupId, structureId, start, end, orderByComparator);
2127 }
2128
2129 Session session = null;
2130
2131 try {
2132 session = openSession();
2133
2134 StringBundler query = null;
2135
2136 if (orderByComparator != null) {
2137 query = new StringBundler(4 +
2138 (orderByComparator.getOrderByFields().length * 3));
2139 }
2140 else {
2141 query = new StringBundler(4);
2142 }
2143
2144 query.append(_FILTER_SQL_SELECT_JOURNALTEMPLATE_WHERE);
2145
2146 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2147
2148 if (structureId == null) {
2149 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
2150 }
2151 else {
2152 if (structureId.equals(StringPool.BLANK)) {
2153 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
2154 }
2155 else {
2156 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
2157 }
2158 }
2159
2160 if (orderByComparator != null) {
2161 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2162 orderByComparator);
2163 }
2164
2165 else {
2166 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
2167 }
2168
2169 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2170 JournalTemplate.class.getName(), _FILTER_COLUMN_ID,
2171 _FILTER_COLUMN_USERID, groupId);
2172
2173 SQLQuery q = session.createSQLQuery(sql);
2174
2175 q.addEntity(_FILTER_ENTITY_ALIAS, JournalTemplateImpl.class);
2176
2177 QueryPos qPos = QueryPos.getInstance(q);
2178
2179 qPos.add(groupId);
2180
2181 if (structureId != null) {
2182 qPos.add(structureId);
2183 }
2184
2185 return (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
2186 start, end);
2187 }
2188 catch (Exception e) {
2189 throw processException(e);
2190 }
2191 finally {
2192 closeSession(session);
2193 }
2194 }
2195
2196 public List<JournalTemplate> findAll() throws SystemException {
2197 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2198 }
2199
2200 public List<JournalTemplate> findAll(int start, int end)
2201 throws SystemException {
2202 return findAll(start, end, null);
2203 }
2204
2205 public List<JournalTemplate> findAll(int start, int end,
2206 OrderByComparator orderByComparator) throws SystemException {
2207 Object[] finderArgs = new Object[] {
2208 String.valueOf(start), String.valueOf(end),
2209 String.valueOf(orderByComparator)
2210 };
2211
2212 List<JournalTemplate> list = (List<JournalTemplate>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2213 finderArgs, this);
2214
2215 if (list == null) {
2216 Session session = null;
2217
2218 try {
2219 session = openSession();
2220
2221 StringBundler query = null;
2222 String sql = null;
2223
2224 if (orderByComparator != null) {
2225 query = new StringBundler(2 +
2226 (orderByComparator.getOrderByFields().length * 3));
2227
2228 query.append(_SQL_SELECT_JOURNALTEMPLATE);
2229
2230 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2231 orderByComparator);
2232
2233 sql = query.toString();
2234 }
2235
2236 else {
2237 sql = _SQL_SELECT_JOURNALTEMPLATE.concat(JournalTemplateModelImpl.ORDER_BY_JPQL);
2238 }
2239
2240 Query q = session.createQuery(sql);
2241
2242 if (orderByComparator == null) {
2243 list = (List<JournalTemplate>)QueryUtil.list(q,
2244 getDialect(), start, end, false);
2245
2246 Collections.sort(list);
2247 }
2248 else {
2249 list = (List<JournalTemplate>)QueryUtil.list(q,
2250 getDialect(), start, end);
2251 }
2252 }
2253 catch (Exception e) {
2254 throw processException(e);
2255 }
2256 finally {
2257 if (list == null) {
2258 list = new ArrayList<JournalTemplate>();
2259 }
2260
2261 cacheResult(list);
2262
2263 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2264
2265 closeSession(session);
2266 }
2267 }
2268
2269 return list;
2270 }
2271
2272 public void removeByUuid(String uuid) throws SystemException {
2273 for (JournalTemplate journalTemplate : findByUuid(uuid)) {
2274 remove(journalTemplate);
2275 }
2276 }
2277
2278 public void removeByUUID_G(String uuid, long groupId)
2279 throws NoSuchTemplateException, SystemException {
2280 JournalTemplate journalTemplate = findByUUID_G(uuid, groupId);
2281
2282 remove(journalTemplate);
2283 }
2284
2285 public void removeByGroupId(long groupId) throws SystemException {
2286 for (JournalTemplate journalTemplate : findByGroupId(groupId)) {
2287 remove(journalTemplate);
2288 }
2289 }
2290
2291 public void removeByTemplateId(String templateId) throws SystemException {
2292 for (JournalTemplate journalTemplate : findByTemplateId(templateId)) {
2293 remove(journalTemplate);
2294 }
2295 }
2296
2297 public void removeBySmallImageId(long smallImageId)
2298 throws NoSuchTemplateException, SystemException {
2299 JournalTemplate journalTemplate = findBySmallImageId(smallImageId);
2300
2301 remove(journalTemplate);
2302 }
2303
2304 public void removeByG_T(long groupId, String templateId)
2305 throws NoSuchTemplateException, SystemException {
2306 JournalTemplate journalTemplate = findByG_T(groupId, templateId);
2307
2308 remove(journalTemplate);
2309 }
2310
2311 public void removeByG_S(long groupId, String structureId)
2312 throws SystemException {
2313 for (JournalTemplate journalTemplate : findByG_S(groupId, structureId)) {
2314 remove(journalTemplate);
2315 }
2316 }
2317
2318 public void removeAll() throws SystemException {
2319 for (JournalTemplate journalTemplate : findAll()) {
2320 remove(journalTemplate);
2321 }
2322 }
2323
2324 public int countByUuid(String uuid) throws SystemException {
2325 Object[] finderArgs = new Object[] { uuid };
2326
2327 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2328 finderArgs, this);
2329
2330 if (count == null) {
2331 Session session = null;
2332
2333 try {
2334 session = openSession();
2335
2336 StringBundler query = new StringBundler(2);
2337
2338 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
2339
2340 if (uuid == null) {
2341 query.append(_FINDER_COLUMN_UUID_UUID_1);
2342 }
2343 else {
2344 if (uuid.equals(StringPool.BLANK)) {
2345 query.append(_FINDER_COLUMN_UUID_UUID_3);
2346 }
2347 else {
2348 query.append(_FINDER_COLUMN_UUID_UUID_2);
2349 }
2350 }
2351
2352 String sql = query.toString();
2353
2354 Query q = session.createQuery(sql);
2355
2356 QueryPos qPos = QueryPos.getInstance(q);
2357
2358 if (uuid != null) {
2359 qPos.add(uuid);
2360 }
2361
2362 count = (Long)q.uniqueResult();
2363 }
2364 catch (Exception e) {
2365 throw processException(e);
2366 }
2367 finally {
2368 if (count == null) {
2369 count = Long.valueOf(0);
2370 }
2371
2372 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2373 finderArgs, count);
2374
2375 closeSession(session);
2376 }
2377 }
2378
2379 return count.intValue();
2380 }
2381
2382 public int countByUUID_G(String uuid, long groupId)
2383 throws SystemException {
2384 Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
2385
2386 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
2387 finderArgs, this);
2388
2389 if (count == null) {
2390 Session session = null;
2391
2392 try {
2393 session = openSession();
2394
2395 StringBundler query = new StringBundler(3);
2396
2397 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
2398
2399 if (uuid == null) {
2400 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
2401 }
2402 else {
2403 if (uuid.equals(StringPool.BLANK)) {
2404 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
2405 }
2406 else {
2407 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
2408 }
2409 }
2410
2411 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
2412
2413 String sql = query.toString();
2414
2415 Query q = session.createQuery(sql);
2416
2417 QueryPos qPos = QueryPos.getInstance(q);
2418
2419 if (uuid != null) {
2420 qPos.add(uuid);
2421 }
2422
2423 qPos.add(groupId);
2424
2425 count = (Long)q.uniqueResult();
2426 }
2427 catch (Exception e) {
2428 throw processException(e);
2429 }
2430 finally {
2431 if (count == null) {
2432 count = Long.valueOf(0);
2433 }
2434
2435 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
2436 finderArgs, count);
2437
2438 closeSession(session);
2439 }
2440 }
2441
2442 return count.intValue();
2443 }
2444
2445 public int countByGroupId(long groupId) throws SystemException {
2446 Object[] finderArgs = new Object[] { new Long(groupId) };
2447
2448 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2449 finderArgs, this);
2450
2451 if (count == null) {
2452 Session session = null;
2453
2454 try {
2455 session = openSession();
2456
2457 StringBundler query = new StringBundler(2);
2458
2459 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
2460
2461 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2462
2463 String sql = query.toString();
2464
2465 Query q = session.createQuery(sql);
2466
2467 QueryPos qPos = QueryPos.getInstance(q);
2468
2469 qPos.add(groupId);
2470
2471 count = (Long)q.uniqueResult();
2472 }
2473 catch (Exception e) {
2474 throw processException(e);
2475 }
2476 finally {
2477 if (count == null) {
2478 count = Long.valueOf(0);
2479 }
2480
2481 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2482 finderArgs, count);
2483
2484 closeSession(session);
2485 }
2486 }
2487
2488 return count.intValue();
2489 }
2490
2491 public int filterCountByGroupId(long groupId) throws SystemException {
2492 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2493 return countByGroupId(groupId);
2494 }
2495
2496 Session session = null;
2497
2498 try {
2499 session = openSession();
2500
2501 StringBundler query = new StringBundler(2);
2502
2503 query.append(_FILTER_SQL_COUNT_JOURNALTEMPLATE_WHERE);
2504
2505 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2506
2507 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2508 JournalTemplate.class.getName(), _FILTER_COLUMN_ID,
2509 _FILTER_COLUMN_USERID, groupId);
2510
2511 SQLQuery q = session.createSQLQuery(sql);
2512
2513 q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
2514
2515 QueryPos qPos = QueryPos.getInstance(q);
2516
2517 qPos.add(groupId);
2518
2519 Long count = (Long)q.uniqueResult();
2520
2521 return count.intValue();
2522 }
2523 catch (Exception e) {
2524 throw processException(e);
2525 }
2526 finally {
2527 closeSession(session);
2528 }
2529 }
2530
2531 public int countByTemplateId(String templateId) throws SystemException {
2532 Object[] finderArgs = new Object[] { templateId };
2533
2534 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TEMPLATEID,
2535 finderArgs, this);
2536
2537 if (count == null) {
2538 Session session = null;
2539
2540 try {
2541 session = openSession();
2542
2543 StringBundler query = new StringBundler(2);
2544
2545 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
2546
2547 if (templateId == null) {
2548 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1);
2549 }
2550 else {
2551 if (templateId.equals(StringPool.BLANK)) {
2552 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3);
2553 }
2554 else {
2555 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2);
2556 }
2557 }
2558
2559 String sql = query.toString();
2560
2561 Query q = session.createQuery(sql);
2562
2563 QueryPos qPos = QueryPos.getInstance(q);
2564
2565 if (templateId != null) {
2566 qPos.add(templateId);
2567 }
2568
2569 count = (Long)q.uniqueResult();
2570 }
2571 catch (Exception e) {
2572 throw processException(e);
2573 }
2574 finally {
2575 if (count == null) {
2576 count = Long.valueOf(0);
2577 }
2578
2579 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TEMPLATEID,
2580 finderArgs, count);
2581
2582 closeSession(session);
2583 }
2584 }
2585
2586 return count.intValue();
2587 }
2588
2589 public int countBySmallImageId(long smallImageId) throws SystemException {
2590 Object[] finderArgs = new Object[] { new Long(smallImageId) };
2591
2592 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
2593 finderArgs, this);
2594
2595 if (count == null) {
2596 Session session = null;
2597
2598 try {
2599 session = openSession();
2600
2601 StringBundler query = new StringBundler(2);
2602
2603 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
2604
2605 query.append(_FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2);
2606
2607 String sql = query.toString();
2608
2609 Query q = session.createQuery(sql);
2610
2611 QueryPos qPos = QueryPos.getInstance(q);
2612
2613 qPos.add(smallImageId);
2614
2615 count = (Long)q.uniqueResult();
2616 }
2617 catch (Exception e) {
2618 throw processException(e);
2619 }
2620 finally {
2621 if (count == null) {
2622 count = Long.valueOf(0);
2623 }
2624
2625 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
2626 finderArgs, count);
2627
2628 closeSession(session);
2629 }
2630 }
2631
2632 return count.intValue();
2633 }
2634
2635 public int countByG_T(long groupId, String templateId)
2636 throws SystemException {
2637 Object[] finderArgs = new Object[] { new Long(groupId), templateId };
2638
2639 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_T,
2640 finderArgs, this);
2641
2642 if (count == null) {
2643 Session session = null;
2644
2645 try {
2646 session = openSession();
2647
2648 StringBundler query = new StringBundler(3);
2649
2650 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
2651
2652 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
2653
2654 if (templateId == null) {
2655 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
2656 }
2657 else {
2658 if (templateId.equals(StringPool.BLANK)) {
2659 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
2660 }
2661 else {
2662 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
2663 }
2664 }
2665
2666 String sql = query.toString();
2667
2668 Query q = session.createQuery(sql);
2669
2670 QueryPos qPos = QueryPos.getInstance(q);
2671
2672 qPos.add(groupId);
2673
2674 if (templateId != null) {
2675 qPos.add(templateId);
2676 }
2677
2678 count = (Long)q.uniqueResult();
2679 }
2680 catch (Exception e) {
2681 throw processException(e);
2682 }
2683 finally {
2684 if (count == null) {
2685 count = Long.valueOf(0);
2686 }
2687
2688 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_T, finderArgs,
2689 count);
2690
2691 closeSession(session);
2692 }
2693 }
2694
2695 return count.intValue();
2696 }
2697
2698 public int filterCountByG_T(long groupId, String templateId)
2699 throws SystemException {
2700 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2701 return countByG_T(groupId, templateId);
2702 }
2703
2704 Session session = null;
2705
2706 try {
2707 session = openSession();
2708
2709 StringBundler query = new StringBundler(3);
2710
2711 query.append(_FILTER_SQL_COUNT_JOURNALTEMPLATE_WHERE);
2712
2713 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
2714
2715 if (templateId == null) {
2716 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
2717 }
2718 else {
2719 if (templateId.equals(StringPool.BLANK)) {
2720 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
2721 }
2722 else {
2723 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
2724 }
2725 }
2726
2727 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2728 JournalTemplate.class.getName(), _FILTER_COLUMN_ID,
2729 _FILTER_COLUMN_USERID, groupId);
2730
2731 SQLQuery q = session.createSQLQuery(sql);
2732
2733 q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
2734
2735 QueryPos qPos = QueryPos.getInstance(q);
2736
2737 qPos.add(groupId);
2738
2739 if (templateId != null) {
2740 qPos.add(templateId);
2741 }
2742
2743 Long count = (Long)q.uniqueResult();
2744
2745 return count.intValue();
2746 }
2747 catch (Exception e) {
2748 throw processException(e);
2749 }
2750 finally {
2751 closeSession(session);
2752 }
2753 }
2754
2755 public int countByG_S(long groupId, String structureId)
2756 throws SystemException {
2757 Object[] finderArgs = new Object[] { new Long(groupId), structureId };
2758
2759 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_S,
2760 finderArgs, this);
2761
2762 if (count == null) {
2763 Session session = null;
2764
2765 try {
2766 session = openSession();
2767
2768 StringBundler query = new StringBundler(3);
2769
2770 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
2771
2772 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2773
2774 if (structureId == null) {
2775 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
2776 }
2777 else {
2778 if (structureId.equals(StringPool.BLANK)) {
2779 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
2780 }
2781 else {
2782 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
2783 }
2784 }
2785
2786 String sql = query.toString();
2787
2788 Query q = session.createQuery(sql);
2789
2790 QueryPos qPos = QueryPos.getInstance(q);
2791
2792 qPos.add(groupId);
2793
2794 if (structureId != null) {
2795 qPos.add(structureId);
2796 }
2797
2798 count = (Long)q.uniqueResult();
2799 }
2800 catch (Exception e) {
2801 throw processException(e);
2802 }
2803 finally {
2804 if (count == null) {
2805 count = Long.valueOf(0);
2806 }
2807
2808 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_S, finderArgs,
2809 count);
2810
2811 closeSession(session);
2812 }
2813 }
2814
2815 return count.intValue();
2816 }
2817
2818 public int filterCountByG_S(long groupId, String structureId)
2819 throws SystemException {
2820 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2821 return countByG_S(groupId, structureId);
2822 }
2823
2824 Session session = null;
2825
2826 try {
2827 session = openSession();
2828
2829 StringBundler query = new StringBundler(3);
2830
2831 query.append(_FILTER_SQL_COUNT_JOURNALTEMPLATE_WHERE);
2832
2833 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2834
2835 if (structureId == null) {
2836 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
2837 }
2838 else {
2839 if (structureId.equals(StringPool.BLANK)) {
2840 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
2841 }
2842 else {
2843 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
2844 }
2845 }
2846
2847 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2848 JournalTemplate.class.getName(), _FILTER_COLUMN_ID,
2849 _FILTER_COLUMN_USERID, groupId);
2850
2851 SQLQuery q = session.createSQLQuery(sql);
2852
2853 q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
2854
2855 QueryPos qPos = QueryPos.getInstance(q);
2856
2857 qPos.add(groupId);
2858
2859 if (structureId != null) {
2860 qPos.add(structureId);
2861 }
2862
2863 Long count = (Long)q.uniqueResult();
2864
2865 return count.intValue();
2866 }
2867 catch (Exception e) {
2868 throw processException(e);
2869 }
2870 finally {
2871 closeSession(session);
2872 }
2873 }
2874
2875 public int countAll() throws SystemException {
2876 Object[] finderArgs = new Object[0];
2877
2878 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2879 finderArgs, this);
2880
2881 if (count == null) {
2882 Session session = null;
2883
2884 try {
2885 session = openSession();
2886
2887 Query q = session.createQuery(_SQL_COUNT_JOURNALTEMPLATE);
2888
2889 count = (Long)q.uniqueResult();
2890 }
2891 catch (Exception e) {
2892 throw processException(e);
2893 }
2894 finally {
2895 if (count == null) {
2896 count = Long.valueOf(0);
2897 }
2898
2899 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2900 count);
2901
2902 closeSession(session);
2903 }
2904 }
2905
2906 return count.intValue();
2907 }
2908
2909 public void afterPropertiesSet() {
2910 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2911 com.liferay.portal.util.PropsUtil.get(
2912 "value.object.listener.com.liferay.portlet.journal.model.JournalTemplate")));
2913
2914 if (listenerClassNames.length > 0) {
2915 try {
2916 List<ModelListener<JournalTemplate>> listenersList = new ArrayList<ModelListener<JournalTemplate>>();
2917
2918 for (String listenerClassName : listenerClassNames) {
2919 listenersList.add((ModelListener<JournalTemplate>)InstanceFactory.newInstance(
2920 listenerClassName));
2921 }
2922
2923 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2924 }
2925 catch (Exception e) {
2926 _log.error(e);
2927 }
2928 }
2929 }
2930
2931 @BeanReference(type = JournalArticlePersistence.class)
2932 protected JournalArticlePersistence journalArticlePersistence;
2933 @BeanReference(type = JournalArticleImagePersistence.class)
2934 protected JournalArticleImagePersistence journalArticleImagePersistence;
2935 @BeanReference(type = JournalArticleResourcePersistence.class)
2936 protected JournalArticleResourcePersistence journalArticleResourcePersistence;
2937 @BeanReference(type = JournalContentSearchPersistence.class)
2938 protected JournalContentSearchPersistence journalContentSearchPersistence;
2939 @BeanReference(type = JournalFeedPersistence.class)
2940 protected JournalFeedPersistence journalFeedPersistence;
2941 @BeanReference(type = JournalStructurePersistence.class)
2942 protected JournalStructurePersistence journalStructurePersistence;
2943 @BeanReference(type = JournalTemplatePersistence.class)
2944 protected JournalTemplatePersistence journalTemplatePersistence;
2945 @BeanReference(type = ImagePersistence.class)
2946 protected ImagePersistence imagePersistence;
2947 @BeanReference(type = ResourcePersistence.class)
2948 protected ResourcePersistence resourcePersistence;
2949 @BeanReference(type = UserPersistence.class)
2950 protected UserPersistence userPersistence;
2951 @BeanReference(type = WebDAVPropsPersistence.class)
2952 protected WebDAVPropsPersistence webDAVPropsPersistence;
2953 @BeanReference(type = ExpandoValuePersistence.class)
2954 protected ExpandoValuePersistence expandoValuePersistence;
2955 private static final String _SQL_SELECT_JOURNALTEMPLATE = "SELECT journalTemplate FROM JournalTemplate journalTemplate";
2956 private static final String _SQL_SELECT_JOURNALTEMPLATE_WHERE = "SELECT journalTemplate FROM JournalTemplate journalTemplate WHERE ";
2957 private static final String _SQL_COUNT_JOURNALTEMPLATE = "SELECT COUNT(journalTemplate) FROM JournalTemplate journalTemplate";
2958 private static final String _SQL_COUNT_JOURNALTEMPLATE_WHERE = "SELECT COUNT(journalTemplate) FROM JournalTemplate journalTemplate WHERE ";
2959 private static final String _FINDER_COLUMN_UUID_UUID_1 = "journalTemplate.uuid IS NULL";
2960 private static final String _FINDER_COLUMN_UUID_UUID_2 = "journalTemplate.uuid = ?";
2961 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(journalTemplate.uuid IS NULL OR journalTemplate.uuid = ?)";
2962 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "journalTemplate.uuid IS NULL AND ";
2963 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "journalTemplate.uuid = ? AND ";
2964 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(journalTemplate.uuid IS NULL OR journalTemplate.uuid = ?) AND ";
2965 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "journalTemplate.groupId = ?";
2966 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "journalTemplate.groupId = ?";
2967 private static final String _FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1 = "journalTemplate.templateId IS NULL";
2968 private static final String _FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2 = "journalTemplate.templateId = ?";
2969 private static final String _FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3 = "(journalTemplate.templateId IS NULL OR journalTemplate.templateId = ?)";
2970 private static final String _FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2 = "journalTemplate.smallImageId = ?";
2971 private static final String _FINDER_COLUMN_G_T_GROUPID_2 = "journalTemplate.groupId = ? AND ";
2972 private static final String _FINDER_COLUMN_G_T_TEMPLATEID_1 = "journalTemplate.templateId IS NULL";
2973 private static final String _FINDER_COLUMN_G_T_TEMPLATEID_2 = "journalTemplate.templateId = ?";
2974 private static final String _FINDER_COLUMN_G_T_TEMPLATEID_3 = "(journalTemplate.templateId IS NULL OR journalTemplate.templateId = ?)";
2975 private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "journalTemplate.groupId = ? AND ";
2976 private static final String _FINDER_COLUMN_G_S_STRUCTUREID_1 = "journalTemplate.structureId IS NULL";
2977 private static final String _FINDER_COLUMN_G_S_STRUCTUREID_2 = "journalTemplate.structureId = ?";
2978 private static final String _FINDER_COLUMN_G_S_STRUCTUREID_3 = "(journalTemplate.structureId IS NULL OR journalTemplate.structureId = ?)";
2979 private static final String _FILTER_SQL_SELECT_JOURNALTEMPLATE_WHERE = "SELECT DISTINCT {journalTemplate.*} FROM JournalTemplate journalTemplate WHERE ";
2980 private static final String _FILTER_SQL_COUNT_JOURNALTEMPLATE_WHERE = "SELECT COUNT(DISTINCT journalTemplate.id) AS COUNT_VALUE FROM JournalTemplate journalTemplate WHERE ";
2981 private static final String _FILTER_COLUMN_ID = "journalTemplate.id";
2982 private static final String _FILTER_COLUMN_USERID = "journalTemplate.userId";
2983 private static final String _FILTER_ENTITY_ALIAS = "journalTemplate";
2984 private static final String _ORDER_BY_ENTITY_ALIAS = "journalTemplate.";
2985 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No JournalTemplate exists with the primary key ";
2986 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No JournalTemplate exists with the key {";
2987 private static Log _log = LogFactoryUtil.getLog(JournalTemplatePersistenceImpl.class);
2988}