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_WITH_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_WITHOUT_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) && !list.isEmpty()) {
623 for (LayoutSetPrototype layoutSetPrototype : list) {
624 if (!Validator.equals(uuid, layoutSetPrototype.getUuid())) {
625 list = null;
626
627 break;
628 }
629 }
630 }
631
632 if (list == null) {
633 StringBundler query = null;
634
635 if (orderByComparator != null) {
636 query = new StringBundler(3 +
637 (orderByComparator.getOrderByFields().length * 3));
638 }
639 else {
640 query = new StringBundler(2);
641 }
642
643 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
644
645 if (uuid == null) {
646 query.append(_FINDER_COLUMN_UUID_UUID_1);
647 }
648 else {
649 if (uuid.equals(StringPool.BLANK)) {
650 query.append(_FINDER_COLUMN_UUID_UUID_3);
651 }
652 else {
653 query.append(_FINDER_COLUMN_UUID_UUID_2);
654 }
655 }
656
657 if (orderByComparator != null) {
658 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
659 orderByComparator);
660 }
661
662 String sql = query.toString();
663
664 Session session = null;
665
666 try {
667 session = openSession();
668
669 Query q = session.createQuery(sql);
670
671 QueryPos qPos = QueryPos.getInstance(q);
672
673 if (uuid != null) {
674 qPos.add(uuid);
675 }
676
677 list = (List<LayoutSetPrototype>)QueryUtil.list(q,
678 getDialect(), start, end);
679 }
680 catch (Exception e) {
681 throw processException(e);
682 }
683 finally {
684 if (list == null) {
685 FinderCacheUtil.removeResult(finderPath, finderArgs);
686 }
687 else {
688 cacheResult(list);
689
690 FinderCacheUtil.putResult(finderPath, finderArgs, list);
691 }
692
693 closeSession(session);
694 }
695 }
696
697 return list;
698 }
699
700
709 public LayoutSetPrototype findByUuid_First(String uuid,
710 OrderByComparator orderByComparator)
711 throws NoSuchLayoutSetPrototypeException, SystemException {
712 LayoutSetPrototype layoutSetPrototype = fetchByUuid_First(uuid,
713 orderByComparator);
714
715 if (layoutSetPrototype != null) {
716 return layoutSetPrototype;
717 }
718
719 StringBundler msg = new StringBundler(4);
720
721 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
722
723 msg.append("uuid=");
724 msg.append(uuid);
725
726 msg.append(StringPool.CLOSE_CURLY_BRACE);
727
728 throw new NoSuchLayoutSetPrototypeException(msg.toString());
729 }
730
731
739 public LayoutSetPrototype fetchByUuid_First(String uuid,
740 OrderByComparator orderByComparator) throws SystemException {
741 List<LayoutSetPrototype> list = findByUuid(uuid, 0, 1, orderByComparator);
742
743 if (!list.isEmpty()) {
744 return list.get(0);
745 }
746
747 return null;
748 }
749
750
759 public LayoutSetPrototype findByUuid_Last(String uuid,
760 OrderByComparator orderByComparator)
761 throws NoSuchLayoutSetPrototypeException, SystemException {
762 LayoutSetPrototype layoutSetPrototype = fetchByUuid_Last(uuid,
763 orderByComparator);
764
765 if (layoutSetPrototype != null) {
766 return layoutSetPrototype;
767 }
768
769 StringBundler msg = new StringBundler(4);
770
771 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
772
773 msg.append("uuid=");
774 msg.append(uuid);
775
776 msg.append(StringPool.CLOSE_CURLY_BRACE);
777
778 throw new NoSuchLayoutSetPrototypeException(msg.toString());
779 }
780
781
789 public LayoutSetPrototype fetchByUuid_Last(String uuid,
790 OrderByComparator orderByComparator) throws SystemException {
791 int count = countByUuid(uuid);
792
793 List<LayoutSetPrototype> list = findByUuid(uuid, count - 1, count,
794 orderByComparator);
795
796 if (!list.isEmpty()) {
797 return list.get(0);
798 }
799
800 return null;
801 }
802
803
813 public LayoutSetPrototype[] findByUuid_PrevAndNext(
814 long layoutSetPrototypeId, String uuid,
815 OrderByComparator orderByComparator)
816 throws NoSuchLayoutSetPrototypeException, SystemException {
817 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
818
819 Session session = null;
820
821 try {
822 session = openSession();
823
824 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
825
826 array[0] = getByUuid_PrevAndNext(session, layoutSetPrototype, uuid,
827 orderByComparator, true);
828
829 array[1] = layoutSetPrototype;
830
831 array[2] = getByUuid_PrevAndNext(session, layoutSetPrototype, uuid,
832 orderByComparator, false);
833
834 return array;
835 }
836 catch (Exception e) {
837 throw processException(e);
838 }
839 finally {
840 closeSession(session);
841 }
842 }
843
844 protected LayoutSetPrototype getByUuid_PrevAndNext(Session session,
845 LayoutSetPrototype layoutSetPrototype, String uuid,
846 OrderByComparator orderByComparator, boolean previous) {
847 StringBundler query = null;
848
849 if (orderByComparator != null) {
850 query = new StringBundler(6 +
851 (orderByComparator.getOrderByFields().length * 6));
852 }
853 else {
854 query = new StringBundler(3);
855 }
856
857 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
858
859 if (uuid == null) {
860 query.append(_FINDER_COLUMN_UUID_UUID_1);
861 }
862 else {
863 if (uuid.equals(StringPool.BLANK)) {
864 query.append(_FINDER_COLUMN_UUID_UUID_3);
865 }
866 else {
867 query.append(_FINDER_COLUMN_UUID_UUID_2);
868 }
869 }
870
871 if (orderByComparator != null) {
872 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
873
874 if (orderByConditionFields.length > 0) {
875 query.append(WHERE_AND);
876 }
877
878 for (int i = 0; i < orderByConditionFields.length; i++) {
879 query.append(_ORDER_BY_ENTITY_ALIAS);
880 query.append(orderByConditionFields[i]);
881
882 if ((i + 1) < orderByConditionFields.length) {
883 if (orderByComparator.isAscending() ^ previous) {
884 query.append(WHERE_GREATER_THAN_HAS_NEXT);
885 }
886 else {
887 query.append(WHERE_LESSER_THAN_HAS_NEXT);
888 }
889 }
890 else {
891 if (orderByComparator.isAscending() ^ previous) {
892 query.append(WHERE_GREATER_THAN);
893 }
894 else {
895 query.append(WHERE_LESSER_THAN);
896 }
897 }
898 }
899
900 query.append(ORDER_BY_CLAUSE);
901
902 String[] orderByFields = orderByComparator.getOrderByFields();
903
904 for (int i = 0; i < orderByFields.length; i++) {
905 query.append(_ORDER_BY_ENTITY_ALIAS);
906 query.append(orderByFields[i]);
907
908 if ((i + 1) < orderByFields.length) {
909 if (orderByComparator.isAscending() ^ previous) {
910 query.append(ORDER_BY_ASC_HAS_NEXT);
911 }
912 else {
913 query.append(ORDER_BY_DESC_HAS_NEXT);
914 }
915 }
916 else {
917 if (orderByComparator.isAscending() ^ previous) {
918 query.append(ORDER_BY_ASC);
919 }
920 else {
921 query.append(ORDER_BY_DESC);
922 }
923 }
924 }
925 }
926
927 String sql = query.toString();
928
929 Query q = session.createQuery(sql);
930
931 q.setFirstResult(0);
932 q.setMaxResults(2);
933
934 QueryPos qPos = QueryPos.getInstance(q);
935
936 if (uuid != null) {
937 qPos.add(uuid);
938 }
939
940 if (orderByComparator != null) {
941 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
942
943 for (Object value : values) {
944 qPos.add(value);
945 }
946 }
947
948 List<LayoutSetPrototype> list = q.list();
949
950 if (list.size() == 2) {
951 return list.get(1);
952 }
953 else {
954 return null;
955 }
956 }
957
958
965 public List<LayoutSetPrototype> filterFindByUuid(String uuid)
966 throws SystemException {
967 return filterFindByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
968 }
969
970
983 public List<LayoutSetPrototype> filterFindByUuid(String uuid, int start,
984 int end) throws SystemException {
985 return filterFindByUuid(uuid, start, end, null);
986 }
987
988
1002 public List<LayoutSetPrototype> filterFindByUuid(String uuid, int start,
1003 int end, OrderByComparator orderByComparator) throws SystemException {
1004 if (!InlineSQLHelperUtil.isEnabled()) {
1005 return findByUuid(uuid, start, end, orderByComparator);
1006 }
1007
1008 StringBundler query = null;
1009
1010 if (orderByComparator != null) {
1011 query = new StringBundler(3 +
1012 (orderByComparator.getOrderByFields().length * 3));
1013 }
1014 else {
1015 query = new StringBundler(2);
1016 }
1017
1018 if (getDB().isSupportsInlineDistinct()) {
1019 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1020 }
1021 else {
1022 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
1023 }
1024
1025 if (uuid == null) {
1026 query.append(_FINDER_COLUMN_UUID_UUID_1);
1027 }
1028 else {
1029 if (uuid.equals(StringPool.BLANK)) {
1030 query.append(_FINDER_COLUMN_UUID_UUID_3);
1031 }
1032 else {
1033 query.append(_FINDER_COLUMN_UUID_UUID_2);
1034 }
1035 }
1036
1037 if (!getDB().isSupportsInlineDistinct()) {
1038 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1039 }
1040
1041 if (orderByComparator != null) {
1042 if (getDB().isSupportsInlineDistinct()) {
1043 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1044 orderByComparator);
1045 }
1046 else {
1047 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1048 orderByComparator);
1049 }
1050 }
1051
1052 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1053 LayoutSetPrototype.class.getName(),
1054 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1055
1056 Session session = null;
1057
1058 try {
1059 session = openSession();
1060
1061 SQLQuery q = session.createSQLQuery(sql);
1062
1063 if (getDB().isSupportsInlineDistinct()) {
1064 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
1065 }
1066 else {
1067 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
1068 }
1069
1070 QueryPos qPos = QueryPos.getInstance(q);
1071
1072 if (uuid != null) {
1073 qPos.add(uuid);
1074 }
1075
1076 return (List<LayoutSetPrototype>)QueryUtil.list(q, getDialect(),
1077 start, end);
1078 }
1079 catch (Exception e) {
1080 throw processException(e);
1081 }
1082 finally {
1083 closeSession(session);
1084 }
1085 }
1086
1087
1097 public LayoutSetPrototype[] filterFindByUuid_PrevAndNext(
1098 long layoutSetPrototypeId, String uuid,
1099 OrderByComparator orderByComparator)
1100 throws NoSuchLayoutSetPrototypeException, SystemException {
1101 if (!InlineSQLHelperUtil.isEnabled()) {
1102 return findByUuid_PrevAndNext(layoutSetPrototypeId, uuid,
1103 orderByComparator);
1104 }
1105
1106 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
1107
1108 Session session = null;
1109
1110 try {
1111 session = openSession();
1112
1113 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
1114
1115 array[0] = filterGetByUuid_PrevAndNext(session, layoutSetPrototype,
1116 uuid, orderByComparator, true);
1117
1118 array[1] = layoutSetPrototype;
1119
1120 array[2] = filterGetByUuid_PrevAndNext(session, layoutSetPrototype,
1121 uuid, orderByComparator, false);
1122
1123 return array;
1124 }
1125 catch (Exception e) {
1126 throw processException(e);
1127 }
1128 finally {
1129 closeSession(session);
1130 }
1131 }
1132
1133 protected LayoutSetPrototype filterGetByUuid_PrevAndNext(Session session,
1134 LayoutSetPrototype layoutSetPrototype, String uuid,
1135 OrderByComparator orderByComparator, boolean previous) {
1136 StringBundler query = null;
1137
1138 if (orderByComparator != null) {
1139 query = new StringBundler(6 +
1140 (orderByComparator.getOrderByFields().length * 6));
1141 }
1142 else {
1143 query = new StringBundler(3);
1144 }
1145
1146 if (getDB().isSupportsInlineDistinct()) {
1147 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1148 }
1149 else {
1150 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
1151 }
1152
1153 if (uuid == null) {
1154 query.append(_FINDER_COLUMN_UUID_UUID_1);
1155 }
1156 else {
1157 if (uuid.equals(StringPool.BLANK)) {
1158 query.append(_FINDER_COLUMN_UUID_UUID_3);
1159 }
1160 else {
1161 query.append(_FINDER_COLUMN_UUID_UUID_2);
1162 }
1163 }
1164
1165 if (!getDB().isSupportsInlineDistinct()) {
1166 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1167 }
1168
1169 if (orderByComparator != null) {
1170 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1171
1172 if (orderByConditionFields.length > 0) {
1173 query.append(WHERE_AND);
1174 }
1175
1176 for (int i = 0; i < orderByConditionFields.length; i++) {
1177 if (getDB().isSupportsInlineDistinct()) {
1178 query.append(_ORDER_BY_ENTITY_ALIAS);
1179 }
1180 else {
1181 query.append(_ORDER_BY_ENTITY_TABLE);
1182 }
1183
1184 query.append(orderByConditionFields[i]);
1185
1186 if ((i + 1) < orderByConditionFields.length) {
1187 if (orderByComparator.isAscending() ^ previous) {
1188 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1189 }
1190 else {
1191 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1192 }
1193 }
1194 else {
1195 if (orderByComparator.isAscending() ^ previous) {
1196 query.append(WHERE_GREATER_THAN);
1197 }
1198 else {
1199 query.append(WHERE_LESSER_THAN);
1200 }
1201 }
1202 }
1203
1204 query.append(ORDER_BY_CLAUSE);
1205
1206 String[] orderByFields = orderByComparator.getOrderByFields();
1207
1208 for (int i = 0; i < orderByFields.length; i++) {
1209 if (getDB().isSupportsInlineDistinct()) {
1210 query.append(_ORDER_BY_ENTITY_ALIAS);
1211 }
1212 else {
1213 query.append(_ORDER_BY_ENTITY_TABLE);
1214 }
1215
1216 query.append(orderByFields[i]);
1217
1218 if ((i + 1) < orderByFields.length) {
1219 if (orderByComparator.isAscending() ^ previous) {
1220 query.append(ORDER_BY_ASC_HAS_NEXT);
1221 }
1222 else {
1223 query.append(ORDER_BY_DESC_HAS_NEXT);
1224 }
1225 }
1226 else {
1227 if (orderByComparator.isAscending() ^ previous) {
1228 query.append(ORDER_BY_ASC);
1229 }
1230 else {
1231 query.append(ORDER_BY_DESC);
1232 }
1233 }
1234 }
1235 }
1236
1237 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1238 LayoutSetPrototype.class.getName(),
1239 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1240
1241 SQLQuery q = session.createSQLQuery(sql);
1242
1243 q.setFirstResult(0);
1244 q.setMaxResults(2);
1245
1246 if (getDB().isSupportsInlineDistinct()) {
1247 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
1248 }
1249 else {
1250 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
1251 }
1252
1253 QueryPos qPos = QueryPos.getInstance(q);
1254
1255 if (uuid != null) {
1256 qPos.add(uuid);
1257 }
1258
1259 if (orderByComparator != null) {
1260 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
1261
1262 for (Object value : values) {
1263 qPos.add(value);
1264 }
1265 }
1266
1267 List<LayoutSetPrototype> list = q.list();
1268
1269 if (list.size() == 2) {
1270 return list.get(1);
1271 }
1272 else {
1273 return null;
1274 }
1275 }
1276
1277
1284 public List<LayoutSetPrototype> findByCompanyId(long companyId)
1285 throws SystemException {
1286 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1287 null);
1288 }
1289
1290
1303 public List<LayoutSetPrototype> findByCompanyId(long companyId, int start,
1304 int end) throws SystemException {
1305 return findByCompanyId(companyId, start, end, null);
1306 }
1307
1308
1322 public List<LayoutSetPrototype> findByCompanyId(long companyId, int start,
1323 int end, OrderByComparator orderByComparator) throws SystemException {
1324 FinderPath finderPath = null;
1325 Object[] finderArgs = null;
1326
1327 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1328 (orderByComparator == null)) {
1329 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
1330 finderArgs = new Object[] { companyId };
1331 }
1332 else {
1333 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
1334 finderArgs = new Object[] { companyId, start, end, orderByComparator };
1335 }
1336
1337 List<LayoutSetPrototype> list = (List<LayoutSetPrototype>)FinderCacheUtil.getResult(finderPath,
1338 finderArgs, this);
1339
1340 if ((list != null) && !list.isEmpty()) {
1341 for (LayoutSetPrototype layoutSetPrototype : list) {
1342 if ((companyId != layoutSetPrototype.getCompanyId())) {
1343 list = null;
1344
1345 break;
1346 }
1347 }
1348 }
1349
1350 if (list == null) {
1351 StringBundler query = null;
1352
1353 if (orderByComparator != null) {
1354 query = new StringBundler(3 +
1355 (orderByComparator.getOrderByFields().length * 3));
1356 }
1357 else {
1358 query = new StringBundler(2);
1359 }
1360
1361 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1362
1363 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1364
1365 if (orderByComparator != null) {
1366 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1367 orderByComparator);
1368 }
1369
1370 String sql = query.toString();
1371
1372 Session session = null;
1373
1374 try {
1375 session = openSession();
1376
1377 Query q = session.createQuery(sql);
1378
1379 QueryPos qPos = QueryPos.getInstance(q);
1380
1381 qPos.add(companyId);
1382
1383 list = (List<LayoutSetPrototype>)QueryUtil.list(q,
1384 getDialect(), start, end);
1385 }
1386 catch (Exception e) {
1387 throw processException(e);
1388 }
1389 finally {
1390 if (list == null) {
1391 FinderCacheUtil.removeResult(finderPath, finderArgs);
1392 }
1393 else {
1394 cacheResult(list);
1395
1396 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1397 }
1398
1399 closeSession(session);
1400 }
1401 }
1402
1403 return list;
1404 }
1405
1406
1415 public LayoutSetPrototype findByCompanyId_First(long companyId,
1416 OrderByComparator orderByComparator)
1417 throws NoSuchLayoutSetPrototypeException, SystemException {
1418 LayoutSetPrototype layoutSetPrototype = fetchByCompanyId_First(companyId,
1419 orderByComparator);
1420
1421 if (layoutSetPrototype != null) {
1422 return layoutSetPrototype;
1423 }
1424
1425 StringBundler msg = new StringBundler(4);
1426
1427 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1428
1429 msg.append("companyId=");
1430 msg.append(companyId);
1431
1432 msg.append(StringPool.CLOSE_CURLY_BRACE);
1433
1434 throw new NoSuchLayoutSetPrototypeException(msg.toString());
1435 }
1436
1437
1445 public LayoutSetPrototype fetchByCompanyId_First(long companyId,
1446 OrderByComparator orderByComparator) throws SystemException {
1447 List<LayoutSetPrototype> list = findByCompanyId(companyId, 0, 1,
1448 orderByComparator);
1449
1450 if (!list.isEmpty()) {
1451 return list.get(0);
1452 }
1453
1454 return null;
1455 }
1456
1457
1466 public LayoutSetPrototype findByCompanyId_Last(long companyId,
1467 OrderByComparator orderByComparator)
1468 throws NoSuchLayoutSetPrototypeException, SystemException {
1469 LayoutSetPrototype layoutSetPrototype = fetchByCompanyId_Last(companyId,
1470 orderByComparator);
1471
1472 if (layoutSetPrototype != null) {
1473 return layoutSetPrototype;
1474 }
1475
1476 StringBundler msg = new StringBundler(4);
1477
1478 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1479
1480 msg.append("companyId=");
1481 msg.append(companyId);
1482
1483 msg.append(StringPool.CLOSE_CURLY_BRACE);
1484
1485 throw new NoSuchLayoutSetPrototypeException(msg.toString());
1486 }
1487
1488
1496 public LayoutSetPrototype fetchByCompanyId_Last(long companyId,
1497 OrderByComparator orderByComparator) throws SystemException {
1498 int count = countByCompanyId(companyId);
1499
1500 List<LayoutSetPrototype> list = findByCompanyId(companyId, count - 1,
1501 count, orderByComparator);
1502
1503 if (!list.isEmpty()) {
1504 return list.get(0);
1505 }
1506
1507 return null;
1508 }
1509
1510
1520 public LayoutSetPrototype[] findByCompanyId_PrevAndNext(
1521 long layoutSetPrototypeId, long companyId,
1522 OrderByComparator orderByComparator)
1523 throws NoSuchLayoutSetPrototypeException, SystemException {
1524 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
1525
1526 Session session = null;
1527
1528 try {
1529 session = openSession();
1530
1531 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
1532
1533 array[0] = getByCompanyId_PrevAndNext(session, layoutSetPrototype,
1534 companyId, orderByComparator, true);
1535
1536 array[1] = layoutSetPrototype;
1537
1538 array[2] = getByCompanyId_PrevAndNext(session, layoutSetPrototype,
1539 companyId, orderByComparator, false);
1540
1541 return array;
1542 }
1543 catch (Exception e) {
1544 throw processException(e);
1545 }
1546 finally {
1547 closeSession(session);
1548 }
1549 }
1550
1551 protected LayoutSetPrototype getByCompanyId_PrevAndNext(Session session,
1552 LayoutSetPrototype layoutSetPrototype, long companyId,
1553 OrderByComparator orderByComparator, boolean previous) {
1554 StringBundler query = null;
1555
1556 if (orderByComparator != null) {
1557 query = new StringBundler(6 +
1558 (orderByComparator.getOrderByFields().length * 6));
1559 }
1560 else {
1561 query = new StringBundler(3);
1562 }
1563
1564 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1565
1566 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1567
1568 if (orderByComparator != null) {
1569 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1570
1571 if (orderByConditionFields.length > 0) {
1572 query.append(WHERE_AND);
1573 }
1574
1575 for (int i = 0; i < orderByConditionFields.length; i++) {
1576 query.append(_ORDER_BY_ENTITY_ALIAS);
1577 query.append(orderByConditionFields[i]);
1578
1579 if ((i + 1) < orderByConditionFields.length) {
1580 if (orderByComparator.isAscending() ^ previous) {
1581 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1582 }
1583 else {
1584 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1585 }
1586 }
1587 else {
1588 if (orderByComparator.isAscending() ^ previous) {
1589 query.append(WHERE_GREATER_THAN);
1590 }
1591 else {
1592 query.append(WHERE_LESSER_THAN);
1593 }
1594 }
1595 }
1596
1597 query.append(ORDER_BY_CLAUSE);
1598
1599 String[] orderByFields = orderByComparator.getOrderByFields();
1600
1601 for (int i = 0; i < orderByFields.length; i++) {
1602 query.append(_ORDER_BY_ENTITY_ALIAS);
1603 query.append(orderByFields[i]);
1604
1605 if ((i + 1) < orderByFields.length) {
1606 if (orderByComparator.isAscending() ^ previous) {
1607 query.append(ORDER_BY_ASC_HAS_NEXT);
1608 }
1609 else {
1610 query.append(ORDER_BY_DESC_HAS_NEXT);
1611 }
1612 }
1613 else {
1614 if (orderByComparator.isAscending() ^ previous) {
1615 query.append(ORDER_BY_ASC);
1616 }
1617 else {
1618 query.append(ORDER_BY_DESC);
1619 }
1620 }
1621 }
1622 }
1623
1624 String sql = query.toString();
1625
1626 Query q = session.createQuery(sql);
1627
1628 q.setFirstResult(0);
1629 q.setMaxResults(2);
1630
1631 QueryPos qPos = QueryPos.getInstance(q);
1632
1633 qPos.add(companyId);
1634
1635 if (orderByComparator != null) {
1636 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
1637
1638 for (Object value : values) {
1639 qPos.add(value);
1640 }
1641 }
1642
1643 List<LayoutSetPrototype> list = q.list();
1644
1645 if (list.size() == 2) {
1646 return list.get(1);
1647 }
1648 else {
1649 return null;
1650 }
1651 }
1652
1653
1660 public List<LayoutSetPrototype> filterFindByCompanyId(long companyId)
1661 throws SystemException {
1662 return filterFindByCompanyId(companyId, QueryUtil.ALL_POS,
1663 QueryUtil.ALL_POS, null);
1664 }
1665
1666
1679 public List<LayoutSetPrototype> filterFindByCompanyId(long companyId,
1680 int start, int end) throws SystemException {
1681 return filterFindByCompanyId(companyId, start, end, null);
1682 }
1683
1684
1698 public List<LayoutSetPrototype> filterFindByCompanyId(long companyId,
1699 int start, int end, OrderByComparator orderByComparator)
1700 throws SystemException {
1701 if (!InlineSQLHelperUtil.isEnabled()) {
1702 return findByCompanyId(companyId, start, end, orderByComparator);
1703 }
1704
1705 StringBundler query = null;
1706
1707 if (orderByComparator != null) {
1708 query = new StringBundler(3 +
1709 (orderByComparator.getOrderByFields().length * 3));
1710 }
1711 else {
1712 query = new StringBundler(2);
1713 }
1714
1715 if (getDB().isSupportsInlineDistinct()) {
1716 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1717 }
1718 else {
1719 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
1720 }
1721
1722 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1723
1724 if (!getDB().isSupportsInlineDistinct()) {
1725 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1726 }
1727
1728 if (orderByComparator != null) {
1729 if (getDB().isSupportsInlineDistinct()) {
1730 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1731 orderByComparator);
1732 }
1733 else {
1734 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1735 orderByComparator);
1736 }
1737 }
1738
1739 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1740 LayoutSetPrototype.class.getName(),
1741 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1742
1743 Session session = null;
1744
1745 try {
1746 session = openSession();
1747
1748 SQLQuery q = session.createSQLQuery(sql);
1749
1750 if (getDB().isSupportsInlineDistinct()) {
1751 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
1752 }
1753 else {
1754 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
1755 }
1756
1757 QueryPos qPos = QueryPos.getInstance(q);
1758
1759 qPos.add(companyId);
1760
1761 return (List<LayoutSetPrototype>)QueryUtil.list(q, getDialect(),
1762 start, end);
1763 }
1764 catch (Exception e) {
1765 throw processException(e);
1766 }
1767 finally {
1768 closeSession(session);
1769 }
1770 }
1771
1772
1782 public LayoutSetPrototype[] filterFindByCompanyId_PrevAndNext(
1783 long layoutSetPrototypeId, long companyId,
1784 OrderByComparator orderByComparator)
1785 throws NoSuchLayoutSetPrototypeException, SystemException {
1786 if (!InlineSQLHelperUtil.isEnabled()) {
1787 return findByCompanyId_PrevAndNext(layoutSetPrototypeId, companyId,
1788 orderByComparator);
1789 }
1790
1791 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
1792
1793 Session session = null;
1794
1795 try {
1796 session = openSession();
1797
1798 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
1799
1800 array[0] = filterGetByCompanyId_PrevAndNext(session,
1801 layoutSetPrototype, companyId, orderByComparator, true);
1802
1803 array[1] = layoutSetPrototype;
1804
1805 array[2] = filterGetByCompanyId_PrevAndNext(session,
1806 layoutSetPrototype, companyId, orderByComparator, false);
1807
1808 return array;
1809 }
1810 catch (Exception e) {
1811 throw processException(e);
1812 }
1813 finally {
1814 closeSession(session);
1815 }
1816 }
1817
1818 protected LayoutSetPrototype filterGetByCompanyId_PrevAndNext(
1819 Session session, LayoutSetPrototype layoutSetPrototype, long companyId,
1820 OrderByComparator orderByComparator, boolean previous) {
1821 StringBundler query = null;
1822
1823 if (orderByComparator != null) {
1824 query = new StringBundler(6 +
1825 (orderByComparator.getOrderByFields().length * 6));
1826 }
1827 else {
1828 query = new StringBundler(3);
1829 }
1830
1831 if (getDB().isSupportsInlineDistinct()) {
1832 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1833 }
1834 else {
1835 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
1836 }
1837
1838 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1839
1840 if (!getDB().isSupportsInlineDistinct()) {
1841 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1842 }
1843
1844 if (orderByComparator != null) {
1845 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1846
1847 if (orderByConditionFields.length > 0) {
1848 query.append(WHERE_AND);
1849 }
1850
1851 for (int i = 0; i < orderByConditionFields.length; i++) {
1852 if (getDB().isSupportsInlineDistinct()) {
1853 query.append(_ORDER_BY_ENTITY_ALIAS);
1854 }
1855 else {
1856 query.append(_ORDER_BY_ENTITY_TABLE);
1857 }
1858
1859 query.append(orderByConditionFields[i]);
1860
1861 if ((i + 1) < orderByConditionFields.length) {
1862 if (orderByComparator.isAscending() ^ previous) {
1863 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1864 }
1865 else {
1866 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1867 }
1868 }
1869 else {
1870 if (orderByComparator.isAscending() ^ previous) {
1871 query.append(WHERE_GREATER_THAN);
1872 }
1873 else {
1874 query.append(WHERE_LESSER_THAN);
1875 }
1876 }
1877 }
1878
1879 query.append(ORDER_BY_CLAUSE);
1880
1881 String[] orderByFields = orderByComparator.getOrderByFields();
1882
1883 for (int i = 0; i < orderByFields.length; i++) {
1884 if (getDB().isSupportsInlineDistinct()) {
1885 query.append(_ORDER_BY_ENTITY_ALIAS);
1886 }
1887 else {
1888 query.append(_ORDER_BY_ENTITY_TABLE);
1889 }
1890
1891 query.append(orderByFields[i]);
1892
1893 if ((i + 1) < orderByFields.length) {
1894 if (orderByComparator.isAscending() ^ previous) {
1895 query.append(ORDER_BY_ASC_HAS_NEXT);
1896 }
1897 else {
1898 query.append(ORDER_BY_DESC_HAS_NEXT);
1899 }
1900 }
1901 else {
1902 if (orderByComparator.isAscending() ^ previous) {
1903 query.append(ORDER_BY_ASC);
1904 }
1905 else {
1906 query.append(ORDER_BY_DESC);
1907 }
1908 }
1909 }
1910 }
1911
1912 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1913 LayoutSetPrototype.class.getName(),
1914 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1915
1916 SQLQuery q = session.createSQLQuery(sql);
1917
1918 q.setFirstResult(0);
1919 q.setMaxResults(2);
1920
1921 if (getDB().isSupportsInlineDistinct()) {
1922 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
1923 }
1924 else {
1925 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
1926 }
1927
1928 QueryPos qPos = QueryPos.getInstance(q);
1929
1930 qPos.add(companyId);
1931
1932 if (orderByComparator != null) {
1933 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
1934
1935 for (Object value : values) {
1936 qPos.add(value);
1937 }
1938 }
1939
1940 List<LayoutSetPrototype> list = q.list();
1941
1942 if (list.size() == 2) {
1943 return list.get(1);
1944 }
1945 else {
1946 return null;
1947 }
1948 }
1949
1950
1958 public List<LayoutSetPrototype> findByC_A(long companyId, boolean active)
1959 throws SystemException {
1960 return findByC_A(companyId, active, QueryUtil.ALL_POS,
1961 QueryUtil.ALL_POS, null);
1962 }
1963
1964
1978 public List<LayoutSetPrototype> findByC_A(long companyId, boolean active,
1979 int start, int end) throws SystemException {
1980 return findByC_A(companyId, active, start, end, null);
1981 }
1982
1983
1998 public List<LayoutSetPrototype> findByC_A(long companyId, boolean active,
1999 int start, int end, OrderByComparator orderByComparator)
2000 throws SystemException {
2001 FinderPath finderPath = null;
2002 Object[] finderArgs = null;
2003
2004 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2005 (orderByComparator == null)) {
2006 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_A;
2007 finderArgs = new Object[] { companyId, active };
2008 }
2009 else {
2010 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_A;
2011 finderArgs = new Object[] {
2012 companyId, active,
2013
2014 start, end, orderByComparator
2015 };
2016 }
2017
2018 List<LayoutSetPrototype> list = (List<LayoutSetPrototype>)FinderCacheUtil.getResult(finderPath,
2019 finderArgs, this);
2020
2021 if ((list != null) && !list.isEmpty()) {
2022 for (LayoutSetPrototype layoutSetPrototype : list) {
2023 if ((companyId != layoutSetPrototype.getCompanyId()) ||
2024 (active != layoutSetPrototype.getActive())) {
2025 list = null;
2026
2027 break;
2028 }
2029 }
2030 }
2031
2032 if (list == null) {
2033 StringBundler query = null;
2034
2035 if (orderByComparator != null) {
2036 query = new StringBundler(4 +
2037 (orderByComparator.getOrderByFields().length * 3));
2038 }
2039 else {
2040 query = new StringBundler(3);
2041 }
2042
2043 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
2044
2045 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2046
2047 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2048
2049 if (orderByComparator != null) {
2050 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2051 orderByComparator);
2052 }
2053
2054 String sql = query.toString();
2055
2056 Session session = null;
2057
2058 try {
2059 session = openSession();
2060
2061 Query q = session.createQuery(sql);
2062
2063 QueryPos qPos = QueryPos.getInstance(q);
2064
2065 qPos.add(companyId);
2066
2067 qPos.add(active);
2068
2069 list = (List<LayoutSetPrototype>)QueryUtil.list(q,
2070 getDialect(), start, end);
2071 }
2072 catch (Exception e) {
2073 throw processException(e);
2074 }
2075 finally {
2076 if (list == null) {
2077 FinderCacheUtil.removeResult(finderPath, finderArgs);
2078 }
2079 else {
2080 cacheResult(list);
2081
2082 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2083 }
2084
2085 closeSession(session);
2086 }
2087 }
2088
2089 return list;
2090 }
2091
2092
2102 public LayoutSetPrototype findByC_A_First(long companyId, boolean active,
2103 OrderByComparator orderByComparator)
2104 throws NoSuchLayoutSetPrototypeException, SystemException {
2105 LayoutSetPrototype layoutSetPrototype = fetchByC_A_First(companyId,
2106 active, orderByComparator);
2107
2108 if (layoutSetPrototype != null) {
2109 return layoutSetPrototype;
2110 }
2111
2112 StringBundler msg = new StringBundler(6);
2113
2114 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2115
2116 msg.append("companyId=");
2117 msg.append(companyId);
2118
2119 msg.append(", active=");
2120 msg.append(active);
2121
2122 msg.append(StringPool.CLOSE_CURLY_BRACE);
2123
2124 throw new NoSuchLayoutSetPrototypeException(msg.toString());
2125 }
2126
2127
2136 public LayoutSetPrototype fetchByC_A_First(long companyId, boolean active,
2137 OrderByComparator orderByComparator) throws SystemException {
2138 List<LayoutSetPrototype> list = findByC_A(companyId, active, 0, 1,
2139 orderByComparator);
2140
2141 if (!list.isEmpty()) {
2142 return list.get(0);
2143 }
2144
2145 return null;
2146 }
2147
2148
2158 public LayoutSetPrototype findByC_A_Last(long companyId, boolean active,
2159 OrderByComparator orderByComparator)
2160 throws NoSuchLayoutSetPrototypeException, SystemException {
2161 LayoutSetPrototype layoutSetPrototype = fetchByC_A_Last(companyId,
2162 active, orderByComparator);
2163
2164 if (layoutSetPrototype != null) {
2165 return layoutSetPrototype;
2166 }
2167
2168 StringBundler msg = new StringBundler(6);
2169
2170 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2171
2172 msg.append("companyId=");
2173 msg.append(companyId);
2174
2175 msg.append(", active=");
2176 msg.append(active);
2177
2178 msg.append(StringPool.CLOSE_CURLY_BRACE);
2179
2180 throw new NoSuchLayoutSetPrototypeException(msg.toString());
2181 }
2182
2183
2192 public LayoutSetPrototype fetchByC_A_Last(long companyId, boolean active,
2193 OrderByComparator orderByComparator) throws SystemException {
2194 int count = countByC_A(companyId, active);
2195
2196 List<LayoutSetPrototype> list = findByC_A(companyId, active, count - 1,
2197 count, orderByComparator);
2198
2199 if (!list.isEmpty()) {
2200 return list.get(0);
2201 }
2202
2203 return null;
2204 }
2205
2206
2217 public LayoutSetPrototype[] findByC_A_PrevAndNext(
2218 long layoutSetPrototypeId, long companyId, boolean active,
2219 OrderByComparator orderByComparator)
2220 throws NoSuchLayoutSetPrototypeException, SystemException {
2221 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
2222
2223 Session session = null;
2224
2225 try {
2226 session = openSession();
2227
2228 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
2229
2230 array[0] = getByC_A_PrevAndNext(session, layoutSetPrototype,
2231 companyId, active, orderByComparator, true);
2232
2233 array[1] = layoutSetPrototype;
2234
2235 array[2] = getByC_A_PrevAndNext(session, layoutSetPrototype,
2236 companyId, active, orderByComparator, false);
2237
2238 return array;
2239 }
2240 catch (Exception e) {
2241 throw processException(e);
2242 }
2243 finally {
2244 closeSession(session);
2245 }
2246 }
2247
2248 protected LayoutSetPrototype getByC_A_PrevAndNext(Session session,
2249 LayoutSetPrototype layoutSetPrototype, long companyId, boolean active,
2250 OrderByComparator orderByComparator, boolean previous) {
2251 StringBundler query = null;
2252
2253 if (orderByComparator != null) {
2254 query = new StringBundler(6 +
2255 (orderByComparator.getOrderByFields().length * 6));
2256 }
2257 else {
2258 query = new StringBundler(3);
2259 }
2260
2261 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
2262
2263 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2264
2265 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2266
2267 if (orderByComparator != null) {
2268 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2269
2270 if (orderByConditionFields.length > 0) {
2271 query.append(WHERE_AND);
2272 }
2273
2274 for (int i = 0; i < orderByConditionFields.length; i++) {
2275 query.append(_ORDER_BY_ENTITY_ALIAS);
2276 query.append(orderByConditionFields[i]);
2277
2278 if ((i + 1) < orderByConditionFields.length) {
2279 if (orderByComparator.isAscending() ^ previous) {
2280 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2281 }
2282 else {
2283 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2284 }
2285 }
2286 else {
2287 if (orderByComparator.isAscending() ^ previous) {
2288 query.append(WHERE_GREATER_THAN);
2289 }
2290 else {
2291 query.append(WHERE_LESSER_THAN);
2292 }
2293 }
2294 }
2295
2296 query.append(ORDER_BY_CLAUSE);
2297
2298 String[] orderByFields = orderByComparator.getOrderByFields();
2299
2300 for (int i = 0; i < orderByFields.length; i++) {
2301 query.append(_ORDER_BY_ENTITY_ALIAS);
2302 query.append(orderByFields[i]);
2303
2304 if ((i + 1) < orderByFields.length) {
2305 if (orderByComparator.isAscending() ^ previous) {
2306 query.append(ORDER_BY_ASC_HAS_NEXT);
2307 }
2308 else {
2309 query.append(ORDER_BY_DESC_HAS_NEXT);
2310 }
2311 }
2312 else {
2313 if (orderByComparator.isAscending() ^ previous) {
2314 query.append(ORDER_BY_ASC);
2315 }
2316 else {
2317 query.append(ORDER_BY_DESC);
2318 }
2319 }
2320 }
2321 }
2322
2323 String sql = query.toString();
2324
2325 Query q = session.createQuery(sql);
2326
2327 q.setFirstResult(0);
2328 q.setMaxResults(2);
2329
2330 QueryPos qPos = QueryPos.getInstance(q);
2331
2332 qPos.add(companyId);
2333
2334 qPos.add(active);
2335
2336 if (orderByComparator != null) {
2337 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
2338
2339 for (Object value : values) {
2340 qPos.add(value);
2341 }
2342 }
2343
2344 List<LayoutSetPrototype> list = q.list();
2345
2346 if (list.size() == 2) {
2347 return list.get(1);
2348 }
2349 else {
2350 return null;
2351 }
2352 }
2353
2354
2362 public List<LayoutSetPrototype> filterFindByC_A(long companyId,
2363 boolean active) throws SystemException {
2364 return filterFindByC_A(companyId, active, QueryUtil.ALL_POS,
2365 QueryUtil.ALL_POS, null);
2366 }
2367
2368
2382 public List<LayoutSetPrototype> filterFindByC_A(long companyId,
2383 boolean active, int start, int end) throws SystemException {
2384 return filterFindByC_A(companyId, active, start, end, null);
2385 }
2386
2387
2402 public List<LayoutSetPrototype> filterFindByC_A(long companyId,
2403 boolean active, int start, int end, OrderByComparator orderByComparator)
2404 throws SystemException {
2405 if (!InlineSQLHelperUtil.isEnabled()) {
2406 return findByC_A(companyId, active, start, end, orderByComparator);
2407 }
2408
2409 StringBundler query = null;
2410
2411 if (orderByComparator != null) {
2412 query = new StringBundler(4 +
2413 (orderByComparator.getOrderByFields().length * 3));
2414 }
2415 else {
2416 query = new StringBundler(3);
2417 }
2418
2419 if (getDB().isSupportsInlineDistinct()) {
2420 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
2421 }
2422 else {
2423 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
2424 }
2425
2426 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2427
2428 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2429
2430 if (!getDB().isSupportsInlineDistinct()) {
2431 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
2432 }
2433
2434 if (orderByComparator != null) {
2435 if (getDB().isSupportsInlineDistinct()) {
2436 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2437 orderByComparator);
2438 }
2439 else {
2440 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2441 orderByComparator);
2442 }
2443 }
2444
2445 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2446 LayoutSetPrototype.class.getName(),
2447 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2448
2449 Session session = null;
2450
2451 try {
2452 session = openSession();
2453
2454 SQLQuery q = session.createSQLQuery(sql);
2455
2456 if (getDB().isSupportsInlineDistinct()) {
2457 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
2458 }
2459 else {
2460 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
2461 }
2462
2463 QueryPos qPos = QueryPos.getInstance(q);
2464
2465 qPos.add(companyId);
2466
2467 qPos.add(active);
2468
2469 return (List<LayoutSetPrototype>)QueryUtil.list(q, getDialect(),
2470 start, end);
2471 }
2472 catch (Exception e) {
2473 throw processException(e);
2474 }
2475 finally {
2476 closeSession(session);
2477 }
2478 }
2479
2480
2491 public LayoutSetPrototype[] filterFindByC_A_PrevAndNext(
2492 long layoutSetPrototypeId, long companyId, boolean active,
2493 OrderByComparator orderByComparator)
2494 throws NoSuchLayoutSetPrototypeException, SystemException {
2495 if (!InlineSQLHelperUtil.isEnabled()) {
2496 return findByC_A_PrevAndNext(layoutSetPrototypeId, companyId,
2497 active, orderByComparator);
2498 }
2499
2500 LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
2501
2502 Session session = null;
2503
2504 try {
2505 session = openSession();
2506
2507 LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
2508
2509 array[0] = filterGetByC_A_PrevAndNext(session, layoutSetPrototype,
2510 companyId, active, orderByComparator, true);
2511
2512 array[1] = layoutSetPrototype;
2513
2514 array[2] = filterGetByC_A_PrevAndNext(session, layoutSetPrototype,
2515 companyId, active, orderByComparator, false);
2516
2517 return array;
2518 }
2519 catch (Exception e) {
2520 throw processException(e);
2521 }
2522 finally {
2523 closeSession(session);
2524 }
2525 }
2526
2527 protected LayoutSetPrototype filterGetByC_A_PrevAndNext(Session session,
2528 LayoutSetPrototype layoutSetPrototype, long companyId, boolean active,
2529 OrderByComparator orderByComparator, boolean previous) {
2530 StringBundler query = null;
2531
2532 if (orderByComparator != null) {
2533 query = new StringBundler(6 +
2534 (orderByComparator.getOrderByFields().length * 6));
2535 }
2536 else {
2537 query = new StringBundler(3);
2538 }
2539
2540 if (getDB().isSupportsInlineDistinct()) {
2541 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
2542 }
2543 else {
2544 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
2545 }
2546
2547 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2548
2549 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2550
2551 if (!getDB().isSupportsInlineDistinct()) {
2552 query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
2553 }
2554
2555 if (orderByComparator != null) {
2556 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2557
2558 if (orderByConditionFields.length > 0) {
2559 query.append(WHERE_AND);
2560 }
2561
2562 for (int i = 0; i < orderByConditionFields.length; i++) {
2563 if (getDB().isSupportsInlineDistinct()) {
2564 query.append(_ORDER_BY_ENTITY_ALIAS);
2565 }
2566 else {
2567 query.append(_ORDER_BY_ENTITY_TABLE);
2568 }
2569
2570 query.append(orderByConditionFields[i]);
2571
2572 if ((i + 1) < orderByConditionFields.length) {
2573 if (orderByComparator.isAscending() ^ previous) {
2574 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2575 }
2576 else {
2577 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2578 }
2579 }
2580 else {
2581 if (orderByComparator.isAscending() ^ previous) {
2582 query.append(WHERE_GREATER_THAN);
2583 }
2584 else {
2585 query.append(WHERE_LESSER_THAN);
2586 }
2587 }
2588 }
2589
2590 query.append(ORDER_BY_CLAUSE);
2591
2592 String[] orderByFields = orderByComparator.getOrderByFields();
2593
2594 for (int i = 0; i < orderByFields.length; i++) {
2595 if (getDB().isSupportsInlineDistinct()) {
2596 query.append(_ORDER_BY_ENTITY_ALIAS);
2597 }
2598 else {
2599 query.append(_ORDER_BY_ENTITY_TABLE);
2600 }
2601
2602 query.append(orderByFields[i]);
2603
2604 if ((i + 1) < orderByFields.length) {
2605 if (orderByComparator.isAscending() ^ previous) {
2606 query.append(ORDER_BY_ASC_HAS_NEXT);
2607 }
2608 else {
2609 query.append(ORDER_BY_DESC_HAS_NEXT);
2610 }
2611 }
2612 else {
2613 if (orderByComparator.isAscending() ^ previous) {
2614 query.append(ORDER_BY_ASC);
2615 }
2616 else {
2617 query.append(ORDER_BY_DESC);
2618 }
2619 }
2620 }
2621 }
2622
2623 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2624 LayoutSetPrototype.class.getName(),
2625 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2626
2627 SQLQuery q = session.createSQLQuery(sql);
2628
2629 q.setFirstResult(0);
2630 q.setMaxResults(2);
2631
2632 if (getDB().isSupportsInlineDistinct()) {
2633 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
2634 }
2635 else {
2636 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
2637 }
2638
2639 QueryPos qPos = QueryPos.getInstance(q);
2640
2641 qPos.add(companyId);
2642
2643 qPos.add(active);
2644
2645 if (orderByComparator != null) {
2646 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetPrototype);
2647
2648 for (Object value : values) {
2649 qPos.add(value);
2650 }
2651 }
2652
2653 List<LayoutSetPrototype> list = q.list();
2654
2655 if (list.size() == 2) {
2656 return list.get(1);
2657 }
2658 else {
2659 return null;
2660 }
2661 }
2662
2663
2669 public List<LayoutSetPrototype> findAll() throws SystemException {
2670 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2671 }
2672
2673
2685 public List<LayoutSetPrototype> findAll(int start, int end)
2686 throws SystemException {
2687 return findAll(start, end, null);
2688 }
2689
2690
2703 public List<LayoutSetPrototype> findAll(int start, int end,
2704 OrderByComparator orderByComparator) throws SystemException {
2705 FinderPath finderPath = null;
2706 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2707
2708 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2709 (orderByComparator == null)) {
2710 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2711 finderArgs = FINDER_ARGS_EMPTY;
2712 }
2713 else {
2714 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2715 finderArgs = new Object[] { start, end, orderByComparator };
2716 }
2717
2718 List<LayoutSetPrototype> list = (List<LayoutSetPrototype>)FinderCacheUtil.getResult(finderPath,
2719 finderArgs, this);
2720
2721 if (list == null) {
2722 StringBundler query = null;
2723 String sql = null;
2724
2725 if (orderByComparator != null) {
2726 query = new StringBundler(2 +
2727 (orderByComparator.getOrderByFields().length * 3));
2728
2729 query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE);
2730
2731 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2732 orderByComparator);
2733
2734 sql = query.toString();
2735 }
2736 else {
2737 sql = _SQL_SELECT_LAYOUTSETPROTOTYPE;
2738 }
2739
2740 Session session = null;
2741
2742 try {
2743 session = openSession();
2744
2745 Query q = session.createQuery(sql);
2746
2747 if (orderByComparator == null) {
2748 list = (List<LayoutSetPrototype>)QueryUtil.list(q,
2749 getDialect(), start, end, false);
2750
2751 Collections.sort(list);
2752 }
2753 else {
2754 list = (List<LayoutSetPrototype>)QueryUtil.list(q,
2755 getDialect(), start, end);
2756 }
2757 }
2758 catch (Exception e) {
2759 throw processException(e);
2760 }
2761 finally {
2762 if (list == null) {
2763 FinderCacheUtil.removeResult(finderPath, finderArgs);
2764 }
2765 else {
2766 cacheResult(list);
2767
2768 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2769 }
2770
2771 closeSession(session);
2772 }
2773 }
2774
2775 return list;
2776 }
2777
2778
2784 public void removeByUuid(String uuid) throws SystemException {
2785 for (LayoutSetPrototype layoutSetPrototype : findByUuid(uuid)) {
2786 remove(layoutSetPrototype);
2787 }
2788 }
2789
2790
2796 public void removeByCompanyId(long companyId) throws SystemException {
2797 for (LayoutSetPrototype layoutSetPrototype : findByCompanyId(companyId)) {
2798 remove(layoutSetPrototype);
2799 }
2800 }
2801
2802
2809 public void removeByC_A(long companyId, boolean active)
2810 throws SystemException {
2811 for (LayoutSetPrototype layoutSetPrototype : findByC_A(companyId, active)) {
2812 remove(layoutSetPrototype);
2813 }
2814 }
2815
2816
2821 public void removeAll() throws SystemException {
2822 for (LayoutSetPrototype layoutSetPrototype : findAll()) {
2823 remove(layoutSetPrototype);
2824 }
2825 }
2826
2827
2834 public int countByUuid(String uuid) throws SystemException {
2835 Object[] finderArgs = new Object[] { uuid };
2836
2837 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2838 finderArgs, this);
2839
2840 if (count == null) {
2841 StringBundler query = new StringBundler(2);
2842
2843 query.append(_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
2844
2845 if (uuid == null) {
2846 query.append(_FINDER_COLUMN_UUID_UUID_1);
2847 }
2848 else {
2849 if (uuid.equals(StringPool.BLANK)) {
2850 query.append(_FINDER_COLUMN_UUID_UUID_3);
2851 }
2852 else {
2853 query.append(_FINDER_COLUMN_UUID_UUID_2);
2854 }
2855 }
2856
2857 String sql = query.toString();
2858
2859 Session session = null;
2860
2861 try {
2862 session = openSession();
2863
2864 Query q = session.createQuery(sql);
2865
2866 QueryPos qPos = QueryPos.getInstance(q);
2867
2868 if (uuid != null) {
2869 qPos.add(uuid);
2870 }
2871
2872 count = (Long)q.uniqueResult();
2873 }
2874 catch (Exception e) {
2875 throw processException(e);
2876 }
2877 finally {
2878 if (count == null) {
2879 count = Long.valueOf(0);
2880 }
2881
2882 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2883 finderArgs, count);
2884
2885 closeSession(session);
2886 }
2887 }
2888
2889 return count.intValue();
2890 }
2891
2892
2899 public int filterCountByUuid(String uuid) throws SystemException {
2900 if (!InlineSQLHelperUtil.isEnabled()) {
2901 return countByUuid(uuid);
2902 }
2903
2904 StringBundler query = new StringBundler(2);
2905
2906 query.append(_FILTER_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
2907
2908 if (uuid == null) {
2909 query.append(_FINDER_COLUMN_UUID_UUID_1);
2910 }
2911 else {
2912 if (uuid.equals(StringPool.BLANK)) {
2913 query.append(_FINDER_COLUMN_UUID_UUID_3);
2914 }
2915 else {
2916 query.append(_FINDER_COLUMN_UUID_UUID_2);
2917 }
2918 }
2919
2920 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2921 LayoutSetPrototype.class.getName(),
2922 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2923
2924 Session session = null;
2925
2926 try {
2927 session = openSession();
2928
2929 SQLQuery q = session.createSQLQuery(sql);
2930
2931 q.addScalar(COUNT_COLUMN_NAME,
2932 com.liferay.portal.kernel.dao.orm.Type.LONG);
2933
2934 QueryPos qPos = QueryPos.getInstance(q);
2935
2936 if (uuid != null) {
2937 qPos.add(uuid);
2938 }
2939
2940 Long count = (Long)q.uniqueResult();
2941
2942 return count.intValue();
2943 }
2944 catch (Exception e) {
2945 throw processException(e);
2946 }
2947 finally {
2948 closeSession(session);
2949 }
2950 }
2951
2952
2959 public int countByCompanyId(long companyId) throws SystemException {
2960 Object[] finderArgs = new Object[] { companyId };
2961
2962 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2963 finderArgs, this);
2964
2965 if (count == null) {
2966 StringBundler query = new StringBundler(2);
2967
2968 query.append(_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
2969
2970 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2971
2972 String sql = query.toString();
2973
2974 Session session = null;
2975
2976 try {
2977 session = openSession();
2978
2979 Query q = session.createQuery(sql);
2980
2981 QueryPos qPos = QueryPos.getInstance(q);
2982
2983 qPos.add(companyId);
2984
2985 count = (Long)q.uniqueResult();
2986 }
2987 catch (Exception e) {
2988 throw processException(e);
2989 }
2990 finally {
2991 if (count == null) {
2992 count = Long.valueOf(0);
2993 }
2994
2995 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2996 finderArgs, count);
2997
2998 closeSession(session);
2999 }
3000 }
3001
3002 return count.intValue();
3003 }
3004
3005
3012 public int filterCountByCompanyId(long companyId) throws SystemException {
3013 if (!InlineSQLHelperUtil.isEnabled()) {
3014 return countByCompanyId(companyId);
3015 }
3016
3017 StringBundler query = new StringBundler(2);
3018
3019 query.append(_FILTER_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
3020
3021 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_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 Long count = (Long)q.uniqueResult();
3042
3043 return count.intValue();
3044 }
3045 catch (Exception e) {
3046 throw processException(e);
3047 }
3048 finally {
3049 closeSession(session);
3050 }
3051 }
3052
3053
3061 public int countByC_A(long companyId, boolean active)
3062 throws SystemException {
3063 Object[] finderArgs = new Object[] { companyId, active };
3064
3065 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_A,
3066 finderArgs, this);
3067
3068 if (count == null) {
3069 StringBundler query = new StringBundler(3);
3070
3071 query.append(_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
3072
3073 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
3074
3075 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
3076
3077 String sql = query.toString();
3078
3079 Session session = null;
3080
3081 try {
3082 session = openSession();
3083
3084 Query q = session.createQuery(sql);
3085
3086 QueryPos qPos = QueryPos.getInstance(q);
3087
3088 qPos.add(companyId);
3089
3090 qPos.add(active);
3091
3092 count = (Long)q.uniqueResult();
3093 }
3094 catch (Exception e) {
3095 throw processException(e);
3096 }
3097 finally {
3098 if (count == null) {
3099 count = Long.valueOf(0);
3100 }
3101
3102 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_A, finderArgs,
3103 count);
3104
3105 closeSession(session);
3106 }
3107 }
3108
3109 return count.intValue();
3110 }
3111
3112
3120 public int filterCountByC_A(long companyId, boolean active)
3121 throws SystemException {
3122 if (!InlineSQLHelperUtil.isEnabled()) {
3123 return countByC_A(companyId, active);
3124 }
3125
3126 StringBundler query = new StringBundler(3);
3127
3128 query.append(_FILTER_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
3129
3130 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
3131
3132 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
3133
3134 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3135 LayoutSetPrototype.class.getName(),
3136 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3137
3138 Session session = null;
3139
3140 try {
3141 session = openSession();
3142
3143 SQLQuery q = session.createSQLQuery(sql);
3144
3145 q.addScalar(COUNT_COLUMN_NAME,
3146 com.liferay.portal.kernel.dao.orm.Type.LONG);
3147
3148 QueryPos qPos = QueryPos.getInstance(q);
3149
3150 qPos.add(companyId);
3151
3152 qPos.add(active);
3153
3154 Long count = (Long)q.uniqueResult();
3155
3156 return count.intValue();
3157 }
3158 catch (Exception e) {
3159 throw processException(e);
3160 }
3161 finally {
3162 closeSession(session);
3163 }
3164 }
3165
3166
3172 public int countAll() throws SystemException {
3173 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3174 FINDER_ARGS_EMPTY, this);
3175
3176 if (count == null) {
3177 Session session = null;
3178
3179 try {
3180 session = openSession();
3181
3182 Query q = session.createQuery(_SQL_COUNT_LAYOUTSETPROTOTYPE);
3183
3184 count = (Long)q.uniqueResult();
3185 }
3186 catch (Exception e) {
3187 throw processException(e);
3188 }
3189 finally {
3190 if (count == null) {
3191 count = Long.valueOf(0);
3192 }
3193
3194 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3195 FINDER_ARGS_EMPTY, count);
3196
3197 closeSession(session);
3198 }
3199 }
3200
3201 return count.intValue();
3202 }
3203
3204
3207 public void afterPropertiesSet() {
3208 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3209 com.liferay.portal.util.PropsUtil.get(
3210 "value.object.listener.com.liferay.portal.model.LayoutSetPrototype")));
3211
3212 if (listenerClassNames.length > 0) {
3213 try {
3214 List<ModelListener<LayoutSetPrototype>> listenersList = new ArrayList<ModelListener<LayoutSetPrototype>>();
3215
3216 for (String listenerClassName : listenerClassNames) {
3217 Class<?> clazz = getClass();
3218
3219 listenersList.add((ModelListener<LayoutSetPrototype>)InstanceFactory.newInstance(
3220 clazz.getClassLoader(), listenerClassName));
3221 }
3222
3223 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3224 }
3225 catch (Exception e) {
3226 _log.error(e);
3227 }
3228 }
3229 }
3230
3231 public void destroy() {
3232 EntityCacheUtil.removeCache(LayoutSetPrototypeImpl.class.getName());
3233 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3234 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3235 }
3236
3237 @BeanReference(type = AccountPersistence.class)
3238 protected AccountPersistence accountPersistence;
3239 @BeanReference(type = AddressPersistence.class)
3240 protected AddressPersistence addressPersistence;
3241 @BeanReference(type = BrowserTrackerPersistence.class)
3242 protected BrowserTrackerPersistence browserTrackerPersistence;
3243 @BeanReference(type = ClassNamePersistence.class)
3244 protected ClassNamePersistence classNamePersistence;
3245 @BeanReference(type = ClusterGroupPersistence.class)
3246 protected ClusterGroupPersistence clusterGroupPersistence;
3247 @BeanReference(type = CompanyPersistence.class)
3248 protected CompanyPersistence companyPersistence;
3249 @BeanReference(type = ContactPersistence.class)
3250 protected ContactPersistence contactPersistence;
3251 @BeanReference(type = CountryPersistence.class)
3252 protected CountryPersistence countryPersistence;
3253 @BeanReference(type = EmailAddressPersistence.class)
3254 protected EmailAddressPersistence emailAddressPersistence;
3255 @BeanReference(type = GroupPersistence.class)
3256 protected GroupPersistence groupPersistence;
3257 @BeanReference(type = ImagePersistence.class)
3258 protected ImagePersistence imagePersistence;
3259 @BeanReference(type = LayoutPersistence.class)
3260 protected LayoutPersistence layoutPersistence;
3261 @BeanReference(type = LayoutBranchPersistence.class)
3262 protected LayoutBranchPersistence layoutBranchPersistence;
3263 @BeanReference(type = LayoutPrototypePersistence.class)
3264 protected LayoutPrototypePersistence layoutPrototypePersistence;
3265 @BeanReference(type = LayoutRevisionPersistence.class)
3266 protected LayoutRevisionPersistence layoutRevisionPersistence;
3267 @BeanReference(type = LayoutSetPersistence.class)
3268 protected LayoutSetPersistence layoutSetPersistence;
3269 @BeanReference(type = LayoutSetBranchPersistence.class)
3270 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
3271 @BeanReference(type = LayoutSetPrototypePersistence.class)
3272 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
3273 @BeanReference(type = ListTypePersistence.class)
3274 protected ListTypePersistence listTypePersistence;
3275 @BeanReference(type = LockPersistence.class)
3276 protected LockPersistence lockPersistence;
3277 @BeanReference(type = MembershipRequestPersistence.class)
3278 protected MembershipRequestPersistence membershipRequestPersistence;
3279 @BeanReference(type = OrganizationPersistence.class)
3280 protected OrganizationPersistence organizationPersistence;
3281 @BeanReference(type = OrgGroupPermissionPersistence.class)
3282 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
3283 @BeanReference(type = OrgGroupRolePersistence.class)
3284 protected OrgGroupRolePersistence orgGroupRolePersistence;
3285 @BeanReference(type = OrgLaborPersistence.class)
3286 protected OrgLaborPersistence orgLaborPersistence;
3287 @BeanReference(type = PasswordPolicyPersistence.class)
3288 protected PasswordPolicyPersistence passwordPolicyPersistence;
3289 @BeanReference(type = PasswordPolicyRelPersistence.class)
3290 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
3291 @BeanReference(type = PasswordTrackerPersistence.class)
3292 protected PasswordTrackerPersistence passwordTrackerPersistence;
3293 @BeanReference(type = PermissionPersistence.class)
3294 protected PermissionPersistence permissionPersistence;
3295 @BeanReference(type = PhonePersistence.class)
3296 protected PhonePersistence phonePersistence;
3297 @BeanReference(type = PluginSettingPersistence.class)
3298 protected PluginSettingPersistence pluginSettingPersistence;
3299 @BeanReference(type = PortalPreferencesPersistence.class)
3300 protected PortalPreferencesPersistence portalPreferencesPersistence;
3301 @BeanReference(type = PortletPersistence.class)
3302 protected PortletPersistence portletPersistence;
3303 @BeanReference(type = PortletItemPersistence.class)
3304 protected PortletItemPersistence portletItemPersistence;
3305 @BeanReference(type = PortletPreferencesPersistence.class)
3306 protected PortletPreferencesPersistence portletPreferencesPersistence;
3307 @BeanReference(type = RegionPersistence.class)
3308 protected RegionPersistence regionPersistence;
3309 @BeanReference(type = ReleasePersistence.class)
3310 protected ReleasePersistence releasePersistence;
3311 @BeanReference(type = RepositoryPersistence.class)
3312 protected RepositoryPersistence repositoryPersistence;
3313 @BeanReference(type = RepositoryEntryPersistence.class)
3314 protected RepositoryEntryPersistence repositoryEntryPersistence;
3315 @BeanReference(type = ResourcePersistence.class)
3316 protected ResourcePersistence resourcePersistence;
3317 @BeanReference(type = ResourceActionPersistence.class)
3318 protected ResourceActionPersistence resourceActionPersistence;
3319 @BeanReference(type = ResourceBlockPersistence.class)
3320 protected ResourceBlockPersistence resourceBlockPersistence;
3321 @BeanReference(type = ResourceBlockPermissionPersistence.class)
3322 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
3323 @BeanReference(type = ResourceCodePersistence.class)
3324 protected ResourceCodePersistence resourceCodePersistence;
3325 @BeanReference(type = ResourcePermissionPersistence.class)
3326 protected ResourcePermissionPersistence resourcePermissionPersistence;
3327 @BeanReference(type = ResourceTypePermissionPersistence.class)
3328 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
3329 @BeanReference(type = RolePersistence.class)
3330 protected RolePersistence rolePersistence;
3331 @BeanReference(type = ServiceComponentPersistence.class)
3332 protected ServiceComponentPersistence serviceComponentPersistence;
3333 @BeanReference(type = ShardPersistence.class)
3334 protected ShardPersistence shardPersistence;
3335 @BeanReference(type = SubscriptionPersistence.class)
3336 protected SubscriptionPersistence subscriptionPersistence;
3337 @BeanReference(type = TeamPersistence.class)
3338 protected TeamPersistence teamPersistence;
3339 @BeanReference(type = TicketPersistence.class)
3340 protected TicketPersistence ticketPersistence;
3341 @BeanReference(type = UserPersistence.class)
3342 protected UserPersistence userPersistence;
3343 @BeanReference(type = UserGroupPersistence.class)
3344 protected UserGroupPersistence userGroupPersistence;
3345 @BeanReference(type = UserGroupGroupRolePersistence.class)
3346 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
3347 @BeanReference(type = UserGroupRolePersistence.class)
3348 protected UserGroupRolePersistence userGroupRolePersistence;
3349 @BeanReference(type = UserIdMapperPersistence.class)
3350 protected UserIdMapperPersistence userIdMapperPersistence;
3351 @BeanReference(type = UserNotificationEventPersistence.class)
3352 protected UserNotificationEventPersistence userNotificationEventPersistence;
3353 @BeanReference(type = UserTrackerPersistence.class)
3354 protected UserTrackerPersistence userTrackerPersistence;
3355 @BeanReference(type = UserTrackerPathPersistence.class)
3356 protected UserTrackerPathPersistence userTrackerPathPersistence;
3357 @BeanReference(type = VirtualHostPersistence.class)
3358 protected VirtualHostPersistence virtualHostPersistence;
3359 @BeanReference(type = WebDAVPropsPersistence.class)
3360 protected WebDAVPropsPersistence webDAVPropsPersistence;
3361 @BeanReference(type = WebsitePersistence.class)
3362 protected WebsitePersistence websitePersistence;
3363 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
3364 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
3365 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
3366 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
3367 private static final String _SQL_SELECT_LAYOUTSETPROTOTYPE = "SELECT layoutSetPrototype FROM LayoutSetPrototype layoutSetPrototype";
3368 private static final String _SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE = "SELECT layoutSetPrototype FROM LayoutSetPrototype layoutSetPrototype WHERE ";
3369 private static final String _SQL_COUNT_LAYOUTSETPROTOTYPE = "SELECT COUNT(layoutSetPrototype) FROM LayoutSetPrototype layoutSetPrototype";
3370 private static final String _SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE = "SELECT COUNT(layoutSetPrototype) FROM LayoutSetPrototype layoutSetPrototype WHERE ";
3371 private static final String _FINDER_COLUMN_UUID_UUID_1 = "layoutSetPrototype.uuid IS NULL";
3372 private static final String _FINDER_COLUMN_UUID_UUID_2 = "layoutSetPrototype.uuid = ?";
3373 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(layoutSetPrototype.uuid IS NULL OR layoutSetPrototype.uuid = ?)";
3374 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "layoutSetPrototype.companyId = ?";
3375 private static final String _FINDER_COLUMN_C_A_COMPANYID_2 = "layoutSetPrototype.companyId = ? AND ";
3376 private static final String _FINDER_COLUMN_C_A_ACTIVE_2 = "layoutSetPrototype.active = ?";
3377 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "layoutSetPrototype.layoutSetPrototypeId";
3378 private static final String _FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE = "SELECT DISTINCT {layoutSetPrototype.*} FROM LayoutSetPrototype layoutSetPrototype WHERE ";
3379 private static final String _FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1 =
3380 "SELECT {LayoutSetPrototype.*} FROM (SELECT DISTINCT layoutSetPrototype.layoutSetPrototypeId FROM LayoutSetPrototype layoutSetPrototype WHERE ";
3381 private static final String _FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2 =
3382 ") TEMP_TABLE INNER JOIN LayoutSetPrototype ON TEMP_TABLE.layoutSetPrototypeId = LayoutSetPrototype.layoutSetPrototypeId";
3383 private static final String _FILTER_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE = "SELECT COUNT(DISTINCT layoutSetPrototype.layoutSetPrototypeId) AS COUNT_VALUE FROM LayoutSetPrototype layoutSetPrototype WHERE ";
3384 private static final String _FILTER_ENTITY_ALIAS = "layoutSetPrototype";
3385 private static final String _FILTER_ENTITY_TABLE = "LayoutSetPrototype";
3386 private static final String _ORDER_BY_ENTITY_ALIAS = "layoutSetPrototype.";
3387 private static final String _ORDER_BY_ENTITY_TABLE = "LayoutSetPrototype.";
3388 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No LayoutSetPrototype exists with the primary key ";
3389 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No LayoutSetPrototype exists with the key {";
3390 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3391 private static Log _log = LogFactoryUtil.getLog(LayoutSetPrototypePersistenceImpl.class);
3392 private static LayoutSetPrototype _nullLayoutSetPrototype = new LayoutSetPrototypeImpl() {
3393 @Override
3394 public Object clone() {
3395 return this;
3396 }
3397
3398 @Override
3399 public CacheModel<LayoutSetPrototype> toCacheModel() {
3400 return _nullLayoutSetPrototypeCacheModel;
3401 }
3402 };
3403
3404 private static CacheModel<LayoutSetPrototype> _nullLayoutSetPrototypeCacheModel =
3405 new CacheModel<LayoutSetPrototype>() {
3406 public LayoutSetPrototype toEntityModel() {
3407 return _nullLayoutSetPrototype;
3408 }
3409 };
3410 }