001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchLayoutPrototypeException;
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.LayoutPrototype;
042 import com.liferay.portal.model.ModelListener;
043 import com.liferay.portal.model.impl.LayoutPrototypeImpl;
044 import com.liferay.portal.model.impl.LayoutPrototypeModelImpl;
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 LayoutPrototypePersistenceImpl extends BasePersistenceImpl<LayoutPrototype>
067 implements LayoutPrototypePersistence {
068
073 public static final String FINDER_CLASS_NAME_ENTITY = LayoutPrototypeImpl.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(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
079 LayoutPrototypeModelImpl.FINDER_CACHE_ENABLED,
080 LayoutPrototypeImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
081 "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(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
089 LayoutPrototypeModelImpl.FINDER_CACHE_ENABLED,
090 LayoutPrototypeImpl.class,
091 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
092 new String[] { String.class.getName() },
093 LayoutPrototypeModelImpl.UUID_COLUMN_BITMASK);
094 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
095 LayoutPrototypeModelImpl.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(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
100 LayoutPrototypeModelImpl.FINDER_CACHE_ENABLED,
101 LayoutPrototypeImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
102 "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(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
111 LayoutPrototypeModelImpl.FINDER_CACHE_ENABLED,
112 LayoutPrototypeImpl.class,
113 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
114 new String[] { Long.class.getName() },
115 LayoutPrototypeModelImpl.COMPANYID_COLUMN_BITMASK);
116 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
117 LayoutPrototypeModelImpl.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(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
121 LayoutPrototypeModelImpl.FINDER_CACHE_ENABLED,
122 LayoutPrototypeImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
123 "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(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
131 LayoutPrototypeModelImpl.FINDER_CACHE_ENABLED,
132 LayoutPrototypeImpl.class,
133 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_A",
134 new String[] { Long.class.getName(), Boolean.class.getName() },
135 LayoutPrototypeModelImpl.COMPANYID_COLUMN_BITMASK |
136 LayoutPrototypeModelImpl.ACTIVE_COLUMN_BITMASK);
137 public static final FinderPath FINDER_PATH_COUNT_BY_C_A = new FinderPath(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
138 LayoutPrototypeModelImpl.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(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
142 LayoutPrototypeModelImpl.FINDER_CACHE_ENABLED,
143 LayoutPrototypeImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
144 "findAll", new String[0]);
145 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
146 LayoutPrototypeModelImpl.FINDER_CACHE_ENABLED,
147 LayoutPrototypeImpl.class,
148 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
149 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
150 LayoutPrototypeModelImpl.FINDER_CACHE_ENABLED, Long.class,
151 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
152
153
158 public void cacheResult(LayoutPrototype layoutPrototype) {
159 EntityCacheUtil.putResult(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
160 LayoutPrototypeImpl.class, layoutPrototype.getPrimaryKey(),
161 layoutPrototype);
162
163 layoutPrototype.resetOriginalValues();
164 }
165
166
171 public void cacheResult(List<LayoutPrototype> layoutPrototypes) {
172 for (LayoutPrototype layoutPrototype : layoutPrototypes) {
173 if (EntityCacheUtil.getResult(
174 LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
175 LayoutPrototypeImpl.class,
176 layoutPrototype.getPrimaryKey()) == null) {
177 cacheResult(layoutPrototype);
178 }
179 else {
180 layoutPrototype.resetOriginalValues();
181 }
182 }
183 }
184
185
192 @Override
193 public void clearCache() {
194 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
195 CacheRegistryUtil.clear(LayoutPrototypeImpl.class.getName());
196 }
197
198 EntityCacheUtil.clearCache(LayoutPrototypeImpl.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(LayoutPrototype layoutPrototype) {
214 EntityCacheUtil.removeResult(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
215 LayoutPrototypeImpl.class, layoutPrototype.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<LayoutPrototype> layoutPrototypes) {
223 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
224 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
225
226 for (LayoutPrototype layoutPrototype : layoutPrototypes) {
227 EntityCacheUtil.removeResult(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
228 LayoutPrototypeImpl.class, layoutPrototype.getPrimaryKey());
229 }
230 }
231
232
238 public LayoutPrototype create(long layoutPrototypeId) {
239 LayoutPrototype layoutPrototype = new LayoutPrototypeImpl();
240
241 layoutPrototype.setNew(true);
242 layoutPrototype.setPrimaryKey(layoutPrototypeId);
243
244 String uuid = PortalUUIDUtil.generate();
245
246 layoutPrototype.setUuid(uuid);
247
248 return layoutPrototype;
249 }
250
251
259 public LayoutPrototype remove(long layoutPrototypeId)
260 throws NoSuchLayoutPrototypeException, SystemException {
261 return remove(Long.valueOf(layoutPrototypeId));
262 }
263
264
272 @Override
273 public LayoutPrototype remove(Serializable primaryKey)
274 throws NoSuchLayoutPrototypeException, SystemException {
275 Session session = null;
276
277 try {
278 session = openSession();
279
280 LayoutPrototype layoutPrototype = (LayoutPrototype)session.get(LayoutPrototypeImpl.class,
281 primaryKey);
282
283 if (layoutPrototype == null) {
284 if (_log.isWarnEnabled()) {
285 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
286 }
287
288 throw new NoSuchLayoutPrototypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
289 primaryKey);
290 }
291
292 return remove(layoutPrototype);
293 }
294 catch (NoSuchLayoutPrototypeException 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 LayoutPrototype removeImpl(LayoutPrototype layoutPrototype)
307 throws SystemException {
308 layoutPrototype = toUnwrappedModel(layoutPrototype);
309
310 Session session = null;
311
312 try {
313 session = openSession();
314
315 BatchSessionUtil.delete(session, layoutPrototype);
316 }
317 catch (Exception e) {
318 throw processException(e);
319 }
320 finally {
321 closeSession(session);
322 }
323
324 clearCache(layoutPrototype);
325
326 return layoutPrototype;
327 }
328
329 @Override
330 public LayoutPrototype updateImpl(
331 com.liferay.portal.model.LayoutPrototype layoutPrototype, boolean merge)
332 throws SystemException {
333 layoutPrototype = toUnwrappedModel(layoutPrototype);
334
335 boolean isNew = layoutPrototype.isNew();
336
337 LayoutPrototypeModelImpl layoutPrototypeModelImpl = (LayoutPrototypeModelImpl)layoutPrototype;
338
339 if (Validator.isNull(layoutPrototype.getUuid())) {
340 String uuid = PortalUUIDUtil.generate();
341
342 layoutPrototype.setUuid(uuid);
343 }
344
345 Session session = null;
346
347 try {
348 session = openSession();
349
350 BatchSessionUtil.update(session, layoutPrototype, merge);
351
352 layoutPrototype.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 || !LayoutPrototypeModelImpl.COLUMN_BITMASK_ENABLED) {
364 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
365 }
366
367 else {
368 if ((layoutPrototypeModelImpl.getColumnBitmask() &
369 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
370 Object[] args = new Object[] {
371 layoutPrototypeModelImpl.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[] { layoutPrototypeModelImpl.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 ((layoutPrototypeModelImpl.getColumnBitmask() &
386 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
387 Object[] args = new Object[] {
388 Long.valueOf(layoutPrototypeModelImpl.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(layoutPrototypeModelImpl.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 ((layoutPrototypeModelImpl.getColumnBitmask() &
407 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_A.getColumnBitmask()) != 0) {
408 Object[] args = new Object[] {
409 Long.valueOf(layoutPrototypeModelImpl.getOriginalCompanyId()),
410 Boolean.valueOf(layoutPrototypeModelImpl.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(layoutPrototypeModelImpl.getCompanyId()),
419 Boolean.valueOf(layoutPrototypeModelImpl.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(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
429 LayoutPrototypeImpl.class, layoutPrototype.getPrimaryKey(),
430 layoutPrototype);
431
432 return layoutPrototype;
433 }
434
435 protected LayoutPrototype toUnwrappedModel(LayoutPrototype layoutPrototype) {
436 if (layoutPrototype instanceof LayoutPrototypeImpl) {
437 return layoutPrototype;
438 }
439
440 LayoutPrototypeImpl layoutPrototypeImpl = new LayoutPrototypeImpl();
441
442 layoutPrototypeImpl.setNew(layoutPrototype.isNew());
443 layoutPrototypeImpl.setPrimaryKey(layoutPrototype.getPrimaryKey());
444
445 layoutPrototypeImpl.setUuid(layoutPrototype.getUuid());
446 layoutPrototypeImpl.setLayoutPrototypeId(layoutPrototype.getLayoutPrototypeId());
447 layoutPrototypeImpl.setCompanyId(layoutPrototype.getCompanyId());
448 layoutPrototypeImpl.setName(layoutPrototype.getName());
449 layoutPrototypeImpl.setDescription(layoutPrototype.getDescription());
450 layoutPrototypeImpl.setSettings(layoutPrototype.getSettings());
451 layoutPrototypeImpl.setActive(layoutPrototype.isActive());
452
453 return layoutPrototypeImpl;
454 }
455
456
464 @Override
465 public LayoutPrototype findByPrimaryKey(Serializable primaryKey)
466 throws NoSuchModelException, SystemException {
467 return findByPrimaryKey(((Long)primaryKey).longValue());
468 }
469
470
478 public LayoutPrototype findByPrimaryKey(long layoutPrototypeId)
479 throws NoSuchLayoutPrototypeException, SystemException {
480 LayoutPrototype layoutPrototype = fetchByPrimaryKey(layoutPrototypeId);
481
482 if (layoutPrototype == null) {
483 if (_log.isWarnEnabled()) {
484 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + layoutPrototypeId);
485 }
486
487 throw new NoSuchLayoutPrototypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
488 layoutPrototypeId);
489 }
490
491 return layoutPrototype;
492 }
493
494
501 @Override
502 public LayoutPrototype fetchByPrimaryKey(Serializable primaryKey)
503 throws SystemException {
504 return fetchByPrimaryKey(((Long)primaryKey).longValue());
505 }
506
507
514 public LayoutPrototype fetchByPrimaryKey(long layoutPrototypeId)
515 throws SystemException {
516 LayoutPrototype layoutPrototype = (LayoutPrototype)EntityCacheUtil.getResult(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
517 LayoutPrototypeImpl.class, layoutPrototypeId);
518
519 if (layoutPrototype == _nullLayoutPrototype) {
520 return null;
521 }
522
523 if (layoutPrototype == null) {
524 Session session = null;
525
526 boolean hasException = false;
527
528 try {
529 session = openSession();
530
531 layoutPrototype = (LayoutPrototype)session.get(LayoutPrototypeImpl.class,
532 Long.valueOf(layoutPrototypeId));
533 }
534 catch (Exception e) {
535 hasException = true;
536
537 throw processException(e);
538 }
539 finally {
540 if (layoutPrototype != null) {
541 cacheResult(layoutPrototype);
542 }
543 else if (!hasException) {
544 EntityCacheUtil.putResult(LayoutPrototypeModelImpl.ENTITY_CACHE_ENABLED,
545 LayoutPrototypeImpl.class, layoutPrototypeId,
546 _nullLayoutPrototype);
547 }
548
549 closeSession(session);
550 }
551 }
552
553 return layoutPrototype;
554 }
555
556
563 public List<LayoutPrototype> findByUuid(String uuid)
564 throws SystemException {
565 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
566 }
567
568
581 public List<LayoutPrototype> findByUuid(String uuid, int start, int end)
582 throws SystemException {
583 return findByUuid(uuid, start, end, null);
584 }
585
586
600 public List<LayoutPrototype> findByUuid(String uuid, int start, int end,
601 OrderByComparator orderByComparator) throws SystemException {
602 FinderPath finderPath = null;
603 Object[] finderArgs = null;
604
605 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
606 (orderByComparator == null)) {
607 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
608 finderArgs = new Object[] { uuid };
609 }
610 else {
611 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
612 finderArgs = new Object[] { uuid, start, end, orderByComparator };
613 }
614
615 List<LayoutPrototype> list = (List<LayoutPrototype>)FinderCacheUtil.getResult(finderPath,
616 finderArgs, this);
617
618 if ((list != null) && !list.isEmpty()) {
619 for (LayoutPrototype layoutPrototype : list) {
620 if (!Validator.equals(uuid, layoutPrototype.getUuid())) {
621 list = null;
622
623 break;
624 }
625 }
626 }
627
628 if (list == null) {
629 StringBundler query = null;
630
631 if (orderByComparator != null) {
632 query = new StringBundler(3 +
633 (orderByComparator.getOrderByFields().length * 3));
634 }
635 else {
636 query = new StringBundler(2);
637 }
638
639 query.append(_SQL_SELECT_LAYOUTPROTOTYPE_WHERE);
640
641 if (uuid == null) {
642 query.append(_FINDER_COLUMN_UUID_UUID_1);
643 }
644 else {
645 if (uuid.equals(StringPool.BLANK)) {
646 query.append(_FINDER_COLUMN_UUID_UUID_3);
647 }
648 else {
649 query.append(_FINDER_COLUMN_UUID_UUID_2);
650 }
651 }
652
653 if (orderByComparator != null) {
654 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
655 orderByComparator);
656 }
657
658 String sql = query.toString();
659
660 Session session = null;
661
662 try {
663 session = openSession();
664
665 Query q = session.createQuery(sql);
666
667 QueryPos qPos = QueryPos.getInstance(q);
668
669 if (uuid != null) {
670 qPos.add(uuid);
671 }
672
673 list = (List<LayoutPrototype>)QueryUtil.list(q, getDialect(),
674 start, end);
675 }
676 catch (Exception e) {
677 throw processException(e);
678 }
679 finally {
680 if (list == null) {
681 FinderCacheUtil.removeResult(finderPath, finderArgs);
682 }
683 else {
684 cacheResult(list);
685
686 FinderCacheUtil.putResult(finderPath, finderArgs, list);
687 }
688
689 closeSession(session);
690 }
691 }
692
693 return list;
694 }
695
696
705 public LayoutPrototype findByUuid_First(String uuid,
706 OrderByComparator orderByComparator)
707 throws NoSuchLayoutPrototypeException, SystemException {
708 LayoutPrototype layoutPrototype = fetchByUuid_First(uuid,
709 orderByComparator);
710
711 if (layoutPrototype != null) {
712 return layoutPrototype;
713 }
714
715 StringBundler msg = new StringBundler(4);
716
717 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
718
719 msg.append("uuid=");
720 msg.append(uuid);
721
722 msg.append(StringPool.CLOSE_CURLY_BRACE);
723
724 throw new NoSuchLayoutPrototypeException(msg.toString());
725 }
726
727
735 public LayoutPrototype fetchByUuid_First(String uuid,
736 OrderByComparator orderByComparator) throws SystemException {
737 List<LayoutPrototype> list = findByUuid(uuid, 0, 1, orderByComparator);
738
739 if (!list.isEmpty()) {
740 return list.get(0);
741 }
742
743 return null;
744 }
745
746
755 public LayoutPrototype findByUuid_Last(String uuid,
756 OrderByComparator orderByComparator)
757 throws NoSuchLayoutPrototypeException, SystemException {
758 LayoutPrototype layoutPrototype = fetchByUuid_Last(uuid,
759 orderByComparator);
760
761 if (layoutPrototype != null) {
762 return layoutPrototype;
763 }
764
765 StringBundler msg = new StringBundler(4);
766
767 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
768
769 msg.append("uuid=");
770 msg.append(uuid);
771
772 msg.append(StringPool.CLOSE_CURLY_BRACE);
773
774 throw new NoSuchLayoutPrototypeException(msg.toString());
775 }
776
777
785 public LayoutPrototype fetchByUuid_Last(String uuid,
786 OrderByComparator orderByComparator) throws SystemException {
787 int count = countByUuid(uuid);
788
789 List<LayoutPrototype> list = findByUuid(uuid, count - 1, count,
790 orderByComparator);
791
792 if (!list.isEmpty()) {
793 return list.get(0);
794 }
795
796 return null;
797 }
798
799
809 public LayoutPrototype[] findByUuid_PrevAndNext(long layoutPrototypeId,
810 String uuid, OrderByComparator orderByComparator)
811 throws NoSuchLayoutPrototypeException, SystemException {
812 LayoutPrototype layoutPrototype = findByPrimaryKey(layoutPrototypeId);
813
814 Session session = null;
815
816 try {
817 session = openSession();
818
819 LayoutPrototype[] array = new LayoutPrototypeImpl[3];
820
821 array[0] = getByUuid_PrevAndNext(session, layoutPrototype, uuid,
822 orderByComparator, true);
823
824 array[1] = layoutPrototype;
825
826 array[2] = getByUuid_PrevAndNext(session, layoutPrototype, uuid,
827 orderByComparator, false);
828
829 return array;
830 }
831 catch (Exception e) {
832 throw processException(e);
833 }
834 finally {
835 closeSession(session);
836 }
837 }
838
839 protected LayoutPrototype getByUuid_PrevAndNext(Session session,
840 LayoutPrototype layoutPrototype, String uuid,
841 OrderByComparator orderByComparator, boolean previous) {
842 StringBundler query = null;
843
844 if (orderByComparator != null) {
845 query = new StringBundler(6 +
846 (orderByComparator.getOrderByFields().length * 6));
847 }
848 else {
849 query = new StringBundler(3);
850 }
851
852 query.append(_SQL_SELECT_LAYOUTPROTOTYPE_WHERE);
853
854 if (uuid == null) {
855 query.append(_FINDER_COLUMN_UUID_UUID_1);
856 }
857 else {
858 if (uuid.equals(StringPool.BLANK)) {
859 query.append(_FINDER_COLUMN_UUID_UUID_3);
860 }
861 else {
862 query.append(_FINDER_COLUMN_UUID_UUID_2);
863 }
864 }
865
866 if (orderByComparator != null) {
867 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
868
869 if (orderByConditionFields.length > 0) {
870 query.append(WHERE_AND);
871 }
872
873 for (int i = 0; i < orderByConditionFields.length; i++) {
874 query.append(_ORDER_BY_ENTITY_ALIAS);
875 query.append(orderByConditionFields[i]);
876
877 if ((i + 1) < orderByConditionFields.length) {
878 if (orderByComparator.isAscending() ^ previous) {
879 query.append(WHERE_GREATER_THAN_HAS_NEXT);
880 }
881 else {
882 query.append(WHERE_LESSER_THAN_HAS_NEXT);
883 }
884 }
885 else {
886 if (orderByComparator.isAscending() ^ previous) {
887 query.append(WHERE_GREATER_THAN);
888 }
889 else {
890 query.append(WHERE_LESSER_THAN);
891 }
892 }
893 }
894
895 query.append(ORDER_BY_CLAUSE);
896
897 String[] orderByFields = orderByComparator.getOrderByFields();
898
899 for (int i = 0; i < orderByFields.length; i++) {
900 query.append(_ORDER_BY_ENTITY_ALIAS);
901 query.append(orderByFields[i]);
902
903 if ((i + 1) < orderByFields.length) {
904 if (orderByComparator.isAscending() ^ previous) {
905 query.append(ORDER_BY_ASC_HAS_NEXT);
906 }
907 else {
908 query.append(ORDER_BY_DESC_HAS_NEXT);
909 }
910 }
911 else {
912 if (orderByComparator.isAscending() ^ previous) {
913 query.append(ORDER_BY_ASC);
914 }
915 else {
916 query.append(ORDER_BY_DESC);
917 }
918 }
919 }
920 }
921
922 String sql = query.toString();
923
924 Query q = session.createQuery(sql);
925
926 q.setFirstResult(0);
927 q.setMaxResults(2);
928
929 QueryPos qPos = QueryPos.getInstance(q);
930
931 if (uuid != null) {
932 qPos.add(uuid);
933 }
934
935 if (orderByComparator != null) {
936 Object[] values = orderByComparator.getOrderByConditionValues(layoutPrototype);
937
938 for (Object value : values) {
939 qPos.add(value);
940 }
941 }
942
943 List<LayoutPrototype> list = q.list();
944
945 if (list.size() == 2) {
946 return list.get(1);
947 }
948 else {
949 return null;
950 }
951 }
952
953
960 public List<LayoutPrototype> filterFindByUuid(String uuid)
961 throws SystemException {
962 return filterFindByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
963 }
964
965
978 public List<LayoutPrototype> filterFindByUuid(String uuid, int start,
979 int end) throws SystemException {
980 return filterFindByUuid(uuid, start, end, null);
981 }
982
983
997 public List<LayoutPrototype> filterFindByUuid(String uuid, int start,
998 int end, OrderByComparator orderByComparator) throws SystemException {
999 if (!InlineSQLHelperUtil.isEnabled()) {
1000 return findByUuid(uuid, start, end, orderByComparator);
1001 }
1002
1003 StringBundler query = null;
1004
1005 if (orderByComparator != null) {
1006 query = new StringBundler(3 +
1007 (orderByComparator.getOrderByFields().length * 3));
1008 }
1009 else {
1010 query = new StringBundler(2);
1011 }
1012
1013 if (getDB().isSupportsInlineDistinct()) {
1014 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_WHERE);
1015 }
1016 else {
1017 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
1018 }
1019
1020 if (uuid == null) {
1021 query.append(_FINDER_COLUMN_UUID_UUID_1);
1022 }
1023 else {
1024 if (uuid.equals(StringPool.BLANK)) {
1025 query.append(_FINDER_COLUMN_UUID_UUID_3);
1026 }
1027 else {
1028 query.append(_FINDER_COLUMN_UUID_UUID_2);
1029 }
1030 }
1031
1032 if (!getDB().isSupportsInlineDistinct()) {
1033 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1034 }
1035
1036 if (orderByComparator != null) {
1037 if (getDB().isSupportsInlineDistinct()) {
1038 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1039 orderByComparator);
1040 }
1041 else {
1042 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1043 orderByComparator);
1044 }
1045 }
1046
1047 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1048 LayoutPrototype.class.getName(),
1049 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1050
1051 Session session = null;
1052
1053 try {
1054 session = openSession();
1055
1056 SQLQuery q = session.createSQLQuery(sql);
1057
1058 if (getDB().isSupportsInlineDistinct()) {
1059 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutPrototypeImpl.class);
1060 }
1061 else {
1062 q.addEntity(_FILTER_ENTITY_TABLE, LayoutPrototypeImpl.class);
1063 }
1064
1065 QueryPos qPos = QueryPos.getInstance(q);
1066
1067 if (uuid != null) {
1068 qPos.add(uuid);
1069 }
1070
1071 return (List<LayoutPrototype>)QueryUtil.list(q, getDialect(),
1072 start, end);
1073 }
1074 catch (Exception e) {
1075 throw processException(e);
1076 }
1077 finally {
1078 closeSession(session);
1079 }
1080 }
1081
1082
1092 public LayoutPrototype[] filterFindByUuid_PrevAndNext(
1093 long layoutPrototypeId, String uuid, OrderByComparator orderByComparator)
1094 throws NoSuchLayoutPrototypeException, SystemException {
1095 if (!InlineSQLHelperUtil.isEnabled()) {
1096 return findByUuid_PrevAndNext(layoutPrototypeId, uuid,
1097 orderByComparator);
1098 }
1099
1100 LayoutPrototype layoutPrototype = findByPrimaryKey(layoutPrototypeId);
1101
1102 Session session = null;
1103
1104 try {
1105 session = openSession();
1106
1107 LayoutPrototype[] array = new LayoutPrototypeImpl[3];
1108
1109 array[0] = filterGetByUuid_PrevAndNext(session, layoutPrototype,
1110 uuid, orderByComparator, true);
1111
1112 array[1] = layoutPrototype;
1113
1114 array[2] = filterGetByUuid_PrevAndNext(session, layoutPrototype,
1115 uuid, orderByComparator, false);
1116
1117 return array;
1118 }
1119 catch (Exception e) {
1120 throw processException(e);
1121 }
1122 finally {
1123 closeSession(session);
1124 }
1125 }
1126
1127 protected LayoutPrototype filterGetByUuid_PrevAndNext(Session session,
1128 LayoutPrototype layoutPrototype, String uuid,
1129 OrderByComparator orderByComparator, boolean previous) {
1130 StringBundler query = null;
1131
1132 if (orderByComparator != null) {
1133 query = new StringBundler(6 +
1134 (orderByComparator.getOrderByFields().length * 6));
1135 }
1136 else {
1137 query = new StringBundler(3);
1138 }
1139
1140 if (getDB().isSupportsInlineDistinct()) {
1141 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_WHERE);
1142 }
1143 else {
1144 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
1145 }
1146
1147 if (uuid == null) {
1148 query.append(_FINDER_COLUMN_UUID_UUID_1);
1149 }
1150 else {
1151 if (uuid.equals(StringPool.BLANK)) {
1152 query.append(_FINDER_COLUMN_UUID_UUID_3);
1153 }
1154 else {
1155 query.append(_FINDER_COLUMN_UUID_UUID_2);
1156 }
1157 }
1158
1159 if (!getDB().isSupportsInlineDistinct()) {
1160 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1161 }
1162
1163 if (orderByComparator != null) {
1164 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1165
1166 if (orderByConditionFields.length > 0) {
1167 query.append(WHERE_AND);
1168 }
1169
1170 for (int i = 0; i < orderByConditionFields.length; i++) {
1171 if (getDB().isSupportsInlineDistinct()) {
1172 query.append(_ORDER_BY_ENTITY_ALIAS);
1173 }
1174 else {
1175 query.append(_ORDER_BY_ENTITY_TABLE);
1176 }
1177
1178 query.append(orderByConditionFields[i]);
1179
1180 if ((i + 1) < orderByConditionFields.length) {
1181 if (orderByComparator.isAscending() ^ previous) {
1182 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1183 }
1184 else {
1185 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1186 }
1187 }
1188 else {
1189 if (orderByComparator.isAscending() ^ previous) {
1190 query.append(WHERE_GREATER_THAN);
1191 }
1192 else {
1193 query.append(WHERE_LESSER_THAN);
1194 }
1195 }
1196 }
1197
1198 query.append(ORDER_BY_CLAUSE);
1199
1200 String[] orderByFields = orderByComparator.getOrderByFields();
1201
1202 for (int i = 0; i < orderByFields.length; i++) {
1203 if (getDB().isSupportsInlineDistinct()) {
1204 query.append(_ORDER_BY_ENTITY_ALIAS);
1205 }
1206 else {
1207 query.append(_ORDER_BY_ENTITY_TABLE);
1208 }
1209
1210 query.append(orderByFields[i]);
1211
1212 if ((i + 1) < orderByFields.length) {
1213 if (orderByComparator.isAscending() ^ previous) {
1214 query.append(ORDER_BY_ASC_HAS_NEXT);
1215 }
1216 else {
1217 query.append(ORDER_BY_DESC_HAS_NEXT);
1218 }
1219 }
1220 else {
1221 if (orderByComparator.isAscending() ^ previous) {
1222 query.append(ORDER_BY_ASC);
1223 }
1224 else {
1225 query.append(ORDER_BY_DESC);
1226 }
1227 }
1228 }
1229 }
1230
1231 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1232 LayoutPrototype.class.getName(),
1233 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1234
1235 SQLQuery q = session.createSQLQuery(sql);
1236
1237 q.setFirstResult(0);
1238 q.setMaxResults(2);
1239
1240 if (getDB().isSupportsInlineDistinct()) {
1241 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutPrototypeImpl.class);
1242 }
1243 else {
1244 q.addEntity(_FILTER_ENTITY_TABLE, LayoutPrototypeImpl.class);
1245 }
1246
1247 QueryPos qPos = QueryPos.getInstance(q);
1248
1249 if (uuid != null) {
1250 qPos.add(uuid);
1251 }
1252
1253 if (orderByComparator != null) {
1254 Object[] values = orderByComparator.getOrderByConditionValues(layoutPrototype);
1255
1256 for (Object value : values) {
1257 qPos.add(value);
1258 }
1259 }
1260
1261 List<LayoutPrototype> list = q.list();
1262
1263 if (list.size() == 2) {
1264 return list.get(1);
1265 }
1266 else {
1267 return null;
1268 }
1269 }
1270
1271
1278 public List<LayoutPrototype> findByCompanyId(long companyId)
1279 throws SystemException {
1280 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1281 null);
1282 }
1283
1284
1297 public List<LayoutPrototype> findByCompanyId(long companyId, int start,
1298 int end) throws SystemException {
1299 return findByCompanyId(companyId, start, end, null);
1300 }
1301
1302
1316 public List<LayoutPrototype> findByCompanyId(long companyId, int start,
1317 int end, OrderByComparator orderByComparator) throws SystemException {
1318 FinderPath finderPath = null;
1319 Object[] finderArgs = null;
1320
1321 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1322 (orderByComparator == null)) {
1323 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
1324 finderArgs = new Object[] { companyId };
1325 }
1326 else {
1327 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
1328 finderArgs = new Object[] { companyId, start, end, orderByComparator };
1329 }
1330
1331 List<LayoutPrototype> list = (List<LayoutPrototype>)FinderCacheUtil.getResult(finderPath,
1332 finderArgs, this);
1333
1334 if ((list != null) && !list.isEmpty()) {
1335 for (LayoutPrototype layoutPrototype : list) {
1336 if ((companyId != layoutPrototype.getCompanyId())) {
1337 list = null;
1338
1339 break;
1340 }
1341 }
1342 }
1343
1344 if (list == null) {
1345 StringBundler query = null;
1346
1347 if (orderByComparator != null) {
1348 query = new StringBundler(3 +
1349 (orderByComparator.getOrderByFields().length * 3));
1350 }
1351 else {
1352 query = new StringBundler(2);
1353 }
1354
1355 query.append(_SQL_SELECT_LAYOUTPROTOTYPE_WHERE);
1356
1357 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1358
1359 if (orderByComparator != null) {
1360 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1361 orderByComparator);
1362 }
1363
1364 String sql = query.toString();
1365
1366 Session session = null;
1367
1368 try {
1369 session = openSession();
1370
1371 Query q = session.createQuery(sql);
1372
1373 QueryPos qPos = QueryPos.getInstance(q);
1374
1375 qPos.add(companyId);
1376
1377 list = (List<LayoutPrototype>)QueryUtil.list(q, getDialect(),
1378 start, end);
1379 }
1380 catch (Exception e) {
1381 throw processException(e);
1382 }
1383 finally {
1384 if (list == null) {
1385 FinderCacheUtil.removeResult(finderPath, finderArgs);
1386 }
1387 else {
1388 cacheResult(list);
1389
1390 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1391 }
1392
1393 closeSession(session);
1394 }
1395 }
1396
1397 return list;
1398 }
1399
1400
1409 public LayoutPrototype findByCompanyId_First(long companyId,
1410 OrderByComparator orderByComparator)
1411 throws NoSuchLayoutPrototypeException, SystemException {
1412 LayoutPrototype layoutPrototype = fetchByCompanyId_First(companyId,
1413 orderByComparator);
1414
1415 if (layoutPrototype != null) {
1416 return layoutPrototype;
1417 }
1418
1419 StringBundler msg = new StringBundler(4);
1420
1421 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1422
1423 msg.append("companyId=");
1424 msg.append(companyId);
1425
1426 msg.append(StringPool.CLOSE_CURLY_BRACE);
1427
1428 throw new NoSuchLayoutPrototypeException(msg.toString());
1429 }
1430
1431
1439 public LayoutPrototype fetchByCompanyId_First(long companyId,
1440 OrderByComparator orderByComparator) throws SystemException {
1441 List<LayoutPrototype> list = findByCompanyId(companyId, 0, 1,
1442 orderByComparator);
1443
1444 if (!list.isEmpty()) {
1445 return list.get(0);
1446 }
1447
1448 return null;
1449 }
1450
1451
1460 public LayoutPrototype findByCompanyId_Last(long companyId,
1461 OrderByComparator orderByComparator)
1462 throws NoSuchLayoutPrototypeException, SystemException {
1463 LayoutPrototype layoutPrototype = fetchByCompanyId_Last(companyId,
1464 orderByComparator);
1465
1466 if (layoutPrototype != null) {
1467 return layoutPrototype;
1468 }
1469
1470 StringBundler msg = new StringBundler(4);
1471
1472 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1473
1474 msg.append("companyId=");
1475 msg.append(companyId);
1476
1477 msg.append(StringPool.CLOSE_CURLY_BRACE);
1478
1479 throw new NoSuchLayoutPrototypeException(msg.toString());
1480 }
1481
1482
1490 public LayoutPrototype fetchByCompanyId_Last(long companyId,
1491 OrderByComparator orderByComparator) throws SystemException {
1492 int count = countByCompanyId(companyId);
1493
1494 List<LayoutPrototype> list = findByCompanyId(companyId, count - 1,
1495 count, orderByComparator);
1496
1497 if (!list.isEmpty()) {
1498 return list.get(0);
1499 }
1500
1501 return null;
1502 }
1503
1504
1514 public LayoutPrototype[] findByCompanyId_PrevAndNext(
1515 long layoutPrototypeId, long companyId,
1516 OrderByComparator orderByComparator)
1517 throws NoSuchLayoutPrototypeException, SystemException {
1518 LayoutPrototype layoutPrototype = findByPrimaryKey(layoutPrototypeId);
1519
1520 Session session = null;
1521
1522 try {
1523 session = openSession();
1524
1525 LayoutPrototype[] array = new LayoutPrototypeImpl[3];
1526
1527 array[0] = getByCompanyId_PrevAndNext(session, layoutPrototype,
1528 companyId, orderByComparator, true);
1529
1530 array[1] = layoutPrototype;
1531
1532 array[2] = getByCompanyId_PrevAndNext(session, layoutPrototype,
1533 companyId, orderByComparator, false);
1534
1535 return array;
1536 }
1537 catch (Exception e) {
1538 throw processException(e);
1539 }
1540 finally {
1541 closeSession(session);
1542 }
1543 }
1544
1545 protected LayoutPrototype getByCompanyId_PrevAndNext(Session session,
1546 LayoutPrototype layoutPrototype, long companyId,
1547 OrderByComparator orderByComparator, boolean previous) {
1548 StringBundler query = null;
1549
1550 if (orderByComparator != null) {
1551 query = new StringBundler(6 +
1552 (orderByComparator.getOrderByFields().length * 6));
1553 }
1554 else {
1555 query = new StringBundler(3);
1556 }
1557
1558 query.append(_SQL_SELECT_LAYOUTPROTOTYPE_WHERE);
1559
1560 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1561
1562 if (orderByComparator != null) {
1563 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1564
1565 if (orderByConditionFields.length > 0) {
1566 query.append(WHERE_AND);
1567 }
1568
1569 for (int i = 0; i < orderByConditionFields.length; i++) {
1570 query.append(_ORDER_BY_ENTITY_ALIAS);
1571 query.append(orderByConditionFields[i]);
1572
1573 if ((i + 1) < orderByConditionFields.length) {
1574 if (orderByComparator.isAscending() ^ previous) {
1575 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1576 }
1577 else {
1578 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1579 }
1580 }
1581 else {
1582 if (orderByComparator.isAscending() ^ previous) {
1583 query.append(WHERE_GREATER_THAN);
1584 }
1585 else {
1586 query.append(WHERE_LESSER_THAN);
1587 }
1588 }
1589 }
1590
1591 query.append(ORDER_BY_CLAUSE);
1592
1593 String[] orderByFields = orderByComparator.getOrderByFields();
1594
1595 for (int i = 0; i < orderByFields.length; i++) {
1596 query.append(_ORDER_BY_ENTITY_ALIAS);
1597 query.append(orderByFields[i]);
1598
1599 if ((i + 1) < orderByFields.length) {
1600 if (orderByComparator.isAscending() ^ previous) {
1601 query.append(ORDER_BY_ASC_HAS_NEXT);
1602 }
1603 else {
1604 query.append(ORDER_BY_DESC_HAS_NEXT);
1605 }
1606 }
1607 else {
1608 if (orderByComparator.isAscending() ^ previous) {
1609 query.append(ORDER_BY_ASC);
1610 }
1611 else {
1612 query.append(ORDER_BY_DESC);
1613 }
1614 }
1615 }
1616 }
1617
1618 String sql = query.toString();
1619
1620 Query q = session.createQuery(sql);
1621
1622 q.setFirstResult(0);
1623 q.setMaxResults(2);
1624
1625 QueryPos qPos = QueryPos.getInstance(q);
1626
1627 qPos.add(companyId);
1628
1629 if (orderByComparator != null) {
1630 Object[] values = orderByComparator.getOrderByConditionValues(layoutPrototype);
1631
1632 for (Object value : values) {
1633 qPos.add(value);
1634 }
1635 }
1636
1637 List<LayoutPrototype> list = q.list();
1638
1639 if (list.size() == 2) {
1640 return list.get(1);
1641 }
1642 else {
1643 return null;
1644 }
1645 }
1646
1647
1654 public List<LayoutPrototype> filterFindByCompanyId(long companyId)
1655 throws SystemException {
1656 return filterFindByCompanyId(companyId, QueryUtil.ALL_POS,
1657 QueryUtil.ALL_POS, null);
1658 }
1659
1660
1673 public List<LayoutPrototype> filterFindByCompanyId(long companyId,
1674 int start, int end) throws SystemException {
1675 return filterFindByCompanyId(companyId, start, end, null);
1676 }
1677
1678
1692 public List<LayoutPrototype> filterFindByCompanyId(long companyId,
1693 int start, int end, OrderByComparator orderByComparator)
1694 throws SystemException {
1695 if (!InlineSQLHelperUtil.isEnabled()) {
1696 return findByCompanyId(companyId, start, end, orderByComparator);
1697 }
1698
1699 StringBundler query = null;
1700
1701 if (orderByComparator != null) {
1702 query = new StringBundler(3 +
1703 (orderByComparator.getOrderByFields().length * 3));
1704 }
1705 else {
1706 query = new StringBundler(2);
1707 }
1708
1709 if (getDB().isSupportsInlineDistinct()) {
1710 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_WHERE);
1711 }
1712 else {
1713 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
1714 }
1715
1716 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1717
1718 if (!getDB().isSupportsInlineDistinct()) {
1719 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1720 }
1721
1722 if (orderByComparator != null) {
1723 if (getDB().isSupportsInlineDistinct()) {
1724 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1725 orderByComparator);
1726 }
1727 else {
1728 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1729 orderByComparator);
1730 }
1731 }
1732
1733 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1734 LayoutPrototype.class.getName(),
1735 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1736
1737 Session session = null;
1738
1739 try {
1740 session = openSession();
1741
1742 SQLQuery q = session.createSQLQuery(sql);
1743
1744 if (getDB().isSupportsInlineDistinct()) {
1745 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutPrototypeImpl.class);
1746 }
1747 else {
1748 q.addEntity(_FILTER_ENTITY_TABLE, LayoutPrototypeImpl.class);
1749 }
1750
1751 QueryPos qPos = QueryPos.getInstance(q);
1752
1753 qPos.add(companyId);
1754
1755 return (List<LayoutPrototype>)QueryUtil.list(q, getDialect(),
1756 start, end);
1757 }
1758 catch (Exception e) {
1759 throw processException(e);
1760 }
1761 finally {
1762 closeSession(session);
1763 }
1764 }
1765
1766
1776 public LayoutPrototype[] filterFindByCompanyId_PrevAndNext(
1777 long layoutPrototypeId, long companyId,
1778 OrderByComparator orderByComparator)
1779 throws NoSuchLayoutPrototypeException, SystemException {
1780 if (!InlineSQLHelperUtil.isEnabled()) {
1781 return findByCompanyId_PrevAndNext(layoutPrototypeId, companyId,
1782 orderByComparator);
1783 }
1784
1785 LayoutPrototype layoutPrototype = findByPrimaryKey(layoutPrototypeId);
1786
1787 Session session = null;
1788
1789 try {
1790 session = openSession();
1791
1792 LayoutPrototype[] array = new LayoutPrototypeImpl[3];
1793
1794 array[0] = filterGetByCompanyId_PrevAndNext(session,
1795 layoutPrototype, companyId, orderByComparator, true);
1796
1797 array[1] = layoutPrototype;
1798
1799 array[2] = filterGetByCompanyId_PrevAndNext(session,
1800 layoutPrototype, companyId, orderByComparator, false);
1801
1802 return array;
1803 }
1804 catch (Exception e) {
1805 throw processException(e);
1806 }
1807 finally {
1808 closeSession(session);
1809 }
1810 }
1811
1812 protected LayoutPrototype filterGetByCompanyId_PrevAndNext(
1813 Session session, LayoutPrototype layoutPrototype, long companyId,
1814 OrderByComparator orderByComparator, boolean previous) {
1815 StringBundler query = null;
1816
1817 if (orderByComparator != null) {
1818 query = new StringBundler(6 +
1819 (orderByComparator.getOrderByFields().length * 6));
1820 }
1821 else {
1822 query = new StringBundler(3);
1823 }
1824
1825 if (getDB().isSupportsInlineDistinct()) {
1826 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_WHERE);
1827 }
1828 else {
1829 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
1830 }
1831
1832 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1833
1834 if (!getDB().isSupportsInlineDistinct()) {
1835 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1836 }
1837
1838 if (orderByComparator != null) {
1839 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1840
1841 if (orderByConditionFields.length > 0) {
1842 query.append(WHERE_AND);
1843 }
1844
1845 for (int i = 0; i < orderByConditionFields.length; i++) {
1846 if (getDB().isSupportsInlineDistinct()) {
1847 query.append(_ORDER_BY_ENTITY_ALIAS);
1848 }
1849 else {
1850 query.append(_ORDER_BY_ENTITY_TABLE);
1851 }
1852
1853 query.append(orderByConditionFields[i]);
1854
1855 if ((i + 1) < orderByConditionFields.length) {
1856 if (orderByComparator.isAscending() ^ previous) {
1857 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1858 }
1859 else {
1860 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1861 }
1862 }
1863 else {
1864 if (orderByComparator.isAscending() ^ previous) {
1865 query.append(WHERE_GREATER_THAN);
1866 }
1867 else {
1868 query.append(WHERE_LESSER_THAN);
1869 }
1870 }
1871 }
1872
1873 query.append(ORDER_BY_CLAUSE);
1874
1875 String[] orderByFields = orderByComparator.getOrderByFields();
1876
1877 for (int i = 0; i < orderByFields.length; i++) {
1878 if (getDB().isSupportsInlineDistinct()) {
1879 query.append(_ORDER_BY_ENTITY_ALIAS);
1880 }
1881 else {
1882 query.append(_ORDER_BY_ENTITY_TABLE);
1883 }
1884
1885 query.append(orderByFields[i]);
1886
1887 if ((i + 1) < orderByFields.length) {
1888 if (orderByComparator.isAscending() ^ previous) {
1889 query.append(ORDER_BY_ASC_HAS_NEXT);
1890 }
1891 else {
1892 query.append(ORDER_BY_DESC_HAS_NEXT);
1893 }
1894 }
1895 else {
1896 if (orderByComparator.isAscending() ^ previous) {
1897 query.append(ORDER_BY_ASC);
1898 }
1899 else {
1900 query.append(ORDER_BY_DESC);
1901 }
1902 }
1903 }
1904 }
1905
1906 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1907 LayoutPrototype.class.getName(),
1908 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1909
1910 SQLQuery q = session.createSQLQuery(sql);
1911
1912 q.setFirstResult(0);
1913 q.setMaxResults(2);
1914
1915 if (getDB().isSupportsInlineDistinct()) {
1916 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutPrototypeImpl.class);
1917 }
1918 else {
1919 q.addEntity(_FILTER_ENTITY_TABLE, LayoutPrototypeImpl.class);
1920 }
1921
1922 QueryPos qPos = QueryPos.getInstance(q);
1923
1924 qPos.add(companyId);
1925
1926 if (orderByComparator != null) {
1927 Object[] values = orderByComparator.getOrderByConditionValues(layoutPrototype);
1928
1929 for (Object value : values) {
1930 qPos.add(value);
1931 }
1932 }
1933
1934 List<LayoutPrototype> list = q.list();
1935
1936 if (list.size() == 2) {
1937 return list.get(1);
1938 }
1939 else {
1940 return null;
1941 }
1942 }
1943
1944
1952 public List<LayoutPrototype> findByC_A(long companyId, boolean active)
1953 throws SystemException {
1954 return findByC_A(companyId, active, QueryUtil.ALL_POS,
1955 QueryUtil.ALL_POS, null);
1956 }
1957
1958
1972 public List<LayoutPrototype> findByC_A(long companyId, boolean active,
1973 int start, int end) throws SystemException {
1974 return findByC_A(companyId, active, start, end, null);
1975 }
1976
1977
1992 public List<LayoutPrototype> findByC_A(long companyId, boolean active,
1993 int start, int end, OrderByComparator orderByComparator)
1994 throws SystemException {
1995 FinderPath finderPath = null;
1996 Object[] finderArgs = null;
1997
1998 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1999 (orderByComparator == null)) {
2000 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_A;
2001 finderArgs = new Object[] { companyId, active };
2002 }
2003 else {
2004 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_A;
2005 finderArgs = new Object[] {
2006 companyId, active,
2007
2008 start, end, orderByComparator
2009 };
2010 }
2011
2012 List<LayoutPrototype> list = (List<LayoutPrototype>)FinderCacheUtil.getResult(finderPath,
2013 finderArgs, this);
2014
2015 if ((list != null) && !list.isEmpty()) {
2016 for (LayoutPrototype layoutPrototype : list) {
2017 if ((companyId != layoutPrototype.getCompanyId()) ||
2018 (active != layoutPrototype.getActive())) {
2019 list = null;
2020
2021 break;
2022 }
2023 }
2024 }
2025
2026 if (list == null) {
2027 StringBundler query = null;
2028
2029 if (orderByComparator != null) {
2030 query = new StringBundler(4 +
2031 (orderByComparator.getOrderByFields().length * 3));
2032 }
2033 else {
2034 query = new StringBundler(3);
2035 }
2036
2037 query.append(_SQL_SELECT_LAYOUTPROTOTYPE_WHERE);
2038
2039 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2040
2041 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2042
2043 if (orderByComparator != null) {
2044 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2045 orderByComparator);
2046 }
2047
2048 String sql = query.toString();
2049
2050 Session session = null;
2051
2052 try {
2053 session = openSession();
2054
2055 Query q = session.createQuery(sql);
2056
2057 QueryPos qPos = QueryPos.getInstance(q);
2058
2059 qPos.add(companyId);
2060
2061 qPos.add(active);
2062
2063 list = (List<LayoutPrototype>)QueryUtil.list(q, getDialect(),
2064 start, end);
2065 }
2066 catch (Exception e) {
2067 throw processException(e);
2068 }
2069 finally {
2070 if (list == null) {
2071 FinderCacheUtil.removeResult(finderPath, finderArgs);
2072 }
2073 else {
2074 cacheResult(list);
2075
2076 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2077 }
2078
2079 closeSession(session);
2080 }
2081 }
2082
2083 return list;
2084 }
2085
2086
2096 public LayoutPrototype findByC_A_First(long companyId, boolean active,
2097 OrderByComparator orderByComparator)
2098 throws NoSuchLayoutPrototypeException, SystemException {
2099 LayoutPrototype layoutPrototype = fetchByC_A_First(companyId, active,
2100 orderByComparator);
2101
2102 if (layoutPrototype != null) {
2103 return layoutPrototype;
2104 }
2105
2106 StringBundler msg = new StringBundler(6);
2107
2108 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2109
2110 msg.append("companyId=");
2111 msg.append(companyId);
2112
2113 msg.append(", active=");
2114 msg.append(active);
2115
2116 msg.append(StringPool.CLOSE_CURLY_BRACE);
2117
2118 throw new NoSuchLayoutPrototypeException(msg.toString());
2119 }
2120
2121
2130 public LayoutPrototype fetchByC_A_First(long companyId, boolean active,
2131 OrderByComparator orderByComparator) throws SystemException {
2132 List<LayoutPrototype> list = findByC_A(companyId, active, 0, 1,
2133 orderByComparator);
2134
2135 if (!list.isEmpty()) {
2136 return list.get(0);
2137 }
2138
2139 return null;
2140 }
2141
2142
2152 public LayoutPrototype findByC_A_Last(long companyId, boolean active,
2153 OrderByComparator orderByComparator)
2154 throws NoSuchLayoutPrototypeException, SystemException {
2155 LayoutPrototype layoutPrototype = fetchByC_A_Last(companyId, active,
2156 orderByComparator);
2157
2158 if (layoutPrototype != null) {
2159 return layoutPrototype;
2160 }
2161
2162 StringBundler msg = new StringBundler(6);
2163
2164 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2165
2166 msg.append("companyId=");
2167 msg.append(companyId);
2168
2169 msg.append(", active=");
2170 msg.append(active);
2171
2172 msg.append(StringPool.CLOSE_CURLY_BRACE);
2173
2174 throw new NoSuchLayoutPrototypeException(msg.toString());
2175 }
2176
2177
2186 public LayoutPrototype fetchByC_A_Last(long companyId, boolean active,
2187 OrderByComparator orderByComparator) throws SystemException {
2188 int count = countByC_A(companyId, active);
2189
2190 List<LayoutPrototype> list = findByC_A(companyId, active, count - 1,
2191 count, orderByComparator);
2192
2193 if (!list.isEmpty()) {
2194 return list.get(0);
2195 }
2196
2197 return null;
2198 }
2199
2200
2211 public LayoutPrototype[] findByC_A_PrevAndNext(long layoutPrototypeId,
2212 long companyId, boolean active, OrderByComparator orderByComparator)
2213 throws NoSuchLayoutPrototypeException, SystemException {
2214 LayoutPrototype layoutPrototype = findByPrimaryKey(layoutPrototypeId);
2215
2216 Session session = null;
2217
2218 try {
2219 session = openSession();
2220
2221 LayoutPrototype[] array = new LayoutPrototypeImpl[3];
2222
2223 array[0] = getByC_A_PrevAndNext(session, layoutPrototype,
2224 companyId, active, orderByComparator, true);
2225
2226 array[1] = layoutPrototype;
2227
2228 array[2] = getByC_A_PrevAndNext(session, layoutPrototype,
2229 companyId, active, orderByComparator, false);
2230
2231 return array;
2232 }
2233 catch (Exception e) {
2234 throw processException(e);
2235 }
2236 finally {
2237 closeSession(session);
2238 }
2239 }
2240
2241 protected LayoutPrototype getByC_A_PrevAndNext(Session session,
2242 LayoutPrototype layoutPrototype, long companyId, boolean active,
2243 OrderByComparator orderByComparator, boolean previous) {
2244 StringBundler query = null;
2245
2246 if (orderByComparator != null) {
2247 query = new StringBundler(6 +
2248 (orderByComparator.getOrderByFields().length * 6));
2249 }
2250 else {
2251 query = new StringBundler(3);
2252 }
2253
2254 query.append(_SQL_SELECT_LAYOUTPROTOTYPE_WHERE);
2255
2256 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2257
2258 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2259
2260 if (orderByComparator != null) {
2261 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2262
2263 if (orderByConditionFields.length > 0) {
2264 query.append(WHERE_AND);
2265 }
2266
2267 for (int i = 0; i < orderByConditionFields.length; i++) {
2268 query.append(_ORDER_BY_ENTITY_ALIAS);
2269 query.append(orderByConditionFields[i]);
2270
2271 if ((i + 1) < orderByConditionFields.length) {
2272 if (orderByComparator.isAscending() ^ previous) {
2273 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2274 }
2275 else {
2276 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2277 }
2278 }
2279 else {
2280 if (orderByComparator.isAscending() ^ previous) {
2281 query.append(WHERE_GREATER_THAN);
2282 }
2283 else {
2284 query.append(WHERE_LESSER_THAN);
2285 }
2286 }
2287 }
2288
2289 query.append(ORDER_BY_CLAUSE);
2290
2291 String[] orderByFields = orderByComparator.getOrderByFields();
2292
2293 for (int i = 0; i < orderByFields.length; i++) {
2294 query.append(_ORDER_BY_ENTITY_ALIAS);
2295 query.append(orderByFields[i]);
2296
2297 if ((i + 1) < orderByFields.length) {
2298 if (orderByComparator.isAscending() ^ previous) {
2299 query.append(ORDER_BY_ASC_HAS_NEXT);
2300 }
2301 else {
2302 query.append(ORDER_BY_DESC_HAS_NEXT);
2303 }
2304 }
2305 else {
2306 if (orderByComparator.isAscending() ^ previous) {
2307 query.append(ORDER_BY_ASC);
2308 }
2309 else {
2310 query.append(ORDER_BY_DESC);
2311 }
2312 }
2313 }
2314 }
2315
2316 String sql = query.toString();
2317
2318 Query q = session.createQuery(sql);
2319
2320 q.setFirstResult(0);
2321 q.setMaxResults(2);
2322
2323 QueryPos qPos = QueryPos.getInstance(q);
2324
2325 qPos.add(companyId);
2326
2327 qPos.add(active);
2328
2329 if (orderByComparator != null) {
2330 Object[] values = orderByComparator.getOrderByConditionValues(layoutPrototype);
2331
2332 for (Object value : values) {
2333 qPos.add(value);
2334 }
2335 }
2336
2337 List<LayoutPrototype> list = q.list();
2338
2339 if (list.size() == 2) {
2340 return list.get(1);
2341 }
2342 else {
2343 return null;
2344 }
2345 }
2346
2347
2355 public List<LayoutPrototype> filterFindByC_A(long companyId, boolean active)
2356 throws SystemException {
2357 return filterFindByC_A(companyId, active, QueryUtil.ALL_POS,
2358 QueryUtil.ALL_POS, null);
2359 }
2360
2361
2375 public List<LayoutPrototype> filterFindByC_A(long companyId,
2376 boolean active, int start, int end) throws SystemException {
2377 return filterFindByC_A(companyId, active, start, end, null);
2378 }
2379
2380
2395 public List<LayoutPrototype> filterFindByC_A(long companyId,
2396 boolean active, int start, int end, OrderByComparator orderByComparator)
2397 throws SystemException {
2398 if (!InlineSQLHelperUtil.isEnabled()) {
2399 return findByC_A(companyId, active, start, end, orderByComparator);
2400 }
2401
2402 StringBundler query = null;
2403
2404 if (orderByComparator != null) {
2405 query = new StringBundler(4 +
2406 (orderByComparator.getOrderByFields().length * 3));
2407 }
2408 else {
2409 query = new StringBundler(3);
2410 }
2411
2412 if (getDB().isSupportsInlineDistinct()) {
2413 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_WHERE);
2414 }
2415 else {
2416 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
2417 }
2418
2419 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2420
2421 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2422
2423 if (!getDB().isSupportsInlineDistinct()) {
2424 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
2425 }
2426
2427 if (orderByComparator != null) {
2428 if (getDB().isSupportsInlineDistinct()) {
2429 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2430 orderByComparator);
2431 }
2432 else {
2433 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2434 orderByComparator);
2435 }
2436 }
2437
2438 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2439 LayoutPrototype.class.getName(),
2440 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2441
2442 Session session = null;
2443
2444 try {
2445 session = openSession();
2446
2447 SQLQuery q = session.createSQLQuery(sql);
2448
2449 if (getDB().isSupportsInlineDistinct()) {
2450 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutPrototypeImpl.class);
2451 }
2452 else {
2453 q.addEntity(_FILTER_ENTITY_TABLE, LayoutPrototypeImpl.class);
2454 }
2455
2456 QueryPos qPos = QueryPos.getInstance(q);
2457
2458 qPos.add(companyId);
2459
2460 qPos.add(active);
2461
2462 return (List<LayoutPrototype>)QueryUtil.list(q, getDialect(),
2463 start, end);
2464 }
2465 catch (Exception e) {
2466 throw processException(e);
2467 }
2468 finally {
2469 closeSession(session);
2470 }
2471 }
2472
2473
2484 public LayoutPrototype[] filterFindByC_A_PrevAndNext(
2485 long layoutPrototypeId, long companyId, boolean active,
2486 OrderByComparator orderByComparator)
2487 throws NoSuchLayoutPrototypeException, SystemException {
2488 if (!InlineSQLHelperUtil.isEnabled()) {
2489 return findByC_A_PrevAndNext(layoutPrototypeId, companyId, active,
2490 orderByComparator);
2491 }
2492
2493 LayoutPrototype layoutPrototype = findByPrimaryKey(layoutPrototypeId);
2494
2495 Session session = null;
2496
2497 try {
2498 session = openSession();
2499
2500 LayoutPrototype[] array = new LayoutPrototypeImpl[3];
2501
2502 array[0] = filterGetByC_A_PrevAndNext(session, layoutPrototype,
2503 companyId, active, orderByComparator, true);
2504
2505 array[1] = layoutPrototype;
2506
2507 array[2] = filterGetByC_A_PrevAndNext(session, layoutPrototype,
2508 companyId, active, orderByComparator, false);
2509
2510 return array;
2511 }
2512 catch (Exception e) {
2513 throw processException(e);
2514 }
2515 finally {
2516 closeSession(session);
2517 }
2518 }
2519
2520 protected LayoutPrototype filterGetByC_A_PrevAndNext(Session session,
2521 LayoutPrototype layoutPrototype, long companyId, boolean active,
2522 OrderByComparator orderByComparator, boolean previous) {
2523 StringBundler query = null;
2524
2525 if (orderByComparator != null) {
2526 query = new StringBundler(6 +
2527 (orderByComparator.getOrderByFields().length * 6));
2528 }
2529 else {
2530 query = new StringBundler(3);
2531 }
2532
2533 if (getDB().isSupportsInlineDistinct()) {
2534 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_WHERE);
2535 }
2536 else {
2537 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
2538 }
2539
2540 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
2541
2542 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
2543
2544 if (!getDB().isSupportsInlineDistinct()) {
2545 query.append(_FILTER_SQL_SELECT_LAYOUTPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
2546 }
2547
2548 if (orderByComparator != null) {
2549 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2550
2551 if (orderByConditionFields.length > 0) {
2552 query.append(WHERE_AND);
2553 }
2554
2555 for (int i = 0; i < orderByConditionFields.length; i++) {
2556 if (getDB().isSupportsInlineDistinct()) {
2557 query.append(_ORDER_BY_ENTITY_ALIAS);
2558 }
2559 else {
2560 query.append(_ORDER_BY_ENTITY_TABLE);
2561 }
2562
2563 query.append(orderByConditionFields[i]);
2564
2565 if ((i + 1) < orderByConditionFields.length) {
2566 if (orderByComparator.isAscending() ^ previous) {
2567 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2568 }
2569 else {
2570 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2571 }
2572 }
2573 else {
2574 if (orderByComparator.isAscending() ^ previous) {
2575 query.append(WHERE_GREATER_THAN);
2576 }
2577 else {
2578 query.append(WHERE_LESSER_THAN);
2579 }
2580 }
2581 }
2582
2583 query.append(ORDER_BY_CLAUSE);
2584
2585 String[] orderByFields = orderByComparator.getOrderByFields();
2586
2587 for (int i = 0; i < orderByFields.length; i++) {
2588 if (getDB().isSupportsInlineDistinct()) {
2589 query.append(_ORDER_BY_ENTITY_ALIAS);
2590 }
2591 else {
2592 query.append(_ORDER_BY_ENTITY_TABLE);
2593 }
2594
2595 query.append(orderByFields[i]);
2596
2597 if ((i + 1) < orderByFields.length) {
2598 if (orderByComparator.isAscending() ^ previous) {
2599 query.append(ORDER_BY_ASC_HAS_NEXT);
2600 }
2601 else {
2602 query.append(ORDER_BY_DESC_HAS_NEXT);
2603 }
2604 }
2605 else {
2606 if (orderByComparator.isAscending() ^ previous) {
2607 query.append(ORDER_BY_ASC);
2608 }
2609 else {
2610 query.append(ORDER_BY_DESC);
2611 }
2612 }
2613 }
2614 }
2615
2616 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2617 LayoutPrototype.class.getName(),
2618 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2619
2620 SQLQuery q = session.createSQLQuery(sql);
2621
2622 q.setFirstResult(0);
2623 q.setMaxResults(2);
2624
2625 if (getDB().isSupportsInlineDistinct()) {
2626 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutPrototypeImpl.class);
2627 }
2628 else {
2629 q.addEntity(_FILTER_ENTITY_TABLE, LayoutPrototypeImpl.class);
2630 }
2631
2632 QueryPos qPos = QueryPos.getInstance(q);
2633
2634 qPos.add(companyId);
2635
2636 qPos.add(active);
2637
2638 if (orderByComparator != null) {
2639 Object[] values = orderByComparator.getOrderByConditionValues(layoutPrototype);
2640
2641 for (Object value : values) {
2642 qPos.add(value);
2643 }
2644 }
2645
2646 List<LayoutPrototype> list = q.list();
2647
2648 if (list.size() == 2) {
2649 return list.get(1);
2650 }
2651 else {
2652 return null;
2653 }
2654 }
2655
2656
2662 public List<LayoutPrototype> findAll() throws SystemException {
2663 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2664 }
2665
2666
2678 public List<LayoutPrototype> findAll(int start, int end)
2679 throws SystemException {
2680 return findAll(start, end, null);
2681 }
2682
2683
2696 public List<LayoutPrototype> findAll(int start, int end,
2697 OrderByComparator orderByComparator) throws SystemException {
2698 FinderPath finderPath = null;
2699 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2700
2701 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2702 (orderByComparator == null)) {
2703 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2704 finderArgs = FINDER_ARGS_EMPTY;
2705 }
2706 else {
2707 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2708 finderArgs = new Object[] { start, end, orderByComparator };
2709 }
2710
2711 List<LayoutPrototype> list = (List<LayoutPrototype>)FinderCacheUtil.getResult(finderPath,
2712 finderArgs, this);
2713
2714 if (list == null) {
2715 StringBundler query = null;
2716 String sql = null;
2717
2718 if (orderByComparator != null) {
2719 query = new StringBundler(2 +
2720 (orderByComparator.getOrderByFields().length * 3));
2721
2722 query.append(_SQL_SELECT_LAYOUTPROTOTYPE);
2723
2724 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2725 orderByComparator);
2726
2727 sql = query.toString();
2728 }
2729 else {
2730 sql = _SQL_SELECT_LAYOUTPROTOTYPE;
2731 }
2732
2733 Session session = null;
2734
2735 try {
2736 session = openSession();
2737
2738 Query q = session.createQuery(sql);
2739
2740 if (orderByComparator == null) {
2741 list = (List<LayoutPrototype>)QueryUtil.list(q,
2742 getDialect(), start, end, false);
2743
2744 Collections.sort(list);
2745 }
2746 else {
2747 list = (List<LayoutPrototype>)QueryUtil.list(q,
2748 getDialect(), start, end);
2749 }
2750 }
2751 catch (Exception e) {
2752 throw processException(e);
2753 }
2754 finally {
2755 if (list == null) {
2756 FinderCacheUtil.removeResult(finderPath, finderArgs);
2757 }
2758 else {
2759 cacheResult(list);
2760
2761 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2762 }
2763
2764 closeSession(session);
2765 }
2766 }
2767
2768 return list;
2769 }
2770
2771
2777 public void removeByUuid(String uuid) throws SystemException {
2778 for (LayoutPrototype layoutPrototype : findByUuid(uuid)) {
2779 remove(layoutPrototype);
2780 }
2781 }
2782
2783
2789 public void removeByCompanyId(long companyId) throws SystemException {
2790 for (LayoutPrototype layoutPrototype : findByCompanyId(companyId)) {
2791 remove(layoutPrototype);
2792 }
2793 }
2794
2795
2802 public void removeByC_A(long companyId, boolean active)
2803 throws SystemException {
2804 for (LayoutPrototype layoutPrototype : findByC_A(companyId, active)) {
2805 remove(layoutPrototype);
2806 }
2807 }
2808
2809
2814 public void removeAll() throws SystemException {
2815 for (LayoutPrototype layoutPrototype : findAll()) {
2816 remove(layoutPrototype);
2817 }
2818 }
2819
2820
2827 public int countByUuid(String uuid) throws SystemException {
2828 Object[] finderArgs = new Object[] { uuid };
2829
2830 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2831 finderArgs, this);
2832
2833 if (count == null) {
2834 StringBundler query = new StringBundler(2);
2835
2836 query.append(_SQL_COUNT_LAYOUTPROTOTYPE_WHERE);
2837
2838 if (uuid == null) {
2839 query.append(_FINDER_COLUMN_UUID_UUID_1);
2840 }
2841 else {
2842 if (uuid.equals(StringPool.BLANK)) {
2843 query.append(_FINDER_COLUMN_UUID_UUID_3);
2844 }
2845 else {
2846 query.append(_FINDER_COLUMN_UUID_UUID_2);
2847 }
2848 }
2849
2850 String sql = query.toString();
2851
2852 Session session = null;
2853
2854 try {
2855 session = openSession();
2856
2857 Query q = session.createQuery(sql);
2858
2859 QueryPos qPos = QueryPos.getInstance(q);
2860
2861 if (uuid != null) {
2862 qPos.add(uuid);
2863 }
2864
2865 count = (Long)q.uniqueResult();
2866 }
2867 catch (Exception e) {
2868 throw processException(e);
2869 }
2870 finally {
2871 if (count == null) {
2872 count = Long.valueOf(0);
2873 }
2874
2875 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2876 finderArgs, count);
2877
2878 closeSession(session);
2879 }
2880 }
2881
2882 return count.intValue();
2883 }
2884
2885
2892 public int filterCountByUuid(String uuid) throws SystemException {
2893 if (!InlineSQLHelperUtil.isEnabled()) {
2894 return countByUuid(uuid);
2895 }
2896
2897 StringBundler query = new StringBundler(2);
2898
2899 query.append(_FILTER_SQL_COUNT_LAYOUTPROTOTYPE_WHERE);
2900
2901 if (uuid == null) {
2902 query.append(_FINDER_COLUMN_UUID_UUID_1);
2903 }
2904 else {
2905 if (uuid.equals(StringPool.BLANK)) {
2906 query.append(_FINDER_COLUMN_UUID_UUID_3);
2907 }
2908 else {
2909 query.append(_FINDER_COLUMN_UUID_UUID_2);
2910 }
2911 }
2912
2913 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2914 LayoutPrototype.class.getName(),
2915 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2916
2917 Session session = null;
2918
2919 try {
2920 session = openSession();
2921
2922 SQLQuery q = session.createSQLQuery(sql);
2923
2924 q.addScalar(COUNT_COLUMN_NAME,
2925 com.liferay.portal.kernel.dao.orm.Type.LONG);
2926
2927 QueryPos qPos = QueryPos.getInstance(q);
2928
2929 if (uuid != null) {
2930 qPos.add(uuid);
2931 }
2932
2933 Long count = (Long)q.uniqueResult();
2934
2935 return count.intValue();
2936 }
2937 catch (Exception e) {
2938 throw processException(e);
2939 }
2940 finally {
2941 closeSession(session);
2942 }
2943 }
2944
2945
2952 public int countByCompanyId(long companyId) throws SystemException {
2953 Object[] finderArgs = new Object[] { companyId };
2954
2955 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2956 finderArgs, this);
2957
2958 if (count == null) {
2959 StringBundler query = new StringBundler(2);
2960
2961 query.append(_SQL_COUNT_LAYOUTPROTOTYPE_WHERE);
2962
2963 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2964
2965 String sql = query.toString();
2966
2967 Session session = null;
2968
2969 try {
2970 session = openSession();
2971
2972 Query q = session.createQuery(sql);
2973
2974 QueryPos qPos = QueryPos.getInstance(q);
2975
2976 qPos.add(companyId);
2977
2978 count = (Long)q.uniqueResult();
2979 }
2980 catch (Exception e) {
2981 throw processException(e);
2982 }
2983 finally {
2984 if (count == null) {
2985 count = Long.valueOf(0);
2986 }
2987
2988 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2989 finderArgs, count);
2990
2991 closeSession(session);
2992 }
2993 }
2994
2995 return count.intValue();
2996 }
2997
2998
3005 public int filterCountByCompanyId(long companyId) throws SystemException {
3006 if (!InlineSQLHelperUtil.isEnabled()) {
3007 return countByCompanyId(companyId);
3008 }
3009
3010 StringBundler query = new StringBundler(2);
3011
3012 query.append(_FILTER_SQL_COUNT_LAYOUTPROTOTYPE_WHERE);
3013
3014 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
3015
3016 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3017 LayoutPrototype.class.getName(),
3018 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3019
3020 Session session = null;
3021
3022 try {
3023 session = openSession();
3024
3025 SQLQuery q = session.createSQLQuery(sql);
3026
3027 q.addScalar(COUNT_COLUMN_NAME,
3028 com.liferay.portal.kernel.dao.orm.Type.LONG);
3029
3030 QueryPos qPos = QueryPos.getInstance(q);
3031
3032 qPos.add(companyId);
3033
3034 Long count = (Long)q.uniqueResult();
3035
3036 return count.intValue();
3037 }
3038 catch (Exception e) {
3039 throw processException(e);
3040 }
3041 finally {
3042 closeSession(session);
3043 }
3044 }
3045
3046
3054 public int countByC_A(long companyId, boolean active)
3055 throws SystemException {
3056 Object[] finderArgs = new Object[] { companyId, active };
3057
3058 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_A,
3059 finderArgs, this);
3060
3061 if (count == null) {
3062 StringBundler query = new StringBundler(3);
3063
3064 query.append(_SQL_COUNT_LAYOUTPROTOTYPE_WHERE);
3065
3066 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
3067
3068 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
3069
3070 String sql = query.toString();
3071
3072 Session session = null;
3073
3074 try {
3075 session = openSession();
3076
3077 Query q = session.createQuery(sql);
3078
3079 QueryPos qPos = QueryPos.getInstance(q);
3080
3081 qPos.add(companyId);
3082
3083 qPos.add(active);
3084
3085 count = (Long)q.uniqueResult();
3086 }
3087 catch (Exception e) {
3088 throw processException(e);
3089 }
3090 finally {
3091 if (count == null) {
3092 count = Long.valueOf(0);
3093 }
3094
3095 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_A, finderArgs,
3096 count);
3097
3098 closeSession(session);
3099 }
3100 }
3101
3102 return count.intValue();
3103 }
3104
3105
3113 public int filterCountByC_A(long companyId, boolean active)
3114 throws SystemException {
3115 if (!InlineSQLHelperUtil.isEnabled()) {
3116 return countByC_A(companyId, active);
3117 }
3118
3119 StringBundler query = new StringBundler(3);
3120
3121 query.append(_FILTER_SQL_COUNT_LAYOUTPROTOTYPE_WHERE);
3122
3123 query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
3124
3125 query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
3126
3127 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3128 LayoutPrototype.class.getName(),
3129 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3130
3131 Session session = null;
3132
3133 try {
3134 session = openSession();
3135
3136 SQLQuery q = session.createSQLQuery(sql);
3137
3138 q.addScalar(COUNT_COLUMN_NAME,
3139 com.liferay.portal.kernel.dao.orm.Type.LONG);
3140
3141 QueryPos qPos = QueryPos.getInstance(q);
3142
3143 qPos.add(companyId);
3144
3145 qPos.add(active);
3146
3147 Long count = (Long)q.uniqueResult();
3148
3149 return count.intValue();
3150 }
3151 catch (Exception e) {
3152 throw processException(e);
3153 }
3154 finally {
3155 closeSession(session);
3156 }
3157 }
3158
3159
3165 public int countAll() throws SystemException {
3166 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3167 FINDER_ARGS_EMPTY, this);
3168
3169 if (count == null) {
3170 Session session = null;
3171
3172 try {
3173 session = openSession();
3174
3175 Query q = session.createQuery(_SQL_COUNT_LAYOUTPROTOTYPE);
3176
3177 count = (Long)q.uniqueResult();
3178 }
3179 catch (Exception e) {
3180 throw processException(e);
3181 }
3182 finally {
3183 if (count == null) {
3184 count = Long.valueOf(0);
3185 }
3186
3187 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3188 FINDER_ARGS_EMPTY, count);
3189
3190 closeSession(session);
3191 }
3192 }
3193
3194 return count.intValue();
3195 }
3196
3197
3200 public void afterPropertiesSet() {
3201 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3202 com.liferay.portal.util.PropsUtil.get(
3203 "value.object.listener.com.liferay.portal.model.LayoutPrototype")));
3204
3205 if (listenerClassNames.length > 0) {
3206 try {
3207 List<ModelListener<LayoutPrototype>> listenersList = new ArrayList<ModelListener<LayoutPrototype>>();
3208
3209 for (String listenerClassName : listenerClassNames) {
3210 Class<?> clazz = getClass();
3211
3212 listenersList.add((ModelListener<LayoutPrototype>)InstanceFactory.newInstance(
3213 clazz.getClassLoader(), listenerClassName));
3214 }
3215
3216 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3217 }
3218 catch (Exception e) {
3219 _log.error(e);
3220 }
3221 }
3222 }
3223
3224 public void destroy() {
3225 EntityCacheUtil.removeCache(LayoutPrototypeImpl.class.getName());
3226 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3227 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3228 }
3229
3230 @BeanReference(type = AccountPersistence.class)
3231 protected AccountPersistence accountPersistence;
3232 @BeanReference(type = AddressPersistence.class)
3233 protected AddressPersistence addressPersistence;
3234 @BeanReference(type = BrowserTrackerPersistence.class)
3235 protected BrowserTrackerPersistence browserTrackerPersistence;
3236 @BeanReference(type = ClassNamePersistence.class)
3237 protected ClassNamePersistence classNamePersistence;
3238 @BeanReference(type = ClusterGroupPersistence.class)
3239 protected ClusterGroupPersistence clusterGroupPersistence;
3240 @BeanReference(type = CompanyPersistence.class)
3241 protected CompanyPersistence companyPersistence;
3242 @BeanReference(type = ContactPersistence.class)
3243 protected ContactPersistence contactPersistence;
3244 @BeanReference(type = CountryPersistence.class)
3245 protected CountryPersistence countryPersistence;
3246 @BeanReference(type = EmailAddressPersistence.class)
3247 protected EmailAddressPersistence emailAddressPersistence;
3248 @BeanReference(type = GroupPersistence.class)
3249 protected GroupPersistence groupPersistence;
3250 @BeanReference(type = ImagePersistence.class)
3251 protected ImagePersistence imagePersistence;
3252 @BeanReference(type = LayoutPersistence.class)
3253 protected LayoutPersistence layoutPersistence;
3254 @BeanReference(type = LayoutBranchPersistence.class)
3255 protected LayoutBranchPersistence layoutBranchPersistence;
3256 @BeanReference(type = LayoutPrototypePersistence.class)
3257 protected LayoutPrototypePersistence layoutPrototypePersistence;
3258 @BeanReference(type = LayoutRevisionPersistence.class)
3259 protected LayoutRevisionPersistence layoutRevisionPersistence;
3260 @BeanReference(type = LayoutSetPersistence.class)
3261 protected LayoutSetPersistence layoutSetPersistence;
3262 @BeanReference(type = LayoutSetBranchPersistence.class)
3263 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
3264 @BeanReference(type = LayoutSetPrototypePersistence.class)
3265 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
3266 @BeanReference(type = ListTypePersistence.class)
3267 protected ListTypePersistence listTypePersistence;
3268 @BeanReference(type = LockPersistence.class)
3269 protected LockPersistence lockPersistence;
3270 @BeanReference(type = MembershipRequestPersistence.class)
3271 protected MembershipRequestPersistence membershipRequestPersistence;
3272 @BeanReference(type = OrganizationPersistence.class)
3273 protected OrganizationPersistence organizationPersistence;
3274 @BeanReference(type = OrgGroupPermissionPersistence.class)
3275 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
3276 @BeanReference(type = OrgGroupRolePersistence.class)
3277 protected OrgGroupRolePersistence orgGroupRolePersistence;
3278 @BeanReference(type = OrgLaborPersistence.class)
3279 protected OrgLaborPersistence orgLaborPersistence;
3280 @BeanReference(type = PasswordPolicyPersistence.class)
3281 protected PasswordPolicyPersistence passwordPolicyPersistence;
3282 @BeanReference(type = PasswordPolicyRelPersistence.class)
3283 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
3284 @BeanReference(type = PasswordTrackerPersistence.class)
3285 protected PasswordTrackerPersistence passwordTrackerPersistence;
3286 @BeanReference(type = PermissionPersistence.class)
3287 protected PermissionPersistence permissionPersistence;
3288 @BeanReference(type = PhonePersistence.class)
3289 protected PhonePersistence phonePersistence;
3290 @BeanReference(type = PluginSettingPersistence.class)
3291 protected PluginSettingPersistence pluginSettingPersistence;
3292 @BeanReference(type = PortalPreferencesPersistence.class)
3293 protected PortalPreferencesPersistence portalPreferencesPersistence;
3294 @BeanReference(type = PortletPersistence.class)
3295 protected PortletPersistence portletPersistence;
3296 @BeanReference(type = PortletItemPersistence.class)
3297 protected PortletItemPersistence portletItemPersistence;
3298 @BeanReference(type = PortletPreferencesPersistence.class)
3299 protected PortletPreferencesPersistence portletPreferencesPersistence;
3300 @BeanReference(type = RegionPersistence.class)
3301 protected RegionPersistence regionPersistence;
3302 @BeanReference(type = ReleasePersistence.class)
3303 protected ReleasePersistence releasePersistence;
3304 @BeanReference(type = RepositoryPersistence.class)
3305 protected RepositoryPersistence repositoryPersistence;
3306 @BeanReference(type = RepositoryEntryPersistence.class)
3307 protected RepositoryEntryPersistence repositoryEntryPersistence;
3308 @BeanReference(type = ResourcePersistence.class)
3309 protected ResourcePersistence resourcePersistence;
3310 @BeanReference(type = ResourceActionPersistence.class)
3311 protected ResourceActionPersistence resourceActionPersistence;
3312 @BeanReference(type = ResourceBlockPersistence.class)
3313 protected ResourceBlockPersistence resourceBlockPersistence;
3314 @BeanReference(type = ResourceBlockPermissionPersistence.class)
3315 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
3316 @BeanReference(type = ResourceCodePersistence.class)
3317 protected ResourceCodePersistence resourceCodePersistence;
3318 @BeanReference(type = ResourcePermissionPersistence.class)
3319 protected ResourcePermissionPersistence resourcePermissionPersistence;
3320 @BeanReference(type = ResourceTypePermissionPersistence.class)
3321 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
3322 @BeanReference(type = RolePersistence.class)
3323 protected RolePersistence rolePersistence;
3324 @BeanReference(type = ServiceComponentPersistence.class)
3325 protected ServiceComponentPersistence serviceComponentPersistence;
3326 @BeanReference(type = ShardPersistence.class)
3327 protected ShardPersistence shardPersistence;
3328 @BeanReference(type = SubscriptionPersistence.class)
3329 protected SubscriptionPersistence subscriptionPersistence;
3330 @BeanReference(type = TeamPersistence.class)
3331 protected TeamPersistence teamPersistence;
3332 @BeanReference(type = TicketPersistence.class)
3333 protected TicketPersistence ticketPersistence;
3334 @BeanReference(type = UserPersistence.class)
3335 protected UserPersistence userPersistence;
3336 @BeanReference(type = UserGroupPersistence.class)
3337 protected UserGroupPersistence userGroupPersistence;
3338 @BeanReference(type = UserGroupGroupRolePersistence.class)
3339 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
3340 @BeanReference(type = UserGroupRolePersistence.class)
3341 protected UserGroupRolePersistence userGroupRolePersistence;
3342 @BeanReference(type = UserIdMapperPersistence.class)
3343 protected UserIdMapperPersistence userIdMapperPersistence;
3344 @BeanReference(type = UserNotificationEventPersistence.class)
3345 protected UserNotificationEventPersistence userNotificationEventPersistence;
3346 @BeanReference(type = UserTrackerPersistence.class)
3347 protected UserTrackerPersistence userTrackerPersistence;
3348 @BeanReference(type = UserTrackerPathPersistence.class)
3349 protected UserTrackerPathPersistence userTrackerPathPersistence;
3350 @BeanReference(type = VirtualHostPersistence.class)
3351 protected VirtualHostPersistence virtualHostPersistence;
3352 @BeanReference(type = WebDAVPropsPersistence.class)
3353 protected WebDAVPropsPersistence webDAVPropsPersistence;
3354 @BeanReference(type = WebsitePersistence.class)
3355 protected WebsitePersistence websitePersistence;
3356 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
3357 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
3358 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
3359 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
3360 private static final String _SQL_SELECT_LAYOUTPROTOTYPE = "SELECT layoutPrototype FROM LayoutPrototype layoutPrototype";
3361 private static final String _SQL_SELECT_LAYOUTPROTOTYPE_WHERE = "SELECT layoutPrototype FROM LayoutPrototype layoutPrototype WHERE ";
3362 private static final String _SQL_COUNT_LAYOUTPROTOTYPE = "SELECT COUNT(layoutPrototype) FROM LayoutPrototype layoutPrototype";
3363 private static final String _SQL_COUNT_LAYOUTPROTOTYPE_WHERE = "SELECT COUNT(layoutPrototype) FROM LayoutPrototype layoutPrototype WHERE ";
3364 private static final String _FINDER_COLUMN_UUID_UUID_1 = "layoutPrototype.uuid IS NULL";
3365 private static final String _FINDER_COLUMN_UUID_UUID_2 = "layoutPrototype.uuid = ?";
3366 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(layoutPrototype.uuid IS NULL OR layoutPrototype.uuid = ?)";
3367 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "layoutPrototype.companyId = ?";
3368 private static final String _FINDER_COLUMN_C_A_COMPANYID_2 = "layoutPrototype.companyId = ? AND ";
3369 private static final String _FINDER_COLUMN_C_A_ACTIVE_2 = "layoutPrototype.active = ?";
3370 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "layoutPrototype.layoutPrototypeId";
3371 private static final String _FILTER_SQL_SELECT_LAYOUTPROTOTYPE_WHERE = "SELECT DISTINCT {layoutPrototype.*} FROM LayoutPrototype layoutPrototype WHERE ";
3372 private static final String _FILTER_SQL_SELECT_LAYOUTPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1 =
3373 "SELECT {LayoutPrototype.*} FROM (SELECT DISTINCT layoutPrototype.layoutPrototypeId FROM LayoutPrototype layoutPrototype WHERE ";
3374 private static final String _FILTER_SQL_SELECT_LAYOUTPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2 =
3375 ") TEMP_TABLE INNER JOIN LayoutPrototype ON TEMP_TABLE.layoutPrototypeId = LayoutPrototype.layoutPrototypeId";
3376 private static final String _FILTER_SQL_COUNT_LAYOUTPROTOTYPE_WHERE = "SELECT COUNT(DISTINCT layoutPrototype.layoutPrototypeId) AS COUNT_VALUE FROM LayoutPrototype layoutPrototype WHERE ";
3377 private static final String _FILTER_ENTITY_ALIAS = "layoutPrototype";
3378 private static final String _FILTER_ENTITY_TABLE = "LayoutPrototype";
3379 private static final String _ORDER_BY_ENTITY_ALIAS = "layoutPrototype.";
3380 private static final String _ORDER_BY_ENTITY_TABLE = "LayoutPrototype.";
3381 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No LayoutPrototype exists with the primary key ";
3382 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No LayoutPrototype exists with the key {";
3383 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3384 private static Log _log = LogFactoryUtil.getLog(LayoutPrototypePersistenceImpl.class);
3385 private static LayoutPrototype _nullLayoutPrototype = new LayoutPrototypeImpl() {
3386 @Override
3387 public Object clone() {
3388 return this;
3389 }
3390
3391 @Override
3392 public CacheModel<LayoutPrototype> toCacheModel() {
3393 return _nullLayoutPrototypeCacheModel;
3394 }
3395 };
3396
3397 private static CacheModel<LayoutPrototype> _nullLayoutPrototypeCacheModel = new CacheModel<LayoutPrototype>() {
3398 public LayoutPrototype toEntityModel() {
3399 return _nullLayoutPrototype;
3400 }
3401 };
3402 }