001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchLayoutSetPrototypeException;
018 import com.liferay.portal.NoSuchModelException;
019 import com.liferay.portal.kernel.bean.BeanReference;
020 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023 import com.liferay.portal.kernel.dao.orm.FinderPath;
024 import com.liferay.portal.kernel.dao.orm.Query;
025 import com.liferay.portal.kernel.dao.orm.QueryPos;
026 import com.liferay.portal.kernel.dao.orm.QueryUtil;
027 import com.liferay.portal.kernel.dao.orm.SQLQuery;
028 import com.liferay.portal.kernel.dao.orm.Session;
029 import com.liferay.portal.kernel.exception.SystemException;
030 import com.liferay.portal.kernel.log.Log;
031 import com.liferay.portal.kernel.log.LogFactoryUtil;
032 import com.liferay.portal.kernel.util.GetterUtil;
033 import com.liferay.portal.kernel.util.InstanceFactory;
034 import com.liferay.portal.kernel.util.OrderByComparator;
035 import com.liferay.portal.kernel.util.StringBundler;
036 import com.liferay.portal.kernel.util.StringPool;
037 import com.liferay.portal.kernel.util.StringUtil;
038 import com.liferay.portal.kernel.util.Validator;
039 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
040 import com.liferay.portal.model.CacheModel;
041 import com.liferay.portal.model.LayoutSetPrototype;
042 import com.liferay.portal.model.ModelListener;
043 import com.liferay.portal.model.impl.LayoutSetPrototypeImpl;
044 import com.liferay.portal.model.impl.LayoutSetPrototypeModelImpl;
045 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
046 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
047
048 import java.io.Serializable;
049
050 import java.util.ArrayList;
051 import java.util.Collections;
052 import java.util.List;
053
054
066 public class LayoutSetPrototypePersistenceImpl extends BasePersistenceImpl<LayoutSetPrototype>
067 implements LayoutSetPrototypePersistence {
068
073 public static final String FINDER_CLASS_NAME_ENTITY = LayoutSetPrototypeImpl.class.getName();
074 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
075 ".List1";
076 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
077 ".List2";
078 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
079 LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED,
080 LayoutSetPrototypeImpl.class,
081 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid",
082 new String[] {
083 String.class.getName(),
084
085 "java.lang.Integer", "java.lang.Integer",
086 "com.liferay.portal.kernel.util.OrderByComparator"
087 });
088 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
089 LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED,
090 LayoutSetPrototypeImpl.class,
091 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
092 new String[] { String.class.getName() },
093 LayoutSetPrototypeModelImpl.UUID_COLUMN_BITMASK);
094 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
095 LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED, Long.class,
096 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid",
097 new String[] { String.class.getName() });
098 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
099 new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
100 LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED,
101 LayoutSetPrototypeImpl.class,
102 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByCompanyId",
103 new String[] {
104 Long.class.getName(),
105
106 "java.lang.Integer", "java.lang.Integer",
107 "com.liferay.portal.kernel.util.OrderByComparator"
108 });
109 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
110 new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
111 LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED,
112 LayoutSetPrototypeImpl.class,
113 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
114 new String[] { Long.class.getName() },
115 LayoutSetPrototypeModelImpl.COMPANYID_COLUMN_BITMASK);
116 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
117 LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED, Long.class,
118 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
119 new String[] { Long.class.getName() });
120 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_A = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
121 LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED,
122 LayoutSetPrototypeImpl.class,
123 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_A",
124 new String[] {
125 Long.class.getName(), Boolean.class.getName(),
126
127 "java.lang.Integer", "java.lang.Integer",
128 "com.liferay.portal.kernel.util.OrderByComparator"
129 });
130 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_A = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
131 LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED,
132 LayoutSetPrototypeImpl.class,
133 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_A",
134 new String[] { Long.class.getName(), Boolean.class.getName() },
135 LayoutSetPrototypeModelImpl.COMPANYID_COLUMN_BITMASK |
136 LayoutSetPrototypeModelImpl.ACTIVE_COLUMN_BITMASK);
137 public static final FinderPath FINDER_PATH_COUNT_BY_C_A = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
138 LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED, Long.class,
139 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_A",
140 new String[] { Long.class.getName(), Boolean.class.getName() });
141 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
142 LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED,
143 LayoutSetPrototypeImpl.class,
144 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
145 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
146 LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED,
147 LayoutSetPrototypeImpl.class,
148 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
149 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
150 LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED, Long.class,
151 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
152
153
158 public void cacheResult(LayoutSetPrototype layoutSetPrototype) {
159 EntityCacheUtil.putResult(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
160 LayoutSetPrototypeImpl.class, layoutSetPrototype.getPrimaryKey(),
161 layoutSetPrototype);
162
163 layoutSetPrototype.resetOriginalValues();
164 }
165
166
171 public void cacheResult(List<LayoutSetPrototype> layoutSetPrototypes) {
172 for (LayoutSetPrototype layoutSetPrototype : layoutSetPrototypes) {
173 if (EntityCacheUtil.getResult(
174 LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
175 LayoutSetPrototypeImpl.class,
176 layoutSetPrototype.getPrimaryKey()) == null) {
177 cacheResult(layoutSetPrototype);
178 }
179 else {
180 layoutSetPrototype.resetOriginalValues();
181 }
182 }
183 }
184
185
192 @Override
193 public void clearCache() {
194 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
195 CacheRegistryUtil.clear(LayoutSetPrototypeImpl.class.getName());
196 }
197
198 EntityCacheUtil.clearCache(LayoutSetPrototypeImpl.class.getName());
199
200 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
201 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
202 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
203 }
204
205
212 @Override
213 public void clearCache(LayoutSetPrototype layoutSetPrototype) {
214 EntityCacheUtil.removeResult(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
215 LayoutSetPrototypeImpl.class, layoutSetPrototype.getPrimaryKey());
216
217 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
218 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
219 }
220
221 @Override
222 public void clearCache(List<LayoutSetPrototype> layoutSetPrototypes) {
223 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
224 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
225
226 for (LayoutSetPrototype layoutSetPrototype : layoutSetPrototypes) {
227 EntityCacheUtil.removeResult(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
228 LayoutSetPrototypeImpl.class, layoutSetPrototype.getPrimaryKey());
229 }
230 }
231
232
238 public LayoutSetPrototype create(long layoutSetPrototypeId) {
239 LayoutSetPrototype layoutSetPrototype = new LayoutSetPrototypeImpl();
240
241 layoutSetPrototype.setNew(true);
242 layoutSetPrototype.setPrimaryKey(layoutSetPrototypeId);
243
244 String uuid = PortalUUIDUtil.generate();
245
246 layoutSetPrototype.setUuid(uuid);
247
248 return layoutSetPrototype;
249 }
250
251
259 public LayoutSetPrototype remove(long layoutSetPrototypeId)
260 throws NoSuchLayoutSetPrototypeException, SystemException {
261 return remove(Long.valueOf(layoutSetPrototypeId));
262 }
263
264
272 @Override
273 public LayoutSetPrototype remove(Serializable primaryKey)
274 throws NoSuchLayoutSetPrototypeException, SystemException {
275 Session session = null;
276
277 try {
278 session = openSession();
279
280 LayoutSetPrototype layoutSetPrototype = (LayoutSetPrototype)session.get(LayoutSetPrototypeImpl.class,
281 primaryKey);
282
283 if (layoutSetPrototype == null) {
284 if (_log.isWarnEnabled()) {
285 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
286 }
287
288 throw new NoSuchLayoutSetPrototypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
289 primaryKey);
290 }
291
292 return remove(layoutSetPrototype);
293 }
294 catch (NoSuchLayoutSetPrototypeException nsee) {
295 throw nsee;
296 }
297 catch (Exception e) {
298 throw processException(e);
299 }
300 finally {
301 closeSession(session);
302 }
303 }
304
305 @Override
306 protected LayoutSetPrototype removeImpl(
307 LayoutSetPrototype layoutSetPrototype) throws SystemException {
308 layoutSetPrototype = toUnwrappedModel(layoutSetPrototype);
309
310 Session session = null;
311
312 try {
313 session = openSession();
314
315 BatchSessionUtil.delete(session, layoutSetPrototype);
316 }
317 catch (Exception e) {
318 throw processException(e);
319 }
320 finally {
321 closeSession(session);
322 }
323
324 clearCache(layoutSetPrototype);
325
326 return layoutSetPrototype;
327 }
328
329 @Override
330 public LayoutSetPrototype updateImpl(
331 com.liferay.portal.model.LayoutSetPrototype layoutSetPrototype,
332 boolean merge) throws SystemException {
333 layoutSetPrototype = toUnwrappedModel(layoutSetPrototype);
334
335 boolean isNew = layoutSetPrototype.isNew();
336
337 LayoutSetPrototypeModelImpl layoutSetPrototypeModelImpl = (LayoutSetPrototypeModelImpl)layoutSetPrototype;
338
339 if (Validator.isNull(layoutSetPrototype.getUuid())) {
340 String uuid = PortalUUIDUtil.generate();
341
342 layoutSetPrototype.setUuid(uuid);
343 }
344
345 Session session = null;
346
347 try {
348 session = openSession();
349
350 BatchSessionUtil.update(session, layoutSetPrototype, merge);
351
352 layoutSetPrototype.setNew(false);
353 }
354 catch (Exception e) {
355 throw processException(e);
356 }
357 finally {
358 closeSession(session);
359 }
360
361 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
362
363 if (isNew || !LayoutSetPrototypeModelImpl.COLUMN_BITMASK_ENABLED) {
364 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
365 }
366
367 else {
368 if ((layoutSetPrototypeModelImpl.getColumnBitmask() &
369 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
370 Object[] args = new Object[] {
371 layoutSetPrototypeModelImpl.getOriginalUuid()
372 };
373
374 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
375 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
376 args);
377
378 args = new Object[] { layoutSetPrototypeModelImpl.getUuid() };
379
380 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
381 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
382 args);
383 }
384
385 if ((layoutSetPrototypeModelImpl.getColumnBitmask() &
386 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
387 Object[] args = new Object[] {
388 Long.valueOf(layoutSetPrototypeModelImpl.getOriginalCompanyId())
389 };
390
391 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
392 args);
393 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
394 args);
395
396 args = new Object[] {
397 Long.valueOf(layoutSetPrototypeModelImpl.getCompanyId())
398 };
399
400 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
401 args);
402 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
403 args);
404 }
405
406 if ((layoutSetPrototypeModelImpl.getColumnBitmask() &
407 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_A.getColumnBitmask()) != 0) {
408 Object[] args = new Object[] {
409 Long.valueOf(layoutSetPrototypeModelImpl.getOriginalCompanyId()),
410 Boolean.valueOf(layoutSetPrototypeModelImpl.getOriginalActive())
411 };
412
413 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_A, args);
414 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_A,
415 args);
416
417 args = new Object[] {
418 Long.valueOf(layoutSetPrototypeModelImpl.getCompanyId()),
419 Boolean.valueOf(layoutSetPrototypeModelImpl.getActive())
420 };
421
422 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_A, args);
423 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_A,
424 args);
425 }
426 }
427
428 EntityCacheUtil.putResult(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
429 LayoutSetPrototypeImpl.class, layoutSetPrototype.getPrimaryKey(),
430 layoutSetPrototype);
431
432 return layoutSetPrototype;
433 }
434
435 protected LayoutSetPrototype toUnwrappedModel(
436 LayoutSetPrototype layoutSetPrototype) {
437 if (layoutSetPrototype instanceof LayoutSetPrototypeImpl) {
438 return layoutSetPrototype;
439 }
440
441 LayoutSetPrototypeImpl layoutSetPrototypeImpl = new LayoutSetPrototypeImpl();
442
443 layoutSetPrototypeImpl.setNew(layoutSetPrototype.isNew());
444 layoutSetPrototypeImpl.setPrimaryKey(layoutSetPrototype.getPrimaryKey());
445
446 layoutSetPrototypeImpl.setUuid(layoutSetPrototype.getUuid());
447 layoutSetPrototypeImpl.setLayoutSetPrototypeId(layoutSetPrototype.getLayoutSetPrototypeId());
448 layoutSetPrototypeImpl.setCompanyId(layoutSetPrototype.getCompanyId());
449 layoutSetPrototypeImpl.setCreateDate(layoutSetPrototype.getCreateDate());
450 layoutSetPrototypeImpl.setModifiedDate(layoutSetPrototype.getModifiedDate());
451 layoutSetPrototypeImpl.setName(layoutSetPrototype.getName());
452 layoutSetPrototypeImpl.setDescription(layoutSetPrototype.getDescription());
453 layoutSetPrototypeImpl.setSettings(layoutSetPrototype.getSettings());
454 layoutSetPrototypeImpl.setActive(layoutSetPrototype.isActive());
455
456 return layoutSetPrototypeImpl;
457 }
458
459
467 @Override
468 public LayoutSetPrototype findByPrimaryKey(Serializable primaryKey)
469 throws NoSuchModelException, SystemException {
470 return findByPrimaryKey(((Long)primaryKey).longValue());
471 }
472
473
481 public LayoutSetPrototype findByPrimaryKey(long layoutSetPrototypeId)
482 throws NoSuchLayoutSetPrototypeException, SystemException {
483 LayoutSetPrototype layoutSetPrototype = fetchByPrimaryKey(layoutSetPrototypeId);
484
485 if (layoutSetPrototype == null) {
486 if (_log.isWarnEnabled()) {
487 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
488 layoutSetPrototypeId);
489 }
490
491 throw new NoSuchLayoutSetPrototypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
492 layoutSetPrototypeId);
493 }
494
495 return layoutSetPrototype;
496 }
497
498
505 @Override
506 public LayoutSetPrototype fetchByPrimaryKey(Serializable primaryKey)
507 throws SystemException {
508 return fetchByPrimaryKey(((Long)primaryKey).longValue());
509 }
510
511
518 public LayoutSetPrototype fetchByPrimaryKey(long layoutSetPrototypeId)
519 throws SystemException {
520 LayoutSetPrototype layoutSetPrototype = (LayoutSetPrototype)EntityCacheUtil.getResult(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
521 LayoutSetPrototypeImpl.class, layoutSetPrototypeId);
522
523 if (layoutSetPrototype == _nullLayoutSetPrototype) {
524 return null;
525 }
526
527 if (layoutSetPrototype == null) {
528 Session session = null;
529
530 boolean hasException = false;
531
532 try {
533 session = openSession();
534
535 layoutSetPrototype = (LayoutSetPrototype)session.get(LayoutSetPrototypeImpl.class,
536 Long.valueOf(layoutSetPrototypeId));
537 }
538 catch (Exception e) {
539 hasException = true;
540
541 throw processException(e);
542 }
543 finally {
544 if (layoutSetPrototype != null) {
545 cacheResult(layoutSetPrototype);
546 }
547 else if (!hasException) {
548 EntityCacheUtil.putResult(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
549 LayoutSetPrototypeImpl.class, layoutSetPrototypeId,
550 _nullLayoutSetPrototype);
551 }
552
553 closeSession(session);
554 }
555 }
556
557 return layoutSetPrototype;
558 }
559
560
567 public List<LayoutSetPrototype> findByUuid(String uuid)
568 throws SystemException {
569 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
570 }
571
572
585 public List<LayoutSetPrototype> findByUuid(String uuid, int start, int end)
586 throws SystemException {
587 return findByUuid(uuid, start, end, null);
588 }
589
590
604 public List<LayoutSetPrototype> findByUuid(String uuid, int start, int end,
605 OrderByComparator orderByComparator) throws SystemException {
606 FinderPath finderPath = null;
607 Object[] finderArgs = null;
608
609 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
610 (orderByComparator == null)) {
611 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
612 finderArgs = new Object[] { uuid };
613 }
614 else {
615 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
616 finderArgs = new Object[] { uuid, start, end, orderByComparator };
617 }
618
619 List<LayoutSetPrototype> list = (List<LayoutSetPrototype>)FinderCacheUtil.getResult(finderPath,
620 finderArgs, this);
621
622 if (list == null) {
623 StringBundler query = null;
624
625 if (orderByComparator != null) {
626 query = new StringBundler(3 +
627 (orderByComparator.getOrderByFields().length * 3));
628 }
629 else {
630 query = new StringBundler(2);
631 }
632
633 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
634
635 if (uuid == null) {
636 query.append(_FINDER_COLUMN_UUID_UUID_1);
637 }
638 else {
639 if (uuid.equals(StringPool.BLANK)) {
640 query.append(_FINDER_COLUMN_UUID_UUID_3);
641 }
642 else {
643 query.append(_FINDER_COLUMN_UUID_UUID_2);
644 }
645 }
646
647 if (orderByComparator != null) {
648 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
649 orderByComparator);
650 }
651
652 String sql = query.toString();
653
654 Session session = null;
655
656 try {
657 session = openSession();
658
659 Query q = session.createQuery(sql);
660
661 QueryPos qPos = QueryPos.getInstance(q);
662
663 if (uuid != null) {
664 qPos.add(uuid);
665 }
666
667 list = (List<LayoutSetPrototype>)QueryUtil.list(q,
668 getDialect(), start, end);
669 }
670 catch (Exception e) {
671 throw processException(e);
672 }
673 finally {
674 if (list == null) {
675 FinderCacheUtil.removeResult(finderPath, finderArgs);
676 }
677 else {
678 cacheResult(list);
679
680 FinderCacheUtil.putResult(finderPath, finderArgs, list);
681 }
682
683 closeSession(session);
684 }
685 }
686
687 return list;
688 }
689
690
703 public LayoutSetPrototype findByUuid_First(String uuid,
704 OrderByComparator orderByComparator)
705 throws NoSuchLayoutSetPrototypeException, SystemException {
706 List<LayoutSetPrototype> list = findByUuid(uuid, 0, 1, orderByComparator);
707
708 if (list.isEmpty()) {
709 StringBundler msg = new StringBundler(4);
710
711 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
712
713 msg.append("uuid=");
714 msg.append(uuid);
715
716 msg.append(StringPool.CLOSE_CURLY_BRACE);
717
718 throw new NoSuchLayoutSetPrototypeException(msg.toString());
719 }
720 else {
721 return list.get(0);
722 }
723 }
724
725
738 public LayoutSetPrototype findByUuid_Last(String uuid,
739 OrderByComparator orderByComparator)
740 throws NoSuchLayoutSetPrototypeException, SystemException {
741 int count = countByUuid(uuid);
742
743 List<LayoutSetPrototype> list = findByUuid(uuid, count - 1, count,
744 orderByComparator);
745
746 if (list.isEmpty()) {
747 StringBundler msg = new StringBundler(4);
748
749 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
750
751 msg.append("uuid=");
752 msg.append(uuid);
753
754 msg.append(StringPool.CLOSE_CURLY_BRACE);
755
756 throw new NoSuchLayoutSetPrototypeException(msg.toString());
757 }
758 else {
759 return list.get(0);
760 }
761 }
762
763
777 public LayoutSetPrototype[] findByUuid_PrevAndNext(
778 long layoutSetPrototypeId, String uuid,
779 OrderByComparator orderByComparator)
780 throws NoSuchLayoutSetPrototypeException, SystemException {
781 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
782
783 Session session = null;
784
785 try {
786 session = openSession();
787
788 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
789
790 array[0] = getByUuid_PrevAndNext(session, layoutSetPrototype, uuid,
791 orderByComparator, true);
792
793 array[1] = layoutSetPrototype;
794
795 array[2] = getByUuid_PrevAndNext(session, layoutSetPrototype, uuid,
796 orderByComparator, false);
797
798 return array;
799 }
800 catch (Exception e) {
801 throw processException(e);
802 }
803 finally {
804 closeSession(session);
805 }
806 }
807
808 protected LayoutSetPrototype getByUuid_PrevAndNext(Session session,
809 LayoutSetPrototype layoutSetPrototype, String uuid,
810 OrderByComparator orderByComparator, boolean previous) {
811 StringBundler query = null;
812
813 if (orderByComparator != null) {
814 query = new StringBundler(6 +
815 (orderByComparator.getOrderByFields().length * 6));
816 }
817 else {
818 query = new StringBundler(3);
819 }
820
821 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
822
823 if (uuid == null) {
824 query.append(_FINDER_COLUMN_UUID_UUID_1);
825 }
826 else {
827 if (uuid.equals(StringPool.BLANK)) {
828 query.append(_FINDER_COLUMN_UUID_UUID_3);
829 }
830 else {
831 query.append(_FINDER_COLUMN_UUID_UUID_2);
832 }
833 }
834
835 if (orderByComparator != null) {
836 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
837
838 if (orderByConditionFields.length > 0) {
839 query.append(WHERE_AND);
840 }
841
842 for (int i = 0; i < orderByConditionFields.length; i++) {
843 query.append(_ORDER_BY_ENTITY_ALIAS);
844 query.append(orderByConditionFields[i]);
845
846 if ((i + 1) < orderByConditionFields.length) {
847 if (orderByComparator.isAscending() ^ previous) {
848 query.append(WHERE_GREATER_THAN_HAS_NEXT);
849 }
850 else {
851 query.append(WHERE_LESSER_THAN_HAS_NEXT);
852 }
853 }
854 else {
855 if (orderByComparator.isAscending() ^ previous) {
856 query.append(WHERE_GREATER_THAN);
857 }
858 else {
859 query.append(WHERE_LESSER_THAN);
860 }
861 }
862 }
863
864 query.append(ORDER_BY_CLAUSE);
865
866 String[] orderByFields = orderByComparator.getOrderByFields();
867
868 for (int i = 0; i < orderByFields.length; i++) {
869 query.append(_ORDER_BY_ENTITY_ALIAS);
870 query.append(orderByFields[i]);
871
872 if ((i + 1) < orderByFields.length) {
873 if (orderByComparator.isAscending() ^ previous) {
874 query.append(ORDER_BY_ASC_HAS_NEXT);
875 }
876 else {
877 query.append(ORDER_BY_DESC_HAS_NEXT);
878 }
879 }
880 else {
881 if (orderByComparator.isAscending() ^ previous) {
882 query.append(ORDER_BY_ASC);
883 }
884 else {
885 query.append(ORDER_BY_DESC);
886 }
887 }
888 }
889 }
890
891 String sql = query.toString();
892
893 Query q = session.createQuery(sql);
894
895 q.setFirstResult(0);
896 q.setMaxResults(2);
897
898 QueryPos qPos = QueryPos.getInstance(q);
899
900 if (uuid != null) {
901 qPos.add(uuid);
902 }
903
904 if (orderByComparator != null) {
905 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
906
907 for (Object value : values) {
908 qPos.add(value);
909 }
910 }
911
912 List<LayoutSetPrototype> list = q.list();
913
914 if (list.size() == 2) {
915 return list.get(1);
916 }
917 else {
918 return null;
919 }
920 }
921
922
929 public List<LayoutSetPrototype> filterFindByUuid(String uuid)
930 throws SystemException {
931 return filterFindByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
932 }
933
934
947 public List<LayoutSetPrototype> filterFindByUuid(String uuid, int start,
948 int end) throws SystemException {
949 return filterFindByUuid(uuid, start, end, null);
950 }
951
952
966 public List<LayoutSetPrototype> filterFindByUuid(String uuid, int start,
967 int end, OrderByComparator orderByComparator) throws SystemException {
968 if (!InlineSQLHelperUtil.isEnabled()) {
969 return findByUuid(uuid, start, end, orderByComparator);
970 }
971
972 StringBundler query = null;
973
974 if (orderByComparator != null) {
975 query = new StringBundler(3 +
976 (orderByComparator.getOrderByFields().length * 3));
977 }
978 else {
979 query = new StringBundler(2);
980 }
981
982 if (getDB().isSupportsInlineDistinct()) {
983 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
984 }
985 else {
986 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
987 }
988
989 if (uuid == null) {
990 query.append(_FINDER_COLUMN_UUID_UUID_1);
991 }
992 else {
993 if (uuid.equals(StringPool.BLANK)) {
994 query.append(_FINDER_COLUMN_UUID_UUID_3);
995 }
996 else {
997 query.append(_FINDER_COLUMN_UUID_UUID_2);
998 }
999 }
1000
1001 if (!getDB().isSupportsInlineDistinct()) {
1002 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1003 }
1004
1005 if (orderByComparator != null) {
1006 if (getDB().isSupportsInlineDistinct()) {
1007 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1008 orderByComparator);
1009 }
1010 else {
1011 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1012 orderByComparator);
1013 }
1014 }
1015
1016 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1017 LayoutSetPrototype.class.getName(),
1018 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1019
1020 Session session = null;
1021
1022 try {
1023 session = openSession();
1024
1025 SQLQuery q = session.createSQLQuery(sql);
1026
1027 if (getDB().isSupportsInlineDistinct()) {
1028 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
1029 }
1030 else {
1031 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
1032 }
1033
1034 QueryPos qPos = QueryPos.getInstance(q);
1035
1036 if (uuid != null) {
1037 qPos.add(uuid);
1038 }
1039
1040 return (List<LayoutSetPrototype>)QueryUtil.list(q, getDialect(),
1041 start, end);
1042 }
1043 catch (Exception e) {
1044 throw processException(e);
1045 }
1046 finally {
1047 closeSession(session);
1048 }
1049 }
1050
1051
1061 public LayoutSetPrototype[] filterFindByUuid_PrevAndNext(
1062 long layoutSetPrototypeId, String uuid,
1063 OrderByComparator orderByComparator)
1064 throws NoSuchLayoutSetPrototypeException, SystemException {
1065 if (!InlineSQLHelperUtil.isEnabled()) {
1066 return findByUuid_PrevAndNext(layoutSetPrototypeId, uuid,
1067 orderByComparator);
1068 }
1069
1070 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
1071
1072 Session session = null;
1073
1074 try {
1075 session = openSession();
1076
1077 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
1078
1079 array[0] = filterGetByUuid_PrevAndNext(session, layoutSetPrototype,
1080 uuid, orderByComparator, true);
1081
1082 array[1] = layoutSetPrototype;
1083
1084 array[2] = filterGetByUuid_PrevAndNext(session, layoutSetPrototype,
1085 uuid, orderByComparator, false);
1086
1087 return array;
1088 }
1089 catch (Exception e) {
1090 throw processException(e);
1091 }
1092 finally {
1093 closeSession(session);
1094 }
1095 }
1096
1097 protected LayoutSetPrototype filterGetByUuid_PrevAndNext(Session session,
1098 LayoutSetPrototype layoutSetPrototype, String uuid,
1099 OrderByComparator orderByComparator, boolean previous) {
1100 StringBundler query = null;
1101
1102 if (orderByComparator != null) {
1103 query = new StringBundler(6 +
1104 (orderByComparator.getOrderByFields().length * 6));
1105 }
1106 else {
1107 query = new StringBundler(3);
1108 }
1109
1110 if (getDB().isSupportsInlineDistinct()) {
1111 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1112 }
1113 else {
1114 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
1115 }
1116
1117 if (uuid == null) {
1118 query.append(_FINDER_COLUMN_UUID_UUID_1);
1119 }
1120 else {
1121 if (uuid.equals(StringPool.BLANK)) {
1122 query.append(_FINDER_COLUMN_UUID_UUID_3);
1123 }
1124 else {
1125 query.append(_FINDER_COLUMN_UUID_UUID_2);
1126 }
1127 }
1128
1129 if (!getDB().isSupportsInlineDistinct()) {
1130 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1131 }
1132
1133 if (orderByComparator != null) {
1134 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1135
1136 if (orderByConditionFields.length > 0) {
1137 query.append(WHERE_AND);
1138 }
1139
1140 for (int i = 0; i < orderByConditionFields.length; i++) {
1141 if (getDB().isSupportsInlineDistinct()) {
1142 query.append(_ORDER_BY_ENTITY_ALIAS);
1143 }
1144 else {
1145 query.append(_ORDER_BY_ENTITY_TABLE);
1146 }
1147
1148 query.append(orderByConditionFields[i]);
1149
1150 if ((i + 1) < orderByConditionFields.length) {
1151 if (orderByComparator.isAscending() ^ previous) {
1152 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1153 }
1154 else {
1155 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1156 }
1157 }
1158 else {
1159 if (orderByComparator.isAscending() ^ previous) {
1160 query.append(WHERE_GREATER_THAN);
1161 }
1162 else {
1163 query.append(WHERE_LESSER_THAN);
1164 }
1165 }
1166 }
1167
1168 query.append(ORDER_BY_CLAUSE);
1169
1170 String[] orderByFields = orderByComparator.getOrderByFields();
1171
1172 for (int i = 0; i < orderByFields.length; i++) {
1173 if (getDB().isSupportsInlineDistinct()) {
1174 query.append(_ORDER_BY_ENTITY_ALIAS);
1175 }
1176 else {
1177 query.append(_ORDER_BY_ENTITY_TABLE);
1178 }
1179
1180 query.append(orderByFields[i]);
1181
1182 if ((i + 1) < orderByFields.length) {
1183 if (orderByComparator.isAscending() ^ previous) {
1184 query.append(ORDER_BY_ASC_HAS_NEXT);
1185 }
1186 else {
1187 query.append(ORDER_BY_DESC_HAS_NEXT);
1188 }
1189 }
1190 else {
1191 if (orderByComparator.isAscending() ^ previous) {
1192 query.append(ORDER_BY_ASC);
1193 }
1194 else {
1195 query.append(ORDER_BY_DESC);
1196 }
1197 }
1198 }
1199 }
1200
1201 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1202 LayoutSetPrototype.class.getName(),
1203 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1204
1205 SQLQuery q = session.createSQLQuery(sql);
1206
1207 q.setFirstResult(0);
1208 q.setMaxResults(2);
1209
1210 if (getDB().isSupportsInlineDistinct()) {
1211 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
1212 }
1213 else {
1214 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
1215 }
1216
1217 QueryPos qPos = QueryPos.getInstance(q);
1218
1219 if (uuid != null) {
1220 qPos.add(uuid);
1221 }
1222
1223 if (orderByComparator != null) {
1224 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
1225
1226 for (Object value : values) {
1227 qPos.add(value);
1228 }
1229 }
1230
1231 List<LayoutSetPrototype> list = q.list();
1232
1233 if (list.size() == 2) {
1234 return list.get(1);
1235 }
1236 else {
1237 return null;
1238 }
1239 }
1240
1241
1248 public List<LayoutSetPrototype> findByCompanyId(long companyId)
1249 throws SystemException {
1250 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1251 null);
1252 }
1253
1254
1267 public List<LayoutSetPrototype> findByCompanyId(long companyId, int start,
1268 int end) throws SystemException {
1269 return findByCompanyId(companyId, start, end, null);
1270 }
1271
1272
1286 public List<LayoutSetPrototype> findByCompanyId(long companyId, int start,
1287 int end, OrderByComparator orderByComparator) throws SystemException {
1288 FinderPath finderPath = null;
1289 Object[] finderArgs = null;
1290
1291 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1292 (orderByComparator == null)) {
1293 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
1294 finderArgs = new Object[] { companyId };
1295 }
1296 else {
1297 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
1298 finderArgs = new Object[] { companyId, start, end, orderByComparator };
1299 }
1300
1301 List<LayoutSetPrototype> list = (List<LayoutSetPrototype>)FinderCacheUtil.getResult(finderPath,
1302 finderArgs, this);
1303
1304 if (list == null) {
1305 StringBundler query = null;
1306
1307 if (orderByComparator != null) {
1308 query = new StringBundler(3 +
1309 (orderByComparator.getOrderByFields().length * 3));
1310 }
1311 else {
1312 query = new StringBundler(2);
1313 }
1314
1315 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1316
1317 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1318
1319 if (orderByComparator != null) {
1320 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1321 orderByComparator);
1322 }
1323
1324 String sql = query.toString();
1325
1326 Session session = null;
1327
1328 try {
1329 session = openSession();
1330
1331 Query q = session.createQuery(sql);
1332
1333 QueryPos qPos = QueryPos.getInstance(q);
1334
1335 qPos.add(companyId);
1336
1337 list = (List<LayoutSetPrototype>)QueryUtil.list(q,
1338 getDialect(), start, end);
1339 }
1340 catch (Exception e) {
1341 throw processException(e);
1342 }
1343 finally {
1344 if (list == null) {
1345 FinderCacheUtil.removeResult(finderPath, finderArgs);
1346 }
1347 else {
1348 cacheResult(list);
1349
1350 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1351 }
1352
1353 closeSession(session);
1354 }
1355 }
1356
1357 return list;
1358 }
1359
1360
1373 public LayoutSetPrototype findByCompanyId_First(long companyId,
1374 OrderByComparator orderByComparator)
1375 throws NoSuchLayoutSetPrototypeException, SystemException {
1376 List<LayoutSetPrototype> list = findByCompanyId(companyId, 0, 1,
1377 orderByComparator);
1378
1379 if (list.isEmpty()) {
1380 StringBundler msg = new StringBundler(4);
1381
1382 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1383
1384 msg.append("companyId=");
1385 msg.append(companyId);
1386
1387 msg.append(StringPool.CLOSE_CURLY_BRACE);
1388
1389 throw new NoSuchLayoutSetPrototypeException(msg.toString());
1390 }
1391 else {
1392 return list.get(0);
1393 }
1394 }
1395
1396
1409 public LayoutSetPrototype findByCompanyId_Last(long companyId,
1410 OrderByComparator orderByComparator)
1411 throws NoSuchLayoutSetPrototypeException, SystemException {
1412 int count = countByCompanyId(companyId);
1413
1414 List<LayoutSetPrototype> list = findByCompanyId(companyId, count - 1,
1415 count, orderByComparator);
1416
1417 if (list.isEmpty()) {
1418 StringBundler msg = new StringBundler(4);
1419
1420 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1421
1422 msg.append("companyId=");
1423 msg.append(companyId);
1424
1425 msg.append(StringPool.CLOSE_CURLY_BRACE);
1426
1427 throw new NoSuchLayoutSetPrototypeException(msg.toString());
1428 }
1429 else {
1430 return list.get(0);
1431 }
1432 }
1433
1434
1448 public LayoutSetPrototype[] findByCompanyId_PrevAndNext(
1449 long layoutSetPrototypeId, long companyId,
1450 OrderByComparator orderByComparator)
1451 throws NoSuchLayoutSetPrototypeException, SystemException {
1452 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
1453
1454 Session session = null;
1455
1456 try {
1457 session = openSession();
1458
1459 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
1460
1461 array[0] = getByCompanyId_PrevAndNext(session, layoutSetPrototype,
1462 companyId, orderByComparator, true);
1463
1464 array[1] = layoutSetPrototype;
1465
1466 array[2] = getByCompanyId_PrevAndNext(session, layoutSetPrototype,
1467 companyId, orderByComparator, false);
1468
1469 return array;
1470 }
1471 catch (Exception e) {
1472 throw processException(e);
1473 }
1474 finally {
1475 closeSession(session);
1476 }
1477 }
1478
1479 protected LayoutSetPrototype getByCompanyId_PrevAndNext(Session session,
1480 LayoutSetPrototype layoutSetPrototype, long companyId,
1481 OrderByComparator orderByComparator, boolean previous) {
1482 StringBundler query = null;
1483
1484 if (orderByComparator != null) {
1485 query = new StringBundler(6 +
1486 (orderByComparator.getOrderByFields().length * 6));
1487 }
1488 else {
1489 query = new StringBundler(3);
1490 }
1491
1492 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1493
1494 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1495
1496 if (orderByComparator != null) {
1497 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1498
1499 if (orderByConditionFields.length > 0) {
1500 query.append(WHERE_AND);
1501 }
1502
1503 for (int i = 0; i < orderByConditionFields.length; i++) {
1504 query.append(_ORDER_BY_ENTITY_ALIAS);
1505 query.append(orderByConditionFields[i]);
1506
1507 if ((i + 1) < orderByConditionFields.length) {
1508 if (orderByComparator.isAscending() ^ previous) {
1509 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1510 }
1511 else {
1512 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1513 }
1514 }
1515 else {
1516 if (orderByComparator.isAscending() ^ previous) {
1517 query.append(WHERE_GREATER_THAN);
1518 }
1519 else {
1520 query.append(WHERE_LESSER_THAN);
1521 }
1522 }
1523 }
1524
1525 query.append(ORDER_BY_CLAUSE);
1526
1527 String[] orderByFields = orderByComparator.getOrderByFields();
1528
1529 for (int i = 0; i < orderByFields.length; i++) {
1530 query.append(_ORDER_BY_ENTITY_ALIAS);
1531 query.append(orderByFields[i]);
1532
1533 if ((i + 1) < orderByFields.length) {
1534 if (orderByComparator.isAscending() ^ previous) {
1535 query.append(ORDER_BY_ASC_HAS_NEXT);
1536 }
1537 else {
1538 query.append(ORDER_BY_DESC_HAS_NEXT);
1539 }
1540 }
1541 else {
1542 if (orderByComparator.isAscending() ^ previous) {
1543 query.append(ORDER_BY_ASC);
1544 }
1545 else {
1546 query.append(ORDER_BY_DESC);
1547 }
1548 }
1549 }
1550 }
1551
1552 String sql = query.toString();
1553
1554 Query q = session.createQuery(sql);
1555
1556 q.setFirstResult(0);
1557 q.setMaxResults(2);
1558
1559 QueryPos qPos = QueryPos.getInstance(q);
1560
1561 qPos.add(companyId);
1562
1563 if (orderByComparator != null) {
1564 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
1565
1566 for (Object value : values) {
1567 qPos.add(value);
1568 }
1569 }
1570
1571 List<LayoutSetPrototype> list = q.list();
1572
1573 if (list.size() == 2) {
1574 return list.get(1);
1575 }
1576 else {
1577 return null;
1578 }
1579 }
1580
1581
1588 public List<LayoutSetPrototype> filterFindByCompanyId(long companyId)
1589 throws SystemException {
1590 return filterFindByCompanyId(companyId, QueryUtil.ALL_POS,
1591 QueryUtil.ALL_POS, null);
1592 }
1593
1594
1607 public List<LayoutSetPrototype> filterFindByCompanyId(long companyId,
1608 int start, int end) throws SystemException {
1609 return filterFindByCompanyId(companyId, start, end, null);
1610 }
1611
1612
1626 public List<LayoutSetPrototype> filterFindByCompanyId(long companyId,
1627 int start, int end, OrderByComparator orderByComparator)
1628 throws SystemException {
1629 if (!InlineSQLHelperUtil.isEnabled()) {
1630 return findByCompanyId(companyId, start, end, orderByComparator);
1631 }
1632
1633 StringBundler query = null;
1634
1635 if (orderByComparator != null) {
1636 query = new StringBundler(3 +
1637 (orderByComparator.getOrderByFields().length * 3));
1638 }
1639 else {
1640 query = new StringBundler(2);
1641 }
1642
1643 if (getDB().isSupportsInlineDistinct()) {
1644 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1645 }
1646 else {
1647 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
1648 }
1649
1650 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1651
1652 if (!getDB().isSupportsInlineDistinct()) {
1653 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1654 }
1655
1656 if (orderByComparator != null) {
1657 if (getDB().isSupportsInlineDistinct()) {
1658 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1659 orderByComparator);
1660 }
1661 else {
1662 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1663 orderByComparator);
1664 }
1665 }
1666
1667 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1668 LayoutSetPrototype.class.getName(),
1669 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1670
1671 Session session = null;
1672
1673 try {
1674 session = openSession();
1675
1676 SQLQuery q = session.createSQLQuery(sql);
1677
1678 if (getDB().isSupportsInlineDistinct()) {
1679 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
1680 }
1681 else {
1682 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
1683 }
1684
1685 QueryPos qPos = QueryPos.getInstance(q);
1686
1687 qPos.add(companyId);
1688
1689 return (List<LayoutSetPrototype>)QueryUtil.list(q, getDialect(),
1690 start, end);
1691 }
1692 catch (Exception e) {
1693 throw processException(e);
1694 }
1695 finally {
1696 closeSession(session);
1697 }
1698 }
1699
1700
1710 public LayoutSetPrototype[] filterFindByCompanyId_PrevAndNext(
1711 long layoutSetPrototypeId, long companyId,
1712 OrderByComparator orderByComparator)
1713 throws NoSuchLayoutSetPrototypeException, SystemException {
1714 if (!InlineSQLHelperUtil.isEnabled()) {
1715 return findByCompanyId_PrevAndNext(layoutSetPrototypeId, companyId,
1716 orderByComparator);
1717 }
1718
1719 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
1720
1721 Session session = null;
1722
1723 try {
1724 session = openSession();
1725
1726 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
1727
1728 array[0] = filterGetByCompanyId_PrevAndNext(session,
1729 layoutSetPrototype, companyId, orderByComparator, true);
1730
1731 array[1] = layoutSetPrototype;
1732
1733 array[2] = filterGetByCompanyId_PrevAndNext(session,
1734 layoutSetPrototype, companyId, orderByComparator, false);
1735
1736 return array;
1737 }
1738 catch (Exception e) {
1739 throw processException(e);
1740 }
1741 finally {
1742 closeSession(session);
1743 }
1744 }
1745
1746 protected LayoutSetPrototype filterGetByCompanyId_PrevAndNext(
1747 Session session, LayoutSetPrototype layoutSetPrototype, long companyId,
1748 OrderByComparator orderByComparator, boolean previous) {
1749 StringBundler query = null;
1750
1751 if (orderByComparator != null) {
1752 query = new StringBundler(6 +
1753 (orderByComparator.getOrderByFields().length * 6));
1754 }
1755 else {
1756 query = new StringBundler(3);
1757 }
1758
1759 if (getDB().isSupportsInlineDistinct()) {
1760 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1761 }
1762 else {
1763 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
1764 }
1765
1766 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1767
1768 if (!getDB().isSupportsInlineDistinct()) {
1769 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1770 }
1771
1772 if (orderByComparator != null) {
1773 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1774
1775 if (orderByConditionFields.length > 0) {
1776 query.append(WHERE_AND);
1777 }
1778
1779 for (int i = 0; i < orderByConditionFields.length; i++) {
1780 if (getDB().isSupportsInlineDistinct()) {
1781 query.append(_ORDER_BY_ENTITY_ALIAS);
1782 }
1783 else {
1784 query.append(_ORDER_BY_ENTITY_TABLE);
1785 }
1786
1787 query.append(orderByConditionFields[i]);
1788
1789 if ((i + 1) < orderByConditionFields.length) {
1790 if (orderByComparator.isAscending() ^ previous) {
1791 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1792 }
1793 else {
1794 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1795 }
1796 }
1797 else {
1798 if (orderByComparator.isAscending() ^ previous) {
1799 query.append(WHERE_GREATER_THAN);
1800 }
1801 else {
1802 query.append(WHERE_LESSER_THAN);
1803 }
1804 }
1805 }
1806
1807 query.append(ORDER_BY_CLAUSE);
1808
1809 String[] orderByFields = orderByComparator.getOrderByFields();
1810
1811 for (int i = 0; i < orderByFields.length; i++) {
1812 if (getDB().isSupportsInlineDistinct()) {
1813 query.append(_ORDER_BY_ENTITY_ALIAS);
1814 }
1815 else {
1816 query.append(_ORDER_BY_ENTITY_TABLE);
1817 }
1818
1819 query.append(orderByFields[i]);
1820
1821 if ((i + 1) < orderByFields.length) {
1822 if (orderByComparator.isAscending() ^ previous) {
1823 query.append(ORDER_BY_ASC_HAS_NEXT);
1824 }
1825 else {
1826 query.append(ORDER_BY_DESC_HAS_NEXT);
1827 }
1828 }
1829 else {
1830 if (orderByComparator.isAscending() ^ previous) {
1831 query.append(ORDER_BY_ASC);
1832 }
1833 else {
1834 query.append(ORDER_BY_DESC);
1835 }
1836 }
1837 }
1838 }
1839
1840 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1841 LayoutSetPrototype.class.getName(),
1842 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1843
1844 SQLQuery q = session.createSQLQuery(sql);
1845
1846 q.setFirstResult(0);
1847 q.setMaxResults(2);
1848
1849 if (getDB().isSupportsInlineDistinct()) {
1850 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
1851 }
1852 else {
1853 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
1854 }
1855
1856 QueryPos qPos = QueryPos.getInstance(q);
1857
1858 qPos.add(companyId);
1859
1860 if (orderByComparator != null) {
1861 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
1862
1863 for (Object value : values) {
1864 qPos.add(value);
1865 }
1866 }
1867
1868 List<LayoutSetPrototype> list = q.list();
1869
1870 if (list.size() == 2) {
1871 return list.get(1);
1872 }
1873 else {
1874 return null;
1875 }
1876 }
1877
1878
1886 public List<LayoutSetPrototype> findByC_A(long companyId, boolean active)
1887 throws SystemException {
1888 return findByC_A(companyId, active, QueryUtil.ALL_POS,
1889 QueryUtil.ALL_POS, null);
1890 }
1891
1892
1906 public List<LayoutSetPrototype> findByC_A(long companyId, boolean active,
1907 int start, int end) throws SystemException {
1908 return findByC_A(companyId, active, start, end, null);
1909 }
1910
1911
1926 public List<LayoutSetPrototype> findByC_A(long companyId, boolean active,
1927 int start, int end, OrderByComparator orderByComparator)
1928 throws SystemException {
1929 FinderPath finderPath = null;
1930 Object[] finderArgs = null;
1931
1932 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1933 (orderByComparator == null)) {
1934 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_A;
1935 finderArgs = new Object[] { companyId, active };
1936 }
1937 else {
1938 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_A;
1939 finderArgs = new Object[] {
1940 companyId, active,
1941
1942 start, end, orderByComparator
1943 };
1944 }
1945
1946 List<LayoutSetPrototype> list = (List<LayoutSetPrototype>)FinderCacheUtil.getResult(finderPath,
1947 finderArgs, this);
1948
1949 if (list == null) {
1950 StringBundler query = null;
1951
1952 if (orderByComparator != null) {
1953 query = new StringBundler(4 +
1954 (orderByComparator.getOrderByFields().length * 3));
1955 }
1956 else {
1957 query = new StringBundler(3);
1958 }
1959
1960 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1961
1962 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
1963
1964 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
1965
1966 if (orderByComparator != null) {
1967 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1968 orderByComparator);
1969 }
1970
1971 String sql = query.toString();
1972
1973 Session session = null;
1974
1975 try {
1976 session = openSession();
1977
1978 Query q = session.createQuery(sql);
1979
1980 QueryPos qPos = QueryPos.getInstance(q);
1981
1982 qPos.add(companyId);
1983
1984 qPos.add(active);
1985
1986 list = (List<LayoutSetPrototype>)QueryUtil.list(q,
1987 getDialect(), start, end);
1988 }
1989 catch (Exception e) {
1990 throw processException(e);
1991 }
1992 finally {
1993 if (list == null) {
1994 FinderCacheUtil.removeResult(finderPath, finderArgs);
1995 }
1996 else {
1997 cacheResult(list);
1998
1999 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2000 }
2001
2002 closeSession(session);
2003 }
2004 }
2005
2006 return list;
2007 }
2008
2009
2023 public LayoutSetPrototype findByC_A_First(long companyId, boolean active,
2024 OrderByComparator orderByComparator)
2025 throws NoSuchLayoutSetPrototypeException, SystemException {
2026 List<LayoutSetPrototype> list = findByC_A(companyId, active, 0, 1,
2027 orderByComparator);
2028
2029 if (list.isEmpty()) {
2030 StringBundler msg = new StringBundler(6);
2031
2032 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2033
2034 msg.append("companyId=");
2035 msg.append(companyId);
2036
2037 msg.append(", active=");
2038 msg.append(active);
2039
2040 msg.append(StringPool.CLOSE_CURLY_BRACE);
2041
2042 throw new NoSuchLayoutSetPrototypeException(msg.toString());
2043 }
2044 else {
2045 return list.get(0);
2046 }
2047 }
2048
2049
2063 public LayoutSetPrototype findByC_A_Last(long companyId, boolean active,
2064 OrderByComparator orderByComparator)
2065 throws NoSuchLayoutSetPrototypeException, SystemException {
2066 int count = countByC_A(companyId, active);
2067
2068 List<LayoutSetPrototype> list = findByC_A(companyId, active, count - 1,
2069 count, orderByComparator);
2070
2071 if (list.isEmpty()) {
2072 StringBundler msg = new StringBundler(6);
2073
2074 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2075
2076 msg.append("companyId=");
2077 msg.append(companyId);
2078
2079 msg.append(", active=");
2080 msg.append(active);
2081
2082 msg.append(StringPool.CLOSE_CURLY_BRACE);
2083
2084 throw new NoSuchLayoutSetPrototypeException(msg.toString());
2085 }
2086 else {
2087 return list.get(0);
2088 }
2089 }
2090
2091
2106 public LayoutSetPrototype[] findByC_A_PrevAndNext(
2107 long layoutSetPrototypeId, long companyId, boolean active,
2108 OrderByComparator orderByComparator)
2109 throws NoSuchLayoutSetPrototypeException, SystemException {
2110 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
2111
2112 Session session = null;
2113
2114 try {
2115 session = openSession();
2116
2117 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
2118
2119 array[0] = getByC_A_PrevAndNext(session, layoutSetPrototype,
2120 companyId, active, orderByComparator, true);
2121
2122 array[1] = layoutSetPrototype;
2123
2124 array[2] = getByC_A_PrevAndNext(session, layoutSetPrototype,
2125 companyId, active, orderByComparator, false);
2126
2127 return array;
2128 }
2129 catch (Exception e) {
2130 throw processException(e);
2131 }
2132 finally {
2133 closeSession(session);
2134 }
2135 }
2136
2137 protected LayoutSetPrototype getByC_A_PrevAndNext(Session session,
2138 LayoutSetPrototype layoutSetPrototype, long companyId, boolean active,
2139 OrderByComparator orderByComparator, boolean previous) {
2140 StringBundler query = null;
2141
2142 if (orderByComparator != null) {
2143 query = new StringBundler(6 +
2144 (orderByComparator.getOrderByFields().length * 6));
2145 }
2146 else {
2147 query = new StringBundler(3);
2148 }
2149
2150 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
2151
2152 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2153
2154 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2155
2156 if (orderByComparator != null) {
2157 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2158
2159 if (orderByConditionFields.length > 0) {
2160 query.append(WHERE_AND);
2161 }
2162
2163 for (int i = 0; i < orderByConditionFields.length; i++) {
2164 query.append(_ORDER_BY_ENTITY_ALIAS);
2165 query.append(orderByConditionFields[i]);
2166
2167 if ((i + 1) < orderByConditionFields.length) {
2168 if (orderByComparator.isAscending() ^ previous) {
2169 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2170 }
2171 else {
2172 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2173 }
2174 }
2175 else {
2176 if (orderByComparator.isAscending() ^ previous) {
2177 query.append(WHERE_GREATER_THAN);
2178 }
2179 else {
2180 query.append(WHERE_LESSER_THAN);
2181 }
2182 }
2183 }
2184
2185 query.append(ORDER_BY_CLAUSE);
2186
2187 String[] orderByFields = orderByComparator.getOrderByFields();
2188
2189 for (int i = 0; i < orderByFields.length; i++) {
2190 query.append(_ORDER_BY_ENTITY_ALIAS);
2191 query.append(orderByFields[i]);
2192
2193 if ((i + 1) < orderByFields.length) {
2194 if (orderByComparator.isAscending() ^ previous) {
2195 query.append(ORDER_BY_ASC_HAS_NEXT);
2196 }
2197 else {
2198 query.append(ORDER_BY_DESC_HAS_NEXT);
2199 }
2200 }
2201 else {
2202 if (orderByComparator.isAscending() ^ previous) {
2203 query.append(ORDER_BY_ASC);
2204 }
2205 else {
2206 query.append(ORDER_BY_DESC);
2207 }
2208 }
2209 }
2210 }
2211
2212 String sql = query.toString();
2213
2214 Query q = session.createQuery(sql);
2215
2216 q.setFirstResult(0);
2217 q.setMaxResults(2);
2218
2219 QueryPos qPos = QueryPos.getInstance(q);
2220
2221 qPos.add(companyId);
2222
2223 qPos.add(active);
2224
2225 if (orderByComparator != null) {
2226 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
2227
2228 for (Object value : values) {
2229 qPos.add(value);
2230 }
2231 }
2232
2233 List<LayoutSetPrototype> list = q.list();
2234
2235 if (list.size() == 2) {
2236 return list.get(1);
2237 }
2238 else {
2239 return null;
2240 }
2241 }
2242
2243
2251 public List<LayoutSetPrototype> filterFindByC_A(long companyId,
2252 boolean active) throws SystemException {
2253 return filterFindByC_A(companyId, active, QueryUtil.ALL_POS,
2254 QueryUtil.ALL_POS, null);
2255 }
2256
2257
2271 public List<LayoutSetPrototype> filterFindByC_A(long companyId,
2272 boolean active, int start, int end) throws SystemException {
2273 return filterFindByC_A(companyId, active, start, end, null);
2274 }
2275
2276
2291 public List<LayoutSetPrototype> filterFindByC_A(long companyId,
2292 boolean active, int start, int end, OrderByComparator orderByComparator)
2293 throws SystemException {
2294 if (!InlineSQLHelperUtil.isEnabled()) {
2295 return findByC_A(companyId, active, start, end, orderByComparator);
2296 }
2297
2298 StringBundler query = null;
2299
2300 if (orderByComparator != null) {
2301 query = new StringBundler(4 +
2302 (orderByComparator.getOrderByFields().length * 3));
2303 }
2304 else {
2305 query = new StringBundler(3);
2306 }
2307
2308 if (getDB().isSupportsInlineDistinct()) {
2309 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
2310 }
2311 else {
2312 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
2313 }
2314
2315 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2316
2317 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2318
2319 if (!getDB().isSupportsInlineDistinct()) {
2320 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
2321 }
2322
2323 if (orderByComparator != null) {
2324 if (getDB().isSupportsInlineDistinct()) {
2325 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2326 orderByComparator);
2327 }
2328 else {
2329 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2330 orderByComparator);
2331 }
2332 }
2333
2334 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2335 LayoutSetPrototype.class.getName(),
2336 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2337
2338 Session session = null;
2339
2340 try {
2341 session = openSession();
2342
2343 SQLQuery q = session.createSQLQuery(sql);
2344
2345 if (getDB().isSupportsInlineDistinct()) {
2346 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
2347 }
2348 else {
2349 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
2350 }
2351
2352 QueryPos qPos = QueryPos.getInstance(q);
2353
2354 qPos.add(companyId);
2355
2356 qPos.add(active);
2357
2358 return (List<LayoutSetPrototype>)QueryUtil.list(q, getDialect(),
2359 start, end);
2360 }
2361 catch (Exception e) {
2362 throw processException(e);
2363 }
2364 finally {
2365 closeSession(session);
2366 }
2367 }
2368
2369
2380 public LayoutSetPrototype[] filterFindByC_A_PrevAndNext(
2381 long layoutSetPrototypeId, long companyId, boolean active,
2382 OrderByComparator orderByComparator)
2383 throws NoSuchLayoutSetPrototypeException, SystemException {
2384 if (!InlineSQLHelperUtil.isEnabled()) {
2385 return findByC_A_PrevAndNext(layoutSetPrototypeId, companyId,
2386 active, orderByComparator);
2387 }
2388
2389 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
2390
2391 Session session = null;
2392
2393 try {
2394 session = openSession();
2395
2396 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
2397
2398 array[0] = filterGetByC_A_PrevAndNext(session, layoutSetPrototype,
2399 companyId, active, orderByComparator, true);
2400
2401 array[1] = layoutSetPrototype;
2402
2403 array[2] = filterGetByC_A_PrevAndNext(session, layoutSetPrototype,
2404 companyId, active, orderByComparator, false);
2405
2406 return array;
2407 }
2408 catch (Exception e) {
2409 throw processException(e);
2410 }
2411 finally {
2412 closeSession(session);
2413 }
2414 }
2415
2416 protected LayoutSetPrototype filterGetByC_A_PrevAndNext(Session session,
2417 LayoutSetPrototype layoutSetPrototype, long companyId, boolean active,
2418 OrderByComparator orderByComparator, boolean previous) {
2419 StringBundler query = null;
2420
2421 if (orderByComparator != null) {
2422 query = new StringBundler(6 +
2423 (orderByComparator.getOrderByFields().length * 6));
2424 }
2425 else {
2426 query = new StringBundler(3);
2427 }
2428
2429 if (getDB().isSupportsInlineDistinct()) {
2430 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
2431 }
2432 else {
2433 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
2434 }
2435
2436 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2437
2438 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2439
2440 if (!getDB().isSupportsInlineDistinct()) {
2441 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
2442 }
2443
2444 if (orderByComparator != null) {
2445 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2446
2447 if (orderByConditionFields.length > 0) {
2448 query.append(WHERE_AND);
2449 }
2450
2451 for (int i = 0; i < orderByConditionFields.length; i++) {
2452 if (getDB().isSupportsInlineDistinct()) {
2453 query.append(_ORDER_BY_ENTITY_ALIAS);
2454 }
2455 else {
2456 query.append(_ORDER_BY_ENTITY_TABLE);
2457 }
2458
2459 query.append(orderByConditionFields[i]);
2460
2461 if ((i + 1) < orderByConditionFields.length) {
2462 if (orderByComparator.isAscending() ^ previous) {
2463 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2464 }
2465 else {
2466 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2467 }
2468 }
2469 else {
2470 if (orderByComparator.isAscending() ^ previous) {
2471 query.append(WHERE_GREATER_THAN);
2472 }
2473 else {
2474 query.append(WHERE_LESSER_THAN);
2475 }
2476 }
2477 }
2478
2479 query.append(ORDER_BY_CLAUSE);
2480
2481 String[] orderByFields = orderByComparator.getOrderByFields();
2482
2483 for (int i = 0; i < orderByFields.length; i++) {
2484 if (getDB().isSupportsInlineDistinct()) {
2485 query.append(_ORDER_BY_ENTITY_ALIAS);
2486 }
2487 else {
2488 query.append(_ORDER_BY_ENTITY_TABLE);
2489 }
2490
2491 query.append(orderByFields[i]);
2492
2493 if ((i + 1) < orderByFields.length) {
2494 if (orderByComparator.isAscending() ^ previous) {
2495 query.append(ORDER_BY_ASC_HAS_NEXT);
2496 }
2497 else {
2498 query.append(ORDER_BY_DESC_HAS_NEXT);
2499 }
2500 }
2501 else {
2502 if (orderByComparator.isAscending() ^ previous) {
2503 query.append(ORDER_BY_ASC);
2504 }
2505 else {
2506 query.append(ORDER_BY_DESC);
2507 }
2508 }
2509 }
2510 }
2511
2512 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2513 LayoutSetPrototype.class.getName(),
2514 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2515
2516 SQLQuery q = session.createSQLQuery(sql);
2517
2518 q.setFirstResult(0);
2519 q.setMaxResults(2);
2520
2521 if (getDB().isSupportsInlineDistinct()) {
2522 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
2523 }
2524 else {
2525 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
2526 }
2527
2528 QueryPos qPos = QueryPos.getInstance(q);
2529
2530 qPos.add(companyId);
2531
2532 qPos.add(active);
2533
2534 if (orderByComparator != null) {
2535 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
2536
2537 for (Object value : values) {
2538 qPos.add(value);
2539 }
2540 }
2541
2542 List<LayoutSetPrototype> list = q.list();
2543
2544 if (list.size() == 2) {
2545 return list.get(1);
2546 }
2547 else {
2548 return null;
2549 }
2550 }
2551
2552
2558 public List<LayoutSetPrototype> findAll() throws SystemException {
2559 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2560 }
2561
2562
2574 public List<LayoutSetPrototype> findAll(int start, int end)
2575 throws SystemException {
2576 return findAll(start, end, null);
2577 }
2578
2579
2592 public List<LayoutSetPrototype> findAll(int start, int end,
2593 OrderByComparator orderByComparator) throws SystemException {
2594 FinderPath finderPath = null;
2595 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2596
2597 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2598 (orderByComparator == null)) {
2599 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2600 finderArgs = FINDER_ARGS_EMPTY;
2601 }
2602 else {
2603 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2604 finderArgs = new Object[] { start, end, orderByComparator };
2605 }
2606
2607 List<LayoutSetPrototype> list = (List<LayoutSetPrototype>)FinderCacheUtil.getResult(finderPath,
2608 finderArgs, this);
2609
2610 if (list == null) {
2611 StringBundler query = null;
2612 String sql = null;
2613
2614 if (orderByComparator != null) {
2615 query = new StringBundler(2 +
2616 (orderByComparator.getOrderByFields().length * 3));
2617
2618 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE);
2619
2620 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2621 orderByComparator);
2622
2623 sql = query.toString();
2624 }
2625 else {
2626 sql = _SQL_SELECT_LAYOUTSETPROTOTYPE;
2627 }
2628
2629 Session session = null;
2630
2631 try {
2632 session = openSession();
2633
2634 Query q = session.createQuery(sql);
2635
2636 if (orderByComparator == null) {
2637 list = (List<LayoutSetPrototype>)QueryUtil.list(q,
2638 getDialect(), start, end, false);
2639
2640 Collections.sort(list);
2641 }
2642 else {
2643 list = (List<LayoutSetPrototype>)QueryUtil.list(q,
2644 getDialect(), start, end);
2645 }
2646 }
2647 catch (Exception e) {
2648 throw processException(e);
2649 }
2650 finally {
2651 if (list == null) {
2652 FinderCacheUtil.removeResult(finderPath, finderArgs);
2653 }
2654 else {
2655 cacheResult(list);
2656
2657 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2658 }
2659
2660 closeSession(session);
2661 }
2662 }
2663
2664 return list;
2665 }
2666
2667
2673 public void removeByUuid(String uuid) throws SystemException {
2674 for (LayoutSetPrototype layoutSetPrototype : findByUuid(uuid)) {
2675 remove(layoutSetPrototype);
2676 }
2677 }
2678
2679
2685 public void removeByCompanyId(long companyId) throws SystemException {
2686 for (LayoutSetPrototype layoutSetPrototype : findByCompanyId(companyId)) {
2687 remove(layoutSetPrototype);
2688 }
2689 }
2690
2691
2698 public void removeByC_A(long companyId, boolean active)
2699 throws SystemException {
2700 for (LayoutSetPrototype layoutSetPrototype : findByC_A(companyId, active)) {
2701 remove(layoutSetPrototype);
2702 }
2703 }
2704
2705
2710 public void removeAll() throws SystemException {
2711 for (LayoutSetPrototype layoutSetPrototype : findAll()) {
2712 remove(layoutSetPrototype);
2713 }
2714 }
2715
2716
2723 public int countByUuid(String uuid) throws SystemException {
2724 Object[] finderArgs = new Object[] { uuid };
2725
2726 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2727 finderArgs, this);
2728
2729 if (count == null) {
2730 StringBundler query = new StringBundler(2);
2731
2732 query.append(_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
2733
2734 if (uuid == null) {
2735 query.append(_FINDER_COLUMN_UUID_UUID_1);
2736 }
2737 else {
2738 if (uuid.equals(StringPool.BLANK)) {
2739 query.append(_FINDER_COLUMN_UUID_UUID_3);
2740 }
2741 else {
2742 query.append(_FINDER_COLUMN_UUID_UUID_2);
2743 }
2744 }
2745
2746 String sql = query.toString();
2747
2748 Session session = null;
2749
2750 try {
2751 session = openSession();
2752
2753 Query q = session.createQuery(sql);
2754
2755 QueryPos qPos = QueryPos.getInstance(q);
2756
2757 if (uuid != null) {
2758 qPos.add(uuid);
2759 }
2760
2761 count = (Long)q.uniqueResult();
2762 }
2763 catch (Exception e) {
2764 throw processException(e);
2765 }
2766 finally {
2767 if (count == null) {
2768 count = Long.valueOf(0);
2769 }
2770
2771 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2772 finderArgs, count);
2773
2774 closeSession(session);
2775 }
2776 }
2777
2778 return count.intValue();
2779 }
2780
2781
2788 public int filterCountByUuid(String uuid) throws SystemException {
2789 if (!InlineSQLHelperUtil.isEnabled()) {
2790 return countByUuid(uuid);
2791 }
2792
2793 StringBundler query = new StringBundler(2);
2794
2795 query.append(_FILTER_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
2796
2797 if (uuid == null) {
2798 query.append(_FINDER_COLUMN_UUID_UUID_1);
2799 }
2800 else {
2801 if (uuid.equals(StringPool.BLANK)) {
2802 query.append(_FINDER_COLUMN_UUID_UUID_3);
2803 }
2804 else {
2805 query.append(_FINDER_COLUMN_UUID_UUID_2);
2806 }
2807 }
2808
2809 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2810 LayoutSetPrototype.class.getName(),
2811 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2812
2813 Session session = null;
2814
2815 try {
2816 session = openSession();
2817
2818 SQLQuery q = session.createSQLQuery(sql);
2819
2820 q.addScalar(COUNT_COLUMN_NAME,
2821 com.liferay.portal.kernel.dao.orm.Type.LONG);
2822
2823 QueryPos qPos = QueryPos.getInstance(q);
2824
2825 if (uuid != null) {
2826 qPos.add(uuid);
2827 }
2828
2829 Long count = (Long)q.uniqueResult();
2830
2831 return count.intValue();
2832 }
2833 catch (Exception e) {
2834 throw processException(e);
2835 }
2836 finally {
2837 closeSession(session);
2838 }
2839 }
2840
2841
2848 public int countByCompanyId(long companyId) throws SystemException {
2849 Object[] finderArgs = new Object[] { companyId };
2850
2851 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2852 finderArgs, this);
2853
2854 if (count == null) {
2855 StringBundler query = new StringBundler(2);
2856
2857 query.append(_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
2858
2859 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2860
2861 String sql = query.toString();
2862
2863 Session session = null;
2864
2865 try {
2866 session = openSession();
2867
2868 Query q = session.createQuery(sql);
2869
2870 QueryPos qPos = QueryPos.getInstance(q);
2871
2872 qPos.add(companyId);
2873
2874 count = (Long)q.uniqueResult();
2875 }
2876 catch (Exception e) {
2877 throw processException(e);
2878 }
2879 finally {
2880 if (count == null) {
2881 count = Long.valueOf(0);
2882 }
2883
2884 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2885 finderArgs, count);
2886
2887 closeSession(session);
2888 }
2889 }
2890
2891 return count.intValue();
2892 }
2893
2894
2901 public int filterCountByCompanyId(long companyId) throws SystemException {
2902 if (!InlineSQLHelperUtil.isEnabled()) {
2903 return countByCompanyId(companyId);
2904 }
2905
2906 StringBundler query = new StringBundler(2);
2907
2908 query.append(_FILTER_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
2909
2910 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2911
2912 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2913 LayoutSetPrototype.class.getName(),
2914 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2915
2916 Session session = null;
2917
2918 try {
2919 session = openSession();
2920
2921 SQLQuery q = session.createSQLQuery(sql);
2922
2923 q.addScalar(COUNT_COLUMN_NAME,
2924 com.liferay.portal.kernel.dao.orm.Type.LONG);
2925
2926 QueryPos qPos = QueryPos.getInstance(q);
2927
2928 qPos.add(companyId);
2929
2930 Long count = (Long)q.uniqueResult();
2931
2932 return count.intValue();
2933 }
2934 catch (Exception e) {
2935 throw processException(e);
2936 }
2937 finally {
2938 closeSession(session);
2939 }
2940 }
2941
2942
2950 public int countByC_A(long companyId, boolean active)
2951 throws SystemException {
2952 Object[] finderArgs = new Object[] { companyId, active };
2953
2954 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_A,
2955 finderArgs, this);
2956
2957 if (count == null) {
2958 StringBundler query = new StringBundler(3);
2959
2960 query.append(_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
2961
2962 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2963
2964 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2965
2966 String sql = query.toString();
2967
2968 Session session = null;
2969
2970 try {
2971 session = openSession();
2972
2973 Query q = session.createQuery(sql);
2974
2975 QueryPos qPos = QueryPos.getInstance(q);
2976
2977 qPos.add(companyId);
2978
2979 qPos.add(active);
2980
2981 count = (Long)q.uniqueResult();
2982 }
2983 catch (Exception e) {
2984 throw processException(e);
2985 }
2986 finally {
2987 if (count == null) {
2988 count = Long.valueOf(0);
2989 }
2990
2991 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_A, finderArgs,
2992 count);
2993
2994 closeSession(session);
2995 }
2996 }
2997
2998 return count.intValue();
2999 }
3000
3001
3009 public int filterCountByC_A(long companyId, boolean active)
3010 throws SystemException {
3011 if (!InlineSQLHelperUtil.isEnabled()) {
3012 return countByC_A(companyId, active);
3013 }
3014
3015 StringBundler query = new StringBundler(3);
3016
3017 query.append(_FILTER_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
3018
3019 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
3020
3021 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
3022
3023 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3024 LayoutSetPrototype.class.getName(),
3025 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3026
3027 Session session = null;
3028
3029 try {
3030 session = openSession();
3031
3032 SQLQuery q = session.createSQLQuery(sql);
3033
3034 q.addScalar(COUNT_COLUMN_NAME,
3035 com.liferay.portal.kernel.dao.orm.Type.LONG);
3036
3037 QueryPos qPos = QueryPos.getInstance(q);
3038
3039 qPos.add(companyId);
3040
3041 qPos.add(active);
3042
3043 Long count = (Long)q.uniqueResult();
3044
3045 return count.intValue();
3046 }
3047 catch (Exception e) {
3048 throw processException(e);
3049 }
3050 finally {
3051 closeSession(session);
3052 }
3053 }
3054
3055
3061 public int countAll() throws SystemException {
3062 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3063 FINDER_ARGS_EMPTY, this);
3064
3065 if (count == null) {
3066 Session session = null;
3067
3068 try {
3069 session = openSession();
3070
3071 Query q = session.createQuery(_SQL_COUNT_LAYOUTSETPROTOTYPE);
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_ALL,
3084 FINDER_ARGS_EMPTY, count);
3085
3086 closeSession(session);
3087 }
3088 }
3089
3090 return count.intValue();
3091 }
3092
3093
3096 public void afterPropertiesSet() {
3097 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3098 com.liferay.portal.util.PropsUtil.get(
3099 "value.object.listener.com.liferay.portal.model.LayoutSetPrototype")));
3100
3101 if (listenerClassNames.length > 0) {
3102 try {
3103 List<ModelListener<LayoutSetPrototype>> listenersList = new ArrayList<ModelListener<LayoutSetPrototype>>();
3104
3105 for (String listenerClassName : listenerClassNames) {
3106 listenersList.add((ModelListener<LayoutSetPrototype>)InstanceFactory.newInstance(
3107 listenerClassName));
3108 }
3109
3110 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3111 }
3112 catch (Exception e) {
3113 _log.error(e);
3114 }
3115 }
3116 }
3117
3118 public void destroy() {
3119 EntityCacheUtil.removeCache(LayoutSetPrototypeImpl.class.getName());
3120 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3121 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3122 }
3123
3124 @BeanReference(type = AccountPersistence.class)
3125 protected AccountPersistence accountPersistence;
3126 @BeanReference(type = AddressPersistence.class)
3127 protected AddressPersistence addressPersistence;
3128 @BeanReference(type = BrowserTrackerPersistence.class)
3129 protected BrowserTrackerPersistence browserTrackerPersistence;
3130 @BeanReference(type = ClassNamePersistence.class)
3131 protected ClassNamePersistence classNamePersistence;
3132 @BeanReference(type = ClusterGroupPersistence.class)
3133 protected ClusterGroupPersistence clusterGroupPersistence;
3134 @BeanReference(type = CompanyPersistence.class)
3135 protected CompanyPersistence companyPersistence;
3136 @BeanReference(type = ContactPersistence.class)
3137 protected ContactPersistence contactPersistence;
3138 @BeanReference(type = CountryPersistence.class)
3139 protected CountryPersistence countryPersistence;
3140 @BeanReference(type = EmailAddressPersistence.class)
3141 protected EmailAddressPersistence emailAddressPersistence;
3142 @BeanReference(type = GroupPersistence.class)
3143 protected GroupPersistence groupPersistence;
3144 @BeanReference(type = ImagePersistence.class)
3145 protected ImagePersistence imagePersistence;
3146 @BeanReference(type = LayoutPersistence.class)
3147 protected LayoutPersistence layoutPersistence;
3148 @BeanReference(type = LayoutBranchPersistence.class)
3149 protected LayoutBranchPersistence layoutBranchPersistence;
3150 @BeanReference(type = LayoutPrototypePersistence.class)
3151 protected LayoutPrototypePersistence layoutPrototypePersistence;
3152 @BeanReference(type = LayoutRevisionPersistence.class)
3153 protected LayoutRevisionPersistence layoutRevisionPersistence;
3154 @BeanReference(type = LayoutSetPersistence.class)
3155 protected LayoutSetPersistence layoutSetPersistence;
3156 @BeanReference(type = LayoutSetBranchPersistence.class)
3157 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
3158 @BeanReference(type = LayoutSetPrototypePersistence.class)
3159 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
3160 @BeanReference(type = ListTypePersistence.class)
3161 protected ListTypePersistence listTypePersistence;
3162 @BeanReference(type = LockPersistence.class)
3163 protected LockPersistence lockPersistence;
3164 @BeanReference(type = MembershipRequestPersistence.class)
3165 protected MembershipRequestPersistence membershipRequestPersistence;
3166 @BeanReference(type = OrganizationPersistence.class)
3167 protected OrganizationPersistence organizationPersistence;
3168 @BeanReference(type = OrgGroupPermissionPersistence.class)
3169 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
3170 @BeanReference(type = OrgGroupRolePersistence.class)
3171 protected OrgGroupRolePersistence orgGroupRolePersistence;
3172 @BeanReference(type = OrgLaborPersistence.class)
3173 protected OrgLaborPersistence orgLaborPersistence;
3174 @BeanReference(type = PasswordPolicyPersistence.class)
3175 protected PasswordPolicyPersistence passwordPolicyPersistence;
3176 @BeanReference(type = PasswordPolicyRelPersistence.class)
3177 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
3178 @BeanReference(type = PasswordTrackerPersistence.class)
3179 protected PasswordTrackerPersistence passwordTrackerPersistence;
3180 @BeanReference(type = PermissionPersistence.class)
3181 protected PermissionPersistence permissionPersistence;
3182 @BeanReference(type = PhonePersistence.class)
3183 protected PhonePersistence phonePersistence;
3184 @BeanReference(type = PluginSettingPersistence.class)
3185 protected PluginSettingPersistence pluginSettingPersistence;
3186 @BeanReference(type = PortalPreferencesPersistence.class)
3187 protected PortalPreferencesPersistence portalPreferencesPersistence;
3188 @BeanReference(type = PortletPersistence.class)
3189 protected PortletPersistence portletPersistence;
3190 @BeanReference(type = PortletItemPersistence.class)
3191 protected PortletItemPersistence portletItemPersistence;
3192 @BeanReference(type = PortletPreferencesPersistence.class)
3193 protected PortletPreferencesPersistence portletPreferencesPersistence;
3194 @BeanReference(type = RegionPersistence.class)
3195 protected RegionPersistence regionPersistence;
3196 @BeanReference(type = ReleasePersistence.class)
3197 protected ReleasePersistence releasePersistence;
3198 @BeanReference(type = RepositoryPersistence.class)
3199 protected RepositoryPersistence repositoryPersistence;
3200 @BeanReference(type = RepositoryEntryPersistence.class)
3201 protected RepositoryEntryPersistence repositoryEntryPersistence;
3202 @BeanReference(type = ResourcePersistence.class)
3203 protected ResourcePersistence resourcePersistence;
3204 @BeanReference(type = ResourceActionPersistence.class)
3205 protected ResourceActionPersistence resourceActionPersistence;
3206 @BeanReference(type = ResourceBlockPersistence.class)
3207 protected ResourceBlockPersistence resourceBlockPersistence;
3208 @BeanReference(type = ResourceBlockPermissionPersistence.class)
3209 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
3210 @BeanReference(type = ResourceCodePersistence.class)
3211 protected ResourceCodePersistence resourceCodePersistence;
3212 @BeanReference(type = ResourcePermissionPersistence.class)
3213 protected ResourcePermissionPersistence resourcePermissionPersistence;
3214 @BeanReference(type = ResourceTypePermissionPersistence.class)
3215 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
3216 @BeanReference(type = RolePersistence.class)
3217 protected RolePersistence rolePersistence;
3218 @BeanReference(type = ServiceComponentPersistence.class)
3219 protected ServiceComponentPersistence serviceComponentPersistence;
3220 @BeanReference(type = ShardPersistence.class)
3221 protected ShardPersistence shardPersistence;
3222 @BeanReference(type = SubscriptionPersistence.class)
3223 protected SubscriptionPersistence subscriptionPersistence;
3224 @BeanReference(type = TeamPersistence.class)
3225 protected TeamPersistence teamPersistence;
3226 @BeanReference(type = TicketPersistence.class)
3227 protected TicketPersistence ticketPersistence;
3228 @BeanReference(type = UserPersistence.class)
3229 protected UserPersistence userPersistence;
3230 @BeanReference(type = UserGroupPersistence.class)
3231 protected UserGroupPersistence userGroupPersistence;
3232 @BeanReference(type = UserGroupGroupRolePersistence.class)
3233 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
3234 @BeanReference(type = UserGroupRolePersistence.class)
3235 protected UserGroupRolePersistence userGroupRolePersistence;
3236 @BeanReference(type = UserIdMapperPersistence.class)
3237 protected UserIdMapperPersistence userIdMapperPersistence;
3238 @BeanReference(type = UserNotificationEventPersistence.class)
3239 protected UserNotificationEventPersistence userNotificationEventPersistence;
3240 @BeanReference(type = UserTrackerPersistence.class)
3241 protected UserTrackerPersistence userTrackerPersistence;
3242 @BeanReference(type = UserTrackerPathPersistence.class)
3243 protected UserTrackerPathPersistence userTrackerPathPersistence;
3244 @BeanReference(type = VirtualHostPersistence.class)
3245 protected VirtualHostPersistence virtualHostPersistence;
3246 @BeanReference(type = WebDAVPropsPersistence.class)
3247 protected WebDAVPropsPersistence webDAVPropsPersistence;
3248 @BeanReference(type = WebsitePersistence.class)
3249 protected WebsitePersistence websitePersistence;
3250 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
3251 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
3252 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
3253 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
3254 private static final String _SQL_SELECT_LAYOUTSETPROTOTYPE = "SELECT layoutSetPrototype FROM LayoutSetPrototype layoutSetPrototype";
3255 private static final String _SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE = "SELECT layoutSetPrototype FROM LayoutSetPrototype layoutSetPrototype WHERE ";
3256 private static final String _SQL_COUNT_LAYOUTSETPROTOTYPE = "SELECT COUNT(layoutSetPrototype) FROM LayoutSetPrototype layoutSetPrototype";
3257 private static final String _SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE = "SELECT COUNT(layoutSetPrototype) FROM LayoutSetPrototype layoutSetPrototype WHERE ";
3258 private static final String _FINDER_COLUMN_UUID_UUID_1 = "layoutSetPrototype.uuid IS NULL";
3259 private static final String _FINDER_COLUMN_UUID_UUID_2 = "layoutSetPrototype.uuid = ?";
3260 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(layoutSetPrototype.uuid IS NULL OR layoutSetPrototype.uuid = ?)";
3261 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "layoutSetPrototype.companyId = ?";
3262 private static final String _FINDER_COLUMN_C_A_COMPANYID_2 = "layoutSetPrototype.companyId = ? AND ";
3263 private static final String _FINDER_COLUMN_C_A_ACTIVE_2 = "layoutSetPrototype.active = ?";
3264 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "layoutSetPrototype.layoutSetPrototypeId";
3265 private static final String _FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE = "SELECT DISTINCT {layoutSetPrototype.*} FROM LayoutSetPrototype layoutSetPrototype WHERE ";
3266 private static final String _FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1 =
3267 "SELECT {LayoutSetPrototype.*} FROM (SELECT DISTINCT layoutSetPrototype.layoutSetPrototypeId FROM LayoutSetPrototype layoutSetPrototype WHERE ";
3268 private static final String _FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2 =
3269 ") TEMP_TABLE INNER JOIN LayoutSetPrototype ON TEMP_TABLE.layoutSetPrototypeId = LayoutSetPrototype.layoutSetPrototypeId";
3270 private static final String _FILTER_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE = "SELECT COUNT(DISTINCT layoutSetPrototype.layoutSetPrototypeId) AS COUNT_VALUE FROM LayoutSetPrototype layoutSetPrototype WHERE ";
3271 private static final String _FILTER_ENTITY_ALIAS = "layoutSetPrototype";
3272 private static final String _FILTER_ENTITY_TABLE = "LayoutSetPrototype";
3273 private static final String _ORDER_BY_ENTITY_ALIAS = "layoutSetPrototype.";
3274 private static final String _ORDER_BY_ENTITY_TABLE = "LayoutSetPrototype.";
3275 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No LayoutSetPrototype exists with the primary key ";
3276 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No LayoutSetPrototype exists with the key {";
3277 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3278 private static Log _log = LogFactoryUtil.getLog(LayoutSetPrototypePersistenceImpl.class);
3279 private static LayoutSetPrototype _nullLayoutSetPrototype = new LayoutSetPrototypeImpl() {
3280 @Override
3281 public Object clone() {
3282 return this;
3283 }
3284
3285 @Override
3286 public CacheModel<LayoutSetPrototype> toCacheModel() {
3287 return _nullLayoutSetPrototypeCacheModel;
3288 }
3289 };
3290
3291 private static CacheModel<LayoutSetPrototype> _nullLayoutSetPrototypeCacheModel =
3292 new CacheModel<LayoutSetPrototype>() {
3293 public LayoutSetPrototype toEntityModel() {
3294 return _nullLayoutSetPrototype;
3295 }
3296 };
3297 }