001
014
015 package com.liferay.portlet.journal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.annotation.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.SQLQuery;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.GetterUtil;
032 import com.liferay.portal.kernel.util.InstanceFactory;
033 import com.liferay.portal.kernel.util.OrderByComparator;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.kernel.util.Validator;
038 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
039 import com.liferay.portal.model.ModelListener;
040 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
041 import com.liferay.portal.service.persistence.BatchSessionUtil;
042 import com.liferay.portal.service.persistence.ImagePersistence;
043 import com.liferay.portal.service.persistence.ResourcePersistence;
044 import com.liferay.portal.service.persistence.UserPersistence;
045 import com.liferay.portal.service.persistence.WebDAVPropsPersistence;
046 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
047
048 import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
049 import com.liferay.portlet.journal.NoSuchTemplateException;
050 import com.liferay.portlet.journal.model.JournalTemplate;
051 import com.liferay.portlet.journal.model.impl.JournalTemplateImpl;
052 import com.liferay.portlet.journal.model.impl.JournalTemplateModelImpl;
053
054 import java.io.Serializable;
055
056 import java.util.ArrayList;
057 import java.util.Collections;
058 import java.util.List;
059
060
076 public class JournalTemplatePersistenceImpl extends BasePersistenceImpl<JournalTemplate>
077 implements JournalTemplatePersistence {
078 public static final String FINDER_CLASS_NAME_ENTITY = JournalTemplateImpl.class.getName();
079 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
080 ".List";
081 public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
082 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
083 FINDER_CLASS_NAME_LIST, "findByUuid",
084 new String[] {
085 String.class.getName(),
086
087 "java.lang.Integer", "java.lang.Integer",
088 "com.liferay.portal.kernel.util.OrderByComparator"
089 });
090 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
091 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
092 FINDER_CLASS_NAME_LIST, "countByUuid",
093 new String[] { String.class.getName() });
094 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
095 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
096 FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
097 new String[] { String.class.getName(), Long.class.getName() });
098 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
099 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
100 FINDER_CLASS_NAME_LIST, "countByUUID_G",
101 new String[] { String.class.getName(), Long.class.getName() });
102 public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
103 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
104 FINDER_CLASS_NAME_LIST, "findByGroupId",
105 new String[] {
106 Long.class.getName(),
107
108 "java.lang.Integer", "java.lang.Integer",
109 "com.liferay.portal.kernel.util.OrderByComparator"
110 });
111 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
112 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
113 FINDER_CLASS_NAME_LIST, "countByGroupId",
114 new String[] { Long.class.getName() });
115 public static final FinderPath FINDER_PATH_FIND_BY_TEMPLATEID = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
116 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
117 FINDER_CLASS_NAME_LIST, "findByTemplateId",
118 new String[] {
119 String.class.getName(),
120
121 "java.lang.Integer", "java.lang.Integer",
122 "com.liferay.portal.kernel.util.OrderByComparator"
123 });
124 public static final FinderPath FINDER_PATH_COUNT_BY_TEMPLATEID = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
125 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
126 FINDER_CLASS_NAME_LIST, "countByTemplateId",
127 new String[] { String.class.getName() });
128 public static final FinderPath FINDER_PATH_FETCH_BY_SMALLIMAGEID = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
129 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
130 FINDER_CLASS_NAME_ENTITY, "fetchBySmallImageId",
131 new String[] { Long.class.getName() });
132 public static final FinderPath FINDER_PATH_COUNT_BY_SMALLIMAGEID = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
133 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
134 FINDER_CLASS_NAME_LIST, "countBySmallImageId",
135 new String[] { Long.class.getName() });
136 public static final FinderPath FINDER_PATH_FETCH_BY_G_T = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
137 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
138 FINDER_CLASS_NAME_ENTITY, "fetchByG_T",
139 new String[] { Long.class.getName(), String.class.getName() });
140 public static final FinderPath FINDER_PATH_COUNT_BY_G_T = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
141 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
142 FINDER_CLASS_NAME_LIST, "countByG_T",
143 new String[] { Long.class.getName(), String.class.getName() });
144 public static final FinderPath FINDER_PATH_FIND_BY_G_S = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
145 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
146 FINDER_CLASS_NAME_LIST, "findByG_S",
147 new String[] {
148 Long.class.getName(), String.class.getName(),
149
150 "java.lang.Integer", "java.lang.Integer",
151 "com.liferay.portal.kernel.util.OrderByComparator"
152 });
153 public static final FinderPath FINDER_PATH_COUNT_BY_G_S = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
154 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
155 FINDER_CLASS_NAME_LIST, "countByG_S",
156 new String[] { Long.class.getName(), String.class.getName() });
157 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
158 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
159 FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
160 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
161 JournalTemplateModelImpl.FINDER_CACHE_ENABLED,
162 FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
163
164
169 public void cacheResult(JournalTemplate journalTemplate) {
170 EntityCacheUtil.putResult(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
171 JournalTemplateImpl.class, journalTemplate.getPrimaryKey(),
172 journalTemplate);
173
174 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
175 new Object[] {
176 journalTemplate.getUuid(),
177 new Long(journalTemplate.getGroupId())
178 }, journalTemplate);
179
180 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
181 new Object[] { new Long(journalTemplate.getSmallImageId()) },
182 journalTemplate);
183
184 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_T,
185 new Object[] {
186 new Long(journalTemplate.getGroupId()),
187
188 journalTemplate.getTemplateId()
189 }, journalTemplate);
190 }
191
192
197 public void cacheResult(List<JournalTemplate> journalTemplates) {
198 for (JournalTemplate journalTemplate : journalTemplates) {
199 if (EntityCacheUtil.getResult(
200 JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
201 JournalTemplateImpl.class,
202 journalTemplate.getPrimaryKey(), this) == null) {
203 cacheResult(journalTemplate);
204 }
205 }
206 }
207
208
215 public void clearCache() {
216 CacheRegistryUtil.clear(JournalTemplateImpl.class.getName());
217 EntityCacheUtil.clearCache(JournalTemplateImpl.class.getName());
218 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
219 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
220 }
221
222
229 public void clearCache(JournalTemplate journalTemplate) {
230 EntityCacheUtil.removeResult(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
231 JournalTemplateImpl.class, journalTemplate.getPrimaryKey());
232
233 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
234 new Object[] {
235 journalTemplate.getUuid(),
236 new Long(journalTemplate.getGroupId())
237 });
238
239 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
240 new Object[] { new Long(journalTemplate.getSmallImageId()) });
241
242 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_T,
243 new Object[] {
244 new Long(journalTemplate.getGroupId()),
245
246 journalTemplate.getTemplateId()
247 });
248 }
249
250
256 public JournalTemplate create(long id) {
257 JournalTemplate journalTemplate = new JournalTemplateImpl();
258
259 journalTemplate.setNew(true);
260 journalTemplate.setPrimaryKey(id);
261
262 String uuid = PortalUUIDUtil.generate();
263
264 journalTemplate.setUuid(uuid);
265
266 return journalTemplate;
267 }
268
269
277 public JournalTemplate remove(Serializable primaryKey)
278 throws NoSuchModelException, SystemException {
279 return remove(((Long)primaryKey).longValue());
280 }
281
282
290 public JournalTemplate remove(long id)
291 throws NoSuchTemplateException, SystemException {
292 Session session = null;
293
294 try {
295 session = openSession();
296
297 JournalTemplate journalTemplate = (JournalTemplate)session.get(JournalTemplateImpl.class,
298 new Long(id));
299
300 if (journalTemplate == null) {
301 if (_log.isWarnEnabled()) {
302 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + id);
303 }
304
305 throw new NoSuchTemplateException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
306 id);
307 }
308
309 return remove(journalTemplate);
310 }
311 catch (NoSuchTemplateException nsee) {
312 throw nsee;
313 }
314 catch (Exception e) {
315 throw processException(e);
316 }
317 finally {
318 closeSession(session);
319 }
320 }
321
322 protected JournalTemplate removeImpl(JournalTemplate journalTemplate)
323 throws SystemException {
324 journalTemplate = toUnwrappedModel(journalTemplate);
325
326 Session session = null;
327
328 try {
329 session = openSession();
330
331 if (journalTemplate.isCachedModel() ||
332 BatchSessionUtil.isEnabled()) {
333 Object staleObject = session.get(JournalTemplateImpl.class,
334 journalTemplate.getPrimaryKeyObj());
335
336 if (staleObject != null) {
337 session.evict(staleObject);
338 }
339 }
340
341 session.delete(journalTemplate);
342
343 session.flush();
344 }
345 catch (Exception e) {
346 throw processException(e);
347 }
348 finally {
349 closeSession(session);
350 }
351
352 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
353
354 JournalTemplateModelImpl journalTemplateModelImpl = (JournalTemplateModelImpl)journalTemplate;
355
356 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
357 new Object[] {
358 journalTemplateModelImpl.getOriginalUuid(),
359 new Long(journalTemplateModelImpl.getOriginalGroupId())
360 });
361
362 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
363 new Object[] {
364 new Long(journalTemplateModelImpl.getOriginalSmallImageId())
365 });
366
367 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_T,
368 new Object[] {
369 new Long(journalTemplateModelImpl.getOriginalGroupId()),
370
371 journalTemplateModelImpl.getOriginalTemplateId()
372 });
373
374 EntityCacheUtil.removeResult(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
375 JournalTemplateImpl.class, journalTemplate.getPrimaryKey());
376
377 return journalTemplate;
378 }
379
380 public JournalTemplate updateImpl(
381 com.liferay.portlet.journal.model.JournalTemplate journalTemplate,
382 boolean merge) throws SystemException {
383 journalTemplate = toUnwrappedModel(journalTemplate);
384
385 boolean isNew = journalTemplate.isNew();
386
387 JournalTemplateModelImpl journalTemplateModelImpl = (JournalTemplateModelImpl)journalTemplate;
388
389 if (Validator.isNull(journalTemplate.getUuid())) {
390 String uuid = PortalUUIDUtil.generate();
391
392 journalTemplate.setUuid(uuid);
393 }
394
395 Session session = null;
396
397 try {
398 session = openSession();
399
400 BatchSessionUtil.update(session, journalTemplate, merge);
401
402 journalTemplate.setNew(false);
403 }
404 catch (Exception e) {
405 throw processException(e);
406 }
407 finally {
408 closeSession(session);
409 }
410
411 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
412
413 EntityCacheUtil.putResult(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
414 JournalTemplateImpl.class, journalTemplate.getPrimaryKey(),
415 journalTemplate);
416
417 if (!isNew &&
418 (!Validator.equals(journalTemplate.getUuid(),
419 journalTemplateModelImpl.getOriginalUuid()) ||
420 (journalTemplate.getGroupId() != journalTemplateModelImpl.getOriginalGroupId()))) {
421 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
422 new Object[] {
423 journalTemplateModelImpl.getOriginalUuid(),
424 new Long(journalTemplateModelImpl.getOriginalGroupId())
425 });
426 }
427
428 if (isNew ||
429 (!Validator.equals(journalTemplate.getUuid(),
430 journalTemplateModelImpl.getOriginalUuid()) ||
431 (journalTemplate.getGroupId() != journalTemplateModelImpl.getOriginalGroupId()))) {
432 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
433 new Object[] {
434 journalTemplate.getUuid(),
435 new Long(journalTemplate.getGroupId())
436 }, journalTemplate);
437 }
438
439 if (!isNew &&
440 (journalTemplate.getSmallImageId() != journalTemplateModelImpl.getOriginalSmallImageId())) {
441 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
442 new Object[] {
443 new Long(journalTemplateModelImpl.getOriginalSmallImageId())
444 });
445 }
446
447 if (isNew ||
448 (journalTemplate.getSmallImageId() != journalTemplateModelImpl.getOriginalSmallImageId())) {
449 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
450 new Object[] { new Long(journalTemplate.getSmallImageId()) },
451 journalTemplate);
452 }
453
454 if (!isNew &&
455 ((journalTemplate.getGroupId() != journalTemplateModelImpl.getOriginalGroupId()) ||
456 !Validator.equals(journalTemplate.getTemplateId(),
457 journalTemplateModelImpl.getOriginalTemplateId()))) {
458 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_T,
459 new Object[] {
460 new Long(journalTemplateModelImpl.getOriginalGroupId()),
461
462 journalTemplateModelImpl.getOriginalTemplateId()
463 });
464 }
465
466 if (isNew ||
467 ((journalTemplate.getGroupId() != journalTemplateModelImpl.getOriginalGroupId()) ||
468 !Validator.equals(journalTemplate.getTemplateId(),
469 journalTemplateModelImpl.getOriginalTemplateId()))) {
470 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_T,
471 new Object[] {
472 new Long(journalTemplate.getGroupId()),
473
474 journalTemplate.getTemplateId()
475 }, journalTemplate);
476 }
477
478 return journalTemplate;
479 }
480
481 protected JournalTemplate toUnwrappedModel(JournalTemplate journalTemplate) {
482 if (journalTemplate instanceof JournalTemplateImpl) {
483 return journalTemplate;
484 }
485
486 JournalTemplateImpl journalTemplateImpl = new JournalTemplateImpl();
487
488 journalTemplateImpl.setNew(journalTemplate.isNew());
489 journalTemplateImpl.setPrimaryKey(journalTemplate.getPrimaryKey());
490
491 journalTemplateImpl.setUuid(journalTemplate.getUuid());
492 journalTemplateImpl.setId(journalTemplate.getId());
493 journalTemplateImpl.setGroupId(journalTemplate.getGroupId());
494 journalTemplateImpl.setCompanyId(journalTemplate.getCompanyId());
495 journalTemplateImpl.setUserId(journalTemplate.getUserId());
496 journalTemplateImpl.setUserName(journalTemplate.getUserName());
497 journalTemplateImpl.setCreateDate(journalTemplate.getCreateDate());
498 journalTemplateImpl.setModifiedDate(journalTemplate.getModifiedDate());
499 journalTemplateImpl.setTemplateId(journalTemplate.getTemplateId());
500 journalTemplateImpl.setStructureId(journalTemplate.getStructureId());
501 journalTemplateImpl.setName(journalTemplate.getName());
502 journalTemplateImpl.setDescription(journalTemplate.getDescription());
503 journalTemplateImpl.setXsl(journalTemplate.getXsl());
504 journalTemplateImpl.setLangType(journalTemplate.getLangType());
505 journalTemplateImpl.setCacheable(journalTemplate.isCacheable());
506 journalTemplateImpl.setSmallImage(journalTemplate.isSmallImage());
507 journalTemplateImpl.setSmallImageId(journalTemplate.getSmallImageId());
508 journalTemplateImpl.setSmallImageURL(journalTemplate.getSmallImageURL());
509
510 return journalTemplateImpl;
511 }
512
513
521 public JournalTemplate findByPrimaryKey(Serializable primaryKey)
522 throws NoSuchModelException, SystemException {
523 return findByPrimaryKey(((Long)primaryKey).longValue());
524 }
525
526
534 public JournalTemplate findByPrimaryKey(long id)
535 throws NoSuchTemplateException, SystemException {
536 JournalTemplate journalTemplate = fetchByPrimaryKey(id);
537
538 if (journalTemplate == null) {
539 if (_log.isWarnEnabled()) {
540 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + id);
541 }
542
543 throw new NoSuchTemplateException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
544 id);
545 }
546
547 return journalTemplate;
548 }
549
550
557 public JournalTemplate fetchByPrimaryKey(Serializable primaryKey)
558 throws SystemException {
559 return fetchByPrimaryKey(((Long)primaryKey).longValue());
560 }
561
562
569 public JournalTemplate fetchByPrimaryKey(long id) throws SystemException {
570 JournalTemplate journalTemplate = (JournalTemplate)EntityCacheUtil.getResult(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
571 JournalTemplateImpl.class, id, this);
572
573 if (journalTemplate == null) {
574 Session session = null;
575
576 try {
577 session = openSession();
578
579 journalTemplate = (JournalTemplate)session.get(JournalTemplateImpl.class,
580 new Long(id));
581 }
582 catch (Exception e) {
583 throw processException(e);
584 }
585 finally {
586 if (journalTemplate != null) {
587 cacheResult(journalTemplate);
588 }
589
590 closeSession(session);
591 }
592 }
593
594 return journalTemplate;
595 }
596
597
604 public List<JournalTemplate> findByUuid(String uuid)
605 throws SystemException {
606 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
607 }
608
609
622 public List<JournalTemplate> findByUuid(String uuid, int start, int end)
623 throws SystemException {
624 return findByUuid(uuid, start, end, null);
625 }
626
627
641 public List<JournalTemplate> findByUuid(String uuid, int start, int end,
642 OrderByComparator orderByComparator) throws SystemException {
643 Object[] finderArgs = new Object[] {
644 uuid,
645
646 String.valueOf(start), String.valueOf(end),
647 String.valueOf(orderByComparator)
648 };
649
650 List<JournalTemplate> list = (List<JournalTemplate>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
651 finderArgs, this);
652
653 if (list == null) {
654 Session session = null;
655
656 try {
657 session = openSession();
658
659 StringBundler query = null;
660
661 if (orderByComparator != null) {
662 query = new StringBundler(3 +
663 (orderByComparator.getOrderByFields().length * 3));
664 }
665 else {
666 query = new StringBundler(3);
667 }
668
669 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
670
671 if (uuid == null) {
672 query.append(_FINDER_COLUMN_UUID_UUID_1);
673 }
674 else {
675 if (uuid.equals(StringPool.BLANK)) {
676 query.append(_FINDER_COLUMN_UUID_UUID_3);
677 }
678 else {
679 query.append(_FINDER_COLUMN_UUID_UUID_2);
680 }
681 }
682
683 if (orderByComparator != null) {
684 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
685 orderByComparator);
686 }
687
688 else {
689 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
690 }
691
692 String sql = query.toString();
693
694 Query q = session.createQuery(sql);
695
696 QueryPos qPos = QueryPos.getInstance(q);
697
698 if (uuid != null) {
699 qPos.add(uuid);
700 }
701
702 list = (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
703 start, end);
704 }
705 catch (Exception e) {
706 throw processException(e);
707 }
708 finally {
709 if (list == null) {
710 list = new ArrayList<JournalTemplate>();
711 }
712
713 cacheResult(list);
714
715 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
716 list);
717
718 closeSession(session);
719 }
720 }
721
722 return list;
723 }
724
725
738 public JournalTemplate findByUuid_First(String uuid,
739 OrderByComparator orderByComparator)
740 throws NoSuchTemplateException, SystemException {
741 List<JournalTemplate> list = findByUuid(uuid, 0, 1, orderByComparator);
742
743 if (list.isEmpty()) {
744 StringBundler msg = new StringBundler(4);
745
746 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
747
748 msg.append("uuid=");
749 msg.append(uuid);
750
751 msg.append(StringPool.CLOSE_CURLY_BRACE);
752
753 throw new NoSuchTemplateException(msg.toString());
754 }
755 else {
756 return list.get(0);
757 }
758 }
759
760
773 public JournalTemplate findByUuid_Last(String uuid,
774 OrderByComparator orderByComparator)
775 throws NoSuchTemplateException, SystemException {
776 int count = countByUuid(uuid);
777
778 List<JournalTemplate> list = findByUuid(uuid, count - 1, count,
779 orderByComparator);
780
781 if (list.isEmpty()) {
782 StringBundler msg = new StringBundler(4);
783
784 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
785
786 msg.append("uuid=");
787 msg.append(uuid);
788
789 msg.append(StringPool.CLOSE_CURLY_BRACE);
790
791 throw new NoSuchTemplateException(msg.toString());
792 }
793 else {
794 return list.get(0);
795 }
796 }
797
798
812 public JournalTemplate[] findByUuid_PrevAndNext(long id, String uuid,
813 OrderByComparator orderByComparator)
814 throws NoSuchTemplateException, SystemException {
815 JournalTemplate journalTemplate = findByPrimaryKey(id);
816
817 Session session = null;
818
819 try {
820 session = openSession();
821
822 JournalTemplate[] array = new JournalTemplateImpl[3];
823
824 array[0] = getByUuid_PrevAndNext(session, journalTemplate, uuid,
825 orderByComparator, true);
826
827 array[1] = journalTemplate;
828
829 array[2] = getByUuid_PrevAndNext(session, journalTemplate, uuid,
830 orderByComparator, false);
831
832 return array;
833 }
834 catch (Exception e) {
835 throw processException(e);
836 }
837 finally {
838 closeSession(session);
839 }
840 }
841
842 protected JournalTemplate getByUuid_PrevAndNext(Session session,
843 JournalTemplate journalTemplate, String uuid,
844 OrderByComparator orderByComparator, boolean previous) {
845 StringBundler query = null;
846
847 if (orderByComparator != null) {
848 query = new StringBundler(6 +
849 (orderByComparator.getOrderByFields().length * 6));
850 }
851 else {
852 query = new StringBundler(3);
853 }
854
855 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
856
857 if (uuid == null) {
858 query.append(_FINDER_COLUMN_UUID_UUID_1);
859 }
860 else {
861 if (uuid.equals(StringPool.BLANK)) {
862 query.append(_FINDER_COLUMN_UUID_UUID_3);
863 }
864 else {
865 query.append(_FINDER_COLUMN_UUID_UUID_2);
866 }
867 }
868
869 if (orderByComparator != null) {
870 String[] orderByFields = orderByComparator.getOrderByFields();
871
872 if (orderByFields.length > 0) {
873 query.append(WHERE_AND);
874 }
875
876 for (int i = 0; i < orderByFields.length; i++) {
877 query.append(_ORDER_BY_ENTITY_ALIAS);
878 query.append(orderByFields[i]);
879
880 if ((i + 1) < orderByFields.length) {
881 if (orderByComparator.isAscending() ^ previous) {
882 query.append(WHERE_GREATER_THAN_HAS_NEXT);
883 }
884 else {
885 query.append(WHERE_LESSER_THAN_HAS_NEXT);
886 }
887 }
888 else {
889 if (orderByComparator.isAscending() ^ previous) {
890 query.append(WHERE_GREATER_THAN);
891 }
892 else {
893 query.append(WHERE_LESSER_THAN);
894 }
895 }
896 }
897
898 query.append(ORDER_BY_CLAUSE);
899
900 for (int i = 0; i < orderByFields.length; i++) {
901 query.append(_ORDER_BY_ENTITY_ALIAS);
902 query.append(orderByFields[i]);
903
904 if ((i + 1) < orderByFields.length) {
905 if (orderByComparator.isAscending() ^ previous) {
906 query.append(ORDER_BY_ASC_HAS_NEXT);
907 }
908 else {
909 query.append(ORDER_BY_DESC_HAS_NEXT);
910 }
911 }
912 else {
913 if (orderByComparator.isAscending() ^ previous) {
914 query.append(ORDER_BY_ASC);
915 }
916 else {
917 query.append(ORDER_BY_DESC);
918 }
919 }
920 }
921 }
922
923 else {
924 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
925 }
926
927 String sql = query.toString();
928
929 Query q = session.createQuery(sql);
930
931 q.setFirstResult(0);
932 q.setMaxResults(2);
933
934 QueryPos qPos = QueryPos.getInstance(q);
935
936 if (uuid != null) {
937 qPos.add(uuid);
938 }
939
940 if (orderByComparator != null) {
941 Object[] values = orderByComparator.getOrderByValues(journalTemplate);
942
943 for (Object value : values) {
944 qPos.add(value);
945 }
946 }
947
948 List<JournalTemplate> list = q.list();
949
950 if (list.size() == 2) {
951 return list.get(1);
952 }
953 else {
954 return null;
955 }
956 }
957
958
967 public JournalTemplate findByUUID_G(String uuid, long groupId)
968 throws NoSuchTemplateException, SystemException {
969 JournalTemplate journalTemplate = fetchByUUID_G(uuid, groupId);
970
971 if (journalTemplate == null) {
972 StringBundler msg = new StringBundler(6);
973
974 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
975
976 msg.append("uuid=");
977 msg.append(uuid);
978
979 msg.append(", groupId=");
980 msg.append(groupId);
981
982 msg.append(StringPool.CLOSE_CURLY_BRACE);
983
984 if (_log.isWarnEnabled()) {
985 _log.warn(msg.toString());
986 }
987
988 throw new NoSuchTemplateException(msg.toString());
989 }
990
991 return journalTemplate;
992 }
993
994
1002 public JournalTemplate fetchByUUID_G(String uuid, long groupId)
1003 throws SystemException {
1004 return fetchByUUID_G(uuid, groupId, true);
1005 }
1006
1007
1015 public JournalTemplate fetchByUUID_G(String uuid, long groupId,
1016 boolean retrieveFromCache) throws SystemException {
1017 Object[] finderArgs = new Object[] { uuid, groupId };
1018
1019 Object result = null;
1020
1021 if (retrieveFromCache) {
1022 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1023 finderArgs, this);
1024 }
1025
1026 if (result == null) {
1027 Session session = null;
1028
1029 try {
1030 session = openSession();
1031
1032 StringBundler query = new StringBundler(4);
1033
1034 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1035
1036 if (uuid == null) {
1037 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1038 }
1039 else {
1040 if (uuid.equals(StringPool.BLANK)) {
1041 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1042 }
1043 else {
1044 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1045 }
1046 }
1047
1048 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1049
1050 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1051
1052 String sql = query.toString();
1053
1054 Query q = session.createQuery(sql);
1055
1056 QueryPos qPos = QueryPos.getInstance(q);
1057
1058 if (uuid != null) {
1059 qPos.add(uuid);
1060 }
1061
1062 qPos.add(groupId);
1063
1064 List<JournalTemplate> list = q.list();
1065
1066 result = list;
1067
1068 JournalTemplate journalTemplate = null;
1069
1070 if (list.isEmpty()) {
1071 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1072 finderArgs, list);
1073 }
1074 else {
1075 journalTemplate = list.get(0);
1076
1077 cacheResult(journalTemplate);
1078
1079 if ((journalTemplate.getUuid() == null) ||
1080 !journalTemplate.getUuid().equals(uuid) ||
1081 (journalTemplate.getGroupId() != groupId)) {
1082 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1083 finderArgs, journalTemplate);
1084 }
1085 }
1086
1087 return journalTemplate;
1088 }
1089 catch (Exception e) {
1090 throw processException(e);
1091 }
1092 finally {
1093 if (result == null) {
1094 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1095 finderArgs, new ArrayList<JournalTemplate>());
1096 }
1097
1098 closeSession(session);
1099 }
1100 }
1101 else {
1102 if (result instanceof List<?>) {
1103 return null;
1104 }
1105 else {
1106 return (JournalTemplate)result;
1107 }
1108 }
1109 }
1110
1111
1118 public List<JournalTemplate> findByGroupId(long groupId)
1119 throws SystemException {
1120 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1121 }
1122
1123
1136 public List<JournalTemplate> findByGroupId(long groupId, int start, int end)
1137 throws SystemException {
1138 return findByGroupId(groupId, start, end, null);
1139 }
1140
1141
1155 public List<JournalTemplate> findByGroupId(long groupId, int start,
1156 int end, OrderByComparator orderByComparator) throws SystemException {
1157 Object[] finderArgs = new Object[] {
1158 groupId,
1159
1160 String.valueOf(start), String.valueOf(end),
1161 String.valueOf(orderByComparator)
1162 };
1163
1164 List<JournalTemplate> list = (List<JournalTemplate>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
1165 finderArgs, this);
1166
1167 if (list == null) {
1168 Session session = null;
1169
1170 try {
1171 session = openSession();
1172
1173 StringBundler query = null;
1174
1175 if (orderByComparator != null) {
1176 query = new StringBundler(3 +
1177 (orderByComparator.getOrderByFields().length * 3));
1178 }
1179 else {
1180 query = new StringBundler(3);
1181 }
1182
1183 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1184
1185 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1186
1187 if (orderByComparator != null) {
1188 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1189 orderByComparator);
1190 }
1191
1192 else {
1193 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1194 }
1195
1196 String sql = query.toString();
1197
1198 Query q = session.createQuery(sql);
1199
1200 QueryPos qPos = QueryPos.getInstance(q);
1201
1202 qPos.add(groupId);
1203
1204 list = (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
1205 start, end);
1206 }
1207 catch (Exception e) {
1208 throw processException(e);
1209 }
1210 finally {
1211 if (list == null) {
1212 list = new ArrayList<JournalTemplate>();
1213 }
1214
1215 cacheResult(list);
1216
1217 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
1218 finderArgs, list);
1219
1220 closeSession(session);
1221 }
1222 }
1223
1224 return list;
1225 }
1226
1227
1240 public JournalTemplate findByGroupId_First(long groupId,
1241 OrderByComparator orderByComparator)
1242 throws NoSuchTemplateException, SystemException {
1243 List<JournalTemplate> list = findByGroupId(groupId, 0, 1,
1244 orderByComparator);
1245
1246 if (list.isEmpty()) {
1247 StringBundler msg = new StringBundler(4);
1248
1249 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1250
1251 msg.append("groupId=");
1252 msg.append(groupId);
1253
1254 msg.append(StringPool.CLOSE_CURLY_BRACE);
1255
1256 throw new NoSuchTemplateException(msg.toString());
1257 }
1258 else {
1259 return list.get(0);
1260 }
1261 }
1262
1263
1276 public JournalTemplate findByGroupId_Last(long groupId,
1277 OrderByComparator orderByComparator)
1278 throws NoSuchTemplateException, SystemException {
1279 int count = countByGroupId(groupId);
1280
1281 List<JournalTemplate> list = findByGroupId(groupId, count - 1, count,
1282 orderByComparator);
1283
1284 if (list.isEmpty()) {
1285 StringBundler msg = new StringBundler(4);
1286
1287 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1288
1289 msg.append("groupId=");
1290 msg.append(groupId);
1291
1292 msg.append(StringPool.CLOSE_CURLY_BRACE);
1293
1294 throw new NoSuchTemplateException(msg.toString());
1295 }
1296 else {
1297 return list.get(0);
1298 }
1299 }
1300
1301
1315 public JournalTemplate[] findByGroupId_PrevAndNext(long id, long groupId,
1316 OrderByComparator orderByComparator)
1317 throws NoSuchTemplateException, SystemException {
1318 JournalTemplate journalTemplate = findByPrimaryKey(id);
1319
1320 Session session = null;
1321
1322 try {
1323 session = openSession();
1324
1325 JournalTemplate[] array = new JournalTemplateImpl[3];
1326
1327 array[0] = getByGroupId_PrevAndNext(session, journalTemplate,
1328 groupId, orderByComparator, true);
1329
1330 array[1] = journalTemplate;
1331
1332 array[2] = getByGroupId_PrevAndNext(session, journalTemplate,
1333 groupId, orderByComparator, false);
1334
1335 return array;
1336 }
1337 catch (Exception e) {
1338 throw processException(e);
1339 }
1340 finally {
1341 closeSession(session);
1342 }
1343 }
1344
1345 protected JournalTemplate getByGroupId_PrevAndNext(Session session,
1346 JournalTemplate journalTemplate, long groupId,
1347 OrderByComparator orderByComparator, boolean previous) {
1348 StringBundler query = null;
1349
1350 if (orderByComparator != null) {
1351 query = new StringBundler(6 +
1352 (orderByComparator.getOrderByFields().length * 6));
1353 }
1354 else {
1355 query = new StringBundler(3);
1356 }
1357
1358 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1359
1360 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1361
1362 if (orderByComparator != null) {
1363 String[] orderByFields = orderByComparator.getOrderByFields();
1364
1365 if (orderByFields.length > 0) {
1366 query.append(WHERE_AND);
1367 }
1368
1369 for (int i = 0; i < orderByFields.length; i++) {
1370 query.append(_ORDER_BY_ENTITY_ALIAS);
1371 query.append(orderByFields[i]);
1372
1373 if ((i + 1) < orderByFields.length) {
1374 if (orderByComparator.isAscending() ^ previous) {
1375 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1376 }
1377 else {
1378 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1379 }
1380 }
1381 else {
1382 if (orderByComparator.isAscending() ^ previous) {
1383 query.append(WHERE_GREATER_THAN);
1384 }
1385 else {
1386 query.append(WHERE_LESSER_THAN);
1387 }
1388 }
1389 }
1390
1391 query.append(ORDER_BY_CLAUSE);
1392
1393 for (int i = 0; i < orderByFields.length; i++) {
1394 query.append(_ORDER_BY_ENTITY_ALIAS);
1395 query.append(orderByFields[i]);
1396
1397 if ((i + 1) < orderByFields.length) {
1398 if (orderByComparator.isAscending() ^ previous) {
1399 query.append(ORDER_BY_ASC_HAS_NEXT);
1400 }
1401 else {
1402 query.append(ORDER_BY_DESC_HAS_NEXT);
1403 }
1404 }
1405 else {
1406 if (orderByComparator.isAscending() ^ previous) {
1407 query.append(ORDER_BY_ASC);
1408 }
1409 else {
1410 query.append(ORDER_BY_DESC);
1411 }
1412 }
1413 }
1414 }
1415
1416 else {
1417 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1418 }
1419
1420 String sql = query.toString();
1421
1422 Query q = session.createQuery(sql);
1423
1424 q.setFirstResult(0);
1425 q.setMaxResults(2);
1426
1427 QueryPos qPos = QueryPos.getInstance(q);
1428
1429 qPos.add(groupId);
1430
1431 if (orderByComparator != null) {
1432 Object[] values = orderByComparator.getOrderByValues(journalTemplate);
1433
1434 for (Object value : values) {
1435 qPos.add(value);
1436 }
1437 }
1438
1439 List<JournalTemplate> list = q.list();
1440
1441 if (list.size() == 2) {
1442 return list.get(1);
1443 }
1444 else {
1445 return null;
1446 }
1447 }
1448
1449
1456 public List<JournalTemplate> filterFindByGroupId(long groupId)
1457 throws SystemException {
1458 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1459 QueryUtil.ALL_POS, null);
1460 }
1461
1462
1475 public List<JournalTemplate> filterFindByGroupId(long groupId, int start,
1476 int end) throws SystemException {
1477 return filterFindByGroupId(groupId, start, end, null);
1478 }
1479
1480
1494 public List<JournalTemplate> filterFindByGroupId(long groupId, int start,
1495 int end, OrderByComparator orderByComparator) throws SystemException {
1496 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1497 return findByGroupId(groupId, start, end, orderByComparator);
1498 }
1499
1500 Session session = null;
1501
1502 try {
1503 session = openSession();
1504
1505 StringBundler query = null;
1506
1507 if (orderByComparator != null) {
1508 query = new StringBundler(3 +
1509 (orderByComparator.getOrderByFields().length * 3));
1510 }
1511 else {
1512 query = new StringBundler(3);
1513 }
1514
1515 query.append(_FILTER_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1516
1517 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1518
1519 if (orderByComparator != null) {
1520 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1521 orderByComparator);
1522 }
1523
1524 else {
1525 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1526 }
1527
1528 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1529 JournalTemplate.class.getName(), _FILTER_COLUMN_PK,
1530 _FILTER_COLUMN_USERID, groupId);
1531
1532 SQLQuery q = session.createSQLQuery(sql);
1533
1534 q.addEntity(_FILTER_ENTITY_ALIAS, JournalTemplateImpl.class);
1535
1536 QueryPos qPos = QueryPos.getInstance(q);
1537
1538 qPos.add(groupId);
1539
1540 return (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
1541 start, end);
1542 }
1543 catch (Exception e) {
1544 throw processException(e);
1545 }
1546 finally {
1547 closeSession(session);
1548 }
1549 }
1550
1551
1558 public List<JournalTemplate> findByTemplateId(String templateId)
1559 throws SystemException {
1560 return findByTemplateId(templateId, QueryUtil.ALL_POS,
1561 QueryUtil.ALL_POS, null);
1562 }
1563
1564
1577 public List<JournalTemplate> findByTemplateId(String templateId, int start,
1578 int end) throws SystemException {
1579 return findByTemplateId(templateId, start, end, null);
1580 }
1581
1582
1596 public List<JournalTemplate> findByTemplateId(String templateId, int start,
1597 int end, OrderByComparator orderByComparator) throws SystemException {
1598 Object[] finderArgs = new Object[] {
1599 templateId,
1600
1601 String.valueOf(start), String.valueOf(end),
1602 String.valueOf(orderByComparator)
1603 };
1604
1605 List<JournalTemplate> list = (List<JournalTemplate>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_TEMPLATEID,
1606 finderArgs, this);
1607
1608 if (list == null) {
1609 Session session = null;
1610
1611 try {
1612 session = openSession();
1613
1614 StringBundler query = null;
1615
1616 if (orderByComparator != null) {
1617 query = new StringBundler(3 +
1618 (orderByComparator.getOrderByFields().length * 3));
1619 }
1620 else {
1621 query = new StringBundler(3);
1622 }
1623
1624 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1625
1626 if (templateId == null) {
1627 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1);
1628 }
1629 else {
1630 if (templateId.equals(StringPool.BLANK)) {
1631 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3);
1632 }
1633 else {
1634 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2);
1635 }
1636 }
1637
1638 if (orderByComparator != null) {
1639 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1640 orderByComparator);
1641 }
1642
1643 else {
1644 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1645 }
1646
1647 String sql = query.toString();
1648
1649 Query q = session.createQuery(sql);
1650
1651 QueryPos qPos = QueryPos.getInstance(q);
1652
1653 if (templateId != null) {
1654 qPos.add(templateId);
1655 }
1656
1657 list = (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
1658 start, end);
1659 }
1660 catch (Exception e) {
1661 throw processException(e);
1662 }
1663 finally {
1664 if (list == null) {
1665 list = new ArrayList<JournalTemplate>();
1666 }
1667
1668 cacheResult(list);
1669
1670 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_TEMPLATEID,
1671 finderArgs, list);
1672
1673 closeSession(session);
1674 }
1675 }
1676
1677 return list;
1678 }
1679
1680
1693 public JournalTemplate findByTemplateId_First(String templateId,
1694 OrderByComparator orderByComparator)
1695 throws NoSuchTemplateException, SystemException {
1696 List<JournalTemplate> list = findByTemplateId(templateId, 0, 1,
1697 orderByComparator);
1698
1699 if (list.isEmpty()) {
1700 StringBundler msg = new StringBundler(4);
1701
1702 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1703
1704 msg.append("templateId=");
1705 msg.append(templateId);
1706
1707 msg.append(StringPool.CLOSE_CURLY_BRACE);
1708
1709 throw new NoSuchTemplateException(msg.toString());
1710 }
1711 else {
1712 return list.get(0);
1713 }
1714 }
1715
1716
1729 public JournalTemplate findByTemplateId_Last(String templateId,
1730 OrderByComparator orderByComparator)
1731 throws NoSuchTemplateException, SystemException {
1732 int count = countByTemplateId(templateId);
1733
1734 List<JournalTemplate> list = findByTemplateId(templateId, count - 1,
1735 count, orderByComparator);
1736
1737 if (list.isEmpty()) {
1738 StringBundler msg = new StringBundler(4);
1739
1740 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1741
1742 msg.append("templateId=");
1743 msg.append(templateId);
1744
1745 msg.append(StringPool.CLOSE_CURLY_BRACE);
1746
1747 throw new NoSuchTemplateException(msg.toString());
1748 }
1749 else {
1750 return list.get(0);
1751 }
1752 }
1753
1754
1768 public JournalTemplate[] findByTemplateId_PrevAndNext(long id,
1769 String templateId, OrderByComparator orderByComparator)
1770 throws NoSuchTemplateException, SystemException {
1771 JournalTemplate journalTemplate = findByPrimaryKey(id);
1772
1773 Session session = null;
1774
1775 try {
1776 session = openSession();
1777
1778 JournalTemplate[] array = new JournalTemplateImpl[3];
1779
1780 array[0] = getByTemplateId_PrevAndNext(session, journalTemplate,
1781 templateId, orderByComparator, true);
1782
1783 array[1] = journalTemplate;
1784
1785 array[2] = getByTemplateId_PrevAndNext(session, journalTemplate,
1786 templateId, orderByComparator, false);
1787
1788 return array;
1789 }
1790 catch (Exception e) {
1791 throw processException(e);
1792 }
1793 finally {
1794 closeSession(session);
1795 }
1796 }
1797
1798 protected JournalTemplate getByTemplateId_PrevAndNext(Session session,
1799 JournalTemplate journalTemplate, String templateId,
1800 OrderByComparator orderByComparator, boolean previous) {
1801 StringBundler query = null;
1802
1803 if (orderByComparator != null) {
1804 query = new StringBundler(6 +
1805 (orderByComparator.getOrderByFields().length * 6));
1806 }
1807 else {
1808 query = new StringBundler(3);
1809 }
1810
1811 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1812
1813 if (templateId == null) {
1814 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1);
1815 }
1816 else {
1817 if (templateId.equals(StringPool.BLANK)) {
1818 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3);
1819 }
1820 else {
1821 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2);
1822 }
1823 }
1824
1825 if (orderByComparator != null) {
1826 String[] orderByFields = orderByComparator.getOrderByFields();
1827
1828 if (orderByFields.length > 0) {
1829 query.append(WHERE_AND);
1830 }
1831
1832 for (int i = 0; i < orderByFields.length; i++) {
1833 query.append(_ORDER_BY_ENTITY_ALIAS);
1834 query.append(orderByFields[i]);
1835
1836 if ((i + 1) < orderByFields.length) {
1837 if (orderByComparator.isAscending() ^ previous) {
1838 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1839 }
1840 else {
1841 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1842 }
1843 }
1844 else {
1845 if (orderByComparator.isAscending() ^ previous) {
1846 query.append(WHERE_GREATER_THAN);
1847 }
1848 else {
1849 query.append(WHERE_LESSER_THAN);
1850 }
1851 }
1852 }
1853
1854 query.append(ORDER_BY_CLAUSE);
1855
1856 for (int i = 0; i < orderByFields.length; i++) {
1857 query.append(_ORDER_BY_ENTITY_ALIAS);
1858 query.append(orderByFields[i]);
1859
1860 if ((i + 1) < orderByFields.length) {
1861 if (orderByComparator.isAscending() ^ previous) {
1862 query.append(ORDER_BY_ASC_HAS_NEXT);
1863 }
1864 else {
1865 query.append(ORDER_BY_DESC_HAS_NEXT);
1866 }
1867 }
1868 else {
1869 if (orderByComparator.isAscending() ^ previous) {
1870 query.append(ORDER_BY_ASC);
1871 }
1872 else {
1873 query.append(ORDER_BY_DESC);
1874 }
1875 }
1876 }
1877 }
1878
1879 else {
1880 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1881 }
1882
1883 String sql = query.toString();
1884
1885 Query q = session.createQuery(sql);
1886
1887 q.setFirstResult(0);
1888 q.setMaxResults(2);
1889
1890 QueryPos qPos = QueryPos.getInstance(q);
1891
1892 if (templateId != null) {
1893 qPos.add(templateId);
1894 }
1895
1896 if (orderByComparator != null) {
1897 Object[] values = orderByComparator.getOrderByValues(journalTemplate);
1898
1899 for (Object value : values) {
1900 qPos.add(value);
1901 }
1902 }
1903
1904 List<JournalTemplate> list = q.list();
1905
1906 if (list.size() == 2) {
1907 return list.get(1);
1908 }
1909 else {
1910 return null;
1911 }
1912 }
1913
1914
1922 public JournalTemplate findBySmallImageId(long smallImageId)
1923 throws NoSuchTemplateException, SystemException {
1924 JournalTemplate journalTemplate = fetchBySmallImageId(smallImageId);
1925
1926 if (journalTemplate == null) {
1927 StringBundler msg = new StringBundler(4);
1928
1929 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1930
1931 msg.append("smallImageId=");
1932 msg.append(smallImageId);
1933
1934 msg.append(StringPool.CLOSE_CURLY_BRACE);
1935
1936 if (_log.isWarnEnabled()) {
1937 _log.warn(msg.toString());
1938 }
1939
1940 throw new NoSuchTemplateException(msg.toString());
1941 }
1942
1943 return journalTemplate;
1944 }
1945
1946
1953 public JournalTemplate fetchBySmallImageId(long smallImageId)
1954 throws SystemException {
1955 return fetchBySmallImageId(smallImageId, true);
1956 }
1957
1958
1965 public JournalTemplate fetchBySmallImageId(long smallImageId,
1966 boolean retrieveFromCache) throws SystemException {
1967 Object[] finderArgs = new Object[] { smallImageId };
1968
1969 Object result = null;
1970
1971 if (retrieveFromCache) {
1972 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
1973 finderArgs, this);
1974 }
1975
1976 if (result == null) {
1977 Session session = null;
1978
1979 try {
1980 session = openSession();
1981
1982 StringBundler query = new StringBundler(3);
1983
1984 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1985
1986 query.append(_FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2);
1987
1988 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1989
1990 String sql = query.toString();
1991
1992 Query q = session.createQuery(sql);
1993
1994 QueryPos qPos = QueryPos.getInstance(q);
1995
1996 qPos.add(smallImageId);
1997
1998 List<JournalTemplate> list = q.list();
1999
2000 result = list;
2001
2002 JournalTemplate journalTemplate = null;
2003
2004 if (list.isEmpty()) {
2005 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
2006 finderArgs, list);
2007 }
2008 else {
2009 journalTemplate = list.get(0);
2010
2011 cacheResult(journalTemplate);
2012
2013 if ((journalTemplate.getSmallImageId() != smallImageId)) {
2014 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
2015 finderArgs, journalTemplate);
2016 }
2017 }
2018
2019 return journalTemplate;
2020 }
2021 catch (Exception e) {
2022 throw processException(e);
2023 }
2024 finally {
2025 if (result == null) {
2026 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
2027 finderArgs, new ArrayList<JournalTemplate>());
2028 }
2029
2030 closeSession(session);
2031 }
2032 }
2033 else {
2034 if (result instanceof List<?>) {
2035 return null;
2036 }
2037 else {
2038 return (JournalTemplate)result;
2039 }
2040 }
2041 }
2042
2043
2052 public JournalTemplate findByG_T(long groupId, String templateId)
2053 throws NoSuchTemplateException, SystemException {
2054 JournalTemplate journalTemplate = fetchByG_T(groupId, templateId);
2055
2056 if (journalTemplate == null) {
2057 StringBundler msg = new StringBundler(6);
2058
2059 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2060
2061 msg.append("groupId=");
2062 msg.append(groupId);
2063
2064 msg.append(", templateId=");
2065 msg.append(templateId);
2066
2067 msg.append(StringPool.CLOSE_CURLY_BRACE);
2068
2069 if (_log.isWarnEnabled()) {
2070 _log.warn(msg.toString());
2071 }
2072
2073 throw new NoSuchTemplateException(msg.toString());
2074 }
2075
2076 return journalTemplate;
2077 }
2078
2079
2087 public JournalTemplate fetchByG_T(long groupId, String templateId)
2088 throws SystemException {
2089 return fetchByG_T(groupId, templateId, true);
2090 }
2091
2092
2100 public JournalTemplate fetchByG_T(long groupId, String templateId,
2101 boolean retrieveFromCache) throws SystemException {
2102 Object[] finderArgs = new Object[] { groupId, templateId };
2103
2104 Object result = null;
2105
2106 if (retrieveFromCache) {
2107 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_T,
2108 finderArgs, this);
2109 }
2110
2111 if (result == null) {
2112 Session session = null;
2113
2114 try {
2115 session = openSession();
2116
2117 StringBundler query = new StringBundler(4);
2118
2119 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
2120
2121 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
2122
2123 if (templateId == null) {
2124 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
2125 }
2126 else {
2127 if (templateId.equals(StringPool.BLANK)) {
2128 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
2129 }
2130 else {
2131 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
2132 }
2133 }
2134
2135 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
2136
2137 String sql = query.toString();
2138
2139 Query q = session.createQuery(sql);
2140
2141 QueryPos qPos = QueryPos.getInstance(q);
2142
2143 qPos.add(groupId);
2144
2145 if (templateId != null) {
2146 qPos.add(templateId);
2147 }
2148
2149 List<JournalTemplate> list = q.list();
2150
2151 result = list;
2152
2153 JournalTemplate journalTemplate = null;
2154
2155 if (list.isEmpty()) {
2156 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_T,
2157 finderArgs, list);
2158 }
2159 else {
2160 journalTemplate = list.get(0);
2161
2162 cacheResult(journalTemplate);
2163
2164 if ((journalTemplate.getGroupId() != groupId) ||
2165 (journalTemplate.getTemplateId() == null) ||
2166 !journalTemplate.getTemplateId().equals(templateId)) {
2167 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_T,
2168 finderArgs, journalTemplate);
2169 }
2170 }
2171
2172 return journalTemplate;
2173 }
2174 catch (Exception e) {
2175 throw processException(e);
2176 }
2177 finally {
2178 if (result == null) {
2179 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_T,
2180 finderArgs, new ArrayList<JournalTemplate>());
2181 }
2182
2183 closeSession(session);
2184 }
2185 }
2186 else {
2187 if (result instanceof List<?>) {
2188 return null;
2189 }
2190 else {
2191 return (JournalTemplate)result;
2192 }
2193 }
2194 }
2195
2196
2204 public List<JournalTemplate> findByG_S(long groupId, String structureId)
2205 throws SystemException {
2206 return findByG_S(groupId, structureId, QueryUtil.ALL_POS,
2207 QueryUtil.ALL_POS, null);
2208 }
2209
2210
2224 public List<JournalTemplate> findByG_S(long groupId, String structureId,
2225 int start, int end) throws SystemException {
2226 return findByG_S(groupId, structureId, start, end, null);
2227 }
2228
2229
2244 public List<JournalTemplate> findByG_S(long groupId, String structureId,
2245 int start, int end, OrderByComparator orderByComparator)
2246 throws SystemException {
2247 Object[] finderArgs = new Object[] {
2248 groupId, structureId,
2249
2250 String.valueOf(start), String.valueOf(end),
2251 String.valueOf(orderByComparator)
2252 };
2253
2254 List<JournalTemplate> list = (List<JournalTemplate>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_S,
2255 finderArgs, this);
2256
2257 if (list == null) {
2258 Session session = null;
2259
2260 try {
2261 session = openSession();
2262
2263 StringBundler query = null;
2264
2265 if (orderByComparator != null) {
2266 query = new StringBundler(4 +
2267 (orderByComparator.getOrderByFields().length * 3));
2268 }
2269 else {
2270 query = new StringBundler(4);
2271 }
2272
2273 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
2274
2275 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2276
2277 if (structureId == null) {
2278 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
2279 }
2280 else {
2281 if (structureId.equals(StringPool.BLANK)) {
2282 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
2283 }
2284 else {
2285 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
2286 }
2287 }
2288
2289 if (orderByComparator != null) {
2290 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2291 orderByComparator);
2292 }
2293
2294 else {
2295 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
2296 }
2297
2298 String sql = query.toString();
2299
2300 Query q = session.createQuery(sql);
2301
2302 QueryPos qPos = QueryPos.getInstance(q);
2303
2304 qPos.add(groupId);
2305
2306 if (structureId != null) {
2307 qPos.add(structureId);
2308 }
2309
2310 list = (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
2311 start, end);
2312 }
2313 catch (Exception e) {
2314 throw processException(e);
2315 }
2316 finally {
2317 if (list == null) {
2318 list = new ArrayList<JournalTemplate>();
2319 }
2320
2321 cacheResult(list);
2322
2323 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_S, finderArgs,
2324 list);
2325
2326 closeSession(session);
2327 }
2328 }
2329
2330 return list;
2331 }
2332
2333
2347 public JournalTemplate findByG_S_First(long groupId, String structureId,
2348 OrderByComparator orderByComparator)
2349 throws NoSuchTemplateException, SystemException {
2350 List<JournalTemplate> list = findByG_S(groupId, structureId, 0, 1,
2351 orderByComparator);
2352
2353 if (list.isEmpty()) {
2354 StringBundler msg = new StringBundler(6);
2355
2356 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2357
2358 msg.append("groupId=");
2359 msg.append(groupId);
2360
2361 msg.append(", structureId=");
2362 msg.append(structureId);
2363
2364 msg.append(StringPool.CLOSE_CURLY_BRACE);
2365
2366 throw new NoSuchTemplateException(msg.toString());
2367 }
2368 else {
2369 return list.get(0);
2370 }
2371 }
2372
2373
2387 public JournalTemplate findByG_S_Last(long groupId, String structureId,
2388 OrderByComparator orderByComparator)
2389 throws NoSuchTemplateException, SystemException {
2390 int count = countByG_S(groupId, structureId);
2391
2392 List<JournalTemplate> list = findByG_S(groupId, structureId, count - 1,
2393 count, orderByComparator);
2394
2395 if (list.isEmpty()) {
2396 StringBundler msg = new StringBundler(6);
2397
2398 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2399
2400 msg.append("groupId=");
2401 msg.append(groupId);
2402
2403 msg.append(", structureId=");
2404 msg.append(structureId);
2405
2406 msg.append(StringPool.CLOSE_CURLY_BRACE);
2407
2408 throw new NoSuchTemplateException(msg.toString());
2409 }
2410 else {
2411 return list.get(0);
2412 }
2413 }
2414
2415
2430 public JournalTemplate[] findByG_S_PrevAndNext(long id, long groupId,
2431 String structureId, OrderByComparator orderByComparator)
2432 throws NoSuchTemplateException, SystemException {
2433 JournalTemplate journalTemplate = findByPrimaryKey(id);
2434
2435 Session session = null;
2436
2437 try {
2438 session = openSession();
2439
2440 JournalTemplate[] array = new JournalTemplateImpl[3];
2441
2442 array[0] = getByG_S_PrevAndNext(session, journalTemplate, groupId,
2443 structureId, orderByComparator, true);
2444
2445 array[1] = journalTemplate;
2446
2447 array[2] = getByG_S_PrevAndNext(session, journalTemplate, groupId,
2448 structureId, orderByComparator, false);
2449
2450 return array;
2451 }
2452 catch (Exception e) {
2453 throw processException(e);
2454 }
2455 finally {
2456 closeSession(session);
2457 }
2458 }
2459
2460 protected JournalTemplate getByG_S_PrevAndNext(Session session,
2461 JournalTemplate journalTemplate, long groupId, String structureId,
2462 OrderByComparator orderByComparator, boolean previous) {
2463 StringBundler query = null;
2464
2465 if (orderByComparator != null) {
2466 query = new StringBundler(6 +
2467 (orderByComparator.getOrderByFields().length * 6));
2468 }
2469 else {
2470 query = new StringBundler(3);
2471 }
2472
2473 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
2474
2475 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2476
2477 if (structureId == null) {
2478 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
2479 }
2480 else {
2481 if (structureId.equals(StringPool.BLANK)) {
2482 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
2483 }
2484 else {
2485 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
2486 }
2487 }
2488
2489 if (orderByComparator != null) {
2490 String[] orderByFields = orderByComparator.getOrderByFields();
2491
2492 if (orderByFields.length > 0) {
2493 query.append(WHERE_AND);
2494 }
2495
2496 for (int i = 0; i < orderByFields.length; i++) {
2497 query.append(_ORDER_BY_ENTITY_ALIAS);
2498 query.append(orderByFields[i]);
2499
2500 if ((i + 1) < orderByFields.length) {
2501 if (orderByComparator.isAscending() ^ previous) {
2502 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2503 }
2504 else {
2505 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2506 }
2507 }
2508 else {
2509 if (orderByComparator.isAscending() ^ previous) {
2510 query.append(WHERE_GREATER_THAN);
2511 }
2512 else {
2513 query.append(WHERE_LESSER_THAN);
2514 }
2515 }
2516 }
2517
2518 query.append(ORDER_BY_CLAUSE);
2519
2520 for (int i = 0; i < orderByFields.length; i++) {
2521 query.append(_ORDER_BY_ENTITY_ALIAS);
2522 query.append(orderByFields[i]);
2523
2524 if ((i + 1) < orderByFields.length) {
2525 if (orderByComparator.isAscending() ^ previous) {
2526 query.append(ORDER_BY_ASC_HAS_NEXT);
2527 }
2528 else {
2529 query.append(ORDER_BY_DESC_HAS_NEXT);
2530 }
2531 }
2532 else {
2533 if (orderByComparator.isAscending() ^ previous) {
2534 query.append(ORDER_BY_ASC);
2535 }
2536 else {
2537 query.append(ORDER_BY_DESC);
2538 }
2539 }
2540 }
2541 }
2542
2543 else {
2544 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
2545 }
2546
2547 String sql = query.toString();
2548
2549 Query q = session.createQuery(sql);
2550
2551 q.setFirstResult(0);
2552 q.setMaxResults(2);
2553
2554 QueryPos qPos = QueryPos.getInstance(q);
2555
2556 qPos.add(groupId);
2557
2558 if (structureId != null) {
2559 qPos.add(structureId);
2560 }
2561
2562 if (orderByComparator != null) {
2563 Object[] values = orderByComparator.getOrderByValues(journalTemplate);
2564
2565 for (Object value : values) {
2566 qPos.add(value);
2567 }
2568 }
2569
2570 List<JournalTemplate> list = q.list();
2571
2572 if (list.size() == 2) {
2573 return list.get(1);
2574 }
2575 else {
2576 return null;
2577 }
2578 }
2579
2580
2588 public List<JournalTemplate> filterFindByG_S(long groupId,
2589 String structureId) throws SystemException {
2590 return filterFindByG_S(groupId, structureId, QueryUtil.ALL_POS,
2591 QueryUtil.ALL_POS, null);
2592 }
2593
2594
2608 public List<JournalTemplate> filterFindByG_S(long groupId,
2609 String structureId, int start, int end) throws SystemException {
2610 return filterFindByG_S(groupId, structureId, start, end, null);
2611 }
2612
2613
2628 public List<JournalTemplate> filterFindByG_S(long groupId,
2629 String structureId, int start, int end,
2630 OrderByComparator orderByComparator) throws SystemException {
2631 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2632 return findByG_S(groupId, structureId, start, end, orderByComparator);
2633 }
2634
2635 Session session = null;
2636
2637 try {
2638 session = openSession();
2639
2640 StringBundler query = null;
2641
2642 if (orderByComparator != null) {
2643 query = new StringBundler(4 +
2644 (orderByComparator.getOrderByFields().length * 3));
2645 }
2646 else {
2647 query = new StringBundler(4);
2648 }
2649
2650 query.append(_FILTER_SQL_SELECT_JOURNALTEMPLATE_WHERE);
2651
2652 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2653
2654 if (structureId == null) {
2655 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
2656 }
2657 else {
2658 if (structureId.equals(StringPool.BLANK)) {
2659 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
2660 }
2661 else {
2662 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
2663 }
2664 }
2665
2666 if (orderByComparator != null) {
2667 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2668 orderByComparator);
2669 }
2670
2671 else {
2672 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
2673 }
2674
2675 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2676 JournalTemplate.class.getName(), _FILTER_COLUMN_PK,
2677 _FILTER_COLUMN_USERID, groupId);
2678
2679 SQLQuery q = session.createSQLQuery(sql);
2680
2681 q.addEntity(_FILTER_ENTITY_ALIAS, JournalTemplateImpl.class);
2682
2683 QueryPos qPos = QueryPos.getInstance(q);
2684
2685 qPos.add(groupId);
2686
2687 if (structureId != null) {
2688 qPos.add(structureId);
2689 }
2690
2691 return (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
2692 start, end);
2693 }
2694 catch (Exception e) {
2695 throw processException(e);
2696 }
2697 finally {
2698 closeSession(session);
2699 }
2700 }
2701
2702
2708 public List<JournalTemplate> findAll() throws SystemException {
2709 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2710 }
2711
2712
2724 public List<JournalTemplate> findAll(int start, int end)
2725 throws SystemException {
2726 return findAll(start, end, null);
2727 }
2728
2729
2742 public List<JournalTemplate> findAll(int start, int end,
2743 OrderByComparator orderByComparator) throws SystemException {
2744 Object[] finderArgs = new Object[] {
2745 String.valueOf(start), String.valueOf(end),
2746 String.valueOf(orderByComparator)
2747 };
2748
2749 List<JournalTemplate> list = (List<JournalTemplate>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2750 finderArgs, this);
2751
2752 if (list == null) {
2753 Session session = null;
2754
2755 try {
2756 session = openSession();
2757
2758 StringBundler query = null;
2759 String sql = null;
2760
2761 if (orderByComparator != null) {
2762 query = new StringBundler(2 +
2763 (orderByComparator.getOrderByFields().length * 3));
2764
2765 query.append(_SQL_SELECT_JOURNALTEMPLATE);
2766
2767 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2768 orderByComparator);
2769
2770 sql = query.toString();
2771 }
2772 else {
2773 sql = _SQL_SELECT_JOURNALTEMPLATE.concat(JournalTemplateModelImpl.ORDER_BY_JPQL);
2774 }
2775
2776 Query q = session.createQuery(sql);
2777
2778 if (orderByComparator == null) {
2779 list = (List<JournalTemplate>)QueryUtil.list(q,
2780 getDialect(), start, end, false);
2781
2782 Collections.sort(list);
2783 }
2784 else {
2785 list = (List<JournalTemplate>)QueryUtil.list(q,
2786 getDialect(), start, end);
2787 }
2788 }
2789 catch (Exception e) {
2790 throw processException(e);
2791 }
2792 finally {
2793 if (list == null) {
2794 list = new ArrayList<JournalTemplate>();
2795 }
2796
2797 cacheResult(list);
2798
2799 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2800
2801 closeSession(session);
2802 }
2803 }
2804
2805 return list;
2806 }
2807
2808
2814 public void removeByUuid(String uuid) throws SystemException {
2815 for (JournalTemplate journalTemplate : findByUuid(uuid)) {
2816 remove(journalTemplate);
2817 }
2818 }
2819
2820
2827 public void removeByUUID_G(String uuid, long groupId)
2828 throws NoSuchTemplateException, SystemException {
2829 JournalTemplate journalTemplate = findByUUID_G(uuid, groupId);
2830
2831 remove(journalTemplate);
2832 }
2833
2834
2840 public void removeByGroupId(long groupId) throws SystemException {
2841 for (JournalTemplate journalTemplate : findByGroupId(groupId)) {
2842 remove(journalTemplate);
2843 }
2844 }
2845
2846
2852 public void removeByTemplateId(String templateId) throws SystemException {
2853 for (JournalTemplate journalTemplate : findByTemplateId(templateId)) {
2854 remove(journalTemplate);
2855 }
2856 }
2857
2858
2864 public void removeBySmallImageId(long smallImageId)
2865 throws NoSuchTemplateException, SystemException {
2866 JournalTemplate journalTemplate = findBySmallImageId(smallImageId);
2867
2868 remove(journalTemplate);
2869 }
2870
2871
2878 public void removeByG_T(long groupId, String templateId)
2879 throws NoSuchTemplateException, SystemException {
2880 JournalTemplate journalTemplate = findByG_T(groupId, templateId);
2881
2882 remove(journalTemplate);
2883 }
2884
2885
2892 public void removeByG_S(long groupId, String structureId)
2893 throws SystemException {
2894 for (JournalTemplate journalTemplate : findByG_S(groupId, structureId)) {
2895 remove(journalTemplate);
2896 }
2897 }
2898
2899
2904 public void removeAll() throws SystemException {
2905 for (JournalTemplate journalTemplate : findAll()) {
2906 remove(journalTemplate);
2907 }
2908 }
2909
2910
2917 public int countByUuid(String uuid) throws SystemException {
2918 Object[] finderArgs = new Object[] { uuid };
2919
2920 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2921 finderArgs, this);
2922
2923 if (count == null) {
2924 Session session = null;
2925
2926 try {
2927 session = openSession();
2928
2929 StringBundler query = new StringBundler(2);
2930
2931 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
2932
2933 if (uuid == null) {
2934 query.append(_FINDER_COLUMN_UUID_UUID_1);
2935 }
2936 else {
2937 if (uuid.equals(StringPool.BLANK)) {
2938 query.append(_FINDER_COLUMN_UUID_UUID_3);
2939 }
2940 else {
2941 query.append(_FINDER_COLUMN_UUID_UUID_2);
2942 }
2943 }
2944
2945 String sql = query.toString();
2946
2947 Query q = session.createQuery(sql);
2948
2949 QueryPos qPos = QueryPos.getInstance(q);
2950
2951 if (uuid != null) {
2952 qPos.add(uuid);
2953 }
2954
2955 count = (Long)q.uniqueResult();
2956 }
2957 catch (Exception e) {
2958 throw processException(e);
2959 }
2960 finally {
2961 if (count == null) {
2962 count = Long.valueOf(0);
2963 }
2964
2965 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2966 finderArgs, count);
2967
2968 closeSession(session);
2969 }
2970 }
2971
2972 return count.intValue();
2973 }
2974
2975
2983 public int countByUUID_G(String uuid, long groupId)
2984 throws SystemException {
2985 Object[] finderArgs = new Object[] { uuid, groupId };
2986
2987 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
2988 finderArgs, this);
2989
2990 if (count == null) {
2991 Session session = null;
2992
2993 try {
2994 session = openSession();
2995
2996 StringBundler query = new StringBundler(3);
2997
2998 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
2999
3000 if (uuid == null) {
3001 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
3002 }
3003 else {
3004 if (uuid.equals(StringPool.BLANK)) {
3005 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
3006 }
3007 else {
3008 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
3009 }
3010 }
3011
3012 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
3013
3014 String sql = query.toString();
3015
3016 Query q = session.createQuery(sql);
3017
3018 QueryPos qPos = QueryPos.getInstance(q);
3019
3020 if (uuid != null) {
3021 qPos.add(uuid);
3022 }
3023
3024 qPos.add(groupId);
3025
3026 count = (Long)q.uniqueResult();
3027 }
3028 catch (Exception e) {
3029 throw processException(e);
3030 }
3031 finally {
3032 if (count == null) {
3033 count = Long.valueOf(0);
3034 }
3035
3036 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
3037 finderArgs, count);
3038
3039 closeSession(session);
3040 }
3041 }
3042
3043 return count.intValue();
3044 }
3045
3046
3053 public int countByGroupId(long groupId) throws SystemException {
3054 Object[] finderArgs = new Object[] { groupId };
3055
3056 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
3057 finderArgs, this);
3058
3059 if (count == null) {
3060 Session session = null;
3061
3062 try {
3063 session = openSession();
3064
3065 StringBundler query = new StringBundler(2);
3066
3067 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3068
3069 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3070
3071 String sql = query.toString();
3072
3073 Query q = session.createQuery(sql);
3074
3075 QueryPos qPos = QueryPos.getInstance(q);
3076
3077 qPos.add(groupId);
3078
3079 count = (Long)q.uniqueResult();
3080 }
3081 catch (Exception e) {
3082 throw processException(e);
3083 }
3084 finally {
3085 if (count == null) {
3086 count = Long.valueOf(0);
3087 }
3088
3089 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
3090 finderArgs, count);
3091
3092 closeSession(session);
3093 }
3094 }
3095
3096 return count.intValue();
3097 }
3098
3099
3106 public int filterCountByGroupId(long groupId) throws SystemException {
3107 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3108 return countByGroupId(groupId);
3109 }
3110
3111 Session session = null;
3112
3113 try {
3114 session = openSession();
3115
3116 StringBundler query = new StringBundler(2);
3117
3118 query.append(_FILTER_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3119
3120 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3121
3122 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3123 JournalTemplate.class.getName(), _FILTER_COLUMN_PK,
3124 _FILTER_COLUMN_USERID, groupId);
3125
3126 SQLQuery q = session.createSQLQuery(sql);
3127
3128 q.addScalar(COUNT_COLUMN_NAME,
3129 com.liferay.portal.kernel.dao.orm.Type.LONG);
3130
3131 QueryPos qPos = QueryPos.getInstance(q);
3132
3133 qPos.add(groupId);
3134
3135 Long count = (Long)q.uniqueResult();
3136
3137 return count.intValue();
3138 }
3139 catch (Exception e) {
3140 throw processException(e);
3141 }
3142 finally {
3143 closeSession(session);
3144 }
3145 }
3146
3147
3154 public int countByTemplateId(String templateId) throws SystemException {
3155 Object[] finderArgs = new Object[] { templateId };
3156
3157 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TEMPLATEID,
3158 finderArgs, this);
3159
3160 if (count == null) {
3161 Session session = null;
3162
3163 try {
3164 session = openSession();
3165
3166 StringBundler query = new StringBundler(2);
3167
3168 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3169
3170 if (templateId == null) {
3171 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1);
3172 }
3173 else {
3174 if (templateId.equals(StringPool.BLANK)) {
3175 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3);
3176 }
3177 else {
3178 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2);
3179 }
3180 }
3181
3182 String sql = query.toString();
3183
3184 Query q = session.createQuery(sql);
3185
3186 QueryPos qPos = QueryPos.getInstance(q);
3187
3188 if (templateId != null) {
3189 qPos.add(templateId);
3190 }
3191
3192 count = (Long)q.uniqueResult();
3193 }
3194 catch (Exception e) {
3195 throw processException(e);
3196 }
3197 finally {
3198 if (count == null) {
3199 count = Long.valueOf(0);
3200 }
3201
3202 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TEMPLATEID,
3203 finderArgs, count);
3204
3205 closeSession(session);
3206 }
3207 }
3208
3209 return count.intValue();
3210 }
3211
3212
3219 public int countBySmallImageId(long smallImageId) throws SystemException {
3220 Object[] finderArgs = new Object[] { smallImageId };
3221
3222 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
3223 finderArgs, this);
3224
3225 if (count == null) {
3226 Session session = null;
3227
3228 try {
3229 session = openSession();
3230
3231 StringBundler query = new StringBundler(2);
3232
3233 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3234
3235 query.append(_FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2);
3236
3237 String sql = query.toString();
3238
3239 Query q = session.createQuery(sql);
3240
3241 QueryPos qPos = QueryPos.getInstance(q);
3242
3243 qPos.add(smallImageId);
3244
3245 count = (Long)q.uniqueResult();
3246 }
3247 catch (Exception e) {
3248 throw processException(e);
3249 }
3250 finally {
3251 if (count == null) {
3252 count = Long.valueOf(0);
3253 }
3254
3255 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
3256 finderArgs, count);
3257
3258 closeSession(session);
3259 }
3260 }
3261
3262 return count.intValue();
3263 }
3264
3265
3273 public int countByG_T(long groupId, String templateId)
3274 throws SystemException {
3275 Object[] finderArgs = new Object[] { groupId, templateId };
3276
3277 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_T,
3278 finderArgs, this);
3279
3280 if (count == null) {
3281 Session session = null;
3282
3283 try {
3284 session = openSession();
3285
3286 StringBundler query = new StringBundler(3);
3287
3288 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3289
3290 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
3291
3292 if (templateId == null) {
3293 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
3294 }
3295 else {
3296 if (templateId.equals(StringPool.BLANK)) {
3297 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
3298 }
3299 else {
3300 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
3301 }
3302 }
3303
3304 String sql = query.toString();
3305
3306 Query q = session.createQuery(sql);
3307
3308 QueryPos qPos = QueryPos.getInstance(q);
3309
3310 qPos.add(groupId);
3311
3312 if (templateId != null) {
3313 qPos.add(templateId);
3314 }
3315
3316 count = (Long)q.uniqueResult();
3317 }
3318 catch (Exception e) {
3319 throw processException(e);
3320 }
3321 finally {
3322 if (count == null) {
3323 count = Long.valueOf(0);
3324 }
3325
3326 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_T, finderArgs,
3327 count);
3328
3329 closeSession(session);
3330 }
3331 }
3332
3333 return count.intValue();
3334 }
3335
3336
3344 public int filterCountByG_T(long groupId, String templateId)
3345 throws SystemException {
3346 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3347 return countByG_T(groupId, templateId);
3348 }
3349
3350 Session session = null;
3351
3352 try {
3353 session = openSession();
3354
3355 StringBundler query = new StringBundler(3);
3356
3357 query.append(_FILTER_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3358
3359 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
3360
3361 if (templateId == null) {
3362 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
3363 }
3364 else {
3365 if (templateId.equals(StringPool.BLANK)) {
3366 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
3367 }
3368 else {
3369 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
3370 }
3371 }
3372
3373 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3374 JournalTemplate.class.getName(), _FILTER_COLUMN_PK,
3375 _FILTER_COLUMN_USERID, groupId);
3376
3377 SQLQuery q = session.createSQLQuery(sql);
3378
3379 q.addScalar(COUNT_COLUMN_NAME,
3380 com.liferay.portal.kernel.dao.orm.Type.LONG);
3381
3382 QueryPos qPos = QueryPos.getInstance(q);
3383
3384 qPos.add(groupId);
3385
3386 if (templateId != null) {
3387 qPos.add(templateId);
3388 }
3389
3390 Long count = (Long)q.uniqueResult();
3391
3392 return count.intValue();
3393 }
3394 catch (Exception e) {
3395 throw processException(e);
3396 }
3397 finally {
3398 closeSession(session);
3399 }
3400 }
3401
3402
3410 public int countByG_S(long groupId, String structureId)
3411 throws SystemException {
3412 Object[] finderArgs = new Object[] { groupId, structureId };
3413
3414 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_S,
3415 finderArgs, this);
3416
3417 if (count == null) {
3418 Session session = null;
3419
3420 try {
3421 session = openSession();
3422
3423 StringBundler query = new StringBundler(3);
3424
3425 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3426
3427 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
3428
3429 if (structureId == null) {
3430 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
3431 }
3432 else {
3433 if (structureId.equals(StringPool.BLANK)) {
3434 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
3435 }
3436 else {
3437 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
3438 }
3439 }
3440
3441 String sql = query.toString();
3442
3443 Query q = session.createQuery(sql);
3444
3445 QueryPos qPos = QueryPos.getInstance(q);
3446
3447 qPos.add(groupId);
3448
3449 if (structureId != null) {
3450 qPos.add(structureId);
3451 }
3452
3453 count = (Long)q.uniqueResult();
3454 }
3455 catch (Exception e) {
3456 throw processException(e);
3457 }
3458 finally {
3459 if (count == null) {
3460 count = Long.valueOf(0);
3461 }
3462
3463 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_S, finderArgs,
3464 count);
3465
3466 closeSession(session);
3467 }
3468 }
3469
3470 return count.intValue();
3471 }
3472
3473
3481 public int filterCountByG_S(long groupId, String structureId)
3482 throws SystemException {
3483 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3484 return countByG_S(groupId, structureId);
3485 }
3486
3487 Session session = null;
3488
3489 try {
3490 session = openSession();
3491
3492 StringBundler query = new StringBundler(3);
3493
3494 query.append(_FILTER_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3495
3496 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
3497
3498 if (structureId == null) {
3499 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
3500 }
3501 else {
3502 if (structureId.equals(StringPool.BLANK)) {
3503 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
3504 }
3505 else {
3506 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
3507 }
3508 }
3509
3510 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3511 JournalTemplate.class.getName(), _FILTER_COLUMN_PK,
3512 _FILTER_COLUMN_USERID, groupId);
3513
3514 SQLQuery q = session.createSQLQuery(sql);
3515
3516 q.addScalar(COUNT_COLUMN_NAME,
3517 com.liferay.portal.kernel.dao.orm.Type.LONG);
3518
3519 QueryPos qPos = QueryPos.getInstance(q);
3520
3521 qPos.add(groupId);
3522
3523 if (structureId != null) {
3524 qPos.add(structureId);
3525 }
3526
3527 Long count = (Long)q.uniqueResult();
3528
3529 return count.intValue();
3530 }
3531 catch (Exception e) {
3532 throw processException(e);
3533 }
3534 finally {
3535 closeSession(session);
3536 }
3537 }
3538
3539
3545 public int countAll() throws SystemException {
3546 Object[] finderArgs = new Object[0];
3547
3548 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3549 finderArgs, this);
3550
3551 if (count == null) {
3552 Session session = null;
3553
3554 try {
3555 session = openSession();
3556
3557 Query q = session.createQuery(_SQL_COUNT_JOURNALTEMPLATE);
3558
3559 count = (Long)q.uniqueResult();
3560 }
3561 catch (Exception e) {
3562 throw processException(e);
3563 }
3564 finally {
3565 if (count == null) {
3566 count = Long.valueOf(0);
3567 }
3568
3569 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3570 count);
3571
3572 closeSession(session);
3573 }
3574 }
3575
3576 return count.intValue();
3577 }
3578
3579
3582 public void afterPropertiesSet() {
3583 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3584 com.liferay.portal.util.PropsUtil.get(
3585 "value.object.listener.com.liferay.portlet.journal.model.JournalTemplate")));
3586
3587 if (listenerClassNames.length > 0) {
3588 try {
3589 List<ModelListener<JournalTemplate>> listenersList = new ArrayList<ModelListener<JournalTemplate>>();
3590
3591 for (String listenerClassName : listenerClassNames) {
3592 listenersList.add((ModelListener<JournalTemplate>)InstanceFactory.newInstance(
3593 listenerClassName));
3594 }
3595
3596 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3597 }
3598 catch (Exception e) {
3599 _log.error(e);
3600 }
3601 }
3602 }
3603
3604 @BeanReference(type = JournalArticlePersistence.class)
3605 protected JournalArticlePersistence journalArticlePersistence;
3606 @BeanReference(type = JournalArticleImagePersistence.class)
3607 protected JournalArticleImagePersistence journalArticleImagePersistence;
3608 @BeanReference(type = JournalArticleResourcePersistence.class)
3609 protected JournalArticleResourcePersistence journalArticleResourcePersistence;
3610 @BeanReference(type = JournalContentSearchPersistence.class)
3611 protected JournalContentSearchPersistence journalContentSearchPersistence;
3612 @BeanReference(type = JournalFeedPersistence.class)
3613 protected JournalFeedPersistence journalFeedPersistence;
3614 @BeanReference(type = JournalStructurePersistence.class)
3615 protected JournalStructurePersistence journalStructurePersistence;
3616 @BeanReference(type = JournalTemplatePersistence.class)
3617 protected JournalTemplatePersistence journalTemplatePersistence;
3618 @BeanReference(type = ImagePersistence.class)
3619 protected ImagePersistence imagePersistence;
3620 @BeanReference(type = ResourcePersistence.class)
3621 protected ResourcePersistence resourcePersistence;
3622 @BeanReference(type = UserPersistence.class)
3623 protected UserPersistence userPersistence;
3624 @BeanReference(type = WebDAVPropsPersistence.class)
3625 protected WebDAVPropsPersistence webDAVPropsPersistence;
3626 @BeanReference(type = ExpandoValuePersistence.class)
3627 protected ExpandoValuePersistence expandoValuePersistence;
3628 private static final String _SQL_SELECT_JOURNALTEMPLATE = "SELECT journalTemplate FROM JournalTemplate journalTemplate";
3629 private static final String _SQL_SELECT_JOURNALTEMPLATE_WHERE = "SELECT journalTemplate FROM JournalTemplate journalTemplate WHERE ";
3630 private static final String _SQL_COUNT_JOURNALTEMPLATE = "SELECT COUNT(journalTemplate) FROM JournalTemplate journalTemplate";
3631 private static final String _SQL_COUNT_JOURNALTEMPLATE_WHERE = "SELECT COUNT(journalTemplate) FROM JournalTemplate journalTemplate WHERE ";
3632 private static final String _FINDER_COLUMN_UUID_UUID_1 = "journalTemplate.uuid IS NULL";
3633 private static final String _FINDER_COLUMN_UUID_UUID_2 = "journalTemplate.uuid = ?";
3634 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(journalTemplate.uuid IS NULL OR journalTemplate.uuid = ?)";
3635 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "journalTemplate.uuid IS NULL AND ";
3636 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "journalTemplate.uuid = ? AND ";
3637 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(journalTemplate.uuid IS NULL OR journalTemplate.uuid = ?) AND ";
3638 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "journalTemplate.groupId = ?";
3639 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "journalTemplate.groupId = ?";
3640 private static final String _FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1 = "journalTemplate.templateId IS NULL";
3641 private static final String _FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2 = "journalTemplate.templateId = ?";
3642 private static final String _FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3 = "(journalTemplate.templateId IS NULL OR journalTemplate.templateId = ?)";
3643 private static final String _FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2 = "journalTemplate.smallImageId = ?";
3644 private static final String _FINDER_COLUMN_G_T_GROUPID_2 = "journalTemplate.groupId = ? AND ";
3645 private static final String _FINDER_COLUMN_G_T_TEMPLATEID_1 = "journalTemplate.templateId IS NULL";
3646 private static final String _FINDER_COLUMN_G_T_TEMPLATEID_2 = "journalTemplate.templateId = ?";
3647 private static final String _FINDER_COLUMN_G_T_TEMPLATEID_3 = "(journalTemplate.templateId IS NULL OR journalTemplate.templateId = ?)";
3648 private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "journalTemplate.groupId = ? AND ";
3649 private static final String _FINDER_COLUMN_G_S_STRUCTUREID_1 = "journalTemplate.structureId IS NULL";
3650 private static final String _FINDER_COLUMN_G_S_STRUCTUREID_2 = "journalTemplate.structureId = ?";
3651 private static final String _FINDER_COLUMN_G_S_STRUCTUREID_3 = "(journalTemplate.structureId IS NULL OR journalTemplate.structureId = ?)";
3652 private static final String _FILTER_SQL_SELECT_JOURNALTEMPLATE_WHERE = "SELECT DISTINCT {journalTemplate.*} FROM JournalTemplate journalTemplate WHERE ";
3653 private static final String _FILTER_SQL_COUNT_JOURNALTEMPLATE_WHERE = "SELECT COUNT(DISTINCT journalTemplate.id) AS COUNT_VALUE FROM JournalTemplate journalTemplate WHERE ";
3654 private static final String _FILTER_COLUMN_PK = "journalTemplate.id";
3655 private static final String _FILTER_COLUMN_USERID = "journalTemplate.userId";
3656 private static final String _FILTER_ENTITY_ALIAS = "journalTemplate";
3657 private static final String _ORDER_BY_ENTITY_ALIAS = "journalTemplate.";
3658 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No JournalTemplate exists with the primary key ";
3659 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No JournalTemplate exists with the key {";
3660 private static Log _log = LogFactoryUtil.getLog(JournalTemplatePersistenceImpl.class);
3661 }