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 BatchSessionUtil.delete(session, journalTemplate);
332 }
333 catch (Exception e) {
334 throw processException(e);
335 }
336 finally {
337 closeSession(session);
338 }
339
340 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
341
342 JournalTemplateModelImpl journalTemplateModelImpl = (JournalTemplateModelImpl)journalTemplate;
343
344 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
345 new Object[] {
346 journalTemplateModelImpl.getUuid(),
347 new Long(journalTemplateModelImpl.getGroupId())
348 });
349
350 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
351 new Object[] { new Long(journalTemplateModelImpl.getSmallImageId()) });
352
353 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_T,
354 new Object[] {
355 new Long(journalTemplateModelImpl.getGroupId()),
356
357 journalTemplateModelImpl.getTemplateId()
358 });
359
360 EntityCacheUtil.removeResult(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
361 JournalTemplateImpl.class, journalTemplate.getPrimaryKey());
362
363 return journalTemplate;
364 }
365
366 public JournalTemplate updateImpl(
367 com.liferay.portlet.journal.model.JournalTemplate journalTemplate,
368 boolean merge) throws SystemException {
369 journalTemplate = toUnwrappedModel(journalTemplate);
370
371 boolean isNew = journalTemplate.isNew();
372
373 JournalTemplateModelImpl journalTemplateModelImpl = (JournalTemplateModelImpl)journalTemplate;
374
375 if (Validator.isNull(journalTemplate.getUuid())) {
376 String uuid = PortalUUIDUtil.generate();
377
378 journalTemplate.setUuid(uuid);
379 }
380
381 Session session = null;
382
383 try {
384 session = openSession();
385
386 BatchSessionUtil.update(session, journalTemplate, merge);
387
388 journalTemplate.setNew(false);
389 }
390 catch (Exception e) {
391 throw processException(e);
392 }
393 finally {
394 closeSession(session);
395 }
396
397 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
398
399 EntityCacheUtil.putResult(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
400 JournalTemplateImpl.class, journalTemplate.getPrimaryKey(),
401 journalTemplate);
402
403 if (!isNew &&
404 (!Validator.equals(journalTemplate.getUuid(),
405 journalTemplateModelImpl.getOriginalUuid()) ||
406 (journalTemplate.getGroupId() != journalTemplateModelImpl.getOriginalGroupId()))) {
407 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
408 new Object[] {
409 journalTemplateModelImpl.getOriginalUuid(),
410 new Long(journalTemplateModelImpl.getOriginalGroupId())
411 });
412 }
413
414 if (isNew ||
415 (!Validator.equals(journalTemplate.getUuid(),
416 journalTemplateModelImpl.getOriginalUuid()) ||
417 (journalTemplate.getGroupId() != journalTemplateModelImpl.getOriginalGroupId()))) {
418 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
419 new Object[] {
420 journalTemplate.getUuid(),
421 new Long(journalTemplate.getGroupId())
422 }, journalTemplate);
423 }
424
425 if (!isNew &&
426 (journalTemplate.getSmallImageId() != journalTemplateModelImpl.getOriginalSmallImageId())) {
427 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
428 new Object[] {
429 new Long(journalTemplateModelImpl.getOriginalSmallImageId())
430 });
431 }
432
433 if (isNew ||
434 (journalTemplate.getSmallImageId() != journalTemplateModelImpl.getOriginalSmallImageId())) {
435 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
436 new Object[] { new Long(journalTemplate.getSmallImageId()) },
437 journalTemplate);
438 }
439
440 if (!isNew &&
441 ((journalTemplate.getGroupId() != journalTemplateModelImpl.getOriginalGroupId()) ||
442 !Validator.equals(journalTemplate.getTemplateId(),
443 journalTemplateModelImpl.getOriginalTemplateId()))) {
444 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_T,
445 new Object[] {
446 new Long(journalTemplateModelImpl.getOriginalGroupId()),
447
448 journalTemplateModelImpl.getOriginalTemplateId()
449 });
450 }
451
452 if (isNew ||
453 ((journalTemplate.getGroupId() != journalTemplateModelImpl.getOriginalGroupId()) ||
454 !Validator.equals(journalTemplate.getTemplateId(),
455 journalTemplateModelImpl.getOriginalTemplateId()))) {
456 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_T,
457 new Object[] {
458 new Long(journalTemplate.getGroupId()),
459
460 journalTemplate.getTemplateId()
461 }, journalTemplate);
462 }
463
464 return journalTemplate;
465 }
466
467 protected JournalTemplate toUnwrappedModel(JournalTemplate journalTemplate) {
468 if (journalTemplate instanceof JournalTemplateImpl) {
469 return journalTemplate;
470 }
471
472 JournalTemplateImpl journalTemplateImpl = new JournalTemplateImpl();
473
474 journalTemplateImpl.setNew(journalTemplate.isNew());
475 journalTemplateImpl.setPrimaryKey(journalTemplate.getPrimaryKey());
476
477 journalTemplateImpl.setUuid(journalTemplate.getUuid());
478 journalTemplateImpl.setId(journalTemplate.getId());
479 journalTemplateImpl.setGroupId(journalTemplate.getGroupId());
480 journalTemplateImpl.setCompanyId(journalTemplate.getCompanyId());
481 journalTemplateImpl.setUserId(journalTemplate.getUserId());
482 journalTemplateImpl.setUserName(journalTemplate.getUserName());
483 journalTemplateImpl.setCreateDate(journalTemplate.getCreateDate());
484 journalTemplateImpl.setModifiedDate(journalTemplate.getModifiedDate());
485 journalTemplateImpl.setTemplateId(journalTemplate.getTemplateId());
486 journalTemplateImpl.setStructureId(journalTemplate.getStructureId());
487 journalTemplateImpl.setName(journalTemplate.getName());
488 journalTemplateImpl.setDescription(journalTemplate.getDescription());
489 journalTemplateImpl.setXsl(journalTemplate.getXsl());
490 journalTemplateImpl.setLangType(journalTemplate.getLangType());
491 journalTemplateImpl.setCacheable(journalTemplate.isCacheable());
492 journalTemplateImpl.setSmallImage(journalTemplate.isSmallImage());
493 journalTemplateImpl.setSmallImageId(journalTemplate.getSmallImageId());
494 journalTemplateImpl.setSmallImageURL(journalTemplate.getSmallImageURL());
495
496 return journalTemplateImpl;
497 }
498
499
507 public JournalTemplate findByPrimaryKey(Serializable primaryKey)
508 throws NoSuchModelException, SystemException {
509 return findByPrimaryKey(((Long)primaryKey).longValue());
510 }
511
512
520 public JournalTemplate findByPrimaryKey(long id)
521 throws NoSuchTemplateException, SystemException {
522 JournalTemplate journalTemplate = fetchByPrimaryKey(id);
523
524 if (journalTemplate == null) {
525 if (_log.isWarnEnabled()) {
526 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + id);
527 }
528
529 throw new NoSuchTemplateException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
530 id);
531 }
532
533 return journalTemplate;
534 }
535
536
543 public JournalTemplate fetchByPrimaryKey(Serializable primaryKey)
544 throws SystemException {
545 return fetchByPrimaryKey(((Long)primaryKey).longValue());
546 }
547
548
555 public JournalTemplate fetchByPrimaryKey(long id) throws SystemException {
556 JournalTemplate journalTemplate = (JournalTemplate)EntityCacheUtil.getResult(JournalTemplateModelImpl.ENTITY_CACHE_ENABLED,
557 JournalTemplateImpl.class, id, this);
558
559 if (journalTemplate == null) {
560 Session session = null;
561
562 try {
563 session = openSession();
564
565 journalTemplate = (JournalTemplate)session.get(JournalTemplateImpl.class,
566 new Long(id));
567 }
568 catch (Exception e) {
569 throw processException(e);
570 }
571 finally {
572 if (journalTemplate != null) {
573 cacheResult(journalTemplate);
574 }
575
576 closeSession(session);
577 }
578 }
579
580 return journalTemplate;
581 }
582
583
590 public List<JournalTemplate> findByUuid(String uuid)
591 throws SystemException {
592 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
593 }
594
595
608 public List<JournalTemplate> findByUuid(String uuid, int start, int end)
609 throws SystemException {
610 return findByUuid(uuid, start, end, null);
611 }
612
613
627 public List<JournalTemplate> findByUuid(String uuid, int start, int end,
628 OrderByComparator orderByComparator) throws SystemException {
629 Object[] finderArgs = new Object[] {
630 uuid,
631
632 String.valueOf(start), String.valueOf(end),
633 String.valueOf(orderByComparator)
634 };
635
636 List<JournalTemplate> list = (List<JournalTemplate>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
637 finderArgs, this);
638
639 if (list == null) {
640 StringBundler query = null;
641
642 if (orderByComparator != null) {
643 query = new StringBundler(3 +
644 (orderByComparator.getOrderByFields().length * 3));
645 }
646 else {
647 query = new StringBundler(3);
648 }
649
650 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
651
652 if (uuid == null) {
653 query.append(_FINDER_COLUMN_UUID_UUID_1);
654 }
655 else {
656 if (uuid.equals(StringPool.BLANK)) {
657 query.append(_FINDER_COLUMN_UUID_UUID_3);
658 }
659 else {
660 query.append(_FINDER_COLUMN_UUID_UUID_2);
661 }
662 }
663
664 if (orderByComparator != null) {
665 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
666 orderByComparator);
667 }
668
669 else {
670 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
671 }
672
673 String sql = query.toString();
674
675 Session session = null;
676
677 try {
678 session = openSession();
679
680 Query q = session.createQuery(sql);
681
682 QueryPos qPos = QueryPos.getInstance(q);
683
684 if (uuid != null) {
685 qPos.add(uuid);
686 }
687
688 list = (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
689 start, end);
690 }
691 catch (Exception e) {
692 throw processException(e);
693 }
694 finally {
695 if (list == null) {
696 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_UUID,
697 finderArgs);
698 }
699 else {
700 cacheResult(list);
701
702 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID,
703 finderArgs, list);
704 }
705
706 closeSession(session);
707 }
708 }
709
710 return list;
711 }
712
713
726 public JournalTemplate findByUuid_First(String uuid,
727 OrderByComparator orderByComparator)
728 throws NoSuchTemplateException, SystemException {
729 List<JournalTemplate> list = findByUuid(uuid, 0, 1, orderByComparator);
730
731 if (list.isEmpty()) {
732 StringBundler msg = new StringBundler(4);
733
734 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
735
736 msg.append("uuid=");
737 msg.append(uuid);
738
739 msg.append(StringPool.CLOSE_CURLY_BRACE);
740
741 throw new NoSuchTemplateException(msg.toString());
742 }
743 else {
744 return list.get(0);
745 }
746 }
747
748
761 public JournalTemplate findByUuid_Last(String uuid,
762 OrderByComparator orderByComparator)
763 throws NoSuchTemplateException, SystemException {
764 int count = countByUuid(uuid);
765
766 List<JournalTemplate> list = findByUuid(uuid, count - 1, count,
767 orderByComparator);
768
769 if (list.isEmpty()) {
770 StringBundler msg = new StringBundler(4);
771
772 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
773
774 msg.append("uuid=");
775 msg.append(uuid);
776
777 msg.append(StringPool.CLOSE_CURLY_BRACE);
778
779 throw new NoSuchTemplateException(msg.toString());
780 }
781 else {
782 return list.get(0);
783 }
784 }
785
786
800 public JournalTemplate[] findByUuid_PrevAndNext(long id, String uuid,
801 OrderByComparator orderByComparator)
802 throws NoSuchTemplateException, SystemException {
803 JournalTemplate journalTemplate = findByPrimaryKey(id);
804
805 Session session = null;
806
807 try {
808 session = openSession();
809
810 JournalTemplate[] array = new JournalTemplateImpl[3];
811
812 array[0] = getByUuid_PrevAndNext(session, journalTemplate, uuid,
813 orderByComparator, true);
814
815 array[1] = journalTemplate;
816
817 array[2] = getByUuid_PrevAndNext(session, journalTemplate, uuid,
818 orderByComparator, false);
819
820 return array;
821 }
822 catch (Exception e) {
823 throw processException(e);
824 }
825 finally {
826 closeSession(session);
827 }
828 }
829
830 protected JournalTemplate getByUuid_PrevAndNext(Session session,
831 JournalTemplate journalTemplate, String uuid,
832 OrderByComparator orderByComparator, boolean previous) {
833 StringBundler query = null;
834
835 if (orderByComparator != null) {
836 query = new StringBundler(6 +
837 (orderByComparator.getOrderByFields().length * 6));
838 }
839 else {
840 query = new StringBundler(3);
841 }
842
843 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
844
845 if (uuid == null) {
846 query.append(_FINDER_COLUMN_UUID_UUID_1);
847 }
848 else {
849 if (uuid.equals(StringPool.BLANK)) {
850 query.append(_FINDER_COLUMN_UUID_UUID_3);
851 }
852 else {
853 query.append(_FINDER_COLUMN_UUID_UUID_2);
854 }
855 }
856
857 if (orderByComparator != null) {
858 String[] orderByFields = orderByComparator.getOrderByFields();
859
860 if (orderByFields.length > 0) {
861 query.append(WHERE_AND);
862 }
863
864 for (int i = 0; i < orderByFields.length; i++) {
865 query.append(_ORDER_BY_ENTITY_ALIAS);
866 query.append(orderByFields[i]);
867
868 if ((i + 1) < orderByFields.length) {
869 if (orderByComparator.isAscending() ^ previous) {
870 query.append(WHERE_GREATER_THAN_HAS_NEXT);
871 }
872 else {
873 query.append(WHERE_LESSER_THAN_HAS_NEXT);
874 }
875 }
876 else {
877 if (orderByComparator.isAscending() ^ previous) {
878 query.append(WHERE_GREATER_THAN);
879 }
880 else {
881 query.append(WHERE_LESSER_THAN);
882 }
883 }
884 }
885
886 query.append(ORDER_BY_CLAUSE);
887
888 for (int i = 0; i < orderByFields.length; i++) {
889 query.append(_ORDER_BY_ENTITY_ALIAS);
890 query.append(orderByFields[i]);
891
892 if ((i + 1) < orderByFields.length) {
893 if (orderByComparator.isAscending() ^ previous) {
894 query.append(ORDER_BY_ASC_HAS_NEXT);
895 }
896 else {
897 query.append(ORDER_BY_DESC_HAS_NEXT);
898 }
899 }
900 else {
901 if (orderByComparator.isAscending() ^ previous) {
902 query.append(ORDER_BY_ASC);
903 }
904 else {
905 query.append(ORDER_BY_DESC);
906 }
907 }
908 }
909 }
910
911 else {
912 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
913 }
914
915 String sql = query.toString();
916
917 Query q = session.createQuery(sql);
918
919 q.setFirstResult(0);
920 q.setMaxResults(2);
921
922 QueryPos qPos = QueryPos.getInstance(q);
923
924 if (uuid != null) {
925 qPos.add(uuid);
926 }
927
928 if (orderByComparator != null) {
929 Object[] values = orderByComparator.getOrderByValues(journalTemplate);
930
931 for (Object value : values) {
932 qPos.add(value);
933 }
934 }
935
936 List<JournalTemplate> list = q.list();
937
938 if (list.size() == 2) {
939 return list.get(1);
940 }
941 else {
942 return null;
943 }
944 }
945
946
955 public JournalTemplate findByUUID_G(String uuid, long groupId)
956 throws NoSuchTemplateException, SystemException {
957 JournalTemplate journalTemplate = fetchByUUID_G(uuid, groupId);
958
959 if (journalTemplate == null) {
960 StringBundler msg = new StringBundler(6);
961
962 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
963
964 msg.append("uuid=");
965 msg.append(uuid);
966
967 msg.append(", groupId=");
968 msg.append(groupId);
969
970 msg.append(StringPool.CLOSE_CURLY_BRACE);
971
972 if (_log.isWarnEnabled()) {
973 _log.warn(msg.toString());
974 }
975
976 throw new NoSuchTemplateException(msg.toString());
977 }
978
979 return journalTemplate;
980 }
981
982
990 public JournalTemplate fetchByUUID_G(String uuid, long groupId)
991 throws SystemException {
992 return fetchByUUID_G(uuid, groupId, true);
993 }
994
995
1003 public JournalTemplate fetchByUUID_G(String uuid, long groupId,
1004 boolean retrieveFromCache) throws SystemException {
1005 Object[] finderArgs = new Object[] { uuid, groupId };
1006
1007 Object result = null;
1008
1009 if (retrieveFromCache) {
1010 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1011 finderArgs, this);
1012 }
1013
1014 if (result == null) {
1015 StringBundler query = new StringBundler(4);
1016
1017 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1018
1019 if (uuid == null) {
1020 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1021 }
1022 else {
1023 if (uuid.equals(StringPool.BLANK)) {
1024 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1025 }
1026 else {
1027 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1028 }
1029 }
1030
1031 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1032
1033 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1034
1035 String sql = query.toString();
1036
1037 Session session = null;
1038
1039 try {
1040 session = openSession();
1041
1042 Query q = session.createQuery(sql);
1043
1044 QueryPos qPos = QueryPos.getInstance(q);
1045
1046 if (uuid != null) {
1047 qPos.add(uuid);
1048 }
1049
1050 qPos.add(groupId);
1051
1052 List<JournalTemplate> list = q.list();
1053
1054 result = list;
1055
1056 JournalTemplate journalTemplate = null;
1057
1058 if (list.isEmpty()) {
1059 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1060 finderArgs, list);
1061 }
1062 else {
1063 journalTemplate = list.get(0);
1064
1065 cacheResult(journalTemplate);
1066
1067 if ((journalTemplate.getUuid() == null) ||
1068 !journalTemplate.getUuid().equals(uuid) ||
1069 (journalTemplate.getGroupId() != groupId)) {
1070 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1071 finderArgs, journalTemplate);
1072 }
1073 }
1074
1075 return journalTemplate;
1076 }
1077 catch (Exception e) {
1078 throw processException(e);
1079 }
1080 finally {
1081 if (result == null) {
1082 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
1083 finderArgs);
1084 }
1085
1086 closeSession(session);
1087 }
1088 }
1089 else {
1090 if (result instanceof List<?>) {
1091 return null;
1092 }
1093 else {
1094 return (JournalTemplate)result;
1095 }
1096 }
1097 }
1098
1099
1106 public List<JournalTemplate> findByGroupId(long groupId)
1107 throws SystemException {
1108 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1109 }
1110
1111
1124 public List<JournalTemplate> findByGroupId(long groupId, int start, int end)
1125 throws SystemException {
1126 return findByGroupId(groupId, start, end, null);
1127 }
1128
1129
1143 public List<JournalTemplate> findByGroupId(long groupId, int start,
1144 int end, OrderByComparator orderByComparator) throws SystemException {
1145 Object[] finderArgs = new Object[] {
1146 groupId,
1147
1148 String.valueOf(start), String.valueOf(end),
1149 String.valueOf(orderByComparator)
1150 };
1151
1152 List<JournalTemplate> list = (List<JournalTemplate>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
1153 finderArgs, this);
1154
1155 if (list == null) {
1156 StringBundler query = null;
1157
1158 if (orderByComparator != null) {
1159 query = new StringBundler(3 +
1160 (orderByComparator.getOrderByFields().length * 3));
1161 }
1162 else {
1163 query = new StringBundler(3);
1164 }
1165
1166 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1167
1168 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1169
1170 if (orderByComparator != null) {
1171 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1172 orderByComparator);
1173 }
1174
1175 else {
1176 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1177 }
1178
1179 String sql = query.toString();
1180
1181 Session session = null;
1182
1183 try {
1184 session = openSession();
1185
1186 Query q = session.createQuery(sql);
1187
1188 QueryPos qPos = QueryPos.getInstance(q);
1189
1190 qPos.add(groupId);
1191
1192 list = (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
1193 start, end);
1194 }
1195 catch (Exception e) {
1196 throw processException(e);
1197 }
1198 finally {
1199 if (list == null) {
1200 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_GROUPID,
1201 finderArgs);
1202 }
1203 else {
1204 cacheResult(list);
1205
1206 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
1207 finderArgs, list);
1208 }
1209
1210 closeSession(session);
1211 }
1212 }
1213
1214 return list;
1215 }
1216
1217
1230 public JournalTemplate findByGroupId_First(long groupId,
1231 OrderByComparator orderByComparator)
1232 throws NoSuchTemplateException, SystemException {
1233 List<JournalTemplate> list = findByGroupId(groupId, 0, 1,
1234 orderByComparator);
1235
1236 if (list.isEmpty()) {
1237 StringBundler msg = new StringBundler(4);
1238
1239 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1240
1241 msg.append("groupId=");
1242 msg.append(groupId);
1243
1244 msg.append(StringPool.CLOSE_CURLY_BRACE);
1245
1246 throw new NoSuchTemplateException(msg.toString());
1247 }
1248 else {
1249 return list.get(0);
1250 }
1251 }
1252
1253
1266 public JournalTemplate findByGroupId_Last(long groupId,
1267 OrderByComparator orderByComparator)
1268 throws NoSuchTemplateException, SystemException {
1269 int count = countByGroupId(groupId);
1270
1271 List<JournalTemplate> list = findByGroupId(groupId, count - 1, count,
1272 orderByComparator);
1273
1274 if (list.isEmpty()) {
1275 StringBundler msg = new StringBundler(4);
1276
1277 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1278
1279 msg.append("groupId=");
1280 msg.append(groupId);
1281
1282 msg.append(StringPool.CLOSE_CURLY_BRACE);
1283
1284 throw new NoSuchTemplateException(msg.toString());
1285 }
1286 else {
1287 return list.get(0);
1288 }
1289 }
1290
1291
1305 public JournalTemplate[] findByGroupId_PrevAndNext(long id, long groupId,
1306 OrderByComparator orderByComparator)
1307 throws NoSuchTemplateException, SystemException {
1308 JournalTemplate journalTemplate = findByPrimaryKey(id);
1309
1310 Session session = null;
1311
1312 try {
1313 session = openSession();
1314
1315 JournalTemplate[] array = new JournalTemplateImpl[3];
1316
1317 array[0] = getByGroupId_PrevAndNext(session, journalTemplate,
1318 groupId, orderByComparator, true);
1319
1320 array[1] = journalTemplate;
1321
1322 array[2] = getByGroupId_PrevAndNext(session, journalTemplate,
1323 groupId, orderByComparator, false);
1324
1325 return array;
1326 }
1327 catch (Exception e) {
1328 throw processException(e);
1329 }
1330 finally {
1331 closeSession(session);
1332 }
1333 }
1334
1335 protected JournalTemplate getByGroupId_PrevAndNext(Session session,
1336 JournalTemplate journalTemplate, long groupId,
1337 OrderByComparator orderByComparator, boolean previous) {
1338 StringBundler query = null;
1339
1340 if (orderByComparator != null) {
1341 query = new StringBundler(6 +
1342 (orderByComparator.getOrderByFields().length * 6));
1343 }
1344 else {
1345 query = new StringBundler(3);
1346 }
1347
1348 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1349
1350 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1351
1352 if (orderByComparator != null) {
1353 String[] orderByFields = orderByComparator.getOrderByFields();
1354
1355 if (orderByFields.length > 0) {
1356 query.append(WHERE_AND);
1357 }
1358
1359 for (int i = 0; i < orderByFields.length; i++) {
1360 query.append(_ORDER_BY_ENTITY_ALIAS);
1361 query.append(orderByFields[i]);
1362
1363 if ((i + 1) < orderByFields.length) {
1364 if (orderByComparator.isAscending() ^ previous) {
1365 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1366 }
1367 else {
1368 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1369 }
1370 }
1371 else {
1372 if (orderByComparator.isAscending() ^ previous) {
1373 query.append(WHERE_GREATER_THAN);
1374 }
1375 else {
1376 query.append(WHERE_LESSER_THAN);
1377 }
1378 }
1379 }
1380
1381 query.append(ORDER_BY_CLAUSE);
1382
1383 for (int i = 0; i < orderByFields.length; i++) {
1384 query.append(_ORDER_BY_ENTITY_ALIAS);
1385 query.append(orderByFields[i]);
1386
1387 if ((i + 1) < orderByFields.length) {
1388 if (orderByComparator.isAscending() ^ previous) {
1389 query.append(ORDER_BY_ASC_HAS_NEXT);
1390 }
1391 else {
1392 query.append(ORDER_BY_DESC_HAS_NEXT);
1393 }
1394 }
1395 else {
1396 if (orderByComparator.isAscending() ^ previous) {
1397 query.append(ORDER_BY_ASC);
1398 }
1399 else {
1400 query.append(ORDER_BY_DESC);
1401 }
1402 }
1403 }
1404 }
1405
1406 else {
1407 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1408 }
1409
1410 String sql = query.toString();
1411
1412 Query q = session.createQuery(sql);
1413
1414 q.setFirstResult(0);
1415 q.setMaxResults(2);
1416
1417 QueryPos qPos = QueryPos.getInstance(q);
1418
1419 qPos.add(groupId);
1420
1421 if (orderByComparator != null) {
1422 Object[] values = orderByComparator.getOrderByValues(journalTemplate);
1423
1424 for (Object value : values) {
1425 qPos.add(value);
1426 }
1427 }
1428
1429 List<JournalTemplate> list = q.list();
1430
1431 if (list.size() == 2) {
1432 return list.get(1);
1433 }
1434 else {
1435 return null;
1436 }
1437 }
1438
1439
1446 public List<JournalTemplate> filterFindByGroupId(long groupId)
1447 throws SystemException {
1448 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1449 QueryUtil.ALL_POS, null);
1450 }
1451
1452
1465 public List<JournalTemplate> filterFindByGroupId(long groupId, int start,
1466 int end) throws SystemException {
1467 return filterFindByGroupId(groupId, start, end, null);
1468 }
1469
1470
1484 public List<JournalTemplate> filterFindByGroupId(long groupId, int start,
1485 int end, OrderByComparator orderByComparator) throws SystemException {
1486 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1487 return findByGroupId(groupId, start, end, orderByComparator);
1488 }
1489
1490 StringBundler query = null;
1491
1492 if (orderByComparator != null) {
1493 query = new StringBundler(3 +
1494 (orderByComparator.getOrderByFields().length * 3));
1495 }
1496 else {
1497 query = new StringBundler(3);
1498 }
1499
1500 if (getDB().isSupportsInlineDistinct()) {
1501 query.append(_FILTER_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1502 }
1503 else {
1504 query.append(_FILTER_SQL_SELECT_JOURNALTEMPLATE_NO_INLINE_DISTINCT_WHERE_1);
1505 }
1506
1507 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1508
1509 if (!getDB().isSupportsInlineDistinct()) {
1510 query.append(_FILTER_SQL_SELECT_JOURNALTEMPLATE_NO_INLINE_DISTINCT_WHERE_2);
1511 }
1512
1513 if (orderByComparator != null) {
1514 if (getDB().isSupportsInlineDistinct()) {
1515 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1516 orderByComparator);
1517 }
1518 else {
1519 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1520 orderByComparator);
1521 }
1522 }
1523
1524 else {
1525 if (getDB().isSupportsInlineDistinct()) {
1526 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1527 }
1528 else {
1529 query.append(JournalTemplateModelImpl.ORDER_BY_SQL);
1530 }
1531 }
1532
1533 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1534 JournalTemplate.class.getName(), _FILTER_COLUMN_PK,
1535 _FILTER_COLUMN_USERID, groupId);
1536
1537 Session session = null;
1538
1539 try {
1540 session = openSession();
1541
1542 SQLQuery q = session.createSQLQuery(sql);
1543
1544 if (getDB().isSupportsInlineDistinct()) {
1545 q.addEntity(_FILTER_ENTITY_ALIAS, JournalTemplateImpl.class);
1546 }
1547 else {
1548 q.addEntity(_FILTER_ENTITY_TABLE, JournalTemplateImpl.class);
1549 }
1550
1551 QueryPos qPos = QueryPos.getInstance(q);
1552
1553 qPos.add(groupId);
1554
1555 return (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
1556 start, end);
1557 }
1558 catch (Exception e) {
1559 throw processException(e);
1560 }
1561 finally {
1562 closeSession(session);
1563 }
1564 }
1565
1566
1573 public List<JournalTemplate> findByTemplateId(String templateId)
1574 throws SystemException {
1575 return findByTemplateId(templateId, QueryUtil.ALL_POS,
1576 QueryUtil.ALL_POS, null);
1577 }
1578
1579
1592 public List<JournalTemplate> findByTemplateId(String templateId, int start,
1593 int end) throws SystemException {
1594 return findByTemplateId(templateId, start, end, null);
1595 }
1596
1597
1611 public List<JournalTemplate> findByTemplateId(String templateId, int start,
1612 int end, OrderByComparator orderByComparator) throws SystemException {
1613 Object[] finderArgs = new Object[] {
1614 templateId,
1615
1616 String.valueOf(start), String.valueOf(end),
1617 String.valueOf(orderByComparator)
1618 };
1619
1620 List<JournalTemplate> list = (List<JournalTemplate>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_TEMPLATEID,
1621 finderArgs, this);
1622
1623 if (list == null) {
1624 StringBundler query = null;
1625
1626 if (orderByComparator != null) {
1627 query = new StringBundler(3 +
1628 (orderByComparator.getOrderByFields().length * 3));
1629 }
1630 else {
1631 query = new StringBundler(3);
1632 }
1633
1634 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1635
1636 if (templateId == null) {
1637 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1);
1638 }
1639 else {
1640 if (templateId.equals(StringPool.BLANK)) {
1641 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3);
1642 }
1643 else {
1644 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2);
1645 }
1646 }
1647
1648 if (orderByComparator != null) {
1649 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1650 orderByComparator);
1651 }
1652
1653 else {
1654 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1655 }
1656
1657 String sql = query.toString();
1658
1659 Session session = null;
1660
1661 try {
1662 session = openSession();
1663
1664 Query q = session.createQuery(sql);
1665
1666 QueryPos qPos = QueryPos.getInstance(q);
1667
1668 if (templateId != null) {
1669 qPos.add(templateId);
1670 }
1671
1672 list = (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
1673 start, end);
1674 }
1675 catch (Exception e) {
1676 throw processException(e);
1677 }
1678 finally {
1679 if (list == null) {
1680 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_TEMPLATEID,
1681 finderArgs);
1682 }
1683 else {
1684 cacheResult(list);
1685
1686 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_TEMPLATEID,
1687 finderArgs, list);
1688 }
1689
1690 closeSession(session);
1691 }
1692 }
1693
1694 return list;
1695 }
1696
1697
1710 public JournalTemplate findByTemplateId_First(String templateId,
1711 OrderByComparator orderByComparator)
1712 throws NoSuchTemplateException, SystemException {
1713 List<JournalTemplate> list = findByTemplateId(templateId, 0, 1,
1714 orderByComparator);
1715
1716 if (list.isEmpty()) {
1717 StringBundler msg = new StringBundler(4);
1718
1719 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1720
1721 msg.append("templateId=");
1722 msg.append(templateId);
1723
1724 msg.append(StringPool.CLOSE_CURLY_BRACE);
1725
1726 throw new NoSuchTemplateException(msg.toString());
1727 }
1728 else {
1729 return list.get(0);
1730 }
1731 }
1732
1733
1746 public JournalTemplate findByTemplateId_Last(String templateId,
1747 OrderByComparator orderByComparator)
1748 throws NoSuchTemplateException, SystemException {
1749 int count = countByTemplateId(templateId);
1750
1751 List<JournalTemplate> list = findByTemplateId(templateId, count - 1,
1752 count, orderByComparator);
1753
1754 if (list.isEmpty()) {
1755 StringBundler msg = new StringBundler(4);
1756
1757 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1758
1759 msg.append("templateId=");
1760 msg.append(templateId);
1761
1762 msg.append(StringPool.CLOSE_CURLY_BRACE);
1763
1764 throw new NoSuchTemplateException(msg.toString());
1765 }
1766 else {
1767 return list.get(0);
1768 }
1769 }
1770
1771
1785 public JournalTemplate[] findByTemplateId_PrevAndNext(long id,
1786 String templateId, OrderByComparator orderByComparator)
1787 throws NoSuchTemplateException, SystemException {
1788 JournalTemplate journalTemplate = findByPrimaryKey(id);
1789
1790 Session session = null;
1791
1792 try {
1793 session = openSession();
1794
1795 JournalTemplate[] array = new JournalTemplateImpl[3];
1796
1797 array[0] = getByTemplateId_PrevAndNext(session, journalTemplate,
1798 templateId, orderByComparator, true);
1799
1800 array[1] = journalTemplate;
1801
1802 array[2] = getByTemplateId_PrevAndNext(session, journalTemplate,
1803 templateId, orderByComparator, false);
1804
1805 return array;
1806 }
1807 catch (Exception e) {
1808 throw processException(e);
1809 }
1810 finally {
1811 closeSession(session);
1812 }
1813 }
1814
1815 protected JournalTemplate getByTemplateId_PrevAndNext(Session session,
1816 JournalTemplate journalTemplate, String templateId,
1817 OrderByComparator orderByComparator, boolean previous) {
1818 StringBundler query = null;
1819
1820 if (orderByComparator != null) {
1821 query = new StringBundler(6 +
1822 (orderByComparator.getOrderByFields().length * 6));
1823 }
1824 else {
1825 query = new StringBundler(3);
1826 }
1827
1828 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1829
1830 if (templateId == null) {
1831 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1);
1832 }
1833 else {
1834 if (templateId.equals(StringPool.BLANK)) {
1835 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3);
1836 }
1837 else {
1838 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2);
1839 }
1840 }
1841
1842 if (orderByComparator != null) {
1843 String[] orderByFields = orderByComparator.getOrderByFields();
1844
1845 if (orderByFields.length > 0) {
1846 query.append(WHERE_AND);
1847 }
1848
1849 for (int i = 0; i < orderByFields.length; i++) {
1850 query.append(_ORDER_BY_ENTITY_ALIAS);
1851 query.append(orderByFields[i]);
1852
1853 if ((i + 1) < orderByFields.length) {
1854 if (orderByComparator.isAscending() ^ previous) {
1855 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1856 }
1857 else {
1858 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1859 }
1860 }
1861 else {
1862 if (orderByComparator.isAscending() ^ previous) {
1863 query.append(WHERE_GREATER_THAN);
1864 }
1865 else {
1866 query.append(WHERE_LESSER_THAN);
1867 }
1868 }
1869 }
1870
1871 query.append(ORDER_BY_CLAUSE);
1872
1873 for (int i = 0; i < orderByFields.length; i++) {
1874 query.append(_ORDER_BY_ENTITY_ALIAS);
1875 query.append(orderByFields[i]);
1876
1877 if ((i + 1) < orderByFields.length) {
1878 if (orderByComparator.isAscending() ^ previous) {
1879 query.append(ORDER_BY_ASC_HAS_NEXT);
1880 }
1881 else {
1882 query.append(ORDER_BY_DESC_HAS_NEXT);
1883 }
1884 }
1885 else {
1886 if (orderByComparator.isAscending() ^ previous) {
1887 query.append(ORDER_BY_ASC);
1888 }
1889 else {
1890 query.append(ORDER_BY_DESC);
1891 }
1892 }
1893 }
1894 }
1895
1896 else {
1897 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
1898 }
1899
1900 String sql = query.toString();
1901
1902 Query q = session.createQuery(sql);
1903
1904 q.setFirstResult(0);
1905 q.setMaxResults(2);
1906
1907 QueryPos qPos = QueryPos.getInstance(q);
1908
1909 if (templateId != null) {
1910 qPos.add(templateId);
1911 }
1912
1913 if (orderByComparator != null) {
1914 Object[] values = orderByComparator.getOrderByValues(journalTemplate);
1915
1916 for (Object value : values) {
1917 qPos.add(value);
1918 }
1919 }
1920
1921 List<JournalTemplate> list = q.list();
1922
1923 if (list.size() == 2) {
1924 return list.get(1);
1925 }
1926 else {
1927 return null;
1928 }
1929 }
1930
1931
1939 public JournalTemplate findBySmallImageId(long smallImageId)
1940 throws NoSuchTemplateException, SystemException {
1941 JournalTemplate journalTemplate = fetchBySmallImageId(smallImageId);
1942
1943 if (journalTemplate == null) {
1944 StringBundler msg = new StringBundler(4);
1945
1946 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1947
1948 msg.append("smallImageId=");
1949 msg.append(smallImageId);
1950
1951 msg.append(StringPool.CLOSE_CURLY_BRACE);
1952
1953 if (_log.isWarnEnabled()) {
1954 _log.warn(msg.toString());
1955 }
1956
1957 throw new NoSuchTemplateException(msg.toString());
1958 }
1959
1960 return journalTemplate;
1961 }
1962
1963
1970 public JournalTemplate fetchBySmallImageId(long smallImageId)
1971 throws SystemException {
1972 return fetchBySmallImageId(smallImageId, true);
1973 }
1974
1975
1982 public JournalTemplate fetchBySmallImageId(long smallImageId,
1983 boolean retrieveFromCache) throws SystemException {
1984 Object[] finderArgs = new Object[] { smallImageId };
1985
1986 Object result = null;
1987
1988 if (retrieveFromCache) {
1989 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
1990 finderArgs, this);
1991 }
1992
1993 if (result == null) {
1994 StringBundler query = new StringBundler(3);
1995
1996 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
1997
1998 query.append(_FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2);
1999
2000 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
2001
2002 String sql = query.toString();
2003
2004 Session session = null;
2005
2006 try {
2007 session = openSession();
2008
2009 Query q = session.createQuery(sql);
2010
2011 QueryPos qPos = QueryPos.getInstance(q);
2012
2013 qPos.add(smallImageId);
2014
2015 List<JournalTemplate> list = q.list();
2016
2017 result = list;
2018
2019 JournalTemplate journalTemplate = null;
2020
2021 if (list.isEmpty()) {
2022 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
2023 finderArgs, list);
2024 }
2025 else {
2026 journalTemplate = list.get(0);
2027
2028 cacheResult(journalTemplate);
2029
2030 if ((journalTemplate.getSmallImageId() != smallImageId)) {
2031 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
2032 finderArgs, journalTemplate);
2033 }
2034 }
2035
2036 return journalTemplate;
2037 }
2038 catch (Exception e) {
2039 throw processException(e);
2040 }
2041 finally {
2042 if (result == null) {
2043 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
2044 finderArgs);
2045 }
2046
2047 closeSession(session);
2048 }
2049 }
2050 else {
2051 if (result instanceof List<?>) {
2052 return null;
2053 }
2054 else {
2055 return (JournalTemplate)result;
2056 }
2057 }
2058 }
2059
2060
2069 public JournalTemplate findByG_T(long groupId, String templateId)
2070 throws NoSuchTemplateException, SystemException {
2071 JournalTemplate journalTemplate = fetchByG_T(groupId, templateId);
2072
2073 if (journalTemplate == null) {
2074 StringBundler msg = new StringBundler(6);
2075
2076 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2077
2078 msg.append("groupId=");
2079 msg.append(groupId);
2080
2081 msg.append(", templateId=");
2082 msg.append(templateId);
2083
2084 msg.append(StringPool.CLOSE_CURLY_BRACE);
2085
2086 if (_log.isWarnEnabled()) {
2087 _log.warn(msg.toString());
2088 }
2089
2090 throw new NoSuchTemplateException(msg.toString());
2091 }
2092
2093 return journalTemplate;
2094 }
2095
2096
2104 public JournalTemplate fetchByG_T(long groupId, String templateId)
2105 throws SystemException {
2106 return fetchByG_T(groupId, templateId, true);
2107 }
2108
2109
2117 public JournalTemplate fetchByG_T(long groupId, String templateId,
2118 boolean retrieveFromCache) throws SystemException {
2119 Object[] finderArgs = new Object[] { groupId, templateId };
2120
2121 Object result = null;
2122
2123 if (retrieveFromCache) {
2124 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_T,
2125 finderArgs, this);
2126 }
2127
2128 if (result == null) {
2129 StringBundler query = new StringBundler(4);
2130
2131 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
2132
2133 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
2134
2135 if (templateId == null) {
2136 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
2137 }
2138 else {
2139 if (templateId.equals(StringPool.BLANK)) {
2140 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
2141 }
2142 else {
2143 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
2144 }
2145 }
2146
2147 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
2148
2149 String sql = query.toString();
2150
2151 Session session = null;
2152
2153 try {
2154 session = openSession();
2155
2156 Query q = session.createQuery(sql);
2157
2158 QueryPos qPos = QueryPos.getInstance(q);
2159
2160 qPos.add(groupId);
2161
2162 if (templateId != null) {
2163 qPos.add(templateId);
2164 }
2165
2166 List<JournalTemplate> list = q.list();
2167
2168 result = list;
2169
2170 JournalTemplate journalTemplate = null;
2171
2172 if (list.isEmpty()) {
2173 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_T,
2174 finderArgs, list);
2175 }
2176 else {
2177 journalTemplate = list.get(0);
2178
2179 cacheResult(journalTemplate);
2180
2181 if ((journalTemplate.getGroupId() != groupId) ||
2182 (journalTemplate.getTemplateId() == null) ||
2183 !journalTemplate.getTemplateId().equals(templateId)) {
2184 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_T,
2185 finderArgs, journalTemplate);
2186 }
2187 }
2188
2189 return journalTemplate;
2190 }
2191 catch (Exception e) {
2192 throw processException(e);
2193 }
2194 finally {
2195 if (result == null) {
2196 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_T,
2197 finderArgs);
2198 }
2199
2200 closeSession(session);
2201 }
2202 }
2203 else {
2204 if (result instanceof List<?>) {
2205 return null;
2206 }
2207 else {
2208 return (JournalTemplate)result;
2209 }
2210 }
2211 }
2212
2213
2221 public List<JournalTemplate> findByG_S(long groupId, String structureId)
2222 throws SystemException {
2223 return findByG_S(groupId, structureId, QueryUtil.ALL_POS,
2224 QueryUtil.ALL_POS, null);
2225 }
2226
2227
2241 public List<JournalTemplate> findByG_S(long groupId, String structureId,
2242 int start, int end) throws SystemException {
2243 return findByG_S(groupId, structureId, start, end, null);
2244 }
2245
2246
2261 public List<JournalTemplate> findByG_S(long groupId, String structureId,
2262 int start, int end, OrderByComparator orderByComparator)
2263 throws SystemException {
2264 Object[] finderArgs = new Object[] {
2265 groupId, structureId,
2266
2267 String.valueOf(start), String.valueOf(end),
2268 String.valueOf(orderByComparator)
2269 };
2270
2271 List<JournalTemplate> list = (List<JournalTemplate>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_S,
2272 finderArgs, this);
2273
2274 if (list == null) {
2275 StringBundler query = null;
2276
2277 if (orderByComparator != null) {
2278 query = new StringBundler(4 +
2279 (orderByComparator.getOrderByFields().length * 3));
2280 }
2281 else {
2282 query = new StringBundler(4);
2283 }
2284
2285 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
2286
2287 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2288
2289 if (structureId == null) {
2290 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
2291 }
2292 else {
2293 if (structureId.equals(StringPool.BLANK)) {
2294 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
2295 }
2296 else {
2297 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
2298 }
2299 }
2300
2301 if (orderByComparator != null) {
2302 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2303 orderByComparator);
2304 }
2305
2306 else {
2307 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
2308 }
2309
2310 String sql = query.toString();
2311
2312 Session session = null;
2313
2314 try {
2315 session = openSession();
2316
2317 Query q = session.createQuery(sql);
2318
2319 QueryPos qPos = QueryPos.getInstance(q);
2320
2321 qPos.add(groupId);
2322
2323 if (structureId != null) {
2324 qPos.add(structureId);
2325 }
2326
2327 list = (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
2328 start, end);
2329 }
2330 catch (Exception e) {
2331 throw processException(e);
2332 }
2333 finally {
2334 if (list == null) {
2335 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_G_S,
2336 finderArgs);
2337 }
2338 else {
2339 cacheResult(list);
2340
2341 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_S,
2342 finderArgs, list);
2343 }
2344
2345 closeSession(session);
2346 }
2347 }
2348
2349 return list;
2350 }
2351
2352
2366 public JournalTemplate findByG_S_First(long groupId, String structureId,
2367 OrderByComparator orderByComparator)
2368 throws NoSuchTemplateException, SystemException {
2369 List<JournalTemplate> list = findByG_S(groupId, structureId, 0, 1,
2370 orderByComparator);
2371
2372 if (list.isEmpty()) {
2373 StringBundler msg = new StringBundler(6);
2374
2375 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2376
2377 msg.append("groupId=");
2378 msg.append(groupId);
2379
2380 msg.append(", structureId=");
2381 msg.append(structureId);
2382
2383 msg.append(StringPool.CLOSE_CURLY_BRACE);
2384
2385 throw new NoSuchTemplateException(msg.toString());
2386 }
2387 else {
2388 return list.get(0);
2389 }
2390 }
2391
2392
2406 public JournalTemplate findByG_S_Last(long groupId, String structureId,
2407 OrderByComparator orderByComparator)
2408 throws NoSuchTemplateException, SystemException {
2409 int count = countByG_S(groupId, structureId);
2410
2411 List<JournalTemplate> list = findByG_S(groupId, structureId, count - 1,
2412 count, orderByComparator);
2413
2414 if (list.isEmpty()) {
2415 StringBundler msg = new StringBundler(6);
2416
2417 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2418
2419 msg.append("groupId=");
2420 msg.append(groupId);
2421
2422 msg.append(", structureId=");
2423 msg.append(structureId);
2424
2425 msg.append(StringPool.CLOSE_CURLY_BRACE);
2426
2427 throw new NoSuchTemplateException(msg.toString());
2428 }
2429 else {
2430 return list.get(0);
2431 }
2432 }
2433
2434
2449 public JournalTemplate[] findByG_S_PrevAndNext(long id, long groupId,
2450 String structureId, OrderByComparator orderByComparator)
2451 throws NoSuchTemplateException, SystemException {
2452 JournalTemplate journalTemplate = findByPrimaryKey(id);
2453
2454 Session session = null;
2455
2456 try {
2457 session = openSession();
2458
2459 JournalTemplate[] array = new JournalTemplateImpl[3];
2460
2461 array[0] = getByG_S_PrevAndNext(session, journalTemplate, groupId,
2462 structureId, orderByComparator, true);
2463
2464 array[1] = journalTemplate;
2465
2466 array[2] = getByG_S_PrevAndNext(session, journalTemplate, groupId,
2467 structureId, orderByComparator, false);
2468
2469 return array;
2470 }
2471 catch (Exception e) {
2472 throw processException(e);
2473 }
2474 finally {
2475 closeSession(session);
2476 }
2477 }
2478
2479 protected JournalTemplate getByG_S_PrevAndNext(Session session,
2480 JournalTemplate journalTemplate, long groupId, String structureId,
2481 OrderByComparator orderByComparator, boolean previous) {
2482 StringBundler query = null;
2483
2484 if (orderByComparator != null) {
2485 query = new StringBundler(6 +
2486 (orderByComparator.getOrderByFields().length * 6));
2487 }
2488 else {
2489 query = new StringBundler(3);
2490 }
2491
2492 query.append(_SQL_SELECT_JOURNALTEMPLATE_WHERE);
2493
2494 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2495
2496 if (structureId == null) {
2497 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
2498 }
2499 else {
2500 if (structureId.equals(StringPool.BLANK)) {
2501 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
2502 }
2503 else {
2504 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
2505 }
2506 }
2507
2508 if (orderByComparator != null) {
2509 String[] orderByFields = orderByComparator.getOrderByFields();
2510
2511 if (orderByFields.length > 0) {
2512 query.append(WHERE_AND);
2513 }
2514
2515 for (int i = 0; i < orderByFields.length; i++) {
2516 query.append(_ORDER_BY_ENTITY_ALIAS);
2517 query.append(orderByFields[i]);
2518
2519 if ((i + 1) < orderByFields.length) {
2520 if (orderByComparator.isAscending() ^ previous) {
2521 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2522 }
2523 else {
2524 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2525 }
2526 }
2527 else {
2528 if (orderByComparator.isAscending() ^ previous) {
2529 query.append(WHERE_GREATER_THAN);
2530 }
2531 else {
2532 query.append(WHERE_LESSER_THAN);
2533 }
2534 }
2535 }
2536
2537 query.append(ORDER_BY_CLAUSE);
2538
2539 for (int i = 0; i < orderByFields.length; i++) {
2540 query.append(_ORDER_BY_ENTITY_ALIAS);
2541 query.append(orderByFields[i]);
2542
2543 if ((i + 1) < orderByFields.length) {
2544 if (orderByComparator.isAscending() ^ previous) {
2545 query.append(ORDER_BY_ASC_HAS_NEXT);
2546 }
2547 else {
2548 query.append(ORDER_BY_DESC_HAS_NEXT);
2549 }
2550 }
2551 else {
2552 if (orderByComparator.isAscending() ^ previous) {
2553 query.append(ORDER_BY_ASC);
2554 }
2555 else {
2556 query.append(ORDER_BY_DESC);
2557 }
2558 }
2559 }
2560 }
2561
2562 else {
2563 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
2564 }
2565
2566 String sql = query.toString();
2567
2568 Query q = session.createQuery(sql);
2569
2570 q.setFirstResult(0);
2571 q.setMaxResults(2);
2572
2573 QueryPos qPos = QueryPos.getInstance(q);
2574
2575 qPos.add(groupId);
2576
2577 if (structureId != null) {
2578 qPos.add(structureId);
2579 }
2580
2581 if (orderByComparator != null) {
2582 Object[] values = orderByComparator.getOrderByValues(journalTemplate);
2583
2584 for (Object value : values) {
2585 qPos.add(value);
2586 }
2587 }
2588
2589 List<JournalTemplate> list = q.list();
2590
2591 if (list.size() == 2) {
2592 return list.get(1);
2593 }
2594 else {
2595 return null;
2596 }
2597 }
2598
2599
2607 public List<JournalTemplate> filterFindByG_S(long groupId,
2608 String structureId) throws SystemException {
2609 return filterFindByG_S(groupId, structureId, QueryUtil.ALL_POS,
2610 QueryUtil.ALL_POS, null);
2611 }
2612
2613
2627 public List<JournalTemplate> filterFindByG_S(long groupId,
2628 String structureId, int start, int end) throws SystemException {
2629 return filterFindByG_S(groupId, structureId, start, end, null);
2630 }
2631
2632
2647 public List<JournalTemplate> filterFindByG_S(long groupId,
2648 String structureId, int start, int end,
2649 OrderByComparator orderByComparator) throws SystemException {
2650 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2651 return findByG_S(groupId, structureId, start, end, orderByComparator);
2652 }
2653
2654 StringBundler query = null;
2655
2656 if (orderByComparator != null) {
2657 query = new StringBundler(4 +
2658 (orderByComparator.getOrderByFields().length * 3));
2659 }
2660 else {
2661 query = new StringBundler(4);
2662 }
2663
2664 if (getDB().isSupportsInlineDistinct()) {
2665 query.append(_FILTER_SQL_SELECT_JOURNALTEMPLATE_WHERE);
2666 }
2667 else {
2668 query.append(_FILTER_SQL_SELECT_JOURNALTEMPLATE_NO_INLINE_DISTINCT_WHERE_1);
2669 }
2670
2671 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2672
2673 if (structureId == null) {
2674 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
2675 }
2676 else {
2677 if (structureId.equals(StringPool.BLANK)) {
2678 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
2679 }
2680 else {
2681 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
2682 }
2683 }
2684
2685 if (!getDB().isSupportsInlineDistinct()) {
2686 query.append(_FILTER_SQL_SELECT_JOURNALTEMPLATE_NO_INLINE_DISTINCT_WHERE_2);
2687 }
2688
2689 if (orderByComparator != null) {
2690 if (getDB().isSupportsInlineDistinct()) {
2691 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2692 orderByComparator);
2693 }
2694 else {
2695 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2696 orderByComparator);
2697 }
2698 }
2699
2700 else {
2701 if (getDB().isSupportsInlineDistinct()) {
2702 query.append(JournalTemplateModelImpl.ORDER_BY_JPQL);
2703 }
2704 else {
2705 query.append(JournalTemplateModelImpl.ORDER_BY_SQL);
2706 }
2707 }
2708
2709 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2710 JournalTemplate.class.getName(), _FILTER_COLUMN_PK,
2711 _FILTER_COLUMN_USERID, groupId);
2712
2713 Session session = null;
2714
2715 try {
2716 session = openSession();
2717
2718 SQLQuery q = session.createSQLQuery(sql);
2719
2720 if (getDB().isSupportsInlineDistinct()) {
2721 q.addEntity(_FILTER_ENTITY_ALIAS, JournalTemplateImpl.class);
2722 }
2723 else {
2724 q.addEntity(_FILTER_ENTITY_TABLE, JournalTemplateImpl.class);
2725 }
2726
2727 QueryPos qPos = QueryPos.getInstance(q);
2728
2729 qPos.add(groupId);
2730
2731 if (structureId != null) {
2732 qPos.add(structureId);
2733 }
2734
2735 return (List<JournalTemplate>)QueryUtil.list(q, getDialect(),
2736 start, end);
2737 }
2738 catch (Exception e) {
2739 throw processException(e);
2740 }
2741 finally {
2742 closeSession(session);
2743 }
2744 }
2745
2746
2752 public List<JournalTemplate> findAll() throws SystemException {
2753 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2754 }
2755
2756
2768 public List<JournalTemplate> findAll(int start, int end)
2769 throws SystemException {
2770 return findAll(start, end, null);
2771 }
2772
2773
2786 public List<JournalTemplate> findAll(int start, int end,
2787 OrderByComparator orderByComparator) throws SystemException {
2788 Object[] finderArgs = new Object[] {
2789 String.valueOf(start), String.valueOf(end),
2790 String.valueOf(orderByComparator)
2791 };
2792
2793 List<JournalTemplate> list = (List<JournalTemplate>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2794 finderArgs, this);
2795
2796 if (list == null) {
2797 StringBundler query = null;
2798 String sql = null;
2799
2800 if (orderByComparator != null) {
2801 query = new StringBundler(2 +
2802 (orderByComparator.getOrderByFields().length * 3));
2803
2804 query.append(_SQL_SELECT_JOURNALTEMPLATE);
2805
2806 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2807 orderByComparator);
2808
2809 sql = query.toString();
2810 }
2811 else {
2812 sql = _SQL_SELECT_JOURNALTEMPLATE.concat(JournalTemplateModelImpl.ORDER_BY_JPQL);
2813 }
2814
2815 Session session = null;
2816
2817 try {
2818 session = openSession();
2819
2820 Query q = session.createQuery(sql);
2821
2822 if (orderByComparator == null) {
2823 list = (List<JournalTemplate>)QueryUtil.list(q,
2824 getDialect(), start, end, false);
2825
2826 Collections.sort(list);
2827 }
2828 else {
2829 list = (List<JournalTemplate>)QueryUtil.list(q,
2830 getDialect(), start, end);
2831 }
2832 }
2833 catch (Exception e) {
2834 throw processException(e);
2835 }
2836 finally {
2837 if (list == null) {
2838 FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
2839 finderArgs);
2840 }
2841 else {
2842 cacheResult(list);
2843
2844 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
2845 list);
2846 }
2847
2848 closeSession(session);
2849 }
2850 }
2851
2852 return list;
2853 }
2854
2855
2861 public void removeByUuid(String uuid) throws SystemException {
2862 for (JournalTemplate journalTemplate : findByUuid(uuid)) {
2863 remove(journalTemplate);
2864 }
2865 }
2866
2867
2874 public void removeByUUID_G(String uuid, long groupId)
2875 throws NoSuchTemplateException, SystemException {
2876 JournalTemplate journalTemplate = findByUUID_G(uuid, groupId);
2877
2878 remove(journalTemplate);
2879 }
2880
2881
2887 public void removeByGroupId(long groupId) throws SystemException {
2888 for (JournalTemplate journalTemplate : findByGroupId(groupId)) {
2889 remove(journalTemplate);
2890 }
2891 }
2892
2893
2899 public void removeByTemplateId(String templateId) throws SystemException {
2900 for (JournalTemplate journalTemplate : findByTemplateId(templateId)) {
2901 remove(journalTemplate);
2902 }
2903 }
2904
2905
2911 public void removeBySmallImageId(long smallImageId)
2912 throws NoSuchTemplateException, SystemException {
2913 JournalTemplate journalTemplate = findBySmallImageId(smallImageId);
2914
2915 remove(journalTemplate);
2916 }
2917
2918
2925 public void removeByG_T(long groupId, String templateId)
2926 throws NoSuchTemplateException, SystemException {
2927 JournalTemplate journalTemplate = findByG_T(groupId, templateId);
2928
2929 remove(journalTemplate);
2930 }
2931
2932
2939 public void removeByG_S(long groupId, String structureId)
2940 throws SystemException {
2941 for (JournalTemplate journalTemplate : findByG_S(groupId, structureId)) {
2942 remove(journalTemplate);
2943 }
2944 }
2945
2946
2951 public void removeAll() throws SystemException {
2952 for (JournalTemplate journalTemplate : findAll()) {
2953 remove(journalTemplate);
2954 }
2955 }
2956
2957
2964 public int countByUuid(String uuid) throws SystemException {
2965 Object[] finderArgs = new Object[] { uuid };
2966
2967 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2968 finderArgs, this);
2969
2970 if (count == null) {
2971 StringBundler query = new StringBundler(2);
2972
2973 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
2974
2975 if (uuid == null) {
2976 query.append(_FINDER_COLUMN_UUID_UUID_1);
2977 }
2978 else {
2979 if (uuid.equals(StringPool.BLANK)) {
2980 query.append(_FINDER_COLUMN_UUID_UUID_3);
2981 }
2982 else {
2983 query.append(_FINDER_COLUMN_UUID_UUID_2);
2984 }
2985 }
2986
2987 String sql = query.toString();
2988
2989 Session session = null;
2990
2991 try {
2992 session = openSession();
2993
2994 Query q = session.createQuery(sql);
2995
2996 QueryPos qPos = QueryPos.getInstance(q);
2997
2998 if (uuid != null) {
2999 qPos.add(uuid);
3000 }
3001
3002 count = (Long)q.uniqueResult();
3003 }
3004 catch (Exception e) {
3005 throw processException(e);
3006 }
3007 finally {
3008 if (count == null) {
3009 count = Long.valueOf(0);
3010 }
3011
3012 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
3013 finderArgs, count);
3014
3015 closeSession(session);
3016 }
3017 }
3018
3019 return count.intValue();
3020 }
3021
3022
3030 public int countByUUID_G(String uuid, long groupId)
3031 throws SystemException {
3032 Object[] finderArgs = new Object[] { uuid, groupId };
3033
3034 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
3035 finderArgs, this);
3036
3037 if (count == null) {
3038 StringBundler query = new StringBundler(3);
3039
3040 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3041
3042 if (uuid == null) {
3043 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
3044 }
3045 else {
3046 if (uuid.equals(StringPool.BLANK)) {
3047 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
3048 }
3049 else {
3050 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
3051 }
3052 }
3053
3054 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
3055
3056 String sql = query.toString();
3057
3058 Session session = null;
3059
3060 try {
3061 session = openSession();
3062
3063 Query q = session.createQuery(sql);
3064
3065 QueryPos qPos = QueryPos.getInstance(q);
3066
3067 if (uuid != null) {
3068 qPos.add(uuid);
3069 }
3070
3071 qPos.add(groupId);
3072
3073 count = (Long)q.uniqueResult();
3074 }
3075 catch (Exception e) {
3076 throw processException(e);
3077 }
3078 finally {
3079 if (count == null) {
3080 count = Long.valueOf(0);
3081 }
3082
3083 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
3084 finderArgs, count);
3085
3086 closeSession(session);
3087 }
3088 }
3089
3090 return count.intValue();
3091 }
3092
3093
3100 public int countByGroupId(long groupId) throws SystemException {
3101 Object[] finderArgs = new Object[] { groupId };
3102
3103 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
3104 finderArgs, this);
3105
3106 if (count == null) {
3107 StringBundler query = new StringBundler(2);
3108
3109 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3110
3111 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3112
3113 String sql = query.toString();
3114
3115 Session session = null;
3116
3117 try {
3118 session = openSession();
3119
3120 Query q = session.createQuery(sql);
3121
3122 QueryPos qPos = QueryPos.getInstance(q);
3123
3124 qPos.add(groupId);
3125
3126 count = (Long)q.uniqueResult();
3127 }
3128 catch (Exception e) {
3129 throw processException(e);
3130 }
3131 finally {
3132 if (count == null) {
3133 count = Long.valueOf(0);
3134 }
3135
3136 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
3137 finderArgs, count);
3138
3139 closeSession(session);
3140 }
3141 }
3142
3143 return count.intValue();
3144 }
3145
3146
3153 public int filterCountByGroupId(long groupId) throws SystemException {
3154 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3155 return countByGroupId(groupId);
3156 }
3157
3158 StringBundler query = new StringBundler(2);
3159
3160 query.append(_FILTER_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3161
3162 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3163
3164 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3165 JournalTemplate.class.getName(), _FILTER_COLUMN_PK,
3166 _FILTER_COLUMN_USERID, groupId);
3167
3168 Session session = null;
3169
3170 try {
3171 session = openSession();
3172
3173 SQLQuery q = session.createSQLQuery(sql);
3174
3175 q.addScalar(COUNT_COLUMN_NAME,
3176 com.liferay.portal.kernel.dao.orm.Type.LONG);
3177
3178 QueryPos qPos = QueryPos.getInstance(q);
3179
3180 qPos.add(groupId);
3181
3182 Long count = (Long)q.uniqueResult();
3183
3184 return count.intValue();
3185 }
3186 catch (Exception e) {
3187 throw processException(e);
3188 }
3189 finally {
3190 closeSession(session);
3191 }
3192 }
3193
3194
3201 public int countByTemplateId(String templateId) throws SystemException {
3202 Object[] finderArgs = new Object[] { templateId };
3203
3204 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TEMPLATEID,
3205 finderArgs, this);
3206
3207 if (count == null) {
3208 StringBundler query = new StringBundler(2);
3209
3210 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3211
3212 if (templateId == null) {
3213 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1);
3214 }
3215 else {
3216 if (templateId.equals(StringPool.BLANK)) {
3217 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3);
3218 }
3219 else {
3220 query.append(_FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2);
3221 }
3222 }
3223
3224 String sql = query.toString();
3225
3226 Session session = null;
3227
3228 try {
3229 session = openSession();
3230
3231 Query q = session.createQuery(sql);
3232
3233 QueryPos qPos = QueryPos.getInstance(q);
3234
3235 if (templateId != null) {
3236 qPos.add(templateId);
3237 }
3238
3239 count = (Long)q.uniqueResult();
3240 }
3241 catch (Exception e) {
3242 throw processException(e);
3243 }
3244 finally {
3245 if (count == null) {
3246 count = Long.valueOf(0);
3247 }
3248
3249 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TEMPLATEID,
3250 finderArgs, count);
3251
3252 closeSession(session);
3253 }
3254 }
3255
3256 return count.intValue();
3257 }
3258
3259
3266 public int countBySmallImageId(long smallImageId) throws SystemException {
3267 Object[] finderArgs = new Object[] { smallImageId };
3268
3269 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
3270 finderArgs, this);
3271
3272 if (count == null) {
3273 StringBundler query = new StringBundler(2);
3274
3275 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3276
3277 query.append(_FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2);
3278
3279 String sql = query.toString();
3280
3281 Session session = null;
3282
3283 try {
3284 session = openSession();
3285
3286 Query q = session.createQuery(sql);
3287
3288 QueryPos qPos = QueryPos.getInstance(q);
3289
3290 qPos.add(smallImageId);
3291
3292 count = (Long)q.uniqueResult();
3293 }
3294 catch (Exception e) {
3295 throw processException(e);
3296 }
3297 finally {
3298 if (count == null) {
3299 count = Long.valueOf(0);
3300 }
3301
3302 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
3303 finderArgs, count);
3304
3305 closeSession(session);
3306 }
3307 }
3308
3309 return count.intValue();
3310 }
3311
3312
3320 public int countByG_T(long groupId, String templateId)
3321 throws SystemException {
3322 Object[] finderArgs = new Object[] { groupId, templateId };
3323
3324 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_T,
3325 finderArgs, this);
3326
3327 if (count == null) {
3328 StringBundler query = new StringBundler(3);
3329
3330 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3331
3332 query.append(_FINDER_COLUMN_G_T_GROUPID_2);
3333
3334 if (templateId == null) {
3335 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_1);
3336 }
3337 else {
3338 if (templateId.equals(StringPool.BLANK)) {
3339 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_3);
3340 }
3341 else {
3342 query.append(_FINDER_COLUMN_G_T_TEMPLATEID_2);
3343 }
3344 }
3345
3346 String sql = query.toString();
3347
3348 Session session = null;
3349
3350 try {
3351 session = openSession();
3352
3353 Query q = session.createQuery(sql);
3354
3355 QueryPos qPos = QueryPos.getInstance(q);
3356
3357 qPos.add(groupId);
3358
3359 if (templateId != null) {
3360 qPos.add(templateId);
3361 }
3362
3363 count = (Long)q.uniqueResult();
3364 }
3365 catch (Exception e) {
3366 throw processException(e);
3367 }
3368 finally {
3369 if (count == null) {
3370 count = Long.valueOf(0);
3371 }
3372
3373 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_T, finderArgs,
3374 count);
3375
3376 closeSession(session);
3377 }
3378 }
3379
3380 return count.intValue();
3381 }
3382
3383
3391 public int countByG_S(long groupId, String structureId)
3392 throws SystemException {
3393 Object[] finderArgs = new Object[] { groupId, structureId };
3394
3395 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_S,
3396 finderArgs, this);
3397
3398 if (count == null) {
3399 StringBundler query = new StringBundler(3);
3400
3401 query.append(_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3402
3403 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
3404
3405 if (structureId == null) {
3406 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
3407 }
3408 else {
3409 if (structureId.equals(StringPool.BLANK)) {
3410 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
3411 }
3412 else {
3413 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
3414 }
3415 }
3416
3417 String sql = query.toString();
3418
3419 Session session = null;
3420
3421 try {
3422 session = openSession();
3423
3424 Query q = session.createQuery(sql);
3425
3426 QueryPos qPos = QueryPos.getInstance(q);
3427
3428 qPos.add(groupId);
3429
3430 if (structureId != null) {
3431 qPos.add(structureId);
3432 }
3433
3434 count = (Long)q.uniqueResult();
3435 }
3436 catch (Exception e) {
3437 throw processException(e);
3438 }
3439 finally {
3440 if (count == null) {
3441 count = Long.valueOf(0);
3442 }
3443
3444 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_S, finderArgs,
3445 count);
3446
3447 closeSession(session);
3448 }
3449 }
3450
3451 return count.intValue();
3452 }
3453
3454
3462 public int filterCountByG_S(long groupId, String structureId)
3463 throws SystemException {
3464 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3465 return countByG_S(groupId, structureId);
3466 }
3467
3468 StringBundler query = new StringBundler(3);
3469
3470 query.append(_FILTER_SQL_COUNT_JOURNALTEMPLATE_WHERE);
3471
3472 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
3473
3474 if (structureId == null) {
3475 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_1);
3476 }
3477 else {
3478 if (structureId.equals(StringPool.BLANK)) {
3479 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_3);
3480 }
3481 else {
3482 query.append(_FINDER_COLUMN_G_S_STRUCTUREID_2);
3483 }
3484 }
3485
3486 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3487 JournalTemplate.class.getName(), _FILTER_COLUMN_PK,
3488 _FILTER_COLUMN_USERID, groupId);
3489
3490 Session session = null;
3491
3492 try {
3493 session = openSession();
3494
3495 SQLQuery q = session.createSQLQuery(sql);
3496
3497 q.addScalar(COUNT_COLUMN_NAME,
3498 com.liferay.portal.kernel.dao.orm.Type.LONG);
3499
3500 QueryPos qPos = QueryPos.getInstance(q);
3501
3502 qPos.add(groupId);
3503
3504 if (structureId != null) {
3505 qPos.add(structureId);
3506 }
3507
3508 Long count = (Long)q.uniqueResult();
3509
3510 return count.intValue();
3511 }
3512 catch (Exception e) {
3513 throw processException(e);
3514 }
3515 finally {
3516 closeSession(session);
3517 }
3518 }
3519
3520
3526 public int countAll() throws SystemException {
3527 Object[] finderArgs = new Object[0];
3528
3529 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3530 finderArgs, this);
3531
3532 if (count == null) {
3533 Session session = null;
3534
3535 try {
3536 session = openSession();
3537
3538 Query q = session.createQuery(_SQL_COUNT_JOURNALTEMPLATE);
3539
3540 count = (Long)q.uniqueResult();
3541 }
3542 catch (Exception e) {
3543 throw processException(e);
3544 }
3545 finally {
3546 if (count == null) {
3547 count = Long.valueOf(0);
3548 }
3549
3550 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3551 count);
3552
3553 closeSession(session);
3554 }
3555 }
3556
3557 return count.intValue();
3558 }
3559
3560
3563 public void afterPropertiesSet() {
3564 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3565 com.liferay.portal.util.PropsUtil.get(
3566 "value.object.listener.com.liferay.portlet.journal.model.JournalTemplate")));
3567
3568 if (listenerClassNames.length > 0) {
3569 try {
3570 List<ModelListener<JournalTemplate>> listenersList = new ArrayList<ModelListener<JournalTemplate>>();
3571
3572 for (String listenerClassName : listenerClassNames) {
3573 listenersList.add((ModelListener<JournalTemplate>)InstanceFactory.newInstance(
3574 listenerClassName));
3575 }
3576
3577 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3578 }
3579 catch (Exception e) {
3580 _log.error(e);
3581 }
3582 }
3583 }
3584
3585 public void destroy() {
3586 EntityCacheUtil.removeCache(JournalTemplateImpl.class.getName());
3587 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3588 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
3589 }
3590
3591 @BeanReference(type = JournalArticlePersistence.class)
3592 protected JournalArticlePersistence journalArticlePersistence;
3593 @BeanReference(type = JournalArticleImagePersistence.class)
3594 protected JournalArticleImagePersistence journalArticleImagePersistence;
3595 @BeanReference(type = JournalArticleResourcePersistence.class)
3596 protected JournalArticleResourcePersistence journalArticleResourcePersistence;
3597 @BeanReference(type = JournalContentSearchPersistence.class)
3598 protected JournalContentSearchPersistence journalContentSearchPersistence;
3599 @BeanReference(type = JournalFeedPersistence.class)
3600 protected JournalFeedPersistence journalFeedPersistence;
3601 @BeanReference(type = JournalStructurePersistence.class)
3602 protected JournalStructurePersistence journalStructurePersistence;
3603 @BeanReference(type = JournalTemplatePersistence.class)
3604 protected JournalTemplatePersistence journalTemplatePersistence;
3605 @BeanReference(type = ImagePersistence.class)
3606 protected ImagePersistence imagePersistence;
3607 @BeanReference(type = ResourcePersistence.class)
3608 protected ResourcePersistence resourcePersistence;
3609 @BeanReference(type = UserPersistence.class)
3610 protected UserPersistence userPersistence;
3611 @BeanReference(type = WebDAVPropsPersistence.class)
3612 protected WebDAVPropsPersistence webDAVPropsPersistence;
3613 @BeanReference(type = ExpandoValuePersistence.class)
3614 protected ExpandoValuePersistence expandoValuePersistence;
3615 private static final String _SQL_SELECT_JOURNALTEMPLATE = "SELECT journalTemplate FROM JournalTemplate journalTemplate";
3616 private static final String _SQL_SELECT_JOURNALTEMPLATE_WHERE = "SELECT journalTemplate FROM JournalTemplate journalTemplate WHERE ";
3617 private static final String _SQL_COUNT_JOURNALTEMPLATE = "SELECT COUNT(journalTemplate) FROM JournalTemplate journalTemplate";
3618 private static final String _SQL_COUNT_JOURNALTEMPLATE_WHERE = "SELECT COUNT(journalTemplate) FROM JournalTemplate journalTemplate WHERE ";
3619 private static final String _FINDER_COLUMN_UUID_UUID_1 = "journalTemplate.uuid IS NULL";
3620 private static final String _FINDER_COLUMN_UUID_UUID_2 = "journalTemplate.uuid = ?";
3621 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(journalTemplate.uuid IS NULL OR journalTemplate.uuid = ?)";
3622 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "journalTemplate.uuid IS NULL AND ";
3623 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "journalTemplate.uuid = ? AND ";
3624 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(journalTemplate.uuid IS NULL OR journalTemplate.uuid = ?) AND ";
3625 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "journalTemplate.groupId = ?";
3626 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "journalTemplate.groupId = ?";
3627 private static final String _FINDER_COLUMN_TEMPLATEID_TEMPLATEID_1 = "journalTemplate.templateId IS NULL";
3628 private static final String _FINDER_COLUMN_TEMPLATEID_TEMPLATEID_2 = "journalTemplate.templateId = ?";
3629 private static final String _FINDER_COLUMN_TEMPLATEID_TEMPLATEID_3 = "(journalTemplate.templateId IS NULL OR journalTemplate.templateId = ?)";
3630 private static final String _FINDER_COLUMN_SMALLIMAGEID_SMALLIMAGEID_2 = "journalTemplate.smallImageId = ?";
3631 private static final String _FINDER_COLUMN_G_T_GROUPID_2 = "journalTemplate.groupId = ? AND ";
3632 private static final String _FINDER_COLUMN_G_T_TEMPLATEID_1 = "journalTemplate.templateId IS NULL";
3633 private static final String _FINDER_COLUMN_G_T_TEMPLATEID_2 = "journalTemplate.templateId = ?";
3634 private static final String _FINDER_COLUMN_G_T_TEMPLATEID_3 = "(journalTemplate.templateId IS NULL OR journalTemplate.templateId = ?)";
3635 private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "journalTemplate.groupId = ? AND ";
3636 private static final String _FINDER_COLUMN_G_S_STRUCTUREID_1 = "journalTemplate.structureId IS NULL";
3637 private static final String _FINDER_COLUMN_G_S_STRUCTUREID_2 = "journalTemplate.structureId = ?";
3638 private static final String _FINDER_COLUMN_G_S_STRUCTUREID_3 = "(journalTemplate.structureId IS NULL OR journalTemplate.structureId = ?)";
3639 private static final String _FILTER_SQL_SELECT_JOURNALTEMPLATE_WHERE = "SELECT DISTINCT {journalTemplate.*} FROM JournalTemplate journalTemplate WHERE ";
3640 private static final String _FILTER_SQL_SELECT_JOURNALTEMPLATE_NO_INLINE_DISTINCT_WHERE_1 =
3641 "SELECT {JournalTemplate.*} FROM (SELECT DISTINCT journalTemplate.id FROM JournalTemplate journalTemplate WHERE ";
3642 private static final String _FILTER_SQL_SELECT_JOURNALTEMPLATE_NO_INLINE_DISTINCT_WHERE_2 =
3643 ") TEMP_TABLE INNER JOIN JournalTemplate ON TEMP_TABLE.id = JournalTemplate.id";
3644 private static final String _FILTER_SQL_COUNT_JOURNALTEMPLATE_WHERE = "SELECT COUNT(DISTINCT journalTemplate.id) AS COUNT_VALUE FROM JournalTemplate journalTemplate WHERE ";
3645 private static final String _FILTER_COLUMN_PK = "journalTemplate.id";
3646 private static final String _FILTER_COLUMN_USERID = "journalTemplate.userId";
3647 private static final String _FILTER_ENTITY_ALIAS = "journalTemplate";
3648 private static final String _FILTER_ENTITY_TABLE = "JournalTemplate";
3649 private static final String _ORDER_BY_ENTITY_ALIAS = "journalTemplate.";
3650 private static final String _ORDER_BY_ENTITY_TABLE = "JournalTemplate.";
3651 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No JournalTemplate exists with the primary key ";
3652 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No JournalTemplate exists with the key {";
3653 private static Log _log = LogFactoryUtil.getLog(JournalTemplatePersistenceImpl.class);
3654 }