001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchLayoutSetBranchException;
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.model.CacheModel;
040 import com.liferay.portal.model.LayoutSetBranch;
041 import com.liferay.portal.model.ModelListener;
042 import com.liferay.portal.model.impl.LayoutSetBranchImpl;
043 import com.liferay.portal.model.impl.LayoutSetBranchModelImpl;
044 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
045 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
046
047 import java.io.Serializable;
048
049 import java.util.ArrayList;
050 import java.util.Collections;
051 import java.util.List;
052
053
065 public class LayoutSetBranchPersistenceImpl extends BasePersistenceImpl<LayoutSetBranch>
066 implements LayoutSetBranchPersistence {
067
072 public static final String FINDER_CLASS_NAME_ENTITY = LayoutSetBranchImpl.class.getName();
073 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
074 ".List1";
075 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
076 ".List2";
077 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
078 LayoutSetBranchModelImpl.FINDER_CACHE_ENABLED,
079 LayoutSetBranchImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
080 "findByGroupId",
081 new String[] {
082 Long.class.getName(),
083
084 "java.lang.Integer", "java.lang.Integer",
085 "com.liferay.portal.kernel.util.OrderByComparator"
086 });
087 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
088 new FinderPath(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
089 LayoutSetBranchModelImpl.FINDER_CACHE_ENABLED,
090 LayoutSetBranchImpl.class,
091 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
092 new String[] { Long.class.getName() },
093 LayoutSetBranchModelImpl.GROUPID_COLUMN_BITMASK);
094 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
095 LayoutSetBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
096 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
097 new String[] { Long.class.getName() });
098 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_P = new FinderPath(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
099 LayoutSetBranchModelImpl.FINDER_CACHE_ENABLED,
100 LayoutSetBranchImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
101 "findByG_P",
102 new String[] {
103 Long.class.getName(), Boolean.class.getName(),
104
105 "java.lang.Integer", "java.lang.Integer",
106 "com.liferay.portal.kernel.util.OrderByComparator"
107 });
108 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_P = new FinderPath(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
109 LayoutSetBranchModelImpl.FINDER_CACHE_ENABLED,
110 LayoutSetBranchImpl.class,
111 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_P",
112 new String[] { Long.class.getName(), Boolean.class.getName() },
113 LayoutSetBranchModelImpl.GROUPID_COLUMN_BITMASK |
114 LayoutSetBranchModelImpl.PRIVATELAYOUT_COLUMN_BITMASK);
115 public static final FinderPath FINDER_PATH_COUNT_BY_G_P = new FinderPath(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
116 LayoutSetBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
117 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_P",
118 new String[] { Long.class.getName(), Boolean.class.getName() });
119 public static final FinderPath FINDER_PATH_FETCH_BY_G_P_N = new FinderPath(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
120 LayoutSetBranchModelImpl.FINDER_CACHE_ENABLED,
121 LayoutSetBranchImpl.class, FINDER_CLASS_NAME_ENTITY,
122 "fetchByG_P_N",
123 new String[] {
124 Long.class.getName(), Boolean.class.getName(),
125 String.class.getName()
126 },
127 LayoutSetBranchModelImpl.GROUPID_COLUMN_BITMASK |
128 LayoutSetBranchModelImpl.PRIVATELAYOUT_COLUMN_BITMASK |
129 LayoutSetBranchModelImpl.NAME_COLUMN_BITMASK);
130 public static final FinderPath FINDER_PATH_COUNT_BY_G_P_N = new FinderPath(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
131 LayoutSetBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
132 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_P_N",
133 new String[] {
134 Long.class.getName(), Boolean.class.getName(),
135 String.class.getName()
136 });
137 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_P_M = new FinderPath(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
138 LayoutSetBranchModelImpl.FINDER_CACHE_ENABLED,
139 LayoutSetBranchImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
140 "findByG_P_M",
141 new String[] {
142 Long.class.getName(), Boolean.class.getName(),
143 Boolean.class.getName(),
144
145 "java.lang.Integer", "java.lang.Integer",
146 "com.liferay.portal.kernel.util.OrderByComparator"
147 });
148 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_P_M = new FinderPath(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
149 LayoutSetBranchModelImpl.FINDER_CACHE_ENABLED,
150 LayoutSetBranchImpl.class,
151 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_P_M",
152 new String[] {
153 Long.class.getName(), Boolean.class.getName(),
154 Boolean.class.getName()
155 },
156 LayoutSetBranchModelImpl.GROUPID_COLUMN_BITMASK |
157 LayoutSetBranchModelImpl.PRIVATELAYOUT_COLUMN_BITMASK |
158 LayoutSetBranchModelImpl.MASTER_COLUMN_BITMASK);
159 public static final FinderPath FINDER_PATH_COUNT_BY_G_P_M = new FinderPath(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
160 LayoutSetBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
161 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_P_M",
162 new String[] {
163 Long.class.getName(), Boolean.class.getName(),
164 Boolean.class.getName()
165 });
166 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
167 LayoutSetBranchModelImpl.FINDER_CACHE_ENABLED,
168 LayoutSetBranchImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
169 "findAll", new String[0]);
170 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
171 LayoutSetBranchModelImpl.FINDER_CACHE_ENABLED,
172 LayoutSetBranchImpl.class,
173 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
174 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
175 LayoutSetBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
176 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
177
178
183 public void cacheResult(LayoutSetBranch layoutSetBranch) {
184 EntityCacheUtil.putResult(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
185 LayoutSetBranchImpl.class, layoutSetBranch.getPrimaryKey(),
186 layoutSetBranch);
187
188 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
189 new Object[] {
190 Long.valueOf(layoutSetBranch.getGroupId()),
191 Boolean.valueOf(layoutSetBranch.getPrivateLayout()),
192
193 layoutSetBranch.getName()
194 }, layoutSetBranch);
195
196 layoutSetBranch.resetOriginalValues();
197 }
198
199
204 public void cacheResult(List<LayoutSetBranch> layoutSetBranchs) {
205 for (LayoutSetBranch layoutSetBranch : layoutSetBranchs) {
206 if (EntityCacheUtil.getResult(
207 LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
208 LayoutSetBranchImpl.class,
209 layoutSetBranch.getPrimaryKey()) == null) {
210 cacheResult(layoutSetBranch);
211 }
212 else {
213 layoutSetBranch.resetOriginalValues();
214 }
215 }
216 }
217
218
225 @Override
226 public void clearCache() {
227 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
228 CacheRegistryUtil.clear(LayoutSetBranchImpl.class.getName());
229 }
230
231 EntityCacheUtil.clearCache(LayoutSetBranchImpl.class.getName());
232
233 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
234 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
235 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
236 }
237
238
245 @Override
246 public void clearCache(LayoutSetBranch layoutSetBranch) {
247 EntityCacheUtil.removeResult(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
248 LayoutSetBranchImpl.class, layoutSetBranch.getPrimaryKey());
249
250 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
251 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
252
253 clearUniqueFindersCache(layoutSetBranch);
254 }
255
256 @Override
257 public void clearCache(List<LayoutSetBranch> layoutSetBranchs) {
258 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
259 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
260
261 for (LayoutSetBranch layoutSetBranch : layoutSetBranchs) {
262 EntityCacheUtil.removeResult(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
263 LayoutSetBranchImpl.class, layoutSetBranch.getPrimaryKey());
264
265 clearUniqueFindersCache(layoutSetBranch);
266 }
267 }
268
269 protected void cacheUniqueFindersCache(LayoutSetBranch layoutSetBranch) {
270 if (layoutSetBranch.isNew()) {
271 Object[] args = new Object[] {
272 Long.valueOf(layoutSetBranch.getGroupId()),
273 Boolean.valueOf(layoutSetBranch.getPrivateLayout()),
274
275 layoutSetBranch.getName()
276 };
277
278 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P_N, args,
279 Long.valueOf(1));
280 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N, args,
281 layoutSetBranch);
282 }
283 else {
284 LayoutSetBranchModelImpl layoutSetBranchModelImpl = (LayoutSetBranchModelImpl)layoutSetBranch;
285
286 if ((layoutSetBranchModelImpl.getColumnBitmask() &
287 FINDER_PATH_FETCH_BY_G_P_N.getColumnBitmask()) != 0) {
288 Object[] args = new Object[] {
289 Long.valueOf(layoutSetBranch.getGroupId()),
290 Boolean.valueOf(layoutSetBranch.getPrivateLayout()),
291
292 layoutSetBranch.getName()
293 };
294
295 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P_N, args,
296 Long.valueOf(1));
297 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N, args,
298 layoutSetBranch);
299 }
300 }
301 }
302
303 protected void clearUniqueFindersCache(LayoutSetBranch layoutSetBranch) {
304 LayoutSetBranchModelImpl layoutSetBranchModelImpl = (LayoutSetBranchModelImpl)layoutSetBranch;
305
306 Object[] args = new Object[] {
307 Long.valueOf(layoutSetBranch.getGroupId()),
308 Boolean.valueOf(layoutSetBranch.getPrivateLayout()),
309
310 layoutSetBranch.getName()
311 };
312
313 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_P_N, args);
314 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P_N, args);
315
316 if ((layoutSetBranchModelImpl.getColumnBitmask() &
317 FINDER_PATH_FETCH_BY_G_P_N.getColumnBitmask()) != 0) {
318 args = new Object[] {
319 Long.valueOf(layoutSetBranchModelImpl.getOriginalGroupId()),
320 Boolean.valueOf(layoutSetBranchModelImpl.getOriginalPrivateLayout()),
321
322 layoutSetBranchModelImpl.getOriginalName()
323 };
324
325 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_P_N, args);
326 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P_N, args);
327 }
328 }
329
330
336 public LayoutSetBranch create(long layoutSetBranchId) {
337 LayoutSetBranch layoutSetBranch = new LayoutSetBranchImpl();
338
339 layoutSetBranch.setNew(true);
340 layoutSetBranch.setPrimaryKey(layoutSetBranchId);
341
342 return layoutSetBranch;
343 }
344
345
353 public LayoutSetBranch remove(long layoutSetBranchId)
354 throws NoSuchLayoutSetBranchException, SystemException {
355 return remove(Long.valueOf(layoutSetBranchId));
356 }
357
358
366 @Override
367 public LayoutSetBranch remove(Serializable primaryKey)
368 throws NoSuchLayoutSetBranchException, SystemException {
369 Session session = null;
370
371 try {
372 session = openSession();
373
374 LayoutSetBranch layoutSetBranch = (LayoutSetBranch)session.get(LayoutSetBranchImpl.class,
375 primaryKey);
376
377 if (layoutSetBranch == null) {
378 if (_log.isWarnEnabled()) {
379 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
380 }
381
382 throw new NoSuchLayoutSetBranchException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
383 primaryKey);
384 }
385
386 return remove(layoutSetBranch);
387 }
388 catch (NoSuchLayoutSetBranchException nsee) {
389 throw nsee;
390 }
391 catch (Exception e) {
392 throw processException(e);
393 }
394 finally {
395 closeSession(session);
396 }
397 }
398
399 @Override
400 protected LayoutSetBranch removeImpl(LayoutSetBranch layoutSetBranch)
401 throws SystemException {
402 layoutSetBranch = toUnwrappedModel(layoutSetBranch);
403
404 Session session = null;
405
406 try {
407 session = openSession();
408
409 BatchSessionUtil.delete(session, layoutSetBranch);
410 }
411 catch (Exception e) {
412 throw processException(e);
413 }
414 finally {
415 closeSession(session);
416 }
417
418 clearCache(layoutSetBranch);
419
420 return layoutSetBranch;
421 }
422
423 @Override
424 public LayoutSetBranch updateImpl(
425 com.liferay.portal.model.LayoutSetBranch layoutSetBranch, boolean merge)
426 throws SystemException {
427 layoutSetBranch = toUnwrappedModel(layoutSetBranch);
428
429 boolean isNew = layoutSetBranch.isNew();
430
431 LayoutSetBranchModelImpl layoutSetBranchModelImpl = (LayoutSetBranchModelImpl)layoutSetBranch;
432
433 Session session = null;
434
435 try {
436 session = openSession();
437
438 BatchSessionUtil.update(session, layoutSetBranch, merge);
439
440 layoutSetBranch.setNew(false);
441 }
442 catch (Exception e) {
443 throw processException(e);
444 }
445 finally {
446 closeSession(session);
447 }
448
449 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
450
451 if (isNew || !LayoutSetBranchModelImpl.COLUMN_BITMASK_ENABLED) {
452 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
453 }
454
455 else {
456 if ((layoutSetBranchModelImpl.getColumnBitmask() &
457 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
458 Object[] args = new Object[] {
459 Long.valueOf(layoutSetBranchModelImpl.getOriginalGroupId())
460 };
461
462 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
463 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
464 args);
465
466 args = new Object[] {
467 Long.valueOf(layoutSetBranchModelImpl.getGroupId())
468 };
469
470 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
471 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
472 args);
473 }
474
475 if ((layoutSetBranchModelImpl.getColumnBitmask() &
476 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_P.getColumnBitmask()) != 0) {
477 Object[] args = new Object[] {
478 Long.valueOf(layoutSetBranchModelImpl.getOriginalGroupId()),
479 Boolean.valueOf(layoutSetBranchModelImpl.getOriginalPrivateLayout())
480 };
481
482 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_P, args);
483 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_P,
484 args);
485
486 args = new Object[] {
487 Long.valueOf(layoutSetBranchModelImpl.getGroupId()),
488 Boolean.valueOf(layoutSetBranchModelImpl.getPrivateLayout())
489 };
490
491 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_P, args);
492 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_P,
493 args);
494 }
495
496 if ((layoutSetBranchModelImpl.getColumnBitmask() &
497 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_P_M.getColumnBitmask()) != 0) {
498 Object[] args = new Object[] {
499 Long.valueOf(layoutSetBranchModelImpl.getOriginalGroupId()),
500 Boolean.valueOf(layoutSetBranchModelImpl.getOriginalPrivateLayout()),
501 Boolean.valueOf(layoutSetBranchModelImpl.getOriginalMaster())
502 };
503
504 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_P_M, args);
505 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_P_M,
506 args);
507
508 args = new Object[] {
509 Long.valueOf(layoutSetBranchModelImpl.getGroupId()),
510 Boolean.valueOf(layoutSetBranchModelImpl.getPrivateLayout()),
511 Boolean.valueOf(layoutSetBranchModelImpl.getMaster())
512 };
513
514 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_P_M, args);
515 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_P_M,
516 args);
517 }
518 }
519
520 EntityCacheUtil.putResult(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
521 LayoutSetBranchImpl.class, layoutSetBranch.getPrimaryKey(),
522 layoutSetBranch);
523
524 clearUniqueFindersCache(layoutSetBranch);
525 cacheUniqueFindersCache(layoutSetBranch);
526
527 return layoutSetBranch;
528 }
529
530 protected LayoutSetBranch toUnwrappedModel(LayoutSetBranch layoutSetBranch) {
531 if (layoutSetBranch instanceof LayoutSetBranchImpl) {
532 return layoutSetBranch;
533 }
534
535 LayoutSetBranchImpl layoutSetBranchImpl = new LayoutSetBranchImpl();
536
537 layoutSetBranchImpl.setNew(layoutSetBranch.isNew());
538 layoutSetBranchImpl.setPrimaryKey(layoutSetBranch.getPrimaryKey());
539
540 layoutSetBranchImpl.setLayoutSetBranchId(layoutSetBranch.getLayoutSetBranchId());
541 layoutSetBranchImpl.setGroupId(layoutSetBranch.getGroupId());
542 layoutSetBranchImpl.setCompanyId(layoutSetBranch.getCompanyId());
543 layoutSetBranchImpl.setUserId(layoutSetBranch.getUserId());
544 layoutSetBranchImpl.setUserName(layoutSetBranch.getUserName());
545 layoutSetBranchImpl.setCreateDate(layoutSetBranch.getCreateDate());
546 layoutSetBranchImpl.setModifiedDate(layoutSetBranch.getModifiedDate());
547 layoutSetBranchImpl.setPrivateLayout(layoutSetBranch.isPrivateLayout());
548 layoutSetBranchImpl.setName(layoutSetBranch.getName());
549 layoutSetBranchImpl.setDescription(layoutSetBranch.getDescription());
550 layoutSetBranchImpl.setMaster(layoutSetBranch.isMaster());
551 layoutSetBranchImpl.setLogo(layoutSetBranch.isLogo());
552 layoutSetBranchImpl.setLogoId(layoutSetBranch.getLogoId());
553 layoutSetBranchImpl.setThemeId(layoutSetBranch.getThemeId());
554 layoutSetBranchImpl.setColorSchemeId(layoutSetBranch.getColorSchemeId());
555 layoutSetBranchImpl.setWapThemeId(layoutSetBranch.getWapThemeId());
556 layoutSetBranchImpl.setWapColorSchemeId(layoutSetBranch.getWapColorSchemeId());
557 layoutSetBranchImpl.setCss(layoutSetBranch.getCss());
558 layoutSetBranchImpl.setSettings(layoutSetBranch.getSettings());
559 layoutSetBranchImpl.setLayoutSetPrototypeUuid(layoutSetBranch.getLayoutSetPrototypeUuid());
560 layoutSetBranchImpl.setLayoutSetPrototypeLinkEnabled(layoutSetBranch.isLayoutSetPrototypeLinkEnabled());
561
562 return layoutSetBranchImpl;
563 }
564
565
573 @Override
574 public LayoutSetBranch findByPrimaryKey(Serializable primaryKey)
575 throws NoSuchModelException, SystemException {
576 return findByPrimaryKey(((Long)primaryKey).longValue());
577 }
578
579
587 public LayoutSetBranch findByPrimaryKey(long layoutSetBranchId)
588 throws NoSuchLayoutSetBranchException, SystemException {
589 LayoutSetBranch layoutSetBranch = fetchByPrimaryKey(layoutSetBranchId);
590
591 if (layoutSetBranch == null) {
592 if (_log.isWarnEnabled()) {
593 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + layoutSetBranchId);
594 }
595
596 throw new NoSuchLayoutSetBranchException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
597 layoutSetBranchId);
598 }
599
600 return layoutSetBranch;
601 }
602
603
610 @Override
611 public LayoutSetBranch fetchByPrimaryKey(Serializable primaryKey)
612 throws SystemException {
613 return fetchByPrimaryKey(((Long)primaryKey).longValue());
614 }
615
616
623 public LayoutSetBranch fetchByPrimaryKey(long layoutSetBranchId)
624 throws SystemException {
625 LayoutSetBranch layoutSetBranch = (LayoutSetBranch)EntityCacheUtil.getResult(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
626 LayoutSetBranchImpl.class, layoutSetBranchId);
627
628 if (layoutSetBranch == _nullLayoutSetBranch) {
629 return null;
630 }
631
632 if (layoutSetBranch == null) {
633 Session session = null;
634
635 boolean hasException = false;
636
637 try {
638 session = openSession();
639
640 layoutSetBranch = (LayoutSetBranch)session.get(LayoutSetBranchImpl.class,
641 Long.valueOf(layoutSetBranchId));
642 }
643 catch (Exception e) {
644 hasException = true;
645
646 throw processException(e);
647 }
648 finally {
649 if (layoutSetBranch != null) {
650 cacheResult(layoutSetBranch);
651 }
652 else if (!hasException) {
653 EntityCacheUtil.putResult(LayoutSetBranchModelImpl.ENTITY_CACHE_ENABLED,
654 LayoutSetBranchImpl.class, layoutSetBranchId,
655 _nullLayoutSetBranch);
656 }
657
658 closeSession(session);
659 }
660 }
661
662 return layoutSetBranch;
663 }
664
665
672 public List<LayoutSetBranch> findByGroupId(long groupId)
673 throws SystemException {
674 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
675 }
676
677
690 public List<LayoutSetBranch> findByGroupId(long groupId, int start, int end)
691 throws SystemException {
692 return findByGroupId(groupId, start, end, null);
693 }
694
695
709 public List<LayoutSetBranch> findByGroupId(long groupId, int start,
710 int end, OrderByComparator orderByComparator) throws SystemException {
711 FinderPath finderPath = null;
712 Object[] finderArgs = null;
713
714 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
715 (orderByComparator == null)) {
716 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
717 finderArgs = new Object[] { groupId };
718 }
719 else {
720 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
721 finderArgs = new Object[] { groupId, start, end, orderByComparator };
722 }
723
724 List<LayoutSetBranch> list = (List<LayoutSetBranch>)FinderCacheUtil.getResult(finderPath,
725 finderArgs, this);
726
727 if ((list != null) && !list.isEmpty()) {
728 for (LayoutSetBranch layoutSetBranch : list) {
729 if ((groupId != layoutSetBranch.getGroupId())) {
730 list = null;
731
732 break;
733 }
734 }
735 }
736
737 if (list == null) {
738 StringBundler query = null;
739
740 if (orderByComparator != null) {
741 query = new StringBundler(3 +
742 (orderByComparator.getOrderByFields().length * 3));
743 }
744 else {
745 query = new StringBundler(3);
746 }
747
748 query.append(_SQL_SELECT_LAYOUTSETBRANCH_WHERE);
749
750 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
751
752 if (orderByComparator != null) {
753 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
754 orderByComparator);
755 }
756
757 else {
758 query.append(LayoutSetBranchModelImpl.ORDER_BY_JPQL);
759 }
760
761 String sql = query.toString();
762
763 Session session = null;
764
765 try {
766 session = openSession();
767
768 Query q = session.createQuery(sql);
769
770 QueryPos qPos = QueryPos.getInstance(q);
771
772 qPos.add(groupId);
773
774 list = (List<LayoutSetBranch>)QueryUtil.list(q, getDialect(),
775 start, end);
776 }
777 catch (Exception e) {
778 throw processException(e);
779 }
780 finally {
781 if (list == null) {
782 FinderCacheUtil.removeResult(finderPath, finderArgs);
783 }
784 else {
785 cacheResult(list);
786
787 FinderCacheUtil.putResult(finderPath, finderArgs, list);
788 }
789
790 closeSession(session);
791 }
792 }
793
794 return list;
795 }
796
797
806 public LayoutSetBranch findByGroupId_First(long groupId,
807 OrderByComparator orderByComparator)
808 throws NoSuchLayoutSetBranchException, SystemException {
809 LayoutSetBranch layoutSetBranch = fetchByGroupId_First(groupId,
810 orderByComparator);
811
812 if (layoutSetBranch != null) {
813 return layoutSetBranch;
814 }
815
816 StringBundler msg = new StringBundler(4);
817
818 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
819
820 msg.append("groupId=");
821 msg.append(groupId);
822
823 msg.append(StringPool.CLOSE_CURLY_BRACE);
824
825 throw new NoSuchLayoutSetBranchException(msg.toString());
826 }
827
828
836 public LayoutSetBranch fetchByGroupId_First(long groupId,
837 OrderByComparator orderByComparator) throws SystemException {
838 List<LayoutSetBranch> list = findByGroupId(groupId, 0, 1,
839 orderByComparator);
840
841 if (!list.isEmpty()) {
842 return list.get(0);
843 }
844
845 return null;
846 }
847
848
857 public LayoutSetBranch findByGroupId_Last(long groupId,
858 OrderByComparator orderByComparator)
859 throws NoSuchLayoutSetBranchException, SystemException {
860 LayoutSetBranch layoutSetBranch = fetchByGroupId_Last(groupId,
861 orderByComparator);
862
863 if (layoutSetBranch != null) {
864 return layoutSetBranch;
865 }
866
867 StringBundler msg = new StringBundler(4);
868
869 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
870
871 msg.append("groupId=");
872 msg.append(groupId);
873
874 msg.append(StringPool.CLOSE_CURLY_BRACE);
875
876 throw new NoSuchLayoutSetBranchException(msg.toString());
877 }
878
879
887 public LayoutSetBranch fetchByGroupId_Last(long groupId,
888 OrderByComparator orderByComparator) throws SystemException {
889 int count = countByGroupId(groupId);
890
891 List<LayoutSetBranch> list = findByGroupId(groupId, count - 1, count,
892 orderByComparator);
893
894 if (!list.isEmpty()) {
895 return list.get(0);
896 }
897
898 return null;
899 }
900
901
911 public LayoutSetBranch[] findByGroupId_PrevAndNext(long layoutSetBranchId,
912 long groupId, OrderByComparator orderByComparator)
913 throws NoSuchLayoutSetBranchException, SystemException {
914 LayoutSetBranch layoutSetBranch = findByPrimaryKey(layoutSetBranchId);
915
916 Session session = null;
917
918 try {
919 session = openSession();
920
921 LayoutSetBranch[] array = new LayoutSetBranchImpl[3];
922
923 array[0] = getByGroupId_PrevAndNext(session, layoutSetBranch,
924 groupId, orderByComparator, true);
925
926 array[1] = layoutSetBranch;
927
928 array[2] = getByGroupId_PrevAndNext(session, layoutSetBranch,
929 groupId, orderByComparator, false);
930
931 return array;
932 }
933 catch (Exception e) {
934 throw processException(e);
935 }
936 finally {
937 closeSession(session);
938 }
939 }
940
941 protected LayoutSetBranch getByGroupId_PrevAndNext(Session session,
942 LayoutSetBranch layoutSetBranch, long groupId,
943 OrderByComparator orderByComparator, boolean previous) {
944 StringBundler query = null;
945
946 if (orderByComparator != null) {
947 query = new StringBundler(6 +
948 (orderByComparator.getOrderByFields().length * 6));
949 }
950 else {
951 query = new StringBundler(3);
952 }
953
954 query.append(_SQL_SELECT_LAYOUTSETBRANCH_WHERE);
955
956 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
957
958 if (orderByComparator != null) {
959 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
960
961 if (orderByConditionFields.length > 0) {
962 query.append(WHERE_AND);
963 }
964
965 for (int i = 0; i < orderByConditionFields.length; i++) {
966 query.append(_ORDER_BY_ENTITY_ALIAS);
967 query.append(orderByConditionFields[i]);
968
969 if ((i + 1) < orderByConditionFields.length) {
970 if (orderByComparator.isAscending() ^ previous) {
971 query.append(WHERE_GREATER_THAN_HAS_NEXT);
972 }
973 else {
974 query.append(WHERE_LESSER_THAN_HAS_NEXT);
975 }
976 }
977 else {
978 if (orderByComparator.isAscending() ^ previous) {
979 query.append(WHERE_GREATER_THAN);
980 }
981 else {
982 query.append(WHERE_LESSER_THAN);
983 }
984 }
985 }
986
987 query.append(ORDER_BY_CLAUSE);
988
989 String[] orderByFields = orderByComparator.getOrderByFields();
990
991 for (int i = 0; i < orderByFields.length; i++) {
992 query.append(_ORDER_BY_ENTITY_ALIAS);
993 query.append(orderByFields[i]);
994
995 if ((i + 1) < orderByFields.length) {
996 if (orderByComparator.isAscending() ^ previous) {
997 query.append(ORDER_BY_ASC_HAS_NEXT);
998 }
999 else {
1000 query.append(ORDER_BY_DESC_HAS_NEXT);
1001 }
1002 }
1003 else {
1004 if (orderByComparator.isAscending() ^ previous) {
1005 query.append(ORDER_BY_ASC);
1006 }
1007 else {
1008 query.append(ORDER_BY_DESC);
1009 }
1010 }
1011 }
1012 }
1013
1014 else {
1015 query.append(LayoutSetBranchModelImpl.ORDER_BY_JPQL);
1016 }
1017
1018 String sql = query.toString();
1019
1020 Query q = session.createQuery(sql);
1021
1022 q.setFirstResult(0);
1023 q.setMaxResults(2);
1024
1025 QueryPos qPos = QueryPos.getInstance(q);
1026
1027 qPos.add(groupId);
1028
1029 if (orderByComparator != null) {
1030 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetBranch);
1031
1032 for (Object value : values) {
1033 qPos.add(value);
1034 }
1035 }
1036
1037 List<LayoutSetBranch> list = q.list();
1038
1039 if (list.size() == 2) {
1040 return list.get(1);
1041 }
1042 else {
1043 return null;
1044 }
1045 }
1046
1047
1054 public List<LayoutSetBranch> filterFindByGroupId(long groupId)
1055 throws SystemException {
1056 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1057 QueryUtil.ALL_POS, null);
1058 }
1059
1060
1073 public List<LayoutSetBranch> filterFindByGroupId(long groupId, int start,
1074 int end) throws SystemException {
1075 return filterFindByGroupId(groupId, start, end, null);
1076 }
1077
1078
1092 public List<LayoutSetBranch> filterFindByGroupId(long groupId, int start,
1093 int end, OrderByComparator orderByComparator) throws SystemException {
1094 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1095 return findByGroupId(groupId, start, end, orderByComparator);
1096 }
1097
1098 StringBundler query = null;
1099
1100 if (orderByComparator != null) {
1101 query = new StringBundler(3 +
1102 (orderByComparator.getOrderByFields().length * 3));
1103 }
1104 else {
1105 query = new StringBundler(3);
1106 }
1107
1108 if (getDB().isSupportsInlineDistinct()) {
1109 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_WHERE);
1110 }
1111 else {
1112 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_NO_INLINE_DISTINCT_WHERE_1);
1113 }
1114
1115 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1116
1117 if (!getDB().isSupportsInlineDistinct()) {
1118 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_NO_INLINE_DISTINCT_WHERE_2);
1119 }
1120
1121 if (orderByComparator != null) {
1122 if (getDB().isSupportsInlineDistinct()) {
1123 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1124 orderByComparator);
1125 }
1126 else {
1127 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1128 orderByComparator);
1129 }
1130 }
1131
1132 else {
1133 if (getDB().isSupportsInlineDistinct()) {
1134 query.append(LayoutSetBranchModelImpl.ORDER_BY_JPQL);
1135 }
1136 else {
1137 query.append(LayoutSetBranchModelImpl.ORDER_BY_SQL);
1138 }
1139 }
1140
1141 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1142 LayoutSetBranch.class.getName(),
1143 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1144
1145 Session session = null;
1146
1147 try {
1148 session = openSession();
1149
1150 SQLQuery q = session.createSQLQuery(sql);
1151
1152 if (getDB().isSupportsInlineDistinct()) {
1153 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetBranchImpl.class);
1154 }
1155 else {
1156 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetBranchImpl.class);
1157 }
1158
1159 QueryPos qPos = QueryPos.getInstance(q);
1160
1161 qPos.add(groupId);
1162
1163 return (List<LayoutSetBranch>)QueryUtil.list(q, getDialect(),
1164 start, end);
1165 }
1166 catch (Exception e) {
1167 throw processException(e);
1168 }
1169 finally {
1170 closeSession(session);
1171 }
1172 }
1173
1174
1184 public LayoutSetBranch[] filterFindByGroupId_PrevAndNext(
1185 long layoutSetBranchId, long groupId,
1186 OrderByComparator orderByComparator)
1187 throws NoSuchLayoutSetBranchException, SystemException {
1188 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1189 return findByGroupId_PrevAndNext(layoutSetBranchId, groupId,
1190 orderByComparator);
1191 }
1192
1193 LayoutSetBranch layoutSetBranch = findByPrimaryKey(layoutSetBranchId);
1194
1195 Session session = null;
1196
1197 try {
1198 session = openSession();
1199
1200 LayoutSetBranch[] array = new LayoutSetBranchImpl[3];
1201
1202 array[0] = filterGetByGroupId_PrevAndNext(session, layoutSetBranch,
1203 groupId, orderByComparator, true);
1204
1205 array[1] = layoutSetBranch;
1206
1207 array[2] = filterGetByGroupId_PrevAndNext(session, layoutSetBranch,
1208 groupId, orderByComparator, false);
1209
1210 return array;
1211 }
1212 catch (Exception e) {
1213 throw processException(e);
1214 }
1215 finally {
1216 closeSession(session);
1217 }
1218 }
1219
1220 protected LayoutSetBranch filterGetByGroupId_PrevAndNext(Session session,
1221 LayoutSetBranch layoutSetBranch, long groupId,
1222 OrderByComparator orderByComparator, boolean previous) {
1223 StringBundler query = null;
1224
1225 if (orderByComparator != null) {
1226 query = new StringBundler(6 +
1227 (orderByComparator.getOrderByFields().length * 6));
1228 }
1229 else {
1230 query = new StringBundler(3);
1231 }
1232
1233 if (getDB().isSupportsInlineDistinct()) {
1234 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_WHERE);
1235 }
1236 else {
1237 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_NO_INLINE_DISTINCT_WHERE_1);
1238 }
1239
1240 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1241
1242 if (!getDB().isSupportsInlineDistinct()) {
1243 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_NO_INLINE_DISTINCT_WHERE_2);
1244 }
1245
1246 if (orderByComparator != null) {
1247 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1248
1249 if (orderByConditionFields.length > 0) {
1250 query.append(WHERE_AND);
1251 }
1252
1253 for (int i = 0; i < orderByConditionFields.length; i++) {
1254 if (getDB().isSupportsInlineDistinct()) {
1255 query.append(_ORDER_BY_ENTITY_ALIAS);
1256 }
1257 else {
1258 query.append(_ORDER_BY_ENTITY_TABLE);
1259 }
1260
1261 query.append(orderByConditionFields[i]);
1262
1263 if ((i + 1) < orderByConditionFields.length) {
1264 if (orderByComparator.isAscending() ^ previous) {
1265 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1266 }
1267 else {
1268 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1269 }
1270 }
1271 else {
1272 if (orderByComparator.isAscending() ^ previous) {
1273 query.append(WHERE_GREATER_THAN);
1274 }
1275 else {
1276 query.append(WHERE_LESSER_THAN);
1277 }
1278 }
1279 }
1280
1281 query.append(ORDER_BY_CLAUSE);
1282
1283 String[] orderByFields = orderByComparator.getOrderByFields();
1284
1285 for (int i = 0; i < orderByFields.length; i++) {
1286 if (getDB().isSupportsInlineDistinct()) {
1287 query.append(_ORDER_BY_ENTITY_ALIAS);
1288 }
1289 else {
1290 query.append(_ORDER_BY_ENTITY_TABLE);
1291 }
1292
1293 query.append(orderByFields[i]);
1294
1295 if ((i + 1) < orderByFields.length) {
1296 if (orderByComparator.isAscending() ^ previous) {
1297 query.append(ORDER_BY_ASC_HAS_NEXT);
1298 }
1299 else {
1300 query.append(ORDER_BY_DESC_HAS_NEXT);
1301 }
1302 }
1303 else {
1304 if (orderByComparator.isAscending() ^ previous) {
1305 query.append(ORDER_BY_ASC);
1306 }
1307 else {
1308 query.append(ORDER_BY_DESC);
1309 }
1310 }
1311 }
1312 }
1313
1314 else {
1315 if (getDB().isSupportsInlineDistinct()) {
1316 query.append(LayoutSetBranchModelImpl.ORDER_BY_JPQL);
1317 }
1318 else {
1319 query.append(LayoutSetBranchModelImpl.ORDER_BY_SQL);
1320 }
1321 }
1322
1323 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1324 LayoutSetBranch.class.getName(),
1325 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1326
1327 SQLQuery q = session.createSQLQuery(sql);
1328
1329 q.setFirstResult(0);
1330 q.setMaxResults(2);
1331
1332 if (getDB().isSupportsInlineDistinct()) {
1333 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetBranchImpl.class);
1334 }
1335 else {
1336 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetBranchImpl.class);
1337 }
1338
1339 QueryPos qPos = QueryPos.getInstance(q);
1340
1341 qPos.add(groupId);
1342
1343 if (orderByComparator != null) {
1344 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetBranch);
1345
1346 for (Object value : values) {
1347 qPos.add(value);
1348 }
1349 }
1350
1351 List<LayoutSetBranch> list = q.list();
1352
1353 if (list.size() == 2) {
1354 return list.get(1);
1355 }
1356 else {
1357 return null;
1358 }
1359 }
1360
1361
1369 public List<LayoutSetBranch> findByG_P(long groupId, boolean privateLayout)
1370 throws SystemException {
1371 return findByG_P(groupId, privateLayout, QueryUtil.ALL_POS,
1372 QueryUtil.ALL_POS, null);
1373 }
1374
1375
1389 public List<LayoutSetBranch> findByG_P(long groupId, boolean privateLayout,
1390 int start, int end) throws SystemException {
1391 return findByG_P(groupId, privateLayout, start, end, null);
1392 }
1393
1394
1409 public List<LayoutSetBranch> findByG_P(long groupId, boolean privateLayout,
1410 int start, int end, OrderByComparator orderByComparator)
1411 throws SystemException {
1412 FinderPath finderPath = null;
1413 Object[] finderArgs = null;
1414
1415 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1416 (orderByComparator == null)) {
1417 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_P;
1418 finderArgs = new Object[] { groupId, privateLayout };
1419 }
1420 else {
1421 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_P;
1422 finderArgs = new Object[] {
1423 groupId, privateLayout,
1424
1425 start, end, orderByComparator
1426 };
1427 }
1428
1429 List<LayoutSetBranch> list = (List<LayoutSetBranch>)FinderCacheUtil.getResult(finderPath,
1430 finderArgs, this);
1431
1432 if ((list != null) && !list.isEmpty()) {
1433 for (LayoutSetBranch layoutSetBranch : list) {
1434 if ((groupId != layoutSetBranch.getGroupId()) ||
1435 (privateLayout != layoutSetBranch.getPrivateLayout())) {
1436 list = null;
1437
1438 break;
1439 }
1440 }
1441 }
1442
1443 if (list == null) {
1444 StringBundler query = null;
1445
1446 if (orderByComparator != null) {
1447 query = new StringBundler(4 +
1448 (orderByComparator.getOrderByFields().length * 3));
1449 }
1450 else {
1451 query = new StringBundler(4);
1452 }
1453
1454 query.append(_SQL_SELECT_LAYOUTSETBRANCH_WHERE);
1455
1456 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1457
1458 query.append(_FINDER_COLUMN_G_P_PRIVATELAYOUT_2);
1459
1460 if (orderByComparator != null) {
1461 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1462 orderByComparator);
1463 }
1464
1465 else {
1466 query.append(LayoutSetBranchModelImpl.ORDER_BY_JPQL);
1467 }
1468
1469 String sql = query.toString();
1470
1471 Session session = null;
1472
1473 try {
1474 session = openSession();
1475
1476 Query q = session.createQuery(sql);
1477
1478 QueryPos qPos = QueryPos.getInstance(q);
1479
1480 qPos.add(groupId);
1481
1482 qPos.add(privateLayout);
1483
1484 list = (List<LayoutSetBranch>)QueryUtil.list(q, getDialect(),
1485 start, end);
1486 }
1487 catch (Exception e) {
1488 throw processException(e);
1489 }
1490 finally {
1491 if (list == null) {
1492 FinderCacheUtil.removeResult(finderPath, finderArgs);
1493 }
1494 else {
1495 cacheResult(list);
1496
1497 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1498 }
1499
1500 closeSession(session);
1501 }
1502 }
1503
1504 return list;
1505 }
1506
1507
1517 public LayoutSetBranch findByG_P_First(long groupId, boolean privateLayout,
1518 OrderByComparator orderByComparator)
1519 throws NoSuchLayoutSetBranchException, SystemException {
1520 LayoutSetBranch layoutSetBranch = fetchByG_P_First(groupId,
1521 privateLayout, orderByComparator);
1522
1523 if (layoutSetBranch != null) {
1524 return layoutSetBranch;
1525 }
1526
1527 StringBundler msg = new StringBundler(6);
1528
1529 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1530
1531 msg.append("groupId=");
1532 msg.append(groupId);
1533
1534 msg.append(", privateLayout=");
1535 msg.append(privateLayout);
1536
1537 msg.append(StringPool.CLOSE_CURLY_BRACE);
1538
1539 throw new NoSuchLayoutSetBranchException(msg.toString());
1540 }
1541
1542
1551 public LayoutSetBranch fetchByG_P_First(long groupId,
1552 boolean privateLayout, OrderByComparator orderByComparator)
1553 throws SystemException {
1554 List<LayoutSetBranch> list = findByG_P(groupId, privateLayout, 0, 1,
1555 orderByComparator);
1556
1557 if (!list.isEmpty()) {
1558 return list.get(0);
1559 }
1560
1561 return null;
1562 }
1563
1564
1574 public LayoutSetBranch findByG_P_Last(long groupId, boolean privateLayout,
1575 OrderByComparator orderByComparator)
1576 throws NoSuchLayoutSetBranchException, SystemException {
1577 LayoutSetBranch layoutSetBranch = fetchByG_P_Last(groupId,
1578 privateLayout, orderByComparator);
1579
1580 if (layoutSetBranch != null) {
1581 return layoutSetBranch;
1582 }
1583
1584 StringBundler msg = new StringBundler(6);
1585
1586 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1587
1588 msg.append("groupId=");
1589 msg.append(groupId);
1590
1591 msg.append(", privateLayout=");
1592 msg.append(privateLayout);
1593
1594 msg.append(StringPool.CLOSE_CURLY_BRACE);
1595
1596 throw new NoSuchLayoutSetBranchException(msg.toString());
1597 }
1598
1599
1608 public LayoutSetBranch fetchByG_P_Last(long groupId, boolean privateLayout,
1609 OrderByComparator orderByComparator) throws SystemException {
1610 int count = countByG_P(groupId, privateLayout);
1611
1612 List<LayoutSetBranch> list = findByG_P(groupId, privateLayout,
1613 count - 1, count, orderByComparator);
1614
1615 if (!list.isEmpty()) {
1616 return list.get(0);
1617 }
1618
1619 return null;
1620 }
1621
1622
1633 public LayoutSetBranch[] findByG_P_PrevAndNext(long layoutSetBranchId,
1634 long groupId, boolean privateLayout, OrderByComparator orderByComparator)
1635 throws NoSuchLayoutSetBranchException, SystemException {
1636 LayoutSetBranch layoutSetBranch = findByPrimaryKey(layoutSetBranchId);
1637
1638 Session session = null;
1639
1640 try {
1641 session = openSession();
1642
1643 LayoutSetBranch[] array = new LayoutSetBranchImpl[3];
1644
1645 array[0] = getByG_P_PrevAndNext(session, layoutSetBranch, groupId,
1646 privateLayout, orderByComparator, true);
1647
1648 array[1] = layoutSetBranch;
1649
1650 array[2] = getByG_P_PrevAndNext(session, layoutSetBranch, groupId,
1651 privateLayout, orderByComparator, false);
1652
1653 return array;
1654 }
1655 catch (Exception e) {
1656 throw processException(e);
1657 }
1658 finally {
1659 closeSession(session);
1660 }
1661 }
1662
1663 protected LayoutSetBranch getByG_P_PrevAndNext(Session session,
1664 LayoutSetBranch layoutSetBranch, long groupId, boolean privateLayout,
1665 OrderByComparator orderByComparator, boolean previous) {
1666 StringBundler query = null;
1667
1668 if (orderByComparator != null) {
1669 query = new StringBundler(6 +
1670 (orderByComparator.getOrderByFields().length * 6));
1671 }
1672 else {
1673 query = new StringBundler(3);
1674 }
1675
1676 query.append(_SQL_SELECT_LAYOUTSETBRANCH_WHERE);
1677
1678 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1679
1680 query.append(_FINDER_COLUMN_G_P_PRIVATELAYOUT_2);
1681
1682 if (orderByComparator != null) {
1683 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1684
1685 if (orderByConditionFields.length > 0) {
1686 query.append(WHERE_AND);
1687 }
1688
1689 for (int i = 0; i < orderByConditionFields.length; i++) {
1690 query.append(_ORDER_BY_ENTITY_ALIAS);
1691 query.append(orderByConditionFields[i]);
1692
1693 if ((i + 1) < orderByConditionFields.length) {
1694 if (orderByComparator.isAscending() ^ previous) {
1695 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1696 }
1697 else {
1698 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1699 }
1700 }
1701 else {
1702 if (orderByComparator.isAscending() ^ previous) {
1703 query.append(WHERE_GREATER_THAN);
1704 }
1705 else {
1706 query.append(WHERE_LESSER_THAN);
1707 }
1708 }
1709 }
1710
1711 query.append(ORDER_BY_CLAUSE);
1712
1713 String[] orderByFields = orderByComparator.getOrderByFields();
1714
1715 for (int i = 0; i < orderByFields.length; i++) {
1716 query.append(_ORDER_BY_ENTITY_ALIAS);
1717 query.append(orderByFields[i]);
1718
1719 if ((i + 1) < orderByFields.length) {
1720 if (orderByComparator.isAscending() ^ previous) {
1721 query.append(ORDER_BY_ASC_HAS_NEXT);
1722 }
1723 else {
1724 query.append(ORDER_BY_DESC_HAS_NEXT);
1725 }
1726 }
1727 else {
1728 if (orderByComparator.isAscending() ^ previous) {
1729 query.append(ORDER_BY_ASC);
1730 }
1731 else {
1732 query.append(ORDER_BY_DESC);
1733 }
1734 }
1735 }
1736 }
1737
1738 else {
1739 query.append(LayoutSetBranchModelImpl.ORDER_BY_JPQL);
1740 }
1741
1742 String sql = query.toString();
1743
1744 Query q = session.createQuery(sql);
1745
1746 q.setFirstResult(0);
1747 q.setMaxResults(2);
1748
1749 QueryPos qPos = QueryPos.getInstance(q);
1750
1751 qPos.add(groupId);
1752
1753 qPos.add(privateLayout);
1754
1755 if (orderByComparator != null) {
1756 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetBranch);
1757
1758 for (Object value : values) {
1759 qPos.add(value);
1760 }
1761 }
1762
1763 List<LayoutSetBranch> list = q.list();
1764
1765 if (list.size() == 2) {
1766 return list.get(1);
1767 }
1768 else {
1769 return null;
1770 }
1771 }
1772
1773
1781 public List<LayoutSetBranch> filterFindByG_P(long groupId,
1782 boolean privateLayout) throws SystemException {
1783 return filterFindByG_P(groupId, privateLayout, QueryUtil.ALL_POS,
1784 QueryUtil.ALL_POS, null);
1785 }
1786
1787
1801 public List<LayoutSetBranch> filterFindByG_P(long groupId,
1802 boolean privateLayout, int start, int end) throws SystemException {
1803 return filterFindByG_P(groupId, privateLayout, start, end, null);
1804 }
1805
1806
1821 public List<LayoutSetBranch> filterFindByG_P(long groupId,
1822 boolean privateLayout, int start, int end,
1823 OrderByComparator orderByComparator) throws SystemException {
1824 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1825 return findByG_P(groupId, privateLayout, start, end,
1826 orderByComparator);
1827 }
1828
1829 StringBundler query = null;
1830
1831 if (orderByComparator != null) {
1832 query = new StringBundler(4 +
1833 (orderByComparator.getOrderByFields().length * 3));
1834 }
1835 else {
1836 query = new StringBundler(4);
1837 }
1838
1839 if (getDB().isSupportsInlineDistinct()) {
1840 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_WHERE);
1841 }
1842 else {
1843 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_NO_INLINE_DISTINCT_WHERE_1);
1844 }
1845
1846 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1847
1848 query.append(_FINDER_COLUMN_G_P_PRIVATELAYOUT_2);
1849
1850 if (!getDB().isSupportsInlineDistinct()) {
1851 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_NO_INLINE_DISTINCT_WHERE_2);
1852 }
1853
1854 if (orderByComparator != null) {
1855 if (getDB().isSupportsInlineDistinct()) {
1856 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1857 orderByComparator);
1858 }
1859 else {
1860 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1861 orderByComparator);
1862 }
1863 }
1864
1865 else {
1866 if (getDB().isSupportsInlineDistinct()) {
1867 query.append(LayoutSetBranchModelImpl.ORDER_BY_JPQL);
1868 }
1869 else {
1870 query.append(LayoutSetBranchModelImpl.ORDER_BY_SQL);
1871 }
1872 }
1873
1874 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1875 LayoutSetBranch.class.getName(),
1876 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1877
1878 Session session = null;
1879
1880 try {
1881 session = openSession();
1882
1883 SQLQuery q = session.createSQLQuery(sql);
1884
1885 if (getDB().isSupportsInlineDistinct()) {
1886 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetBranchImpl.class);
1887 }
1888 else {
1889 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetBranchImpl.class);
1890 }
1891
1892 QueryPos qPos = QueryPos.getInstance(q);
1893
1894 qPos.add(groupId);
1895
1896 qPos.add(privateLayout);
1897
1898 return (List<LayoutSetBranch>)QueryUtil.list(q, getDialect(),
1899 start, end);
1900 }
1901 catch (Exception e) {
1902 throw processException(e);
1903 }
1904 finally {
1905 closeSession(session);
1906 }
1907 }
1908
1909
1920 public LayoutSetBranch[] filterFindByG_P_PrevAndNext(
1921 long layoutSetBranchId, long groupId, boolean privateLayout,
1922 OrderByComparator orderByComparator)
1923 throws NoSuchLayoutSetBranchException, SystemException {
1924 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1925 return findByG_P_PrevAndNext(layoutSetBranchId, groupId,
1926 privateLayout, orderByComparator);
1927 }
1928
1929 LayoutSetBranch layoutSetBranch = findByPrimaryKey(layoutSetBranchId);
1930
1931 Session session = null;
1932
1933 try {
1934 session = openSession();
1935
1936 LayoutSetBranch[] array = new LayoutSetBranchImpl[3];
1937
1938 array[0] = filterGetByG_P_PrevAndNext(session, layoutSetBranch,
1939 groupId, privateLayout, orderByComparator, true);
1940
1941 array[1] = layoutSetBranch;
1942
1943 array[2] = filterGetByG_P_PrevAndNext(session, layoutSetBranch,
1944 groupId, privateLayout, orderByComparator, false);
1945
1946 return array;
1947 }
1948 catch (Exception e) {
1949 throw processException(e);
1950 }
1951 finally {
1952 closeSession(session);
1953 }
1954 }
1955
1956 protected LayoutSetBranch filterGetByG_P_PrevAndNext(Session session,
1957 LayoutSetBranch layoutSetBranch, long groupId, boolean privateLayout,
1958 OrderByComparator orderByComparator, boolean previous) {
1959 StringBundler query = null;
1960
1961 if (orderByComparator != null) {
1962 query = new StringBundler(6 +
1963 (orderByComparator.getOrderByFields().length * 6));
1964 }
1965 else {
1966 query = new StringBundler(3);
1967 }
1968
1969 if (getDB().isSupportsInlineDistinct()) {
1970 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_WHERE);
1971 }
1972 else {
1973 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_NO_INLINE_DISTINCT_WHERE_1);
1974 }
1975
1976 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1977
1978 query.append(_FINDER_COLUMN_G_P_PRIVATELAYOUT_2);
1979
1980 if (!getDB().isSupportsInlineDistinct()) {
1981 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_NO_INLINE_DISTINCT_WHERE_2);
1982 }
1983
1984 if (orderByComparator != null) {
1985 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1986
1987 if (orderByConditionFields.length > 0) {
1988 query.append(WHERE_AND);
1989 }
1990
1991 for (int i = 0; i < orderByConditionFields.length; i++) {
1992 if (getDB().isSupportsInlineDistinct()) {
1993 query.append(_ORDER_BY_ENTITY_ALIAS);
1994 }
1995 else {
1996 query.append(_ORDER_BY_ENTITY_TABLE);
1997 }
1998
1999 query.append(orderByConditionFields[i]);
2000
2001 if ((i + 1) < orderByConditionFields.length) {
2002 if (orderByComparator.isAscending() ^ previous) {
2003 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2004 }
2005 else {
2006 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2007 }
2008 }
2009 else {
2010 if (orderByComparator.isAscending() ^ previous) {
2011 query.append(WHERE_GREATER_THAN);
2012 }
2013 else {
2014 query.append(WHERE_LESSER_THAN);
2015 }
2016 }
2017 }
2018
2019 query.append(ORDER_BY_CLAUSE);
2020
2021 String[] orderByFields = orderByComparator.getOrderByFields();
2022
2023 for (int i = 0; i < orderByFields.length; i++) {
2024 if (getDB().isSupportsInlineDistinct()) {
2025 query.append(_ORDER_BY_ENTITY_ALIAS);
2026 }
2027 else {
2028 query.append(_ORDER_BY_ENTITY_TABLE);
2029 }
2030
2031 query.append(orderByFields[i]);
2032
2033 if ((i + 1) < orderByFields.length) {
2034 if (orderByComparator.isAscending() ^ previous) {
2035 query.append(ORDER_BY_ASC_HAS_NEXT);
2036 }
2037 else {
2038 query.append(ORDER_BY_DESC_HAS_NEXT);
2039 }
2040 }
2041 else {
2042 if (orderByComparator.isAscending() ^ previous) {
2043 query.append(ORDER_BY_ASC);
2044 }
2045 else {
2046 query.append(ORDER_BY_DESC);
2047 }
2048 }
2049 }
2050 }
2051
2052 else {
2053 if (getDB().isSupportsInlineDistinct()) {
2054 query.append(LayoutSetBranchModelImpl.ORDER_BY_JPQL);
2055 }
2056 else {
2057 query.append(LayoutSetBranchModelImpl.ORDER_BY_SQL);
2058 }
2059 }
2060
2061 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2062 LayoutSetBranch.class.getName(),
2063 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2064
2065 SQLQuery q = session.createSQLQuery(sql);
2066
2067 q.setFirstResult(0);
2068 q.setMaxResults(2);
2069
2070 if (getDB().isSupportsInlineDistinct()) {
2071 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetBranchImpl.class);
2072 }
2073 else {
2074 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetBranchImpl.class);
2075 }
2076
2077 QueryPos qPos = QueryPos.getInstance(q);
2078
2079 qPos.add(groupId);
2080
2081 qPos.add(privateLayout);
2082
2083 if (orderByComparator != null) {
2084 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetBranch);
2085
2086 for (Object value : values) {
2087 qPos.add(value);
2088 }
2089 }
2090
2091 List<LayoutSetBranch> list = q.list();
2092
2093 if (list.size() == 2) {
2094 return list.get(1);
2095 }
2096 else {
2097 return null;
2098 }
2099 }
2100
2101
2111 public LayoutSetBranch findByG_P_N(long groupId, boolean privateLayout,
2112 String name) throws NoSuchLayoutSetBranchException, SystemException {
2113 LayoutSetBranch layoutSetBranch = fetchByG_P_N(groupId, privateLayout,
2114 name);
2115
2116 if (layoutSetBranch == null) {
2117 StringBundler msg = new StringBundler(8);
2118
2119 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2120
2121 msg.append("groupId=");
2122 msg.append(groupId);
2123
2124 msg.append(", privateLayout=");
2125 msg.append(privateLayout);
2126
2127 msg.append(", name=");
2128 msg.append(name);
2129
2130 msg.append(StringPool.CLOSE_CURLY_BRACE);
2131
2132 if (_log.isWarnEnabled()) {
2133 _log.warn(msg.toString());
2134 }
2135
2136 throw new NoSuchLayoutSetBranchException(msg.toString());
2137 }
2138
2139 return layoutSetBranch;
2140 }
2141
2142
2151 public LayoutSetBranch fetchByG_P_N(long groupId, boolean privateLayout,
2152 String name) throws SystemException {
2153 return fetchByG_P_N(groupId, privateLayout, name, true);
2154 }
2155
2156
2166 public LayoutSetBranch fetchByG_P_N(long groupId, boolean privateLayout,
2167 String name, boolean retrieveFromCache) throws SystemException {
2168 Object[] finderArgs = new Object[] { groupId, privateLayout, name };
2169
2170 Object result = null;
2171
2172 if (retrieveFromCache) {
2173 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_P_N,
2174 finderArgs, this);
2175 }
2176
2177 if (result instanceof LayoutSetBranch) {
2178 LayoutSetBranch layoutSetBranch = (LayoutSetBranch)result;
2179
2180 if ((groupId != layoutSetBranch.getGroupId()) ||
2181 (privateLayout != layoutSetBranch.getPrivateLayout()) ||
2182 !Validator.equals(name, layoutSetBranch.getName())) {
2183 result = null;
2184 }
2185 }
2186
2187 if (result == null) {
2188 StringBundler query = new StringBundler(5);
2189
2190 query.append(_SQL_SELECT_LAYOUTSETBRANCH_WHERE);
2191
2192 query.append(_FINDER_COLUMN_G_P_N_GROUPID_2);
2193
2194 query.append(_FINDER_COLUMN_G_P_N_PRIVATELAYOUT_2);
2195
2196 if (name == null) {
2197 query.append(_FINDER_COLUMN_G_P_N_NAME_1);
2198 }
2199 else {
2200 if (name.equals(StringPool.BLANK)) {
2201 query.append(_FINDER_COLUMN_G_P_N_NAME_3);
2202 }
2203 else {
2204 query.append(_FINDER_COLUMN_G_P_N_NAME_2);
2205 }
2206 }
2207
2208 query.append(LayoutSetBranchModelImpl.ORDER_BY_JPQL);
2209
2210 String sql = query.toString();
2211
2212 Session session = null;
2213
2214 try {
2215 session = openSession();
2216
2217 Query q = session.createQuery(sql);
2218
2219 QueryPos qPos = QueryPos.getInstance(q);
2220
2221 qPos.add(groupId);
2222
2223 qPos.add(privateLayout);
2224
2225 if (name != null) {
2226 qPos.add(name);
2227 }
2228
2229 List<LayoutSetBranch> list = q.list();
2230
2231 result = list;
2232
2233 LayoutSetBranch layoutSetBranch = null;
2234
2235 if (list.isEmpty()) {
2236 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
2237 finderArgs, list);
2238 }
2239 else {
2240 layoutSetBranch = list.get(0);
2241
2242 cacheResult(layoutSetBranch);
2243
2244 if ((layoutSetBranch.getGroupId() != groupId) ||
2245 (layoutSetBranch.getPrivateLayout() != privateLayout) ||
2246 (layoutSetBranch.getName() == null) ||
2247 !layoutSetBranch.getName().equals(name)) {
2248 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P_N,
2249 finderArgs, layoutSetBranch);
2250 }
2251 }
2252
2253 return layoutSetBranch;
2254 }
2255 catch (Exception e) {
2256 throw processException(e);
2257 }
2258 finally {
2259 if (result == null) {
2260 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P_N,
2261 finderArgs);
2262 }
2263
2264 closeSession(session);
2265 }
2266 }
2267 else {
2268 if (result instanceof List<?>) {
2269 return null;
2270 }
2271 else {
2272 return (LayoutSetBranch)result;
2273 }
2274 }
2275 }
2276
2277
2286 public List<LayoutSetBranch> findByG_P_M(long groupId,
2287 boolean privateLayout, boolean master) throws SystemException {
2288 return findByG_P_M(groupId, privateLayout, master, QueryUtil.ALL_POS,
2289 QueryUtil.ALL_POS, null);
2290 }
2291
2292
2307 public List<LayoutSetBranch> findByG_P_M(long groupId,
2308 boolean privateLayout, boolean master, int start, int end)
2309 throws SystemException {
2310 return findByG_P_M(groupId, privateLayout, master, start, end, null);
2311 }
2312
2313
2329 public List<LayoutSetBranch> findByG_P_M(long groupId,
2330 boolean privateLayout, boolean master, int start, int end,
2331 OrderByComparator orderByComparator) throws SystemException {
2332 FinderPath finderPath = null;
2333 Object[] finderArgs = null;
2334
2335 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2336 (orderByComparator == null)) {
2337 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_P_M;
2338 finderArgs = new Object[] { groupId, privateLayout, master };
2339 }
2340 else {
2341 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_P_M;
2342 finderArgs = new Object[] {
2343 groupId, privateLayout, master,
2344
2345 start, end, orderByComparator
2346 };
2347 }
2348
2349 List<LayoutSetBranch> list = (List<LayoutSetBranch>)FinderCacheUtil.getResult(finderPath,
2350 finderArgs, this);
2351
2352 if ((list != null) && !list.isEmpty()) {
2353 for (LayoutSetBranch layoutSetBranch : list) {
2354 if ((groupId != layoutSetBranch.getGroupId()) ||
2355 (privateLayout != layoutSetBranch.getPrivateLayout()) ||
2356 (master != layoutSetBranch.getMaster())) {
2357 list = null;
2358
2359 break;
2360 }
2361 }
2362 }
2363
2364 if (list == null) {
2365 StringBundler query = null;
2366
2367 if (orderByComparator != null) {
2368 query = new StringBundler(5 +
2369 (orderByComparator.getOrderByFields().length * 3));
2370 }
2371 else {
2372 query = new StringBundler(5);
2373 }
2374
2375 query.append(_SQL_SELECT_LAYOUTSETBRANCH_WHERE);
2376
2377 query.append(_FINDER_COLUMN_G_P_M_GROUPID_2);
2378
2379 query.append(_FINDER_COLUMN_G_P_M_PRIVATELAYOUT_2);
2380
2381 query.append(_FINDER_COLUMN_G_P_M_MASTER_2);
2382
2383 if (orderByComparator != null) {
2384 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2385 orderByComparator);
2386 }
2387
2388 else {
2389 query.append(LayoutSetBranchModelImpl.ORDER_BY_JPQL);
2390 }
2391
2392 String sql = query.toString();
2393
2394 Session session = null;
2395
2396 try {
2397 session = openSession();
2398
2399 Query q = session.createQuery(sql);
2400
2401 QueryPos qPos = QueryPos.getInstance(q);
2402
2403 qPos.add(groupId);
2404
2405 qPos.add(privateLayout);
2406
2407 qPos.add(master);
2408
2409 list = (List<LayoutSetBranch>)QueryUtil.list(q, getDialect(),
2410 start, end);
2411 }
2412 catch (Exception e) {
2413 throw processException(e);
2414 }
2415 finally {
2416 if (list == null) {
2417 FinderCacheUtil.removeResult(finderPath, finderArgs);
2418 }
2419 else {
2420 cacheResult(list);
2421
2422 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2423 }
2424
2425 closeSession(session);
2426 }
2427 }
2428
2429 return list;
2430 }
2431
2432
2443 public LayoutSetBranch findByG_P_M_First(long groupId,
2444 boolean privateLayout, boolean master,
2445 OrderByComparator orderByComparator)
2446 throws NoSuchLayoutSetBranchException, SystemException {
2447 LayoutSetBranch layoutSetBranch = fetchByG_P_M_First(groupId,
2448 privateLayout, master, orderByComparator);
2449
2450 if (layoutSetBranch != null) {
2451 return layoutSetBranch;
2452 }
2453
2454 StringBundler msg = new StringBundler(8);
2455
2456 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2457
2458 msg.append("groupId=");
2459 msg.append(groupId);
2460
2461 msg.append(", privateLayout=");
2462 msg.append(privateLayout);
2463
2464 msg.append(", master=");
2465 msg.append(master);
2466
2467 msg.append(StringPool.CLOSE_CURLY_BRACE);
2468
2469 throw new NoSuchLayoutSetBranchException(msg.toString());
2470 }
2471
2472
2482 public LayoutSetBranch fetchByG_P_M_First(long groupId,
2483 boolean privateLayout, boolean master,
2484 OrderByComparator orderByComparator) throws SystemException {
2485 List<LayoutSetBranch> list = findByG_P_M(groupId, privateLayout,
2486 master, 0, 1, orderByComparator);
2487
2488 if (!list.isEmpty()) {
2489 return list.get(0);
2490 }
2491
2492 return null;
2493 }
2494
2495
2506 public LayoutSetBranch findByG_P_M_Last(long groupId,
2507 boolean privateLayout, boolean master,
2508 OrderByComparator orderByComparator)
2509 throws NoSuchLayoutSetBranchException, SystemException {
2510 LayoutSetBranch layoutSetBranch = fetchByG_P_M_Last(groupId,
2511 privateLayout, master, orderByComparator);
2512
2513 if (layoutSetBranch != null) {
2514 return layoutSetBranch;
2515 }
2516
2517 StringBundler msg = new StringBundler(8);
2518
2519 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2520
2521 msg.append("groupId=");
2522 msg.append(groupId);
2523
2524 msg.append(", privateLayout=");
2525 msg.append(privateLayout);
2526
2527 msg.append(", master=");
2528 msg.append(master);
2529
2530 msg.append(StringPool.CLOSE_CURLY_BRACE);
2531
2532 throw new NoSuchLayoutSetBranchException(msg.toString());
2533 }
2534
2535
2545 public LayoutSetBranch fetchByG_P_M_Last(long groupId,
2546 boolean privateLayout, boolean master,
2547 OrderByComparator orderByComparator) throws SystemException {
2548 int count = countByG_P_M(groupId, privateLayout, master);
2549
2550 List<LayoutSetBranch> list = findByG_P_M(groupId, privateLayout,
2551 master, count - 1, count, orderByComparator);
2552
2553 if (!list.isEmpty()) {
2554 return list.get(0);
2555 }
2556
2557 return null;
2558 }
2559
2560
2572 public LayoutSetBranch[] findByG_P_M_PrevAndNext(long layoutSetBranchId,
2573 long groupId, boolean privateLayout, boolean master,
2574 OrderByComparator orderByComparator)
2575 throws NoSuchLayoutSetBranchException, SystemException {
2576 LayoutSetBranch layoutSetBranch = findByPrimaryKey(layoutSetBranchId);
2577
2578 Session session = null;
2579
2580 try {
2581 session = openSession();
2582
2583 LayoutSetBranch[] array = new LayoutSetBranchImpl[3];
2584
2585 array[0] = getByG_P_M_PrevAndNext(session, layoutSetBranch,
2586 groupId, privateLayout, master, orderByComparator, true);
2587
2588 array[1] = layoutSetBranch;
2589
2590 array[2] = getByG_P_M_PrevAndNext(session, layoutSetBranch,
2591 groupId, privateLayout, master, orderByComparator, false);
2592
2593 return array;
2594 }
2595 catch (Exception e) {
2596 throw processException(e);
2597 }
2598 finally {
2599 closeSession(session);
2600 }
2601 }
2602
2603 protected LayoutSetBranch getByG_P_M_PrevAndNext(Session session,
2604 LayoutSetBranch layoutSetBranch, long groupId, boolean privateLayout,
2605 boolean master, OrderByComparator orderByComparator, boolean previous) {
2606 StringBundler query = null;
2607
2608 if (orderByComparator != null) {
2609 query = new StringBundler(6 +
2610 (orderByComparator.getOrderByFields().length * 6));
2611 }
2612 else {
2613 query = new StringBundler(3);
2614 }
2615
2616 query.append(_SQL_SELECT_LAYOUTSETBRANCH_WHERE);
2617
2618 query.append(_FINDER_COLUMN_G_P_M_GROUPID_2);
2619
2620 query.append(_FINDER_COLUMN_G_P_M_PRIVATELAYOUT_2);
2621
2622 query.append(_FINDER_COLUMN_G_P_M_MASTER_2);
2623
2624 if (orderByComparator != null) {
2625 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2626
2627 if (orderByConditionFields.length > 0) {
2628 query.append(WHERE_AND);
2629 }
2630
2631 for (int i = 0; i < orderByConditionFields.length; i++) {
2632 query.append(_ORDER_BY_ENTITY_ALIAS);
2633 query.append(orderByConditionFields[i]);
2634
2635 if ((i + 1) < orderByConditionFields.length) {
2636 if (orderByComparator.isAscending() ^ previous) {
2637 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2638 }
2639 else {
2640 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2641 }
2642 }
2643 else {
2644 if (orderByComparator.isAscending() ^ previous) {
2645 query.append(WHERE_GREATER_THAN);
2646 }
2647 else {
2648 query.append(WHERE_LESSER_THAN);
2649 }
2650 }
2651 }
2652
2653 query.append(ORDER_BY_CLAUSE);
2654
2655 String[] orderByFields = orderByComparator.getOrderByFields();
2656
2657 for (int i = 0; i < orderByFields.length; i++) {
2658 query.append(_ORDER_BY_ENTITY_ALIAS);
2659 query.append(orderByFields[i]);
2660
2661 if ((i + 1) < orderByFields.length) {
2662 if (orderByComparator.isAscending() ^ previous) {
2663 query.append(ORDER_BY_ASC_HAS_NEXT);
2664 }
2665 else {
2666 query.append(ORDER_BY_DESC_HAS_NEXT);
2667 }
2668 }
2669 else {
2670 if (orderByComparator.isAscending() ^ previous) {
2671 query.append(ORDER_BY_ASC);
2672 }
2673 else {
2674 query.append(ORDER_BY_DESC);
2675 }
2676 }
2677 }
2678 }
2679
2680 else {
2681 query.append(LayoutSetBranchModelImpl.ORDER_BY_JPQL);
2682 }
2683
2684 String sql = query.toString();
2685
2686 Query q = session.createQuery(sql);
2687
2688 q.setFirstResult(0);
2689 q.setMaxResults(2);
2690
2691 QueryPos qPos = QueryPos.getInstance(q);
2692
2693 qPos.add(groupId);
2694
2695 qPos.add(privateLayout);
2696
2697 qPos.add(master);
2698
2699 if (orderByComparator != null) {
2700 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetBranch);
2701
2702 for (Object value : values) {
2703 qPos.add(value);
2704 }
2705 }
2706
2707 List<LayoutSetBranch> list = q.list();
2708
2709 if (list.size() == 2) {
2710 return list.get(1);
2711 }
2712 else {
2713 return null;
2714 }
2715 }
2716
2717
2726 public List<LayoutSetBranch> filterFindByG_P_M(long groupId,
2727 boolean privateLayout, boolean master) throws SystemException {
2728 return filterFindByG_P_M(groupId, privateLayout, master,
2729 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2730 }
2731
2732
2747 public List<LayoutSetBranch> filterFindByG_P_M(long groupId,
2748 boolean privateLayout, boolean master, int start, int end)
2749 throws SystemException {
2750 return filterFindByG_P_M(groupId, privateLayout, master, start, end,
2751 null);
2752 }
2753
2754
2770 public List<LayoutSetBranch> filterFindByG_P_M(long groupId,
2771 boolean privateLayout, boolean master, int start, int end,
2772 OrderByComparator orderByComparator) throws SystemException {
2773 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2774 return findByG_P_M(groupId, privateLayout, master, start, end,
2775 orderByComparator);
2776 }
2777
2778 StringBundler query = null;
2779
2780 if (orderByComparator != null) {
2781 query = new StringBundler(5 +
2782 (orderByComparator.getOrderByFields().length * 3));
2783 }
2784 else {
2785 query = new StringBundler(5);
2786 }
2787
2788 if (getDB().isSupportsInlineDistinct()) {
2789 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_WHERE);
2790 }
2791 else {
2792 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_NO_INLINE_DISTINCT_WHERE_1);
2793 }
2794
2795 query.append(_FINDER_COLUMN_G_P_M_GROUPID_2);
2796
2797 query.append(_FINDER_COLUMN_G_P_M_PRIVATELAYOUT_2);
2798
2799 query.append(_FINDER_COLUMN_G_P_M_MASTER_2);
2800
2801 if (!getDB().isSupportsInlineDistinct()) {
2802 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_NO_INLINE_DISTINCT_WHERE_2);
2803 }
2804
2805 if (orderByComparator != null) {
2806 if (getDB().isSupportsInlineDistinct()) {
2807 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2808 orderByComparator);
2809 }
2810 else {
2811 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2812 orderByComparator);
2813 }
2814 }
2815
2816 else {
2817 if (getDB().isSupportsInlineDistinct()) {
2818 query.append(LayoutSetBranchModelImpl.ORDER_BY_JPQL);
2819 }
2820 else {
2821 query.append(LayoutSetBranchModelImpl.ORDER_BY_SQL);
2822 }
2823 }
2824
2825 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2826 LayoutSetBranch.class.getName(),
2827 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2828
2829 Session session = null;
2830
2831 try {
2832 session = openSession();
2833
2834 SQLQuery q = session.createSQLQuery(sql);
2835
2836 if (getDB().isSupportsInlineDistinct()) {
2837 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetBranchImpl.class);
2838 }
2839 else {
2840 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetBranchImpl.class);
2841 }
2842
2843 QueryPos qPos = QueryPos.getInstance(q);
2844
2845 qPos.add(groupId);
2846
2847 qPos.add(privateLayout);
2848
2849 qPos.add(master);
2850
2851 return (List<LayoutSetBranch>)QueryUtil.list(q, getDialect(),
2852 start, end);
2853 }
2854 catch (Exception e) {
2855 throw processException(e);
2856 }
2857 finally {
2858 closeSession(session);
2859 }
2860 }
2861
2862
2874 public LayoutSetBranch[] filterFindByG_P_M_PrevAndNext(
2875 long layoutSetBranchId, long groupId, boolean privateLayout,
2876 boolean master, OrderByComparator orderByComparator)
2877 throws NoSuchLayoutSetBranchException, SystemException {
2878 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2879 return findByG_P_M_PrevAndNext(layoutSetBranchId, groupId,
2880 privateLayout, master, orderByComparator);
2881 }
2882
2883 LayoutSetBranch layoutSetBranch = findByPrimaryKey(layoutSetBranchId);
2884
2885 Session session = null;
2886
2887 try {
2888 session = openSession();
2889
2890 LayoutSetBranch[] array = new LayoutSetBranchImpl[3];
2891
2892 array[0] = filterGetByG_P_M_PrevAndNext(session, layoutSetBranch,
2893 groupId, privateLayout, master, orderByComparator, true);
2894
2895 array[1] = layoutSetBranch;
2896
2897 array[2] = filterGetByG_P_M_PrevAndNext(session, layoutSetBranch,
2898 groupId, privateLayout, master, orderByComparator, false);
2899
2900 return array;
2901 }
2902 catch (Exception e) {
2903 throw processException(e);
2904 }
2905 finally {
2906 closeSession(session);
2907 }
2908 }
2909
2910 protected LayoutSetBranch filterGetByG_P_M_PrevAndNext(Session session,
2911 LayoutSetBranch layoutSetBranch, long groupId, boolean privateLayout,
2912 boolean master, OrderByComparator orderByComparator, boolean previous) {
2913 StringBundler query = null;
2914
2915 if (orderByComparator != null) {
2916 query = new StringBundler(6 +
2917 (orderByComparator.getOrderByFields().length * 6));
2918 }
2919 else {
2920 query = new StringBundler(3);
2921 }
2922
2923 if (getDB().isSupportsInlineDistinct()) {
2924 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_WHERE);
2925 }
2926 else {
2927 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_NO_INLINE_DISTINCT_WHERE_1);
2928 }
2929
2930 query.append(_FINDER_COLUMN_G_P_M_GROUPID_2);
2931
2932 query.append(_FINDER_COLUMN_G_P_M_PRIVATELAYOUT_2);
2933
2934 query.append(_FINDER_COLUMN_G_P_M_MASTER_2);
2935
2936 if (!getDB().isSupportsInlineDistinct()) {
2937 query.append(_FILTER_SQL_SELECT_LAYOUTSETBRANCH_NO_INLINE_DISTINCT_WHERE_2);
2938 }
2939
2940 if (orderByComparator != null) {
2941 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2942
2943 if (orderByConditionFields.length > 0) {
2944 query.append(WHERE_AND);
2945 }
2946
2947 for (int i = 0; i < orderByConditionFields.length; i++) {
2948 if (getDB().isSupportsInlineDistinct()) {
2949 query.append(_ORDER_BY_ENTITY_ALIAS);
2950 }
2951 else {
2952 query.append(_ORDER_BY_ENTITY_TABLE);
2953 }
2954
2955 query.append(orderByConditionFields[i]);
2956
2957 if ((i + 1) < orderByConditionFields.length) {
2958 if (orderByComparator.isAscending() ^ previous) {
2959 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2960 }
2961 else {
2962 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2963 }
2964 }
2965 else {
2966 if (orderByComparator.isAscending() ^ previous) {
2967 query.append(WHERE_GREATER_THAN);
2968 }
2969 else {
2970 query.append(WHERE_LESSER_THAN);
2971 }
2972 }
2973 }
2974
2975 query.append(ORDER_BY_CLAUSE);
2976
2977 String[] orderByFields = orderByComparator.getOrderByFields();
2978
2979 for (int i = 0; i < orderByFields.length; i++) {
2980 if (getDB().isSupportsInlineDistinct()) {
2981 query.append(_ORDER_BY_ENTITY_ALIAS);
2982 }
2983 else {
2984 query.append(_ORDER_BY_ENTITY_TABLE);
2985 }
2986
2987 query.append(orderByFields[i]);
2988
2989 if ((i + 1) < orderByFields.length) {
2990 if (orderByComparator.isAscending() ^ previous) {
2991 query.append(ORDER_BY_ASC_HAS_NEXT);
2992 }
2993 else {
2994 query.append(ORDER_BY_DESC_HAS_NEXT);
2995 }
2996 }
2997 else {
2998 if (orderByComparator.isAscending() ^ previous) {
2999 query.append(ORDER_BY_ASC);
3000 }
3001 else {
3002 query.append(ORDER_BY_DESC);
3003 }
3004 }
3005 }
3006 }
3007
3008 else {
3009 if (getDB().isSupportsInlineDistinct()) {
3010 query.append(LayoutSetBranchModelImpl.ORDER_BY_JPQL);
3011 }
3012 else {
3013 query.append(LayoutSetBranchModelImpl.ORDER_BY_SQL);
3014 }
3015 }
3016
3017 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3018 LayoutSetBranch.class.getName(),
3019 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
3020
3021 SQLQuery q = session.createSQLQuery(sql);
3022
3023 q.setFirstResult(0);
3024 q.setMaxResults(2);
3025
3026 if (getDB().isSupportsInlineDistinct()) {
3027 q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetBranchImpl.class);
3028 }
3029 else {
3030 q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetBranchImpl.class);
3031 }
3032
3033 QueryPos qPos = QueryPos.getInstance(q);
3034
3035 qPos.add(groupId);
3036
3037 qPos.add(privateLayout);
3038
3039 qPos.add(master);
3040
3041 if (orderByComparator != null) {
3042 Object[] values = orderByComparator.getOrderByConditionValues(layoutSetBranch);
3043
3044 for (Object value : values) {
3045 qPos.add(value);
3046 }
3047 }
3048
3049 List<LayoutSetBranch> list = q.list();
3050
3051 if (list.size() == 2) {
3052 return list.get(1);
3053 }
3054 else {
3055 return null;
3056 }
3057 }
3058
3059
3065 public List<LayoutSetBranch> findAll() throws SystemException {
3066 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3067 }
3068
3069
3081 public List<LayoutSetBranch> findAll(int start, int end)
3082 throws SystemException {
3083 return findAll(start, end, null);
3084 }
3085
3086
3099 public List<LayoutSetBranch> findAll(int start, int end,
3100 OrderByComparator orderByComparator) throws SystemException {
3101 FinderPath finderPath = null;
3102 Object[] finderArgs = new Object[] { start, end, orderByComparator };
3103
3104 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3105 (orderByComparator == null)) {
3106 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
3107 finderArgs = FINDER_ARGS_EMPTY;
3108 }
3109 else {
3110 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
3111 finderArgs = new Object[] { start, end, orderByComparator };
3112 }
3113
3114 List<LayoutSetBranch> list = (List<LayoutSetBranch>)FinderCacheUtil.getResult(finderPath,
3115 finderArgs, this);
3116
3117 if (list == null) {
3118 StringBundler query = null;
3119 String sql = null;
3120
3121 if (orderByComparator != null) {
3122 query = new StringBundler(2 +
3123 (orderByComparator.getOrderByFields().length * 3));
3124
3125 query.append(_SQL_SELECT_LAYOUTSETBRANCH);
3126
3127 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3128 orderByComparator);
3129
3130 sql = query.toString();
3131 }
3132 else {
3133 sql = _SQL_SELECT_LAYOUTSETBRANCH.concat(LayoutSetBranchModelImpl.ORDER_BY_JPQL);
3134 }
3135
3136 Session session = null;
3137
3138 try {
3139 session = openSession();
3140
3141 Query q = session.createQuery(sql);
3142
3143 if (orderByComparator == null) {
3144 list = (List<LayoutSetBranch>)QueryUtil.list(q,
3145 getDialect(), start, end, false);
3146
3147 Collections.sort(list);
3148 }
3149 else {
3150 list = (List<LayoutSetBranch>)QueryUtil.list(q,
3151 getDialect(), start, end);
3152 }
3153 }
3154 catch (Exception e) {
3155 throw processException(e);
3156 }
3157 finally {
3158 if (list == null) {
3159 FinderCacheUtil.removeResult(finderPath, finderArgs);
3160 }
3161 else {
3162 cacheResult(list);
3163
3164 FinderCacheUtil.putResult(finderPath, finderArgs, list);
3165 }
3166
3167 closeSession(session);
3168 }
3169 }
3170
3171 return list;
3172 }
3173
3174
3180 public void removeByGroupId(long groupId) throws SystemException {
3181 for (LayoutSetBranch layoutSetBranch : findByGroupId(groupId)) {
3182 remove(layoutSetBranch);
3183 }
3184 }
3185
3186
3193 public void removeByG_P(long groupId, boolean privateLayout)
3194 throws SystemException {
3195 for (LayoutSetBranch layoutSetBranch : findByG_P(groupId, privateLayout)) {
3196 remove(layoutSetBranch);
3197 }
3198 }
3199
3200
3209 public LayoutSetBranch removeByG_P_N(long groupId, boolean privateLayout,
3210 String name) throws NoSuchLayoutSetBranchException, SystemException {
3211 LayoutSetBranch layoutSetBranch = findByG_P_N(groupId, privateLayout,
3212 name);
3213
3214 return remove(layoutSetBranch);
3215 }
3216
3217
3225 public void removeByG_P_M(long groupId, boolean privateLayout,
3226 boolean master) throws SystemException {
3227 for (LayoutSetBranch layoutSetBranch : findByG_P_M(groupId,
3228 privateLayout, master)) {
3229 remove(layoutSetBranch);
3230 }
3231 }
3232
3233
3238 public void removeAll() throws SystemException {
3239 for (LayoutSetBranch layoutSetBranch : findAll()) {
3240 remove(layoutSetBranch);
3241 }
3242 }
3243
3244
3251 public int countByGroupId(long groupId) throws SystemException {
3252 Object[] finderArgs = new Object[] { groupId };
3253
3254 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
3255 finderArgs, this);
3256
3257 if (count == null) {
3258 StringBundler query = new StringBundler(2);
3259
3260 query.append(_SQL_COUNT_LAYOUTSETBRANCH_WHERE);
3261
3262 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3263
3264 String sql = query.toString();
3265
3266 Session session = null;
3267
3268 try {
3269 session = openSession();
3270
3271 Query q = session.createQuery(sql);
3272
3273 QueryPos qPos = QueryPos.getInstance(q);
3274
3275 qPos.add(groupId);
3276
3277 count = (Long)q.uniqueResult();
3278 }
3279 catch (Exception e) {
3280 throw processException(e);
3281 }
3282 finally {
3283 if (count == null) {
3284 count = Long.valueOf(0);
3285 }
3286
3287 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
3288 finderArgs, count);
3289
3290 closeSession(session);
3291 }
3292 }
3293
3294 return count.intValue();
3295 }
3296
3297
3304 public int filterCountByGroupId(long groupId) throws SystemException {
3305 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3306 return countByGroupId(groupId);
3307 }
3308
3309 StringBundler query = new StringBundler(2);
3310
3311 query.append(_FILTER_SQL_COUNT_LAYOUTSETBRANCH_WHERE);
3312
3313 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3314
3315 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3316 LayoutSetBranch.class.getName(),
3317 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
3318
3319 Session session = null;
3320
3321 try {
3322 session = openSession();
3323
3324 SQLQuery q = session.createSQLQuery(sql);
3325
3326 q.addScalar(COUNT_COLUMN_NAME,
3327 com.liferay.portal.kernel.dao.orm.Type.LONG);
3328
3329 QueryPos qPos = QueryPos.getInstance(q);
3330
3331 qPos.add(groupId);
3332
3333 Long count = (Long)q.uniqueResult();
3334
3335 return count.intValue();
3336 }
3337 catch (Exception e) {
3338 throw processException(e);
3339 }
3340 finally {
3341 closeSession(session);
3342 }
3343 }
3344
3345
3353 public int countByG_P(long groupId, boolean privateLayout)
3354 throws SystemException {
3355 Object[] finderArgs = new Object[] { groupId, privateLayout };
3356
3357 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P,
3358 finderArgs, this);
3359
3360 if (count == null) {
3361 StringBundler query = new StringBundler(3);
3362
3363 query.append(_SQL_COUNT_LAYOUTSETBRANCH_WHERE);
3364
3365 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
3366
3367 query.append(_FINDER_COLUMN_G_P_PRIVATELAYOUT_2);
3368
3369 String sql = query.toString();
3370
3371 Session session = null;
3372
3373 try {
3374 session = openSession();
3375
3376 Query q = session.createQuery(sql);
3377
3378 QueryPos qPos = QueryPos.getInstance(q);
3379
3380 qPos.add(groupId);
3381
3382 qPos.add(privateLayout);
3383
3384 count = (Long)q.uniqueResult();
3385 }
3386 catch (Exception e) {
3387 throw processException(e);
3388 }
3389 finally {
3390 if (count == null) {
3391 count = Long.valueOf(0);
3392 }
3393
3394 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P, finderArgs,
3395 count);
3396
3397 closeSession(session);
3398 }
3399 }
3400
3401 return count.intValue();
3402 }
3403
3404
3412 public int filterCountByG_P(long groupId, boolean privateLayout)
3413 throws SystemException {
3414 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3415 return countByG_P(groupId, privateLayout);
3416 }
3417
3418 StringBundler query = new StringBundler(3);
3419
3420 query.append(_FILTER_SQL_COUNT_LAYOUTSETBRANCH_WHERE);
3421
3422 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
3423
3424 query.append(_FINDER_COLUMN_G_P_PRIVATELAYOUT_2);
3425
3426 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3427 LayoutSetBranch.class.getName(),
3428 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
3429
3430 Session session = null;
3431
3432 try {
3433 session = openSession();
3434
3435 SQLQuery q = session.createSQLQuery(sql);
3436
3437 q.addScalar(COUNT_COLUMN_NAME,
3438 com.liferay.portal.kernel.dao.orm.Type.LONG);
3439
3440 QueryPos qPos = QueryPos.getInstance(q);
3441
3442 qPos.add(groupId);
3443
3444 qPos.add(privateLayout);
3445
3446 Long count = (Long)q.uniqueResult();
3447
3448 return count.intValue();
3449 }
3450 catch (Exception e) {
3451 throw processException(e);
3452 }
3453 finally {
3454 closeSession(session);
3455 }
3456 }
3457
3458
3467 public int countByG_P_N(long groupId, boolean privateLayout, String name)
3468 throws SystemException {
3469 Object[] finderArgs = new Object[] { groupId, privateLayout, name };
3470
3471 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P_N,
3472 finderArgs, this);
3473
3474 if (count == null) {
3475 StringBundler query = new StringBundler(4);
3476
3477 query.append(_SQL_COUNT_LAYOUTSETBRANCH_WHERE);
3478
3479 query.append(_FINDER_COLUMN_G_P_N_GROUPID_2);
3480
3481 query.append(_FINDER_COLUMN_G_P_N_PRIVATELAYOUT_2);
3482
3483 if (name == null) {
3484 query.append(_FINDER_COLUMN_G_P_N_NAME_1);
3485 }
3486 else {
3487 if (name.equals(StringPool.BLANK)) {
3488 query.append(_FINDER_COLUMN_G_P_N_NAME_3);
3489 }
3490 else {
3491 query.append(_FINDER_COLUMN_G_P_N_NAME_2);
3492 }
3493 }
3494
3495 String sql = query.toString();
3496
3497 Session session = null;
3498
3499 try {
3500 session = openSession();
3501
3502 Query q = session.createQuery(sql);
3503
3504 QueryPos qPos = QueryPos.getInstance(q);
3505
3506 qPos.add(groupId);
3507
3508 qPos.add(privateLayout);
3509
3510 if (name != null) {
3511 qPos.add(name);
3512 }
3513
3514 count = (Long)q.uniqueResult();
3515 }
3516 catch (Exception e) {
3517 throw processException(e);
3518 }
3519 finally {
3520 if (count == null) {
3521 count = Long.valueOf(0);
3522 }
3523
3524 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P_N,
3525 finderArgs, count);
3526
3527 closeSession(session);
3528 }
3529 }
3530
3531 return count.intValue();
3532 }
3533
3534
3543 public int countByG_P_M(long groupId, boolean privateLayout, boolean master)
3544 throws SystemException {
3545 Object[] finderArgs = new Object[] { groupId, privateLayout, master };
3546
3547 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P_M,
3548 finderArgs, this);
3549
3550 if (count == null) {
3551 StringBundler query = new StringBundler(4);
3552
3553 query.append(_SQL_COUNT_LAYOUTSETBRANCH_WHERE);
3554
3555 query.append(_FINDER_COLUMN_G_P_M_GROUPID_2);
3556
3557 query.append(_FINDER_COLUMN_G_P_M_PRIVATELAYOUT_2);
3558
3559 query.append(_FINDER_COLUMN_G_P_M_MASTER_2);
3560
3561 String sql = query.toString();
3562
3563 Session session = null;
3564
3565 try {
3566 session = openSession();
3567
3568 Query q = session.createQuery(sql);
3569
3570 QueryPos qPos = QueryPos.getInstance(q);
3571
3572 qPos.add(groupId);
3573
3574 qPos.add(privateLayout);
3575
3576 qPos.add(master);
3577
3578 count = (Long)q.uniqueResult();
3579 }
3580 catch (Exception e) {
3581 throw processException(e);
3582 }
3583 finally {
3584 if (count == null) {
3585 count = Long.valueOf(0);
3586 }
3587
3588 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P_M,
3589 finderArgs, count);
3590
3591 closeSession(session);
3592 }
3593 }
3594
3595 return count.intValue();
3596 }
3597
3598
3607 public int filterCountByG_P_M(long groupId, boolean privateLayout,
3608 boolean master) throws SystemException {
3609 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3610 return countByG_P_M(groupId, privateLayout, master);
3611 }
3612
3613 StringBundler query = new StringBundler(4);
3614
3615 query.append(_FILTER_SQL_COUNT_LAYOUTSETBRANCH_WHERE);
3616
3617 query.append(_FINDER_COLUMN_G_P_M_GROUPID_2);
3618
3619 query.append(_FINDER_COLUMN_G_P_M_PRIVATELAYOUT_2);
3620
3621 query.append(_FINDER_COLUMN_G_P_M_MASTER_2);
3622
3623 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3624 LayoutSetBranch.class.getName(),
3625 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
3626
3627 Session session = null;
3628
3629 try {
3630 session = openSession();
3631
3632 SQLQuery q = session.createSQLQuery(sql);
3633
3634 q.addScalar(COUNT_COLUMN_NAME,
3635 com.liferay.portal.kernel.dao.orm.Type.LONG);
3636
3637 QueryPos qPos = QueryPos.getInstance(q);
3638
3639 qPos.add(groupId);
3640
3641 qPos.add(privateLayout);
3642
3643 qPos.add(master);
3644
3645 Long count = (Long)q.uniqueResult();
3646
3647 return count.intValue();
3648 }
3649 catch (Exception e) {
3650 throw processException(e);
3651 }
3652 finally {
3653 closeSession(session);
3654 }
3655 }
3656
3657
3663 public int countAll() throws SystemException {
3664 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3665 FINDER_ARGS_EMPTY, this);
3666
3667 if (count == null) {
3668 Session session = null;
3669
3670 try {
3671 session = openSession();
3672
3673 Query q = session.createQuery(_SQL_COUNT_LAYOUTSETBRANCH);
3674
3675 count = (Long)q.uniqueResult();
3676 }
3677 catch (Exception e) {
3678 throw processException(e);
3679 }
3680 finally {
3681 if (count == null) {
3682 count = Long.valueOf(0);
3683 }
3684
3685 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3686 FINDER_ARGS_EMPTY, count);
3687
3688 closeSession(session);
3689 }
3690 }
3691
3692 return count.intValue();
3693 }
3694
3695
3698 public void afterPropertiesSet() {
3699 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3700 com.liferay.portal.util.PropsUtil.get(
3701 "value.object.listener.com.liferay.portal.model.LayoutSetBranch")));
3702
3703 if (listenerClassNames.length > 0) {
3704 try {
3705 List<ModelListener<LayoutSetBranch>> listenersList = new ArrayList<ModelListener<LayoutSetBranch>>();
3706
3707 for (String listenerClassName : listenerClassNames) {
3708 Class<?> clazz = getClass();
3709
3710 listenersList.add((ModelListener<LayoutSetBranch>)InstanceFactory.newInstance(
3711 clazz.getClassLoader(), listenerClassName));
3712 }
3713
3714 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3715 }
3716 catch (Exception e) {
3717 _log.error(e);
3718 }
3719 }
3720 }
3721
3722 public void destroy() {
3723 EntityCacheUtil.removeCache(LayoutSetBranchImpl.class.getName());
3724 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3725 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3726 }
3727
3728 @BeanReference(type = AccountPersistence.class)
3729 protected AccountPersistence accountPersistence;
3730 @BeanReference(type = AddressPersistence.class)
3731 protected AddressPersistence addressPersistence;
3732 @BeanReference(type = BrowserTrackerPersistence.class)
3733 protected BrowserTrackerPersistence browserTrackerPersistence;
3734 @BeanReference(type = ClassNamePersistence.class)
3735 protected ClassNamePersistence classNamePersistence;
3736 @BeanReference(type = ClusterGroupPersistence.class)
3737 protected ClusterGroupPersistence clusterGroupPersistence;
3738 @BeanReference(type = CompanyPersistence.class)
3739 protected CompanyPersistence companyPersistence;
3740 @BeanReference(type = ContactPersistence.class)
3741 protected ContactPersistence contactPersistence;
3742 @BeanReference(type = CountryPersistence.class)
3743 protected CountryPersistence countryPersistence;
3744 @BeanReference(type = EmailAddressPersistence.class)
3745 protected EmailAddressPersistence emailAddressPersistence;
3746 @BeanReference(type = GroupPersistence.class)
3747 protected GroupPersistence groupPersistence;
3748 @BeanReference(type = ImagePersistence.class)
3749 protected ImagePersistence imagePersistence;
3750 @BeanReference(type = LayoutPersistence.class)
3751 protected LayoutPersistence layoutPersistence;
3752 @BeanReference(type = LayoutBranchPersistence.class)
3753 protected LayoutBranchPersistence layoutBranchPersistence;
3754 @BeanReference(type = LayoutPrototypePersistence.class)
3755 protected LayoutPrototypePersistence layoutPrototypePersistence;
3756 @BeanReference(type = LayoutRevisionPersistence.class)
3757 protected LayoutRevisionPersistence layoutRevisionPersistence;
3758 @BeanReference(type = LayoutSetPersistence.class)
3759 protected LayoutSetPersistence layoutSetPersistence;
3760 @BeanReference(type = LayoutSetBranchPersistence.class)
3761 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
3762 @BeanReference(type = LayoutSetPrototypePersistence.class)
3763 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
3764 @BeanReference(type = ListTypePersistence.class)
3765 protected ListTypePersistence listTypePersistence;
3766 @BeanReference(type = LockPersistence.class)
3767 protected LockPersistence lockPersistence;
3768 @BeanReference(type = MembershipRequestPersistence.class)
3769 protected MembershipRequestPersistence membershipRequestPersistence;
3770 @BeanReference(type = OrganizationPersistence.class)
3771 protected OrganizationPersistence organizationPersistence;
3772 @BeanReference(type = OrgGroupPermissionPersistence.class)
3773 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
3774 @BeanReference(type = OrgGroupRolePersistence.class)
3775 protected OrgGroupRolePersistence orgGroupRolePersistence;
3776 @BeanReference(type = OrgLaborPersistence.class)
3777 protected OrgLaborPersistence orgLaborPersistence;
3778 @BeanReference(type = PasswordPolicyPersistence.class)
3779 protected PasswordPolicyPersistence passwordPolicyPersistence;
3780 @BeanReference(type = PasswordPolicyRelPersistence.class)
3781 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
3782 @BeanReference(type = PasswordTrackerPersistence.class)
3783 protected PasswordTrackerPersistence passwordTrackerPersistence;
3784 @BeanReference(type = PermissionPersistence.class)
3785 protected PermissionPersistence permissionPersistence;
3786 @BeanReference(type = PhonePersistence.class)
3787 protected PhonePersistence phonePersistence;
3788 @BeanReference(type = PluginSettingPersistence.class)
3789 protected PluginSettingPersistence pluginSettingPersistence;
3790 @BeanReference(type = PortalPreferencesPersistence.class)
3791 protected PortalPreferencesPersistence portalPreferencesPersistence;
3792 @BeanReference(type = PortletPersistence.class)
3793 protected PortletPersistence portletPersistence;
3794 @BeanReference(type = PortletItemPersistence.class)
3795 protected PortletItemPersistence portletItemPersistence;
3796 @BeanReference(type = PortletPreferencesPersistence.class)
3797 protected PortletPreferencesPersistence portletPreferencesPersistence;
3798 @BeanReference(type = RegionPersistence.class)
3799 protected RegionPersistence regionPersistence;
3800 @BeanReference(type = ReleasePersistence.class)
3801 protected ReleasePersistence releasePersistence;
3802 @BeanReference(type = RepositoryPersistence.class)
3803 protected RepositoryPersistence repositoryPersistence;
3804 @BeanReference(type = RepositoryEntryPersistence.class)
3805 protected RepositoryEntryPersistence repositoryEntryPersistence;
3806 @BeanReference(type = ResourcePersistence.class)
3807 protected ResourcePersistence resourcePersistence;
3808 @BeanReference(type = ResourceActionPersistence.class)
3809 protected ResourceActionPersistence resourceActionPersistence;
3810 @BeanReference(type = ResourceBlockPersistence.class)
3811 protected ResourceBlockPersistence resourceBlockPersistence;
3812 @BeanReference(type = ResourceBlockPermissionPersistence.class)
3813 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
3814 @BeanReference(type = ResourceCodePersistence.class)
3815 protected ResourceCodePersistence resourceCodePersistence;
3816 @BeanReference(type = ResourcePermissionPersistence.class)
3817 protected ResourcePermissionPersistence resourcePermissionPersistence;
3818 @BeanReference(type = ResourceTypePermissionPersistence.class)
3819 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
3820 @BeanReference(type = RolePersistence.class)
3821 protected RolePersistence rolePersistence;
3822 @BeanReference(type = ServiceComponentPersistence.class)
3823 protected ServiceComponentPersistence serviceComponentPersistence;
3824 @BeanReference(type = ShardPersistence.class)
3825 protected ShardPersistence shardPersistence;
3826 @BeanReference(type = SubscriptionPersistence.class)
3827 protected SubscriptionPersistence subscriptionPersistence;
3828 @BeanReference(type = TeamPersistence.class)
3829 protected TeamPersistence teamPersistence;
3830 @BeanReference(type = TicketPersistence.class)
3831 protected TicketPersistence ticketPersistence;
3832 @BeanReference(type = UserPersistence.class)
3833 protected UserPersistence userPersistence;
3834 @BeanReference(type = UserGroupPersistence.class)
3835 protected UserGroupPersistence userGroupPersistence;
3836 @BeanReference(type = UserGroupGroupRolePersistence.class)
3837 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
3838 @BeanReference(type = UserGroupRolePersistence.class)
3839 protected UserGroupRolePersistence userGroupRolePersistence;
3840 @BeanReference(type = UserIdMapperPersistence.class)
3841 protected UserIdMapperPersistence userIdMapperPersistence;
3842 @BeanReference(type = UserNotificationEventPersistence.class)
3843 protected UserNotificationEventPersistence userNotificationEventPersistence;
3844 @BeanReference(type = UserTrackerPersistence.class)
3845 protected UserTrackerPersistence userTrackerPersistence;
3846 @BeanReference(type = UserTrackerPathPersistence.class)
3847 protected UserTrackerPathPersistence userTrackerPathPersistence;
3848 @BeanReference(type = VirtualHostPersistence.class)
3849 protected VirtualHostPersistence virtualHostPersistence;
3850 @BeanReference(type = WebDAVPropsPersistence.class)
3851 protected WebDAVPropsPersistence webDAVPropsPersistence;
3852 @BeanReference(type = WebsitePersistence.class)
3853 protected WebsitePersistence websitePersistence;
3854 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
3855 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
3856 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
3857 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
3858 private static final String _SQL_SELECT_LAYOUTSETBRANCH = "SELECT layoutSetBranch FROM LayoutSetBranch layoutSetBranch";
3859 private static final String _SQL_SELECT_LAYOUTSETBRANCH_WHERE = "SELECT layoutSetBranch FROM LayoutSetBranch layoutSetBranch WHERE ";
3860 private static final String _SQL_COUNT_LAYOUTSETBRANCH = "SELECT COUNT(layoutSetBranch) FROM LayoutSetBranch layoutSetBranch";
3861 private static final String _SQL_COUNT_LAYOUTSETBRANCH_WHERE = "SELECT COUNT(layoutSetBranch) FROM LayoutSetBranch layoutSetBranch WHERE ";
3862 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "layoutSetBranch.groupId = ?";
3863 private static final String _FINDER_COLUMN_G_P_GROUPID_2 = "layoutSetBranch.groupId = ? AND ";
3864 private static final String _FINDER_COLUMN_G_P_PRIVATELAYOUT_2 = "layoutSetBranch.privateLayout = ?";
3865 private static final String _FINDER_COLUMN_G_P_N_GROUPID_2 = "layoutSetBranch.groupId = ? AND ";
3866 private static final String _FINDER_COLUMN_G_P_N_PRIVATELAYOUT_2 = "layoutSetBranch.privateLayout = ? AND ";
3867 private static final String _FINDER_COLUMN_G_P_N_NAME_1 = "layoutSetBranch.name IS NULL";
3868 private static final String _FINDER_COLUMN_G_P_N_NAME_2 = "layoutSetBranch.name = ?";
3869 private static final String _FINDER_COLUMN_G_P_N_NAME_3 = "(layoutSetBranch.name IS NULL OR layoutSetBranch.name = ?)";
3870 private static final String _FINDER_COLUMN_G_P_M_GROUPID_2 = "layoutSetBranch.groupId = ? AND ";
3871 private static final String _FINDER_COLUMN_G_P_M_PRIVATELAYOUT_2 = "layoutSetBranch.privateLayout = ? AND ";
3872 private static final String _FINDER_COLUMN_G_P_M_MASTER_2 = "layoutSetBranch.master = ?";
3873 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "layoutSetBranch.layoutSetBranchId";
3874 private static final String _FILTER_SQL_SELECT_LAYOUTSETBRANCH_WHERE = "SELECT DISTINCT {layoutSetBranch.*} FROM LayoutSetBranch layoutSetBranch WHERE ";
3875 private static final String _FILTER_SQL_SELECT_LAYOUTSETBRANCH_NO_INLINE_DISTINCT_WHERE_1 =
3876 "SELECT {LayoutSetBranch.*} FROM (SELECT DISTINCT layoutSetBranch.layoutSetBranchId FROM LayoutSetBranch layoutSetBranch WHERE ";
3877 private static final String _FILTER_SQL_SELECT_LAYOUTSETBRANCH_NO_INLINE_DISTINCT_WHERE_2 =
3878 ") TEMP_TABLE INNER JOIN LayoutSetBranch ON TEMP_TABLE.layoutSetBranchId = LayoutSetBranch.layoutSetBranchId";
3879 private static final String _FILTER_SQL_COUNT_LAYOUTSETBRANCH_WHERE = "SELECT COUNT(DISTINCT layoutSetBranch.layoutSetBranchId) AS COUNT_VALUE FROM LayoutSetBranch layoutSetBranch WHERE ";
3880 private static final String _FILTER_ENTITY_ALIAS = "layoutSetBranch";
3881 private static final String _FILTER_ENTITY_TABLE = "LayoutSetBranch";
3882 private static final String _ORDER_BY_ENTITY_ALIAS = "layoutSetBranch.";
3883 private static final String _ORDER_BY_ENTITY_TABLE = "LayoutSetBranch.";
3884 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No LayoutSetBranch exists with the primary key ";
3885 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No LayoutSetBranch exists with the key {";
3886 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3887 private static Log _log = LogFactoryUtil.getLog(LayoutSetBranchPersistenceImpl.class);
3888 private static LayoutSetBranch _nullLayoutSetBranch = new LayoutSetBranchImpl() {
3889 @Override
3890 public Object clone() {
3891 return this;
3892 }
3893
3894 @Override
3895 public CacheModel<LayoutSetBranch> toCacheModel() {
3896 return _nullLayoutSetBranchCacheModel;
3897 }
3898 };
3899
3900 private static CacheModel<LayoutSetBranch> _nullLayoutSetBranchCacheModel = new CacheModel<LayoutSetBranch>() {
3901 public LayoutSetBranch toEntityModel() {
3902 return _nullLayoutSetBranch;
3903 }
3904 };
3905 }