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
227 public LayoutSetPrototype create(long layoutSetPrototypeId) {
228 LayoutSetPrototype layoutSetPrototype = new LayoutSetPrototypeImpl();
229
230 layoutSetPrototype.setNew(true);
231 layoutSetPrototype.setPrimaryKey(layoutSetPrototypeId);
232
233 String uuid = PortalUUIDUtil.generate();
234
235 layoutSetPrototype.setUuid(uuid);
236
237 return layoutSetPrototype;
238 }
239
240
248 @Override
249 public LayoutSetPrototype remove(Serializable primaryKey)
250 throws NoSuchModelException, SystemException {
251 return remove(((Long)primaryKey).longValue());
252 }
253
254
262 public LayoutSetPrototype remove(long layoutSetPrototypeId)
263 throws NoSuchLayoutSetPrototypeException, SystemException {
264 Session session = null;
265
266 try {
267 session = openSession();
268
269 LayoutSetPrototype layoutSetPrototype = (LayoutSetPrototype)session.get(LayoutSetPrototypeImpl.class,
270 Long.valueOf(layoutSetPrototypeId));
271
272 if (layoutSetPrototype == null) {
273 if (_log.isWarnEnabled()) {
274 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
275 layoutSetPrototypeId);
276 }
277
278 throw new NoSuchLayoutSetPrototypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
279 layoutSetPrototypeId);
280 }
281
282 return layoutSetPrototypePersistence.remove(layoutSetPrototype);
283 }
284 catch (NoSuchLayoutSetPrototypeException nsee) {
285 throw nsee;
286 }
287 catch (Exception e) {
288 throw processException(e);
289 }
290 finally {
291 closeSession(session);
292 }
293 }
294
295
302 @Override
303 public LayoutSetPrototype remove(LayoutSetPrototype layoutSetPrototype)
304 throws SystemException {
305 return super.remove(layoutSetPrototype);
306 }
307
308 @Override
309 protected LayoutSetPrototype removeImpl(
310 LayoutSetPrototype layoutSetPrototype) throws SystemException {
311 layoutSetPrototype = toUnwrappedModel(layoutSetPrototype);
312
313 Session session = null;
314
315 try {
316 session = openSession();
317
318 BatchSessionUtil.delete(session, layoutSetPrototype);
319 }
320 catch (Exception e) {
321 throw processException(e);
322 }
323 finally {
324 closeSession(session);
325 }
326
327 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
328 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
329
330 EntityCacheUtil.removeResult(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
331 LayoutSetPrototypeImpl.class, layoutSetPrototype.getPrimaryKey());
332
333 return layoutSetPrototype;
334 }
335
336 @Override
337 public LayoutSetPrototype updateImpl(
338 com.liferay.portal.model.LayoutSetPrototype layoutSetPrototype,
339 boolean merge) throws SystemException {
340 layoutSetPrototype = toUnwrappedModel(layoutSetPrototype);
341
342 boolean isNew = layoutSetPrototype.isNew();
343
344 LayoutSetPrototypeModelImpl layoutSetPrototypeModelImpl = (LayoutSetPrototypeModelImpl)layoutSetPrototype;
345
346 if (Validator.isNull(layoutSetPrototype.getUuid())) {
347 String uuid = PortalUUIDUtil.generate();
348
349 layoutSetPrototype.setUuid(uuid);
350 }
351
352 Session session = null;
353
354 try {
355 session = openSession();
356
357 BatchSessionUtil.update(session, layoutSetPrototype, merge);
358
359 layoutSetPrototype.setNew(false);
360 }
361 catch (Exception e) {
362 throw processException(e);
363 }
364 finally {
365 closeSession(session);
366 }
367
368 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
369
370 if (isNew || !LayoutSetPrototypeModelImpl.COLUMN_BITMASK_ENABLED) {
371 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
372 }
373
374 else {
375 if ((layoutSetPrototypeModelImpl.getColumnBitmask() &
376 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
377 Object[] args = new Object[] {
378 layoutSetPrototypeModelImpl.getOriginalUuid()
379 };
380
381 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
382 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
383 args);
384
385 args = new Object[] { layoutSetPrototypeModelImpl.getUuid() };
386
387 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
388 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
389 args);
390 }
391
392 if ((layoutSetPrototypeModelImpl.getColumnBitmask() &
393 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
394 Object[] args = new Object[] {
395 Long.valueOf(layoutSetPrototypeModelImpl.getOriginalCompanyId())
396 };
397
398 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
399 args);
400 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
401 args);
402
403 args = new Object[] {
404 Long.valueOf(layoutSetPrototypeModelImpl.getCompanyId())
405 };
406
407 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
408 args);
409 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
410 args);
411 }
412
413 if ((layoutSetPrototypeModelImpl.getColumnBitmask() &
414 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_A.getColumnBitmask()) != 0) {
415 Object[] args = new Object[] {
416 Long.valueOf(layoutSetPrototypeModelImpl.getOriginalCompanyId()),
417 Boolean.valueOf(layoutSetPrototypeModelImpl.getOriginalActive())
418 };
419
420 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_A, args);
421 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_A,
422 args);
423
424 args = new Object[] {
425 Long.valueOf(layoutSetPrototypeModelImpl.getCompanyId()),
426 Boolean.valueOf(layoutSetPrototypeModelImpl.getActive())
427 };
428
429 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_A, args);
430 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_A,
431 args);
432 }
433 }
434
435 EntityCacheUtil.putResult(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
436 LayoutSetPrototypeImpl.class, layoutSetPrototype.getPrimaryKey(),
437 layoutSetPrototype);
438
439 return layoutSetPrototype;
440 }
441
442 protected LayoutSetPrototype toUnwrappedModel(
443 LayoutSetPrototype layoutSetPrototype) {
444 if (layoutSetPrototype instanceof LayoutSetPrototypeImpl) {
445 return layoutSetPrototype;
446 }
447
448 LayoutSetPrototypeImpl layoutSetPrototypeImpl = new LayoutSetPrototypeImpl();
449
450 layoutSetPrototypeImpl.setNew(layoutSetPrototype.isNew());
451 layoutSetPrototypeImpl.setPrimaryKey(layoutSetPrototype.getPrimaryKey());
452
453 layoutSetPrototypeImpl.setUuid(layoutSetPrototype.getUuid());
454 layoutSetPrototypeImpl.setLayoutSetPrototypeId(layoutSetPrototype.getLayoutSetPrototypeId());
455 layoutSetPrototypeImpl.setCompanyId(layoutSetPrototype.getCompanyId());
456 layoutSetPrototypeImpl.setName(layoutSetPrototype.getName());
457 layoutSetPrototypeImpl.setDescription(layoutSetPrototype.getDescription());
458 layoutSetPrototypeImpl.setSettings(layoutSetPrototype.getSettings());
459 layoutSetPrototypeImpl.setActive(layoutSetPrototype.isActive());
460
461 return layoutSetPrototypeImpl;
462 }
463
464
472 @Override
473 public LayoutSetPrototype findByPrimaryKey(Serializable primaryKey)
474 throws NoSuchModelException, SystemException {
475 return findByPrimaryKey(((Long)primaryKey).longValue());
476 }
477
478
486 public LayoutSetPrototype findByPrimaryKey(long layoutSetPrototypeId)
487 throws NoSuchLayoutSetPrototypeException, SystemException {
488 LayoutSetPrototype layoutSetPrototype = fetchByPrimaryKey(layoutSetPrototypeId);
489
490 if (layoutSetPrototype == null) {
491 if (_log.isWarnEnabled()) {
492 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
493 layoutSetPrototypeId);
494 }
495
496 throw new NoSuchLayoutSetPrototypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
497 layoutSetPrototypeId);
498 }
499
500 return layoutSetPrototype;
501 }
502
503
510 @Override
511 public LayoutSetPrototype fetchByPrimaryKey(Serializable primaryKey)
512 throws SystemException {
513 return fetchByPrimaryKey(((Long)primaryKey).longValue());
514 }
515
516
523 public LayoutSetPrototype fetchByPrimaryKey(long layoutSetPrototypeId)
524 throws SystemException {
525 LayoutSetPrototype layoutSetPrototype = (LayoutSetPrototype)EntityCacheUtil.getResult(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
526 LayoutSetPrototypeImpl.class, layoutSetPrototypeId);
527
528 if (layoutSetPrototype == _nullLayoutSetPrototype) {
529 return null;
530 }
531
532 if (layoutSetPrototype == null) {
533 Session session = null;
534
535 boolean hasException = false;
536
537 try {
538 session = openSession();
539
540 layoutSetPrototype = (LayoutSetPrototype)session.get(LayoutSetPrototypeImpl.class,
541 Long.valueOf(layoutSetPrototypeId));
542 }
543 catch (Exception e) {
544 hasException = true;
545
546 throw processException(e);
547 }
548 finally {
549 if (layoutSetPrototype != null) {
550 cacheResult(layoutSetPrototype);
551 }
552 else if (!hasException) {
553 EntityCacheUtil.putResult(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
554 LayoutSetPrototypeImpl.class, layoutSetPrototypeId,
555 _nullLayoutSetPrototype);
556 }
557
558 closeSession(session);
559 }
560 }
561
562 return layoutSetPrototype;
563 }
564
565
572 public List<LayoutSetPrototype> findByUuid(String uuid)
573 throws SystemException {
574 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
575 }
576
577
590 public List<LayoutSetPrototype> findByUuid(String uuid, int start, int end)
591 throws SystemException {
592 return findByUuid(uuid, start, end, null);
593 }
594
595
609 public List<LayoutSetPrototype> findByUuid(String uuid, int start, int end,
610 OrderByComparator orderByComparator) throws SystemException {
611 FinderPath finderPath = null;
612 Object[] finderArgs = null;
613
614 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
615 (orderByComparator == null)) {
616 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
617 finderArgs = new Object[] { uuid };
618 }
619 else {
620 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
621 finderArgs = new Object[] { uuid, start, end, orderByComparator };
622 }
623
624 List<LayoutSetPrototype> list = (List<LayoutSetPrototype>)FinderCacheUtil.getResult(finderPath,
625 finderArgs, this);
626
627 if (list == null) {
628 StringBundler query = null;
629
630 if (orderByComparator != null) {
631 query = new StringBundler(3 +
632 (orderByComparator.getOrderByFields().length * 3));
633 }
634 else {
635 query = new StringBundler(2);
636 }
637
638 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
639
640 if (uuid == null) {
641 query.append(_FINDER_COLUMN_UUID_UUID_1);
642 }
643 else {
644 if (uuid.equals(StringPool.BLANK)) {
645 query.append(_FINDER_COLUMN_UUID_UUID_3);
646 }
647 else {
648 query.append(_FINDER_COLUMN_UUID_UUID_2);
649 }
650 }
651
652 if (orderByComparator != null) {
653 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
654 orderByComparator);
655 }
656
657 String sql = query.toString();
658
659 Session session = null;
660
661 try {
662 session = openSession();
663
664 Query q = session.createQuery(sql);
665
666 QueryPos qPos = QueryPos.getInstance(q);
667
668 if (uuid != null) {
669 qPos.add(uuid);
670 }
671
672 list = (List<LayoutSetPrototype>)QueryUtil.list(q,
673 getDialect(), start, end);
674 }
675 catch (Exception e) {
676 throw processException(e);
677 }
678 finally {
679 if (list == null) {
680 FinderCacheUtil.removeResult(finderPath, finderArgs);
681 }
682 else {
683 cacheResult(list);
684
685 FinderCacheUtil.putResult(finderPath, finderArgs, list);
686 }
687
688 closeSession(session);
689 }
690 }
691
692 return list;
693 }
694
695
708 public LayoutSetPrototype findByUuid_First(String uuid,
709 OrderByComparator orderByComparator)
710 throws NoSuchLayoutSetPrototypeException, SystemException {
711 List<LayoutSetPrototype> list = findByUuid(uuid, 0, 1, orderByComparator);
712
713 if (list.isEmpty()) {
714 StringBundler msg = new StringBundler(4);
715
716 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
717
718 msg.append("uuid=");
719 msg.append(uuid);
720
721 msg.append(StringPool.CLOSE_CURLY_BRACE);
722
723 throw new NoSuchLayoutSetPrototypeException(msg.toString());
724 }
725 else {
726 return list.get(0);
727 }
728 }
729
730
743 public LayoutSetPrototype findByUuid_Last(String uuid,
744 OrderByComparator orderByComparator)
745 throws NoSuchLayoutSetPrototypeException, SystemException {
746 int count = countByUuid(uuid);
747
748 List<LayoutSetPrototype> list = findByUuid(uuid, count - 1, count,
749 orderByComparator);
750
751 if (list.isEmpty()) {
752 StringBundler msg = new StringBundler(4);
753
754 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
755
756 msg.append("uuid=");
757 msg.append(uuid);
758
759 msg.append(StringPool.CLOSE_CURLY_BRACE);
760
761 throw new NoSuchLayoutSetPrototypeException(msg.toString());
762 }
763 else {
764 return list.get(0);
765 }
766 }
767
768
782 public LayoutSetPrototype[] findByUuid_PrevAndNext(
783 long layoutSetPrototypeId, String uuid,
784 OrderByComparator orderByComparator)
785 throws NoSuchLayoutSetPrototypeException, SystemException {
786 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
787
788 Session session = null;
789
790 try {
791 session = openSession();
792
793 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
794
795 array[0] = getByUuid_PrevAndNext(session, layoutSetPrototype, uuid,
796 orderByComparator, true);
797
798 array[1] = layoutSetPrototype;
799
800 array[2] = getByUuid_PrevAndNext(session, layoutSetPrototype, uuid,
801 orderByComparator, false);
802
803 return array;
804 }
805 catch (Exception e) {
806 throw processException(e);
807 }
808 finally {
809 closeSession(session);
810 }
811 }
812
813 protected LayoutSetPrototype getByUuid_PrevAndNext(Session session,
814 LayoutSetPrototype layoutSetPrototype, String uuid,
815 OrderByComparator orderByComparator, boolean previous) {
816 StringBundler query = null;
817
818 if (orderByComparator != null) {
819 query = new StringBundler(6 +
820 (orderByComparator.getOrderByFields().length * 6));
821 }
822 else {
823 query = new StringBundler(3);
824 }
825
826 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
827
828 if (uuid == null) {
829 query.append(_FINDER_COLUMN_UUID_UUID_1);
830 }
831 else {
832 if (uuid.equals(StringPool.BLANK)) {
833 query.append(_FINDER_COLUMN_UUID_UUID_3);
834 }
835 else {
836 query.append(_FINDER_COLUMN_UUID_UUID_2);
837 }
838 }
839
840 if (orderByComparator != null) {
841 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
842
843 if (orderByConditionFields.length > 0) {
844 query.append(WHERE_AND);
845 }
846
847 for (int i = 0; i < orderByConditionFields.length; i++) {
848 query.append(_ORDER_BY_ENTITY_ALIAS);
849 query.append(orderByConditionFields[i]);
850
851 if ((i + 1) < orderByConditionFields.length) {
852 if (orderByComparator.isAscending() ^ previous) {
853 query.append(WHERE_GREATER_THAN_HAS_NEXT);
854 }
855 else {
856 query.append(WHERE_LESSER_THAN_HAS_NEXT);
857 }
858 }
859 else {
860 if (orderByComparator.isAscending() ^ previous) {
861 query.append(WHERE_GREATER_THAN);
862 }
863 else {
864 query.append(WHERE_LESSER_THAN);
865 }
866 }
867 }
868
869 query.append(ORDER_BY_CLAUSE);
870
871 String[] orderByFields = orderByComparator.getOrderByFields();
872
873 for (int i = 0; i < orderByFields.length; i++) {
874 query.append(_ORDER_BY_ENTITY_ALIAS);
875 query.append(orderByFields[i]);
876
877 if ((i + 1) < orderByFields.length) {
878 if (orderByComparator.isAscending() ^ previous) {
879 query.append(ORDER_BY_ASC_HAS_NEXT);
880 }
881 else {
882 query.append(ORDER_BY_DESC_HAS_NEXT);
883 }
884 }
885 else {
886 if (orderByComparator.isAscending() ^ previous) {
887 query.append(ORDER_BY_ASC);
888 }
889 else {
890 query.append(ORDER_BY_DESC);
891 }
892 }
893 }
894 }
895
896 String sql = query.toString();
897
898 Query q = session.createQuery(sql);
899
900 q.setFirstResult(0);
901 q.setMaxResults(2);
902
903 QueryPos qPos = QueryPos.getInstance(q);
904
905 if (uuid != null) {
906 qPos.add(uuid);
907 }
908
909 if (orderByComparator != null) {
910 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
911
912 for (Object value : values) {
913 qPos.add(value);
914 }
915 }
916
917 List<LayoutSetPrototype> list = q.list();
918
919 if (list.size() == 2) {
920 return list.get(1);
921 }
922 else {
923 return null;
924 }
925 }
926
927
934 public List<LayoutSetPrototype> filterFindByUuid(String uuid)
935 throws SystemException {
936 return filterFindByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
937 }
938
939
952 public List<LayoutSetPrototype> filterFindByUuid(String uuid, int start,
953 int end) throws SystemException {
954 return filterFindByUuid(uuid, start, end, null);
955 }
956
957
971 public List<LayoutSetPrototype> filterFindByUuid(String uuid, int start,
972 int end, OrderByComparator orderByComparator) throws SystemException {
973 if (!InlineSQLHelperUtil.isEnabled()) {
974 return findByUuid(uuid, start, end, orderByComparator);
975 }
976
977 StringBundler query = null;
978
979 if (orderByComparator != null) {
980 query = new StringBundler(3 +
981 (orderByComparator.getOrderByFields().length * 3));
982 }
983 else {
984 query = new StringBundler(2);
985 }
986
987 if (getDB().isSupportsInlineDistinct()) {
988 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
989 }
990 else {
991 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
992 }
993
994 if (uuid == null) {
995 query.append(_FINDER_COLUMN_UUID_UUID_1);
996 }
997 else {
998 if (uuid.equals(StringPool.BLANK)) {
999 query.append(_FINDER_COLUMN_UUID_UUID_3);
1000 }
1001 else {
1002 query.append(_FINDER_COLUMN_UUID_UUID_2);
1003 }
1004 }
1005
1006 if (!getDB().isSupportsInlineDistinct()) {
1007 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1008 }
1009
1010 if (orderByComparator != null) {
1011 if (getDB().isSupportsInlineDistinct()) {
1012 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1013 orderByComparator);
1014 }
1015 else {
1016 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1017 orderByComparator);
1018 }
1019 }
1020
1021 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1022 LayoutSetPrototype.class.getName(),
1023 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1024
1025 Session session = null;
1026
1027 try {
1028 session = openSession();
1029
1030 SQLQuery q = session.createSQLQuery(sql);
1031
1032 if (getDB().isSupportsInlineDistinct()) {
1033 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
1034 }
1035 else {
1036 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
1037 }
1038
1039 QueryPos qPos = QueryPos.getInstance(q);
1040
1041 if (uuid != null) {
1042 qPos.add(uuid);
1043 }
1044
1045 return (List<LayoutSetPrototype>)QueryUtil.list(q, getDialect(),
1046 start, end);
1047 }
1048 catch (Exception e) {
1049 throw processException(e);
1050 }
1051 finally {
1052 closeSession(session);
1053 }
1054 }
1055
1056
1066 public LayoutSetPrototype[] filterFindByUuid_PrevAndNext(
1067 long layoutSetPrototypeId, String uuid,
1068 OrderByComparator orderByComparator)
1069 throws NoSuchLayoutSetPrototypeException, SystemException {
1070 if (!InlineSQLHelperUtil.isEnabled()) {
1071 return findByUuid_PrevAndNext(layoutSetPrototypeId, uuid,
1072 orderByComparator);
1073 }
1074
1075 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
1076
1077 Session session = null;
1078
1079 try {
1080 session = openSession();
1081
1082 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
1083
1084 array[0] = filterGetByUuid_PrevAndNext(session, layoutSetPrototype,
1085 uuid, orderByComparator, true);
1086
1087 array[1] = layoutSetPrototype;
1088
1089 array[2] = filterGetByUuid_PrevAndNext(session, layoutSetPrototype,
1090 uuid, orderByComparator, false);
1091
1092 return array;
1093 }
1094 catch (Exception e) {
1095 throw processException(e);
1096 }
1097 finally {
1098 closeSession(session);
1099 }
1100 }
1101
1102 protected LayoutSetPrototype filterGetByUuid_PrevAndNext(Session session,
1103 LayoutSetPrototype layoutSetPrototype, String uuid,
1104 OrderByComparator orderByComparator, boolean previous) {
1105 StringBundler query = null;
1106
1107 if (orderByComparator != null) {
1108 query = new StringBundler(6 +
1109 (orderByComparator.getOrderByFields().length * 6));
1110 }
1111 else {
1112 query = new StringBundler(3);
1113 }
1114
1115 if (getDB().isSupportsInlineDistinct()) {
1116 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1117 }
1118 else {
1119 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
1120 }
1121
1122 if (uuid == null) {
1123 query.append(_FINDER_COLUMN_UUID_UUID_1);
1124 }
1125 else {
1126 if (uuid.equals(StringPool.BLANK)) {
1127 query.append(_FINDER_COLUMN_UUID_UUID_3);
1128 }
1129 else {
1130 query.append(_FINDER_COLUMN_UUID_UUID_2);
1131 }
1132 }
1133
1134 if (!getDB().isSupportsInlineDistinct()) {
1135 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1136 }
1137
1138 if (orderByComparator != null) {
1139 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1140
1141 if (orderByConditionFields.length > 0) {
1142 query.append(WHERE_AND);
1143 }
1144
1145 for (int i = 0; i < orderByConditionFields.length; i++) {
1146 if (getDB().isSupportsInlineDistinct()) {
1147 query.append(_ORDER_BY_ENTITY_ALIAS);
1148 }
1149 else {
1150 query.append(_ORDER_BY_ENTITY_TABLE);
1151 }
1152
1153 query.append(orderByConditionFields[i]);
1154
1155 if ((i + 1) < orderByConditionFields.length) {
1156 if (orderByComparator.isAscending() ^ previous) {
1157 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1158 }
1159 else {
1160 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1161 }
1162 }
1163 else {
1164 if (orderByComparator.isAscending() ^ previous) {
1165 query.append(WHERE_GREATER_THAN);
1166 }
1167 else {
1168 query.append(WHERE_LESSER_THAN);
1169 }
1170 }
1171 }
1172
1173 query.append(ORDER_BY_CLAUSE);
1174
1175 String[] orderByFields = orderByComparator.getOrderByFields();
1176
1177 for (int i = 0; i < orderByFields.length; i++) {
1178 if (getDB().isSupportsInlineDistinct()) {
1179 query.append(_ORDER_BY_ENTITY_ALIAS);
1180 }
1181 else {
1182 query.append(_ORDER_BY_ENTITY_TABLE);
1183 }
1184
1185 query.append(orderByFields[i]);
1186
1187 if ((i + 1) < orderByFields.length) {
1188 if (orderByComparator.isAscending() ^ previous) {
1189 query.append(ORDER_BY_ASC_HAS_NEXT);
1190 }
1191 else {
1192 query.append(ORDER_BY_DESC_HAS_NEXT);
1193 }
1194 }
1195 else {
1196 if (orderByComparator.isAscending() ^ previous) {
1197 query.append(ORDER_BY_ASC);
1198 }
1199 else {
1200 query.append(ORDER_BY_DESC);
1201 }
1202 }
1203 }
1204 }
1205
1206 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1207 LayoutSetPrototype.class.getName(),
1208 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1209
1210 SQLQuery q = session.createSQLQuery(sql);
1211
1212 q.setFirstResult(0);
1213 q.setMaxResults(2);
1214
1215 if (getDB().isSupportsInlineDistinct()) {
1216 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
1217 }
1218 else {
1219 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
1220 }
1221
1222 QueryPos qPos = QueryPos.getInstance(q);
1223
1224 if (uuid != null) {
1225 qPos.add(uuid);
1226 }
1227
1228 if (orderByComparator != null) {
1229 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
1230
1231 for (Object value : values) {
1232 qPos.add(value);
1233 }
1234 }
1235
1236 List<LayoutSetPrototype> list = q.list();
1237
1238 if (list.size() == 2) {
1239 return list.get(1);
1240 }
1241 else {
1242 return null;
1243 }
1244 }
1245
1246
1253 public List<LayoutSetPrototype> findByCompanyId(long companyId)
1254 throws SystemException {
1255 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1256 null);
1257 }
1258
1259
1272 public List<LayoutSetPrototype> findByCompanyId(long companyId, int start,
1273 int end) throws SystemException {
1274 return findByCompanyId(companyId, start, end, null);
1275 }
1276
1277
1291 public List<LayoutSetPrototype> findByCompanyId(long companyId, int start,
1292 int end, OrderByComparator orderByComparator) throws SystemException {
1293 FinderPath finderPath = null;
1294 Object[] finderArgs = null;
1295
1296 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1297 (orderByComparator == null)) {
1298 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
1299 finderArgs = new Object[] { companyId };
1300 }
1301 else {
1302 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
1303 finderArgs = new Object[] { companyId, start, end, orderByComparator };
1304 }
1305
1306 List<LayoutSetPrototype> list = (List<LayoutSetPrototype>)FinderCacheUtil.getResult(finderPath,
1307 finderArgs, this);
1308
1309 if (list == null) {
1310 StringBundler query = null;
1311
1312 if (orderByComparator != null) {
1313 query = new StringBundler(3 +
1314 (orderByComparator.getOrderByFields().length * 3));
1315 }
1316 else {
1317 query = new StringBundler(2);
1318 }
1319
1320 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1321
1322 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1323
1324 if (orderByComparator != null) {
1325 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1326 orderByComparator);
1327 }
1328
1329 String sql = query.toString();
1330
1331 Session session = null;
1332
1333 try {
1334 session = openSession();
1335
1336 Query q = session.createQuery(sql);
1337
1338 QueryPos qPos = QueryPos.getInstance(q);
1339
1340 qPos.add(companyId);
1341
1342 list = (List<LayoutSetPrototype>)QueryUtil.list(q,
1343 getDialect(), start, end);
1344 }
1345 catch (Exception e) {
1346 throw processException(e);
1347 }
1348 finally {
1349 if (list == null) {
1350 FinderCacheUtil.removeResult(finderPath, finderArgs);
1351 }
1352 else {
1353 cacheResult(list);
1354
1355 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1356 }
1357
1358 closeSession(session);
1359 }
1360 }
1361
1362 return list;
1363 }
1364
1365
1378 public LayoutSetPrototype findByCompanyId_First(long companyId,
1379 OrderByComparator orderByComparator)
1380 throws NoSuchLayoutSetPrototypeException, SystemException {
1381 List<LayoutSetPrototype> list = findByCompanyId(companyId, 0, 1,
1382 orderByComparator);
1383
1384 if (list.isEmpty()) {
1385 StringBundler msg = new StringBundler(4);
1386
1387 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1388
1389 msg.append("companyId=");
1390 msg.append(companyId);
1391
1392 msg.append(StringPool.CLOSE_CURLY_BRACE);
1393
1394 throw new NoSuchLayoutSetPrototypeException(msg.toString());
1395 }
1396 else {
1397 return list.get(0);
1398 }
1399 }
1400
1401
1414 public LayoutSetPrototype findByCompanyId_Last(long companyId,
1415 OrderByComparator orderByComparator)
1416 throws NoSuchLayoutSetPrototypeException, SystemException {
1417 int count = countByCompanyId(companyId);
1418
1419 List<LayoutSetPrototype> list = findByCompanyId(companyId, count - 1,
1420 count, orderByComparator);
1421
1422 if (list.isEmpty()) {
1423 StringBundler msg = new StringBundler(4);
1424
1425 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1426
1427 msg.append("companyId=");
1428 msg.append(companyId);
1429
1430 msg.append(StringPool.CLOSE_CURLY_BRACE);
1431
1432 throw new NoSuchLayoutSetPrototypeException(msg.toString());
1433 }
1434 else {
1435 return list.get(0);
1436 }
1437 }
1438
1439
1453 public LayoutSetPrototype[] findByCompanyId_PrevAndNext(
1454 long layoutSetPrototypeId, long companyId,
1455 OrderByComparator orderByComparator)
1456 throws NoSuchLayoutSetPrototypeException, SystemException {
1457 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
1458
1459 Session session = null;
1460
1461 try {
1462 session = openSession();
1463
1464 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
1465
1466 array[0] = getByCompanyId_PrevAndNext(session, layoutSetPrototype,
1467 companyId, orderByComparator, true);
1468
1469 array[1] = layoutSetPrototype;
1470
1471 array[2] = getByCompanyId_PrevAndNext(session, layoutSetPrototype,
1472 companyId, orderByComparator, false);
1473
1474 return array;
1475 }
1476 catch (Exception e) {
1477 throw processException(e);
1478 }
1479 finally {
1480 closeSession(session);
1481 }
1482 }
1483
1484 protected LayoutSetPrototype getByCompanyId_PrevAndNext(Session session,
1485 LayoutSetPrototype layoutSetPrototype, long companyId,
1486 OrderByComparator orderByComparator, boolean previous) {
1487 StringBundler query = null;
1488
1489 if (orderByComparator != null) {
1490 query = new StringBundler(6 +
1491 (orderByComparator.getOrderByFields().length * 6));
1492 }
1493 else {
1494 query = new StringBundler(3);
1495 }
1496
1497 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1498
1499 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1500
1501 if (orderByComparator != null) {
1502 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1503
1504 if (orderByConditionFields.length > 0) {
1505 query.append(WHERE_AND);
1506 }
1507
1508 for (int i = 0; i < orderByConditionFields.length; i++) {
1509 query.append(_ORDER_BY_ENTITY_ALIAS);
1510 query.append(orderByConditionFields[i]);
1511
1512 if ((i + 1) < orderByConditionFields.length) {
1513 if (orderByComparator.isAscending() ^ previous) {
1514 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1515 }
1516 else {
1517 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1518 }
1519 }
1520 else {
1521 if (orderByComparator.isAscending() ^ previous) {
1522 query.append(WHERE_GREATER_THAN);
1523 }
1524 else {
1525 query.append(WHERE_LESSER_THAN);
1526 }
1527 }
1528 }
1529
1530 query.append(ORDER_BY_CLAUSE);
1531
1532 String[] orderByFields = orderByComparator.getOrderByFields();
1533
1534 for (int i = 0; i < orderByFields.length; i++) {
1535 query.append(_ORDER_BY_ENTITY_ALIAS);
1536 query.append(orderByFields[i]);
1537
1538 if ((i + 1) < orderByFields.length) {
1539 if (orderByComparator.isAscending() ^ previous) {
1540 query.append(ORDER_BY_ASC_HAS_NEXT);
1541 }
1542 else {
1543 query.append(ORDER_BY_DESC_HAS_NEXT);
1544 }
1545 }
1546 else {
1547 if (orderByComparator.isAscending() ^ previous) {
1548 query.append(ORDER_BY_ASC);
1549 }
1550 else {
1551 query.append(ORDER_BY_DESC);
1552 }
1553 }
1554 }
1555 }
1556
1557 String sql = query.toString();
1558
1559 Query q = session.createQuery(sql);
1560
1561 q.setFirstResult(0);
1562 q.setMaxResults(2);
1563
1564 QueryPos qPos = QueryPos.getInstance(q);
1565
1566 qPos.add(companyId);
1567
1568 if (orderByComparator != null) {
1569 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
1570
1571 for (Object value : values) {
1572 qPos.add(value);
1573 }
1574 }
1575
1576 List<LayoutSetPrototype> list = q.list();
1577
1578 if (list.size() == 2) {
1579 return list.get(1);
1580 }
1581 else {
1582 return null;
1583 }
1584 }
1585
1586
1593 public List<LayoutSetPrototype> filterFindByCompanyId(long companyId)
1594 throws SystemException {
1595 return filterFindByCompanyId(companyId, QueryUtil.ALL_POS,
1596 QueryUtil.ALL_POS, null);
1597 }
1598
1599
1612 public List<LayoutSetPrototype> filterFindByCompanyId(long companyId,
1613 int start, int end) throws SystemException {
1614 return filterFindByCompanyId(companyId, start, end, null);
1615 }
1616
1617
1631 public List<LayoutSetPrototype> filterFindByCompanyId(long companyId,
1632 int start, int end, OrderByComparator orderByComparator)
1633 throws SystemException {
1634 if (!InlineSQLHelperUtil.isEnabled()) {
1635 return findByCompanyId(companyId, start, end, orderByComparator);
1636 }
1637
1638 StringBundler query = null;
1639
1640 if (orderByComparator != null) {
1641 query = new StringBundler(3 +
1642 (orderByComparator.getOrderByFields().length * 3));
1643 }
1644 else {
1645 query = new StringBundler(2);
1646 }
1647
1648 if (getDB().isSupportsInlineDistinct()) {
1649 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1650 }
1651 else {
1652 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
1653 }
1654
1655 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1656
1657 if (!getDB().isSupportsInlineDistinct()) {
1658 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1659 }
1660
1661 if (orderByComparator != null) {
1662 if (getDB().isSupportsInlineDistinct()) {
1663 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1664 orderByComparator);
1665 }
1666 else {
1667 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1668 orderByComparator);
1669 }
1670 }
1671
1672 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1673 LayoutSetPrototype.class.getName(),
1674 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1675
1676 Session session = null;
1677
1678 try {
1679 session = openSession();
1680
1681 SQLQuery q = session.createSQLQuery(sql);
1682
1683 if (getDB().isSupportsInlineDistinct()) {
1684 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
1685 }
1686 else {
1687 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
1688 }
1689
1690 QueryPos qPos = QueryPos.getInstance(q);
1691
1692 qPos.add(companyId);
1693
1694 return (List<LayoutSetPrototype>)QueryUtil.list(q, getDialect(),
1695 start, end);
1696 }
1697 catch (Exception e) {
1698 throw processException(e);
1699 }
1700 finally {
1701 closeSession(session);
1702 }
1703 }
1704
1705
1715 public LayoutSetPrototype[] filterFindByCompanyId_PrevAndNext(
1716 long layoutSetPrototypeId, long companyId,
1717 OrderByComparator orderByComparator)
1718 throws NoSuchLayoutSetPrototypeException, SystemException {
1719 if (!InlineSQLHelperUtil.isEnabled()) {
1720 return findByCompanyId_PrevAndNext(layoutSetPrototypeId, companyId,
1721 orderByComparator);
1722 }
1723
1724 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
1725
1726 Session session = null;
1727
1728 try {
1729 session = openSession();
1730
1731 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
1732
1733 array[0] = filterGetByCompanyId_PrevAndNext(session,
1734 layoutSetPrototype, companyId, orderByComparator, true);
1735
1736 array[1] = layoutSetPrototype;
1737
1738 array[2] = filterGetByCompanyId_PrevAndNext(session,
1739 layoutSetPrototype, companyId, orderByComparator, false);
1740
1741 return array;
1742 }
1743 catch (Exception e) {
1744 throw processException(e);
1745 }
1746 finally {
1747 closeSession(session);
1748 }
1749 }
1750
1751 protected LayoutSetPrototype filterGetByCompanyId_PrevAndNext(
1752 Session session, LayoutSetPrototype layoutSetPrototype, long companyId,
1753 OrderByComparator orderByComparator, boolean previous) {
1754 StringBundler query = null;
1755
1756 if (orderByComparator != null) {
1757 query = new StringBundler(6 +
1758 (orderByComparator.getOrderByFields().length * 6));
1759 }
1760 else {
1761 query = new StringBundler(3);
1762 }
1763
1764 if (getDB().isSupportsInlineDistinct()) {
1765 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1766 }
1767 else {
1768 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
1769 }
1770
1771 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1772
1773 if (!getDB().isSupportsInlineDistinct()) {
1774 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1775 }
1776
1777 if (orderByComparator != null) {
1778 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1779
1780 if (orderByConditionFields.length > 0) {
1781 query.append(WHERE_AND);
1782 }
1783
1784 for (int i = 0; i < orderByConditionFields.length; i++) {
1785 if (getDB().isSupportsInlineDistinct()) {
1786 query.append(_ORDER_BY_ENTITY_ALIAS);
1787 }
1788 else {
1789 query.append(_ORDER_BY_ENTITY_TABLE);
1790 }
1791
1792 query.append(orderByConditionFields[i]);
1793
1794 if ((i + 1) < orderByConditionFields.length) {
1795 if (orderByComparator.isAscending() ^ previous) {
1796 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1797 }
1798 else {
1799 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1800 }
1801 }
1802 else {
1803 if (orderByComparator.isAscending() ^ previous) {
1804 query.append(WHERE_GREATER_THAN);
1805 }
1806 else {
1807 query.append(WHERE_LESSER_THAN);
1808 }
1809 }
1810 }
1811
1812 query.append(ORDER_BY_CLAUSE);
1813
1814 String[] orderByFields = orderByComparator.getOrderByFields();
1815
1816 for (int i = 0; i < orderByFields.length; i++) {
1817 if (getDB().isSupportsInlineDistinct()) {
1818 query.append(_ORDER_BY_ENTITY_ALIAS);
1819 }
1820 else {
1821 query.append(_ORDER_BY_ENTITY_TABLE);
1822 }
1823
1824 query.append(orderByFields[i]);
1825
1826 if ((i + 1) < orderByFields.length) {
1827 if (orderByComparator.isAscending() ^ previous) {
1828 query.append(ORDER_BY_ASC_HAS_NEXT);
1829 }
1830 else {
1831 query.append(ORDER_BY_DESC_HAS_NEXT);
1832 }
1833 }
1834 else {
1835 if (orderByComparator.isAscending() ^ previous) {
1836 query.append(ORDER_BY_ASC);
1837 }
1838 else {
1839 query.append(ORDER_BY_DESC);
1840 }
1841 }
1842 }
1843 }
1844
1845 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1846 LayoutSetPrototype.class.getName(),
1847 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1848
1849 SQLQuery q = session.createSQLQuery(sql);
1850
1851 q.setFirstResult(0);
1852 q.setMaxResults(2);
1853
1854 if (getDB().isSupportsInlineDistinct()) {
1855 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
1856 }
1857 else {
1858 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
1859 }
1860
1861 QueryPos qPos = QueryPos.getInstance(q);
1862
1863 qPos.add(companyId);
1864
1865 if (orderByComparator != null) {
1866 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
1867
1868 for (Object value : values) {
1869 qPos.add(value);
1870 }
1871 }
1872
1873 List<LayoutSetPrototype> list = q.list();
1874
1875 if (list.size() == 2) {
1876 return list.get(1);
1877 }
1878 else {
1879 return null;
1880 }
1881 }
1882
1883
1891 public List<LayoutSetPrototype> findByC_A(long companyId, boolean active)
1892 throws SystemException {
1893 return findByC_A(companyId, active, QueryUtil.ALL_POS,
1894 QueryUtil.ALL_POS, null);
1895 }
1896
1897
1911 public List<LayoutSetPrototype> findByC_A(long companyId, boolean active,
1912 int start, int end) throws SystemException {
1913 return findByC_A(companyId, active, start, end, null);
1914 }
1915
1916
1931 public List<LayoutSetPrototype> findByC_A(long companyId, boolean active,
1932 int start, int end, OrderByComparator orderByComparator)
1933 throws SystemException {
1934 FinderPath finderPath = null;
1935 Object[] finderArgs = null;
1936
1937 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1938 (orderByComparator == null)) {
1939 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_A;
1940 finderArgs = new Object[] { companyId, active };
1941 }
1942 else {
1943 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_A;
1944 finderArgs = new Object[] {
1945 companyId, active,
1946
1947 start, end, orderByComparator
1948 };
1949 }
1950
1951 List<LayoutSetPrototype> list = (List<LayoutSetPrototype>)FinderCacheUtil.getResult(finderPath,
1952 finderArgs, this);
1953
1954 if (list == null) {
1955 StringBundler query = null;
1956
1957 if (orderByComparator != null) {
1958 query = new StringBundler(4 +
1959 (orderByComparator.getOrderByFields().length * 3));
1960 }
1961 else {
1962 query = new StringBundler(3);
1963 }
1964
1965 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1966
1967 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
1968
1969 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
1970
1971 if (orderByComparator != null) {
1972 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1973 orderByComparator);
1974 }
1975
1976 String sql = query.toString();
1977
1978 Session session = null;
1979
1980 try {
1981 session = openSession();
1982
1983 Query q = session.createQuery(sql);
1984
1985 QueryPos qPos = QueryPos.getInstance(q);
1986
1987 qPos.add(companyId);
1988
1989 qPos.add(active);
1990
1991 list = (List<LayoutSetPrototype>)QueryUtil.list(q,
1992 getDialect(), start, end);
1993 }
1994 catch (Exception e) {
1995 throw processException(e);
1996 }
1997 finally {
1998 if (list == null) {
1999 FinderCacheUtil.removeResult(finderPath, finderArgs);
2000 }
2001 else {
2002 cacheResult(list);
2003
2004 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2005 }
2006
2007 closeSession(session);
2008 }
2009 }
2010
2011 return list;
2012 }
2013
2014
2028 public LayoutSetPrototype findByC_A_First(long companyId, boolean active,
2029 OrderByComparator orderByComparator)
2030 throws NoSuchLayoutSetPrototypeException, SystemException {
2031 List<LayoutSetPrototype> list = findByC_A(companyId, active, 0, 1,
2032 orderByComparator);
2033
2034 if (list.isEmpty()) {
2035 StringBundler msg = new StringBundler(6);
2036
2037 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2038
2039 msg.append("companyId=");
2040 msg.append(companyId);
2041
2042 msg.append(", active=");
2043 msg.append(active);
2044
2045 msg.append(StringPool.CLOSE_CURLY_BRACE);
2046
2047 throw new NoSuchLayoutSetPrototypeException(msg.toString());
2048 }
2049 else {
2050 return list.get(0);
2051 }
2052 }
2053
2054
2068 public LayoutSetPrototype findByC_A_Last(long companyId, boolean active,
2069 OrderByComparator orderByComparator)
2070 throws NoSuchLayoutSetPrototypeException, SystemException {
2071 int count = countByC_A(companyId, active);
2072
2073 List<LayoutSetPrototype> list = findByC_A(companyId, active, count - 1,
2074 count, orderByComparator);
2075
2076 if (list.isEmpty()) {
2077 StringBundler msg = new StringBundler(6);
2078
2079 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2080
2081 msg.append("companyId=");
2082 msg.append(companyId);
2083
2084 msg.append(", active=");
2085 msg.append(active);
2086
2087 msg.append(StringPool.CLOSE_CURLY_BRACE);
2088
2089 throw new NoSuchLayoutSetPrototypeException(msg.toString());
2090 }
2091 else {
2092 return list.get(0);
2093 }
2094 }
2095
2096
2111 public LayoutSetPrototype[] findByC_A_PrevAndNext(
2112 long layoutSetPrototypeId, long companyId, boolean active,
2113 OrderByComparator orderByComparator)
2114 throws NoSuchLayoutSetPrototypeException, SystemException {
2115 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
2116
2117 Session session = null;
2118
2119 try {
2120 session = openSession();
2121
2122 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
2123
2124 array[0] = getByC_A_PrevAndNext(session, layoutSetPrototype,
2125 companyId, active, orderByComparator, true);
2126
2127 array[1] = layoutSetPrototype;
2128
2129 array[2] = getByC_A_PrevAndNext(session, layoutSetPrototype,
2130 companyId, active, orderByComparator, false);
2131
2132 return array;
2133 }
2134 catch (Exception e) {
2135 throw processException(e);
2136 }
2137 finally {
2138 closeSession(session);
2139 }
2140 }
2141
2142 protected LayoutSetPrototype getByC_A_PrevAndNext(Session session,
2143 LayoutSetPrototype layoutSetPrototype, long companyId, boolean active,
2144 OrderByComparator orderByComparator, boolean previous) {
2145 StringBundler query = null;
2146
2147 if (orderByComparator != null) {
2148 query = new StringBundler(6 +
2149 (orderByComparator.getOrderByFields().length * 6));
2150 }
2151 else {
2152 query = new StringBundler(3);
2153 }
2154
2155 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
2156
2157 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2158
2159 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2160
2161 if (orderByComparator != null) {
2162 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2163
2164 if (orderByConditionFields.length > 0) {
2165 query.append(WHERE_AND);
2166 }
2167
2168 for (int i = 0; i < orderByConditionFields.length; i++) {
2169 query.append(_ORDER_BY_ENTITY_ALIAS);
2170 query.append(orderByConditionFields[i]);
2171
2172 if ((i + 1) < orderByConditionFields.length) {
2173 if (orderByComparator.isAscending() ^ previous) {
2174 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2175 }
2176 else {
2177 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2178 }
2179 }
2180 else {
2181 if (orderByComparator.isAscending() ^ previous) {
2182 query.append(WHERE_GREATER_THAN);
2183 }
2184 else {
2185 query.append(WHERE_LESSER_THAN);
2186 }
2187 }
2188 }
2189
2190 query.append(ORDER_BY_CLAUSE);
2191
2192 String[] orderByFields = orderByComparator.getOrderByFields();
2193
2194 for (int i = 0; i < orderByFields.length; i++) {
2195 query.append(_ORDER_BY_ENTITY_ALIAS);
2196 query.append(orderByFields[i]);
2197
2198 if ((i + 1) < orderByFields.length) {
2199 if (orderByComparator.isAscending() ^ previous) {
2200 query.append(ORDER_BY_ASC_HAS_NEXT);
2201 }
2202 else {
2203 query.append(ORDER_BY_DESC_HAS_NEXT);
2204 }
2205 }
2206 else {
2207 if (orderByComparator.isAscending() ^ previous) {
2208 query.append(ORDER_BY_ASC);
2209 }
2210 else {
2211 query.append(ORDER_BY_DESC);
2212 }
2213 }
2214 }
2215 }
2216
2217 String sql = query.toString();
2218
2219 Query q = session.createQuery(sql);
2220
2221 q.setFirstResult(0);
2222 q.setMaxResults(2);
2223
2224 QueryPos qPos = QueryPos.getInstance(q);
2225
2226 qPos.add(companyId);
2227
2228 qPos.add(active);
2229
2230 if (orderByComparator != null) {
2231 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
2232
2233 for (Object value : values) {
2234 qPos.add(value);
2235 }
2236 }
2237
2238 List<LayoutSetPrototype> list = q.list();
2239
2240 if (list.size() == 2) {
2241 return list.get(1);
2242 }
2243 else {
2244 return null;
2245 }
2246 }
2247
2248
2256 public List<LayoutSetPrototype> filterFindByC_A(long companyId,
2257 boolean active) throws SystemException {
2258 return filterFindByC_A(companyId, active, QueryUtil.ALL_POS,
2259 QueryUtil.ALL_POS, null);
2260 }
2261
2262
2276 public List<LayoutSetPrototype> filterFindByC_A(long companyId,
2277 boolean active, int start, int end) throws SystemException {
2278 return filterFindByC_A(companyId, active, start, end, null);
2279 }
2280
2281
2296 public List<LayoutSetPrototype> filterFindByC_A(long companyId,
2297 boolean active, int start, int end, OrderByComparator orderByComparator)
2298 throws SystemException {
2299 if (!InlineSQLHelperUtil.isEnabled()) {
2300 return findByC_A(companyId, active, start, end, orderByComparator);
2301 }
2302
2303 StringBundler query = null;
2304
2305 if (orderByComparator != null) {
2306 query = new StringBundler(4 +
2307 (orderByComparator.getOrderByFields().length * 3));
2308 }
2309 else {
2310 query = new StringBundler(3);
2311 }
2312
2313 if (getDB().isSupportsInlineDistinct()) {
2314 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
2315 }
2316 else {
2317 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
2318 }
2319
2320 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2321
2322 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2323
2324 if (!getDB().isSupportsInlineDistinct()) {
2325 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
2326 }
2327
2328 if (orderByComparator != null) {
2329 if (getDB().isSupportsInlineDistinct()) {
2330 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2331 orderByComparator);
2332 }
2333 else {
2334 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2335 orderByComparator);
2336 }
2337 }
2338
2339 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2340 LayoutSetPrototype.class.getName(),
2341 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2342
2343 Session session = null;
2344
2345 try {
2346 session = openSession();
2347
2348 SQLQuery q = session.createSQLQuery(sql);
2349
2350 if (getDB().isSupportsInlineDistinct()) {
2351 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
2352 }
2353 else {
2354 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
2355 }
2356
2357 QueryPos qPos = QueryPos.getInstance(q);
2358
2359 qPos.add(companyId);
2360
2361 qPos.add(active);
2362
2363 return (List<LayoutSetPrototype>)QueryUtil.list(q, getDialect(),
2364 start, end);
2365 }
2366 catch (Exception e) {
2367 throw processException(e);
2368 }
2369 finally {
2370 closeSession(session);
2371 }
2372 }
2373
2374
2385 public LayoutSetPrototype[] filterFindByC_A_PrevAndNext(
2386 long layoutSetPrototypeId, long companyId, boolean active,
2387 OrderByComparator orderByComparator)
2388 throws NoSuchLayoutSetPrototypeException, SystemException {
2389 if (!InlineSQLHelperUtil.isEnabled()) {
2390 return findByC_A_PrevAndNext(layoutSetPrototypeId, companyId,
2391 active, orderByComparator);
2392 }
2393
2394 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
2395
2396 Session session = null;
2397
2398 try {
2399 session = openSession();
2400
2401 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
2402
2403 array[0] = filterGetByC_A_PrevAndNext(session, layoutSetPrototype,
2404 companyId, active, orderByComparator, true);
2405
2406 array[1] = layoutSetPrototype;
2407
2408 array[2] = filterGetByC_A_PrevAndNext(session, layoutSetPrototype,
2409 companyId, active, orderByComparator, false);
2410
2411 return array;
2412 }
2413 catch (Exception e) {
2414 throw processException(e);
2415 }
2416 finally {
2417 closeSession(session);
2418 }
2419 }
2420
2421 protected LayoutSetPrototype filterGetByC_A_PrevAndNext(Session session,
2422 LayoutSetPrototype layoutSetPrototype, long companyId, boolean active,
2423 OrderByComparator orderByComparator, boolean previous) {
2424 StringBundler query = null;
2425
2426 if (orderByComparator != null) {
2427 query = new StringBundler(6 +
2428 (orderByComparator.getOrderByFields().length * 6));
2429 }
2430 else {
2431 query = new StringBundler(3);
2432 }
2433
2434 if (getDB().isSupportsInlineDistinct()) {
2435 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
2436 }
2437 else {
2438 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
2439 }
2440
2441 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2442
2443 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2444
2445 if (!getDB().isSupportsInlineDistinct()) {
2446 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
2447 }
2448
2449 if (orderByComparator != null) {
2450 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2451
2452 if (orderByConditionFields.length > 0) {
2453 query.append(WHERE_AND);
2454 }
2455
2456 for (int i = 0; i < orderByConditionFields.length; i++) {
2457 if (getDB().isSupportsInlineDistinct()) {
2458 query.append(_ORDER_BY_ENTITY_ALIAS);
2459 }
2460 else {
2461 query.append(_ORDER_BY_ENTITY_TABLE);
2462 }
2463
2464 query.append(orderByConditionFields[i]);
2465
2466 if ((i + 1) < orderByConditionFields.length) {
2467 if (orderByComparator.isAscending() ^ previous) {
2468 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2469 }
2470 else {
2471 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2472 }
2473 }
2474 else {
2475 if (orderByComparator.isAscending() ^ previous) {
2476 query.append(WHERE_GREATER_THAN);
2477 }
2478 else {
2479 query.append(WHERE_LESSER_THAN);
2480 }
2481 }
2482 }
2483
2484 query.append(ORDER_BY_CLAUSE);
2485
2486 String[] orderByFields = orderByComparator.getOrderByFields();
2487
2488 for (int i = 0; i < orderByFields.length; i++) {
2489 if (getDB().isSupportsInlineDistinct()) {
2490 query.append(_ORDER_BY_ENTITY_ALIAS);
2491 }
2492 else {
2493 query.append(_ORDER_BY_ENTITY_TABLE);
2494 }
2495
2496 query.append(orderByFields[i]);
2497
2498 if ((i + 1) < orderByFields.length) {
2499 if (orderByComparator.isAscending() ^ previous) {
2500 query.append(ORDER_BY_ASC_HAS_NEXT);
2501 }
2502 else {
2503 query.append(ORDER_BY_DESC_HAS_NEXT);
2504 }
2505 }
2506 else {
2507 if (orderByComparator.isAscending() ^ previous) {
2508 query.append(ORDER_BY_ASC);
2509 }
2510 else {
2511 query.append(ORDER_BY_DESC);
2512 }
2513 }
2514 }
2515 }
2516
2517 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2518 LayoutSetPrototype.class.getName(),
2519 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2520
2521 SQLQuery q = session.createSQLQuery(sql);
2522
2523 q.setFirstResult(0);
2524 q.setMaxResults(2);
2525
2526 if (getDB().isSupportsInlineDistinct()) {
2527 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
2528 }
2529 else {
2530 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
2531 }
2532
2533 QueryPos qPos = QueryPos.getInstance(q);
2534
2535 qPos.add(companyId);
2536
2537 qPos.add(active);
2538
2539 if (orderByComparator != null) {
2540 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
2541
2542 for (Object value : values) {
2543 qPos.add(value);
2544 }
2545 }
2546
2547 List<LayoutSetPrototype> list = q.list();
2548
2549 if (list.size() == 2) {
2550 return list.get(1);
2551 }
2552 else {
2553 return null;
2554 }
2555 }
2556
2557
2563 public List<LayoutSetPrototype> findAll() throws SystemException {
2564 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2565 }
2566
2567
2579 public List<LayoutSetPrototype> findAll(int start, int end)
2580 throws SystemException {
2581 return findAll(start, end, null);
2582 }
2583
2584
2597 public List<LayoutSetPrototype> findAll(int start, int end,
2598 OrderByComparator orderByComparator) throws SystemException {
2599 FinderPath finderPath = null;
2600 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2601
2602 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2603 (orderByComparator == null)) {
2604 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2605 finderArgs = FINDER_ARGS_EMPTY;
2606 }
2607 else {
2608 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2609 finderArgs = new Object[] { start, end, orderByComparator };
2610 }
2611
2612 List<LayoutSetPrototype> list = (List<LayoutSetPrototype>)FinderCacheUtil.getResult(finderPath,
2613 finderArgs, this);
2614
2615 if (list == null) {
2616 StringBundler query = null;
2617 String sql = null;
2618
2619 if (orderByComparator != null) {
2620 query = new StringBundler(2 +
2621 (orderByComparator.getOrderByFields().length * 3));
2622
2623 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE);
2624
2625 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2626 orderByComparator);
2627
2628 sql = query.toString();
2629 }
2630 else {
2631 sql = _SQL_SELECT_LAYOUTSETPROTOTYPE;
2632 }
2633
2634 Session session = null;
2635
2636 try {
2637 session = openSession();
2638
2639 Query q = session.createQuery(sql);
2640
2641 if (orderByComparator == null) {
2642 list = (List<LayoutSetPrototype>)QueryUtil.list(q,
2643 getDialect(), start, end, false);
2644
2645 Collections.sort(list);
2646 }
2647 else {
2648 list = (List<LayoutSetPrototype>)QueryUtil.list(q,
2649 getDialect(), start, end);
2650 }
2651 }
2652 catch (Exception e) {
2653 throw processException(e);
2654 }
2655 finally {
2656 if (list == null) {
2657 FinderCacheUtil.removeResult(finderPath, finderArgs);
2658 }
2659 else {
2660 cacheResult(list);
2661
2662 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2663 }
2664
2665 closeSession(session);
2666 }
2667 }
2668
2669 return list;
2670 }
2671
2672
2678 public void removeByUuid(String uuid) throws SystemException {
2679 for (LayoutSetPrototype layoutSetPrototype : findByUuid(uuid)) {
2680 layoutSetPrototypePersistence.remove(layoutSetPrototype);
2681 }
2682 }
2683
2684
2690 public void removeByCompanyId(long companyId) throws SystemException {
2691 for (LayoutSetPrototype layoutSetPrototype : findByCompanyId(companyId)) {
2692 layoutSetPrototypePersistence.remove(layoutSetPrototype);
2693 }
2694 }
2695
2696
2703 public void removeByC_A(long companyId, boolean active)
2704 throws SystemException {
2705 for (LayoutSetPrototype layoutSetPrototype : findByC_A(companyId, active)) {
2706 layoutSetPrototypePersistence.remove(layoutSetPrototype);
2707 }
2708 }
2709
2710
2715 public void removeAll() throws SystemException {
2716 for (LayoutSetPrototype layoutSetPrototype : findAll()) {
2717 layoutSetPrototypePersistence.remove(layoutSetPrototype);
2718 }
2719 }
2720
2721
2728 public int countByUuid(String uuid) throws SystemException {
2729 Object[] finderArgs = new Object[] { uuid };
2730
2731 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2732 finderArgs, this);
2733
2734 if (count == null) {
2735 StringBundler query = new StringBundler(2);
2736
2737 query.append(_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
2738
2739 if (uuid == null) {
2740 query.append(_FINDER_COLUMN_UUID_UUID_1);
2741 }
2742 else {
2743 if (uuid.equals(StringPool.BLANK)) {
2744 query.append(_FINDER_COLUMN_UUID_UUID_3);
2745 }
2746 else {
2747 query.append(_FINDER_COLUMN_UUID_UUID_2);
2748 }
2749 }
2750
2751 String sql = query.toString();
2752
2753 Session session = null;
2754
2755 try {
2756 session = openSession();
2757
2758 Query q = session.createQuery(sql);
2759
2760 QueryPos qPos = QueryPos.getInstance(q);
2761
2762 if (uuid != null) {
2763 qPos.add(uuid);
2764 }
2765
2766 count = (Long)q.uniqueResult();
2767 }
2768 catch (Exception e) {
2769 throw processException(e);
2770 }
2771 finally {
2772 if (count == null) {
2773 count = Long.valueOf(0);
2774 }
2775
2776 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2777 finderArgs, count);
2778
2779 closeSession(session);
2780 }
2781 }
2782
2783 return count.intValue();
2784 }
2785
2786
2793 public int filterCountByUuid(String uuid) throws SystemException {
2794 if (!InlineSQLHelperUtil.isEnabled()) {
2795 return countByUuid(uuid);
2796 }
2797
2798 StringBundler query = new StringBundler(2);
2799
2800 query.append(_FILTER_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
2801
2802 if (uuid == null) {
2803 query.append(_FINDER_COLUMN_UUID_UUID_1);
2804 }
2805 else {
2806 if (uuid.equals(StringPool.BLANK)) {
2807 query.append(_FINDER_COLUMN_UUID_UUID_3);
2808 }
2809 else {
2810 query.append(_FINDER_COLUMN_UUID_UUID_2);
2811 }
2812 }
2813
2814 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2815 LayoutSetPrototype.class.getName(),
2816 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2817
2818 Session session = null;
2819
2820 try {
2821 session = openSession();
2822
2823 SQLQuery q = session.createSQLQuery(sql);
2824
2825 q.addScalar(COUNT_COLUMN_NAME,
2826 com.liferay.portal.kernel.dao.orm.Type.LONG);
2827
2828 QueryPos qPos = QueryPos.getInstance(q);
2829
2830 if (uuid != null) {
2831 qPos.add(uuid);
2832 }
2833
2834 Long count = (Long)q.uniqueResult();
2835
2836 return count.intValue();
2837 }
2838 catch (Exception e) {
2839 throw processException(e);
2840 }
2841 finally {
2842 closeSession(session);
2843 }
2844 }
2845
2846
2853 public int countByCompanyId(long companyId) throws SystemException {
2854 Object[] finderArgs = new Object[] { companyId };
2855
2856 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2857 finderArgs, this);
2858
2859 if (count == null) {
2860 StringBundler query = new StringBundler(2);
2861
2862 query.append(_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
2863
2864 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2865
2866 String sql = query.toString();
2867
2868 Session session = null;
2869
2870 try {
2871 session = openSession();
2872
2873 Query q = session.createQuery(sql);
2874
2875 QueryPos qPos = QueryPos.getInstance(q);
2876
2877 qPos.add(companyId);
2878
2879 count = (Long)q.uniqueResult();
2880 }
2881 catch (Exception e) {
2882 throw processException(e);
2883 }
2884 finally {
2885 if (count == null) {
2886 count = Long.valueOf(0);
2887 }
2888
2889 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2890 finderArgs, count);
2891
2892 closeSession(session);
2893 }
2894 }
2895
2896 return count.intValue();
2897 }
2898
2899
2906 public int filterCountByCompanyId(long companyId) throws SystemException {
2907 if (!InlineSQLHelperUtil.isEnabled()) {
2908 return countByCompanyId(companyId);
2909 }
2910
2911 StringBundler query = new StringBundler(2);
2912
2913 query.append(_FILTER_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
2914
2915 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2916
2917 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2918 LayoutSetPrototype.class.getName(),
2919 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2920
2921 Session session = null;
2922
2923 try {
2924 session = openSession();
2925
2926 SQLQuery q = session.createSQLQuery(sql);
2927
2928 q.addScalar(COUNT_COLUMN_NAME,
2929 com.liferay.portal.kernel.dao.orm.Type.LONG);
2930
2931 QueryPos qPos = QueryPos.getInstance(q);
2932
2933 qPos.add(companyId);
2934
2935 Long count = (Long)q.uniqueResult();
2936
2937 return count.intValue();
2938 }
2939 catch (Exception e) {
2940 throw processException(e);
2941 }
2942 finally {
2943 closeSession(session);
2944 }
2945 }
2946
2947
2955 public int countByC_A(long companyId, boolean active)
2956 throws SystemException {
2957 Object[] finderArgs = new Object[] { companyId, active };
2958
2959 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_A,
2960 finderArgs, this);
2961
2962 if (count == null) {
2963 StringBundler query = new StringBundler(3);
2964
2965 query.append(_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
2966
2967 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2968
2969 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2970
2971 String sql = query.toString();
2972
2973 Session session = null;
2974
2975 try {
2976 session = openSession();
2977
2978 Query q = session.createQuery(sql);
2979
2980 QueryPos qPos = QueryPos.getInstance(q);
2981
2982 qPos.add(companyId);
2983
2984 qPos.add(active);
2985
2986 count = (Long)q.uniqueResult();
2987 }
2988 catch (Exception e) {
2989 throw processException(e);
2990 }
2991 finally {
2992 if (count == null) {
2993 count = Long.valueOf(0);
2994 }
2995
2996 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_A, finderArgs,
2997 count);
2998
2999 closeSession(session);
3000 }
3001 }
3002
3003 return count.intValue();
3004 }
3005
3006
3014 public int filterCountByC_A(long companyId, boolean active)
3015 throws SystemException {
3016 if (!InlineSQLHelperUtil.isEnabled()) {
3017 return countByC_A(companyId, active);
3018 }
3019
3020 StringBundler query = new StringBundler(3);
3021
3022 query.append(_FILTER_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
3023
3024 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
3025
3026 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
3027
3028 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3029 LayoutSetPrototype.class.getName(),
3030 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3031
3032 Session session = null;
3033
3034 try {
3035 session = openSession();
3036
3037 SQLQuery q = session.createSQLQuery(sql);
3038
3039 q.addScalar(COUNT_COLUMN_NAME,
3040 com.liferay.portal.kernel.dao.orm.Type.LONG);
3041
3042 QueryPos qPos = QueryPos.getInstance(q);
3043
3044 qPos.add(companyId);
3045
3046 qPos.add(active);
3047
3048 Long count = (Long)q.uniqueResult();
3049
3050 return count.intValue();
3051 }
3052 catch (Exception e) {
3053 throw processException(e);
3054 }
3055 finally {
3056 closeSession(session);
3057 }
3058 }
3059
3060
3066 public int countAll() throws SystemException {
3067 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3068 FINDER_ARGS_EMPTY, this);
3069
3070 if (count == null) {
3071 Session session = null;
3072
3073 try {
3074 session = openSession();
3075
3076 Query q = session.createQuery(_SQL_COUNT_LAYOUTSETPROTOTYPE);
3077
3078 count = (Long)q.uniqueResult();
3079 }
3080 catch (Exception e) {
3081 throw processException(e);
3082 }
3083 finally {
3084 if (count == null) {
3085 count = Long.valueOf(0);
3086 }
3087
3088 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3089 FINDER_ARGS_EMPTY, count);
3090
3091 closeSession(session);
3092 }
3093 }
3094
3095 return count.intValue();
3096 }
3097
3098
3101 public void afterPropertiesSet() {
3102 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3103 com.liferay.portal.util.PropsUtil.get(
3104 "value.object.listener.com.liferay.portal.model.LayoutSetPrototype")));
3105
3106 if (listenerClassNames.length > 0) {
3107 try {
3108 List<ModelListener<LayoutSetPrototype>> listenersList = new ArrayList<ModelListener<LayoutSetPrototype>>();
3109
3110 for (String listenerClassName : listenerClassNames) {
3111 listenersList.add((ModelListener<LayoutSetPrototype>)InstanceFactory.newInstance(
3112 listenerClassName));
3113 }
3114
3115 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3116 }
3117 catch (Exception e) {
3118 _log.error(e);
3119 }
3120 }
3121 }
3122
3123 public void destroy() {
3124 EntityCacheUtil.removeCache(LayoutSetPrototypeImpl.class.getName());
3125 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3126 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3127 }
3128
3129 @BeanReference(type = AccountPersistence.class)
3130 protected AccountPersistence accountPersistence;
3131 @BeanReference(type = AddressPersistence.class)
3132 protected AddressPersistence addressPersistence;
3133 @BeanReference(type = BrowserTrackerPersistence.class)
3134 protected BrowserTrackerPersistence browserTrackerPersistence;
3135 @BeanReference(type = ClassNamePersistence.class)
3136 protected ClassNamePersistence classNamePersistence;
3137 @BeanReference(type = ClusterGroupPersistence.class)
3138 protected ClusterGroupPersistence clusterGroupPersistence;
3139 @BeanReference(type = CompanyPersistence.class)
3140 protected CompanyPersistence companyPersistence;
3141 @BeanReference(type = ContactPersistence.class)
3142 protected ContactPersistence contactPersistence;
3143 @BeanReference(type = CountryPersistence.class)
3144 protected CountryPersistence countryPersistence;
3145 @BeanReference(type = EmailAddressPersistence.class)
3146 protected EmailAddressPersistence emailAddressPersistence;
3147 @BeanReference(type = GroupPersistence.class)
3148 protected GroupPersistence groupPersistence;
3149 @BeanReference(type = ImagePersistence.class)
3150 protected ImagePersistence imagePersistence;
3151 @BeanReference(type = LayoutPersistence.class)
3152 protected LayoutPersistence layoutPersistence;
3153 @BeanReference(type = LayoutBranchPersistence.class)
3154 protected LayoutBranchPersistence layoutBranchPersistence;
3155 @BeanReference(type = LayoutPrototypePersistence.class)
3156 protected LayoutPrototypePersistence layoutPrototypePersistence;
3157 @BeanReference(type = LayoutRevisionPersistence.class)
3158 protected LayoutRevisionPersistence layoutRevisionPersistence;
3159 @BeanReference(type = LayoutSetPersistence.class)
3160 protected LayoutSetPersistence layoutSetPersistence;
3161 @BeanReference(type = LayoutSetBranchPersistence.class)
3162 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
3163 @BeanReference(type = LayoutSetPrototypePersistence.class)
3164 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
3165 @BeanReference(type = ListTypePersistence.class)
3166 protected ListTypePersistence listTypePersistence;
3167 @BeanReference(type = LockPersistence.class)
3168 protected LockPersistence lockPersistence;
3169 @BeanReference(type = MembershipRequestPersistence.class)
3170 protected MembershipRequestPersistence membershipRequestPersistence;
3171 @BeanReference(type = OrganizationPersistence.class)
3172 protected OrganizationPersistence organizationPersistence;
3173 @BeanReference(type = OrgGroupPermissionPersistence.class)
3174 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
3175 @BeanReference(type = OrgGroupRolePersistence.class)
3176 protected OrgGroupRolePersistence orgGroupRolePersistence;
3177 @BeanReference(type = OrgLaborPersistence.class)
3178 protected OrgLaborPersistence orgLaborPersistence;
3179 @BeanReference(type = PasswordPolicyPersistence.class)
3180 protected PasswordPolicyPersistence passwordPolicyPersistence;
3181 @BeanReference(type = PasswordPolicyRelPersistence.class)
3182 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
3183 @BeanReference(type = PasswordTrackerPersistence.class)
3184 protected PasswordTrackerPersistence passwordTrackerPersistence;
3185 @BeanReference(type = PermissionPersistence.class)
3186 protected PermissionPersistence permissionPersistence;
3187 @BeanReference(type = PhonePersistence.class)
3188 protected PhonePersistence phonePersistence;
3189 @BeanReference(type = PluginSettingPersistence.class)
3190 protected PluginSettingPersistence pluginSettingPersistence;
3191 @BeanReference(type = PortalPreferencesPersistence.class)
3192 protected PortalPreferencesPersistence portalPreferencesPersistence;
3193 @BeanReference(type = PortletPersistence.class)
3194 protected PortletPersistence portletPersistence;
3195 @BeanReference(type = PortletItemPersistence.class)
3196 protected PortletItemPersistence portletItemPersistence;
3197 @BeanReference(type = PortletPreferencesPersistence.class)
3198 protected PortletPreferencesPersistence portletPreferencesPersistence;
3199 @BeanReference(type = RegionPersistence.class)
3200 protected RegionPersistence regionPersistence;
3201 @BeanReference(type = ReleasePersistence.class)
3202 protected ReleasePersistence releasePersistence;
3203 @BeanReference(type = RepositoryPersistence.class)
3204 protected RepositoryPersistence repositoryPersistence;
3205 @BeanReference(type = RepositoryEntryPersistence.class)
3206 protected RepositoryEntryPersistence repositoryEntryPersistence;
3207 @BeanReference(type = ResourcePersistence.class)
3208 protected ResourcePersistence resourcePersistence;
3209 @BeanReference(type = ResourceActionPersistence.class)
3210 protected ResourceActionPersistence resourceActionPersistence;
3211 @BeanReference(type = ResourceBlockPersistence.class)
3212 protected ResourceBlockPersistence resourceBlockPersistence;
3213 @BeanReference(type = ResourceBlockPermissionPersistence.class)
3214 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
3215 @BeanReference(type = ResourceCodePersistence.class)
3216 protected ResourceCodePersistence resourceCodePersistence;
3217 @BeanReference(type = ResourcePermissionPersistence.class)
3218 protected ResourcePermissionPersistence resourcePermissionPersistence;
3219 @BeanReference(type = ResourceTypePermissionPersistence.class)
3220 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
3221 @BeanReference(type = RolePersistence.class)
3222 protected RolePersistence rolePersistence;
3223 @BeanReference(type = ServiceComponentPersistence.class)
3224 protected ServiceComponentPersistence serviceComponentPersistence;
3225 @BeanReference(type = ShardPersistence.class)
3226 protected ShardPersistence shardPersistence;
3227 @BeanReference(type = SubscriptionPersistence.class)
3228 protected SubscriptionPersistence subscriptionPersistence;
3229 @BeanReference(type = TeamPersistence.class)
3230 protected TeamPersistence teamPersistence;
3231 @BeanReference(type = TicketPersistence.class)
3232 protected TicketPersistence ticketPersistence;
3233 @BeanReference(type = UserPersistence.class)
3234 protected UserPersistence userPersistence;
3235 @BeanReference(type = UserGroupPersistence.class)
3236 protected UserGroupPersistence userGroupPersistence;
3237 @BeanReference(type = UserGroupGroupRolePersistence.class)
3238 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
3239 @BeanReference(type = UserGroupRolePersistence.class)
3240 protected UserGroupRolePersistence userGroupRolePersistence;
3241 @BeanReference(type = UserIdMapperPersistence.class)
3242 protected UserIdMapperPersistence userIdMapperPersistence;
3243 @BeanReference(type = UserNotificationEventPersistence.class)
3244 protected UserNotificationEventPersistence userNotificationEventPersistence;
3245 @BeanReference(type = UserTrackerPersistence.class)
3246 protected UserTrackerPersistence userTrackerPersistence;
3247 @BeanReference(type = UserTrackerPathPersistence.class)
3248 protected UserTrackerPathPersistence userTrackerPathPersistence;
3249 @BeanReference(type = VirtualHostPersistence.class)
3250 protected VirtualHostPersistence virtualHostPersistence;
3251 @BeanReference(type = WebDAVPropsPersistence.class)
3252 protected WebDAVPropsPersistence webDAVPropsPersistence;
3253 @BeanReference(type = WebsitePersistence.class)
3254 protected WebsitePersistence websitePersistence;
3255 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
3256 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
3257 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
3258 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
3259 private static final String _SQL_SELECT_LAYOUTSETPROTOTYPE = "SELECT layoutSetPrototype FROM LayoutSetPrototype layoutSetPrototype";
3260 private static final String _SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE = "SELECT layoutSetPrototype FROM LayoutSetPrototype layoutSetPrototype WHERE ";
3261 private static final String _SQL_COUNT_LAYOUTSETPROTOTYPE = "SELECT COUNT(layoutSetPrototype) FROM LayoutSetPrototype layoutSetPrototype";
3262 private static final String _SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE = "SELECT COUNT(layoutSetPrototype) FROM LayoutSetPrototype layoutSetPrototype WHERE ";
3263 private static final String _FINDER_COLUMN_UUID_UUID_1 = "layoutSetPrototype.uuid IS NULL";
3264 private static final String _FINDER_COLUMN_UUID_UUID_2 = "layoutSetPrototype.uuid = ?";
3265 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(layoutSetPrototype.uuid IS NULL OR layoutSetPrototype.uuid = ?)";
3266 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "layoutSetPrototype.companyId = ?";
3267 private static final String _FINDER_COLUMN_C_A_COMPANYID_2 = "layoutSetPrototype.companyId = ? AND ";
3268 private static final String _FINDER_COLUMN_C_A_ACTIVE_2 = "layoutSetPrototype.active = ?";
3269 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "layoutSetPrototype.layoutSetPrototypeId";
3270 private static final String _FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE = "SELECT DISTINCT {layoutSetPrototype.*} FROM LayoutSetPrototype layoutSetPrototype WHERE ";
3271 private static final String _FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1 =
3272 "SELECT {LayoutSetPrototype.*} FROM (SELECT DISTINCT layoutSetPrototype.layoutSetPrototypeId FROM LayoutSetPrototype layoutSetPrototype WHERE ";
3273 private static final String _FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2 =
3274 ") TEMP_TABLE INNER JOIN LayoutSetPrototype ON TEMP_TABLE.layoutSetPrototypeId = LayoutSetPrototype.layoutSetPrototypeId";
3275 private static final String _FILTER_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE = "SELECT COUNT(DISTINCT layoutSetPrototype.layoutSetPrototypeId) AS COUNT_VALUE FROM LayoutSetPrototype layoutSetPrototype WHERE ";
3276 private static final String _FILTER_ENTITY_ALIAS = "layoutSetPrototype";
3277 private static final String _FILTER_ENTITY_TABLE = "LayoutSetPrototype";
3278 private static final String _ORDER_BY_ENTITY_ALIAS = "layoutSetPrototype.";
3279 private static final String _ORDER_BY_ENTITY_TABLE = "LayoutSetPrototype.";
3280 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No LayoutSetPrototype exists with the primary key ";
3281 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No LayoutSetPrototype exists with the key {";
3282 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3283 private static Log _log = LogFactoryUtil.getLog(LayoutSetPrototypePersistenceImpl.class);
3284 private static LayoutSetPrototype _nullLayoutSetPrototype = new LayoutSetPrototypeImpl() {
3285 @Override
3286 public Object clone() {
3287 return this;
3288 }
3289
3290 @Override
3291 public CacheModel<LayoutSetPrototype> toCacheModel() {
3292 return _nullLayoutSetPrototypeCacheModel;
3293 }
3294 };
3295
3296 private static CacheModel<LayoutSetPrototype> _nullLayoutSetPrototypeCacheModel =
3297 new CacheModel<LayoutSetPrototype>() {
3298 public LayoutSetPrototype toEntityModel() {
3299 return _nullLayoutSetPrototype;
3300 }
3301 };
3302 }