001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchLayoutBranchException;
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.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.GetterUtil;
032 import com.liferay.portal.kernel.util.InstanceFactory;
033 import com.liferay.portal.kernel.util.OrderByComparator;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.model.CacheModel;
038 import com.liferay.portal.model.LayoutBranch;
039 import com.liferay.portal.model.ModelListener;
040 import com.liferay.portal.model.impl.LayoutBranchImpl;
041 import com.liferay.portal.model.impl.LayoutBranchModelImpl;
042 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043
044 import java.io.Serializable;
045
046 import java.util.ArrayList;
047 import java.util.Collections;
048 import java.util.List;
049
050
062 public class LayoutBranchPersistenceImpl extends BasePersistenceImpl<LayoutBranch>
063 implements LayoutBranchPersistence {
064
069 public static final String FINDER_CLASS_NAME_ENTITY = LayoutBranchImpl.class.getName();
070 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
071 ".List1";
072 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
073 ".List2";
074 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_LAYOUTSETBRANCHID =
075 new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
076 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
077 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByLayoutSetBranchId",
078 new String[] {
079 Long.class.getName(),
080
081 "java.lang.Integer", "java.lang.Integer",
082 "com.liferay.portal.kernel.util.OrderByComparator"
083 });
084 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_LAYOUTSETBRANCHID =
085 new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
086 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
087 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
088 "findByLayoutSetBranchId", new String[] { Long.class.getName() },
089 LayoutBranchModelImpl.LAYOUTSETBRANCHID_COLUMN_BITMASK);
090 public static final FinderPath FINDER_PATH_COUNT_BY_LAYOUTSETBRANCHID = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
091 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
092 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
093 "countByLayoutSetBranchId", new String[] { Long.class.getName() });
094 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_L_P = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
095 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
096 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByL_P",
097 new String[] {
098 Long.class.getName(), Long.class.getName(),
099
100 "java.lang.Integer", "java.lang.Integer",
101 "com.liferay.portal.kernel.util.OrderByComparator"
102 });
103 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
104 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
105 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByL_P",
106 new String[] { Long.class.getName(), Long.class.getName() },
107 LayoutBranchModelImpl.LAYOUTSETBRANCHID_COLUMN_BITMASK |
108 LayoutBranchModelImpl.PLID_COLUMN_BITMASK);
109 public static final FinderPath FINDER_PATH_COUNT_BY_L_P = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
110 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
111 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByL_P",
112 new String[] { Long.class.getName(), Long.class.getName() });
113 public static final FinderPath FINDER_PATH_FETCH_BY_L_P_N = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
114 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
115 FINDER_CLASS_NAME_ENTITY, "fetchByL_P_N",
116 new String[] {
117 Long.class.getName(), Long.class.getName(),
118 String.class.getName()
119 },
120 LayoutBranchModelImpl.LAYOUTSETBRANCHID_COLUMN_BITMASK |
121 LayoutBranchModelImpl.PLID_COLUMN_BITMASK |
122 LayoutBranchModelImpl.NAME_COLUMN_BITMASK);
123 public static final FinderPath FINDER_PATH_COUNT_BY_L_P_N = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
124 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
125 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByL_P_N",
126 new String[] {
127 Long.class.getName(), Long.class.getName(),
128 String.class.getName()
129 });
130 public static final FinderPath FINDER_PATH_FETCH_BY_L_P_M = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
131 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
132 FINDER_CLASS_NAME_ENTITY, "fetchByL_P_M",
133 new String[] {
134 Long.class.getName(), Long.class.getName(),
135 Boolean.class.getName()
136 },
137 LayoutBranchModelImpl.LAYOUTSETBRANCHID_COLUMN_BITMASK |
138 LayoutBranchModelImpl.PLID_COLUMN_BITMASK |
139 LayoutBranchModelImpl.MASTER_COLUMN_BITMASK);
140 public static final FinderPath FINDER_PATH_COUNT_BY_L_P_M = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
141 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
142 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByL_P_M",
143 new String[] {
144 Long.class.getName(), Long.class.getName(),
145 Boolean.class.getName()
146 });
147 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
148 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
149 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
150 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
151 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
152 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
153 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
154 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
155 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
156
157
162 public void cacheResult(LayoutBranch layoutBranch) {
163 EntityCacheUtil.putResult(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
164 LayoutBranchImpl.class, layoutBranch.getPrimaryKey(), layoutBranch);
165
166 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_N,
167 new Object[] {
168 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
169 Long.valueOf(layoutBranch.getPlid()),
170
171 layoutBranch.getName()
172 }, layoutBranch);
173
174 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_M,
175 new Object[] {
176 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
177 Long.valueOf(layoutBranch.getPlid()),
178 Boolean.valueOf(layoutBranch.getMaster())
179 }, layoutBranch);
180
181 layoutBranch.resetOriginalValues();
182 }
183
184
189 public void cacheResult(List<LayoutBranch> layoutBranchs) {
190 for (LayoutBranch layoutBranch : layoutBranchs) {
191 if (EntityCacheUtil.getResult(
192 LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
193 LayoutBranchImpl.class, layoutBranch.getPrimaryKey()) == null) {
194 cacheResult(layoutBranch);
195 }
196 else {
197 layoutBranch.resetOriginalValues();
198 }
199 }
200 }
201
202
209 @Override
210 public void clearCache() {
211 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
212 CacheRegistryUtil.clear(LayoutBranchImpl.class.getName());
213 }
214
215 EntityCacheUtil.clearCache(LayoutBranchImpl.class.getName());
216
217 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
218 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
219 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
220 }
221
222
229 @Override
230 public void clearCache(LayoutBranch layoutBranch) {
231 EntityCacheUtil.removeResult(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
232 LayoutBranchImpl.class, layoutBranch.getPrimaryKey());
233
234 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
235 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
236
237 clearUniqueFindersCache(layoutBranch);
238 }
239
240 @Override
241 public void clearCache(List<LayoutBranch> layoutBranchs) {
242 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
243 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
244
245 for (LayoutBranch layoutBranch : layoutBranchs) {
246 EntityCacheUtil.removeResult(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
247 LayoutBranchImpl.class, layoutBranch.getPrimaryKey());
248
249 clearUniqueFindersCache(layoutBranch);
250 }
251 }
252
253 protected void clearUniqueFindersCache(LayoutBranch layoutBranch) {
254 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_L_P_N,
255 new Object[] {
256 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
257 Long.valueOf(layoutBranch.getPlid()),
258
259 layoutBranch.getName()
260 });
261
262 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_L_P_M,
263 new Object[] {
264 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
265 Long.valueOf(layoutBranch.getPlid()),
266 Boolean.valueOf(layoutBranch.getMaster())
267 });
268 }
269
270
276 public LayoutBranch create(long LayoutBranchId) {
277 LayoutBranch layoutBranch = new LayoutBranchImpl();
278
279 layoutBranch.setNew(true);
280 layoutBranch.setPrimaryKey(LayoutBranchId);
281
282 return layoutBranch;
283 }
284
285
293 public LayoutBranch remove(long LayoutBranchId)
294 throws NoSuchLayoutBranchException, SystemException {
295 return remove(Long.valueOf(LayoutBranchId));
296 }
297
298
306 @Override
307 public LayoutBranch remove(Serializable primaryKey)
308 throws NoSuchLayoutBranchException, SystemException {
309 Session session = null;
310
311 try {
312 session = openSession();
313
314 LayoutBranch layoutBranch = (LayoutBranch)session.get(LayoutBranchImpl.class,
315 primaryKey);
316
317 if (layoutBranch == null) {
318 if (_log.isWarnEnabled()) {
319 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
320 }
321
322 throw new NoSuchLayoutBranchException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
323 primaryKey);
324 }
325
326 return remove(layoutBranch);
327 }
328 catch (NoSuchLayoutBranchException nsee) {
329 throw nsee;
330 }
331 catch (Exception e) {
332 throw processException(e);
333 }
334 finally {
335 closeSession(session);
336 }
337 }
338
339 @Override
340 protected LayoutBranch removeImpl(LayoutBranch layoutBranch)
341 throws SystemException {
342 layoutBranch = toUnwrappedModel(layoutBranch);
343
344 Session session = null;
345
346 try {
347 session = openSession();
348
349 BatchSessionUtil.delete(session, layoutBranch);
350 }
351 catch (Exception e) {
352 throw processException(e);
353 }
354 finally {
355 closeSession(session);
356 }
357
358 clearCache(layoutBranch);
359
360 return layoutBranch;
361 }
362
363 @Override
364 public LayoutBranch updateImpl(
365 com.liferay.portal.model.LayoutBranch layoutBranch, boolean merge)
366 throws SystemException {
367 layoutBranch = toUnwrappedModel(layoutBranch);
368
369 boolean isNew = layoutBranch.isNew();
370
371 LayoutBranchModelImpl layoutBranchModelImpl = (LayoutBranchModelImpl)layoutBranch;
372
373 Session session = null;
374
375 try {
376 session = openSession();
377
378 BatchSessionUtil.update(session, layoutBranch, merge);
379
380 layoutBranch.setNew(false);
381 }
382 catch (Exception e) {
383 throw processException(e);
384 }
385 finally {
386 closeSession(session);
387 }
388
389 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
390
391 if (isNew || !LayoutBranchModelImpl.COLUMN_BITMASK_ENABLED) {
392 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
393 }
394
395 else {
396 if ((layoutBranchModelImpl.getColumnBitmask() &
397 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_LAYOUTSETBRANCHID.getColumnBitmask()) != 0) {
398 Object[] args = new Object[] {
399 Long.valueOf(layoutBranchModelImpl.getOriginalLayoutSetBranchId())
400 };
401
402 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_LAYOUTSETBRANCHID,
403 args);
404 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_LAYOUTSETBRANCHID,
405 args);
406
407 args = new Object[] {
408 Long.valueOf(layoutBranchModelImpl.getLayoutSetBranchId())
409 };
410
411 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_LAYOUTSETBRANCHID,
412 args);
413 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_LAYOUTSETBRANCHID,
414 args);
415 }
416
417 if ((layoutBranchModelImpl.getColumnBitmask() &
418 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P.getColumnBitmask()) != 0) {
419 Object[] args = new Object[] {
420 Long.valueOf(layoutBranchModelImpl.getOriginalLayoutSetBranchId()),
421 Long.valueOf(layoutBranchModelImpl.getOriginalPlid())
422 };
423
424 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_L_P, args);
425 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P,
426 args);
427
428 args = new Object[] {
429 Long.valueOf(layoutBranchModelImpl.getLayoutSetBranchId()),
430 Long.valueOf(layoutBranchModelImpl.getPlid())
431 };
432
433 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_L_P, args);
434 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P,
435 args);
436 }
437 }
438
439 EntityCacheUtil.putResult(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
440 LayoutBranchImpl.class, layoutBranch.getPrimaryKey(), layoutBranch);
441
442 if (isNew) {
443 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_N,
444 new Object[] {
445 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
446 Long.valueOf(layoutBranch.getPlid()),
447
448 layoutBranch.getName()
449 }, layoutBranch);
450
451 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_M,
452 new Object[] {
453 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
454 Long.valueOf(layoutBranch.getPlid()),
455 Boolean.valueOf(layoutBranch.getMaster())
456 }, layoutBranch);
457 }
458 else {
459 if ((layoutBranchModelImpl.getColumnBitmask() &
460 FINDER_PATH_FETCH_BY_L_P_N.getColumnBitmask()) != 0) {
461 Object[] args = new Object[] {
462 Long.valueOf(layoutBranchModelImpl.getOriginalLayoutSetBranchId()),
463 Long.valueOf(layoutBranchModelImpl.getOriginalPlid()),
464
465 layoutBranchModelImpl.getOriginalName()
466 };
467
468 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_L_P_N, args);
469 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_L_P_N, args);
470
471 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_N,
472 new Object[] {
473 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
474 Long.valueOf(layoutBranch.getPlid()),
475
476 layoutBranch.getName()
477 }, layoutBranch);
478 }
479
480 if ((layoutBranchModelImpl.getColumnBitmask() &
481 FINDER_PATH_FETCH_BY_L_P_M.getColumnBitmask()) != 0) {
482 Object[] args = new Object[] {
483 Long.valueOf(layoutBranchModelImpl.getOriginalLayoutSetBranchId()),
484 Long.valueOf(layoutBranchModelImpl.getOriginalPlid()),
485 Boolean.valueOf(layoutBranchModelImpl.getOriginalMaster())
486 };
487
488 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_L_P_M, args);
489 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_L_P_M, args);
490
491 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_M,
492 new Object[] {
493 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
494 Long.valueOf(layoutBranch.getPlid()),
495 Boolean.valueOf(layoutBranch.getMaster())
496 }, layoutBranch);
497 }
498 }
499
500 return layoutBranch;
501 }
502
503 protected LayoutBranch toUnwrappedModel(LayoutBranch layoutBranch) {
504 if (layoutBranch instanceof LayoutBranchImpl) {
505 return layoutBranch;
506 }
507
508 LayoutBranchImpl layoutBranchImpl = new LayoutBranchImpl();
509
510 layoutBranchImpl.setNew(layoutBranch.isNew());
511 layoutBranchImpl.setPrimaryKey(layoutBranch.getPrimaryKey());
512
513 layoutBranchImpl.setLayoutBranchId(layoutBranch.getLayoutBranchId());
514 layoutBranchImpl.setGroupId(layoutBranch.getGroupId());
515 layoutBranchImpl.setCompanyId(layoutBranch.getCompanyId());
516 layoutBranchImpl.setUserId(layoutBranch.getUserId());
517 layoutBranchImpl.setUserName(layoutBranch.getUserName());
518 layoutBranchImpl.setLayoutSetBranchId(layoutBranch.getLayoutSetBranchId());
519 layoutBranchImpl.setPlid(layoutBranch.getPlid());
520 layoutBranchImpl.setName(layoutBranch.getName());
521 layoutBranchImpl.setDescription(layoutBranch.getDescription());
522 layoutBranchImpl.setMaster(layoutBranch.isMaster());
523
524 return layoutBranchImpl;
525 }
526
527
535 @Override
536 public LayoutBranch findByPrimaryKey(Serializable primaryKey)
537 throws NoSuchModelException, SystemException {
538 return findByPrimaryKey(((Long)primaryKey).longValue());
539 }
540
541
549 public LayoutBranch findByPrimaryKey(long LayoutBranchId)
550 throws NoSuchLayoutBranchException, SystemException {
551 LayoutBranch layoutBranch = fetchByPrimaryKey(LayoutBranchId);
552
553 if (layoutBranch == null) {
554 if (_log.isWarnEnabled()) {
555 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + LayoutBranchId);
556 }
557
558 throw new NoSuchLayoutBranchException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
559 LayoutBranchId);
560 }
561
562 return layoutBranch;
563 }
564
565
572 @Override
573 public LayoutBranch fetchByPrimaryKey(Serializable primaryKey)
574 throws SystemException {
575 return fetchByPrimaryKey(((Long)primaryKey).longValue());
576 }
577
578
585 public LayoutBranch fetchByPrimaryKey(long LayoutBranchId)
586 throws SystemException {
587 LayoutBranch layoutBranch = (LayoutBranch)EntityCacheUtil.getResult(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
588 LayoutBranchImpl.class, LayoutBranchId);
589
590 if (layoutBranch == _nullLayoutBranch) {
591 return null;
592 }
593
594 if (layoutBranch == null) {
595 Session session = null;
596
597 boolean hasException = false;
598
599 try {
600 session = openSession();
601
602 layoutBranch = (LayoutBranch)session.get(LayoutBranchImpl.class,
603 Long.valueOf(LayoutBranchId));
604 }
605 catch (Exception e) {
606 hasException = true;
607
608 throw processException(e);
609 }
610 finally {
611 if (layoutBranch != null) {
612 cacheResult(layoutBranch);
613 }
614 else if (!hasException) {
615 EntityCacheUtil.putResult(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
616 LayoutBranchImpl.class, LayoutBranchId,
617 _nullLayoutBranch);
618 }
619
620 closeSession(session);
621 }
622 }
623
624 return layoutBranch;
625 }
626
627
634 public List<LayoutBranch> findByLayoutSetBranchId(long layoutSetBranchId)
635 throws SystemException {
636 return findByLayoutSetBranchId(layoutSetBranchId, QueryUtil.ALL_POS,
637 QueryUtil.ALL_POS, null);
638 }
639
640
653 public List<LayoutBranch> findByLayoutSetBranchId(long layoutSetBranchId,
654 int start, int end) throws SystemException {
655 return findByLayoutSetBranchId(layoutSetBranchId, start, end, null);
656 }
657
658
672 public List<LayoutBranch> findByLayoutSetBranchId(long layoutSetBranchId,
673 int start, int end, OrderByComparator orderByComparator)
674 throws SystemException {
675 FinderPath finderPath = null;
676 Object[] finderArgs = null;
677
678 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
679 (orderByComparator == null)) {
680 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_LAYOUTSETBRANCHID;
681 finderArgs = new Object[] { layoutSetBranchId };
682 }
683 else {
684 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_LAYOUTSETBRANCHID;
685 finderArgs = new Object[] {
686 layoutSetBranchId,
687
688 start, end, orderByComparator
689 };
690 }
691
692 List<LayoutBranch> list = (List<LayoutBranch>)FinderCacheUtil.getResult(finderPath,
693 finderArgs, this);
694
695 if (list == null) {
696 StringBundler query = null;
697
698 if (orderByComparator != null) {
699 query = new StringBundler(3 +
700 (orderByComparator.getOrderByFields().length * 3));
701 }
702 else {
703 query = new StringBundler(2);
704 }
705
706 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
707
708 query.append(_FINDER_COLUMN_LAYOUTSETBRANCHID_LAYOUTSETBRANCHID_2);
709
710 if (orderByComparator != null) {
711 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
712 orderByComparator);
713 }
714
715 String sql = query.toString();
716
717 Session session = null;
718
719 try {
720 session = openSession();
721
722 Query q = session.createQuery(sql);
723
724 QueryPos qPos = QueryPos.getInstance(q);
725
726 qPos.add(layoutSetBranchId);
727
728 list = (List<LayoutBranch>)QueryUtil.list(q, getDialect(),
729 start, end);
730 }
731 catch (Exception e) {
732 throw processException(e);
733 }
734 finally {
735 if (list == null) {
736 FinderCacheUtil.removeResult(finderPath, finderArgs);
737 }
738 else {
739 cacheResult(list);
740
741 FinderCacheUtil.putResult(finderPath, finderArgs, list);
742 }
743
744 closeSession(session);
745 }
746 }
747
748 return list;
749 }
750
751
764 public LayoutBranch findByLayoutSetBranchId_First(long layoutSetBranchId,
765 OrderByComparator orderByComparator)
766 throws NoSuchLayoutBranchException, SystemException {
767 List<LayoutBranch> list = findByLayoutSetBranchId(layoutSetBranchId, 0,
768 1, orderByComparator);
769
770 if (list.isEmpty()) {
771 StringBundler msg = new StringBundler(4);
772
773 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
774
775 msg.append("layoutSetBranchId=");
776 msg.append(layoutSetBranchId);
777
778 msg.append(StringPool.CLOSE_CURLY_BRACE);
779
780 throw new NoSuchLayoutBranchException(msg.toString());
781 }
782 else {
783 return list.get(0);
784 }
785 }
786
787
800 public LayoutBranch findByLayoutSetBranchId_Last(long layoutSetBranchId,
801 OrderByComparator orderByComparator)
802 throws NoSuchLayoutBranchException, SystemException {
803 int count = countByLayoutSetBranchId(layoutSetBranchId);
804
805 List<LayoutBranch> list = findByLayoutSetBranchId(layoutSetBranchId,
806 count - 1, count, orderByComparator);
807
808 if (list.isEmpty()) {
809 StringBundler msg = new StringBundler(4);
810
811 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
812
813 msg.append("layoutSetBranchId=");
814 msg.append(layoutSetBranchId);
815
816 msg.append(StringPool.CLOSE_CURLY_BRACE);
817
818 throw new NoSuchLayoutBranchException(msg.toString());
819 }
820 else {
821 return list.get(0);
822 }
823 }
824
825
839 public LayoutBranch[] findByLayoutSetBranchId_PrevAndNext(
840 long LayoutBranchId, long layoutSetBranchId,
841 OrderByComparator orderByComparator)
842 throws NoSuchLayoutBranchException, SystemException {
843 LayoutBranch layoutBranch = findByPrimaryKey(LayoutBranchId);
844
845 Session session = null;
846
847 try {
848 session = openSession();
849
850 LayoutBranch[] array = new LayoutBranchImpl[3];
851
852 array[0] = getByLayoutSetBranchId_PrevAndNext(session,
853 layoutBranch, layoutSetBranchId, orderByComparator, true);
854
855 array[1] = layoutBranch;
856
857 array[2] = getByLayoutSetBranchId_PrevAndNext(session,
858 layoutBranch, layoutSetBranchId, orderByComparator, false);
859
860 return array;
861 }
862 catch (Exception e) {
863 throw processException(e);
864 }
865 finally {
866 closeSession(session);
867 }
868 }
869
870 protected LayoutBranch getByLayoutSetBranchId_PrevAndNext(Session session,
871 LayoutBranch layoutBranch, long layoutSetBranchId,
872 OrderByComparator orderByComparator, boolean previous) {
873 StringBundler query = null;
874
875 if (orderByComparator != null) {
876 query = new StringBundler(6 +
877 (orderByComparator.getOrderByFields().length * 6));
878 }
879 else {
880 query = new StringBundler(3);
881 }
882
883 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
884
885 query.append(_FINDER_COLUMN_LAYOUTSETBRANCHID_LAYOUTSETBRANCHID_2);
886
887 if (orderByComparator != null) {
888 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
889
890 if (orderByConditionFields.length > 0) {
891 query.append(WHERE_AND);
892 }
893
894 for (int i = 0; i < orderByConditionFields.length; i++) {
895 query.append(_ORDER_BY_ENTITY_ALIAS);
896 query.append(orderByConditionFields[i]);
897
898 if ((i + 1) < orderByConditionFields.length) {
899 if (orderByComparator.isAscending() ^ previous) {
900 query.append(WHERE_GREATER_THAN_HAS_NEXT);
901 }
902 else {
903 query.append(WHERE_LESSER_THAN_HAS_NEXT);
904 }
905 }
906 else {
907 if (orderByComparator.isAscending() ^ previous) {
908 query.append(WHERE_GREATER_THAN);
909 }
910 else {
911 query.append(WHERE_LESSER_THAN);
912 }
913 }
914 }
915
916 query.append(ORDER_BY_CLAUSE);
917
918 String[] orderByFields = orderByComparator.getOrderByFields();
919
920 for (int i = 0; i < orderByFields.length; i++) {
921 query.append(_ORDER_BY_ENTITY_ALIAS);
922 query.append(orderByFields[i]);
923
924 if ((i + 1) < orderByFields.length) {
925 if (orderByComparator.isAscending() ^ previous) {
926 query.append(ORDER_BY_ASC_HAS_NEXT);
927 }
928 else {
929 query.append(ORDER_BY_DESC_HAS_NEXT);
930 }
931 }
932 else {
933 if (orderByComparator.isAscending() ^ previous) {
934 query.append(ORDER_BY_ASC);
935 }
936 else {
937 query.append(ORDER_BY_DESC);
938 }
939 }
940 }
941 }
942
943 String sql = query.toString();
944
945 Query q = session.createQuery(sql);
946
947 q.setFirstResult(0);
948 q.setMaxResults(2);
949
950 QueryPos qPos = QueryPos.getInstance(q);
951
952 qPos.add(layoutSetBranchId);
953
954 if (orderByComparator != null) {
955 Object[] values = orderByComparator.getOrderByConditionValues(layoutBranch);
956
957 for (Object value : values) {
958 qPos.add(value);
959 }
960 }
961
962 List<LayoutBranch> list = q.list();
963
964 if (list.size() == 2) {
965 return list.get(1);
966 }
967 else {
968 return null;
969 }
970 }
971
972
980 public List<LayoutBranch> findByL_P(long layoutSetBranchId, long plid)
981 throws SystemException {
982 return findByL_P(layoutSetBranchId, plid, QueryUtil.ALL_POS,
983 QueryUtil.ALL_POS, null);
984 }
985
986
1000 public List<LayoutBranch> findByL_P(long layoutSetBranchId, long plid,
1001 int start, int end) throws SystemException {
1002 return findByL_P(layoutSetBranchId, plid, start, end, null);
1003 }
1004
1005
1020 public List<LayoutBranch> findByL_P(long layoutSetBranchId, long plid,
1021 int start, int end, OrderByComparator orderByComparator)
1022 throws SystemException {
1023 FinderPath finderPath = null;
1024 Object[] finderArgs = null;
1025
1026 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1027 (orderByComparator == null)) {
1028 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P;
1029 finderArgs = new Object[] { layoutSetBranchId, plid };
1030 }
1031 else {
1032 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_L_P;
1033 finderArgs = new Object[] {
1034 layoutSetBranchId, plid,
1035
1036 start, end, orderByComparator
1037 };
1038 }
1039
1040 List<LayoutBranch> list = (List<LayoutBranch>)FinderCacheUtil.getResult(finderPath,
1041 finderArgs, this);
1042
1043 if (list == null) {
1044 StringBundler query = null;
1045
1046 if (orderByComparator != null) {
1047 query = new StringBundler(4 +
1048 (orderByComparator.getOrderByFields().length * 3));
1049 }
1050 else {
1051 query = new StringBundler(3);
1052 }
1053
1054 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
1055
1056 query.append(_FINDER_COLUMN_L_P_LAYOUTSETBRANCHID_2);
1057
1058 query.append(_FINDER_COLUMN_L_P_PLID_2);
1059
1060 if (orderByComparator != null) {
1061 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1062 orderByComparator);
1063 }
1064
1065 String sql = query.toString();
1066
1067 Session session = null;
1068
1069 try {
1070 session = openSession();
1071
1072 Query q = session.createQuery(sql);
1073
1074 QueryPos qPos = QueryPos.getInstance(q);
1075
1076 qPos.add(layoutSetBranchId);
1077
1078 qPos.add(plid);
1079
1080 list = (List<LayoutBranch>)QueryUtil.list(q, getDialect(),
1081 start, end);
1082 }
1083 catch (Exception e) {
1084 throw processException(e);
1085 }
1086 finally {
1087 if (list == null) {
1088 FinderCacheUtil.removeResult(finderPath, finderArgs);
1089 }
1090 else {
1091 cacheResult(list);
1092
1093 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1094 }
1095
1096 closeSession(session);
1097 }
1098 }
1099
1100 return list;
1101 }
1102
1103
1117 public LayoutBranch findByL_P_First(long layoutSetBranchId, long plid,
1118 OrderByComparator orderByComparator)
1119 throws NoSuchLayoutBranchException, SystemException {
1120 List<LayoutBranch> list = findByL_P(layoutSetBranchId, plid, 0, 1,
1121 orderByComparator);
1122
1123 if (list.isEmpty()) {
1124 StringBundler msg = new StringBundler(6);
1125
1126 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1127
1128 msg.append("layoutSetBranchId=");
1129 msg.append(layoutSetBranchId);
1130
1131 msg.append(", plid=");
1132 msg.append(plid);
1133
1134 msg.append(StringPool.CLOSE_CURLY_BRACE);
1135
1136 throw new NoSuchLayoutBranchException(msg.toString());
1137 }
1138 else {
1139 return list.get(0);
1140 }
1141 }
1142
1143
1157 public LayoutBranch findByL_P_Last(long layoutSetBranchId, long plid,
1158 OrderByComparator orderByComparator)
1159 throws NoSuchLayoutBranchException, SystemException {
1160 int count = countByL_P(layoutSetBranchId, plid);
1161
1162 List<LayoutBranch> list = findByL_P(layoutSetBranchId, plid, count - 1,
1163 count, orderByComparator);
1164
1165 if (list.isEmpty()) {
1166 StringBundler msg = new StringBundler(6);
1167
1168 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1169
1170 msg.append("layoutSetBranchId=");
1171 msg.append(layoutSetBranchId);
1172
1173 msg.append(", plid=");
1174 msg.append(plid);
1175
1176 msg.append(StringPool.CLOSE_CURLY_BRACE);
1177
1178 throw new NoSuchLayoutBranchException(msg.toString());
1179 }
1180 else {
1181 return list.get(0);
1182 }
1183 }
1184
1185
1200 public LayoutBranch[] findByL_P_PrevAndNext(long LayoutBranchId,
1201 long layoutSetBranchId, long plid, OrderByComparator orderByComparator)
1202 throws NoSuchLayoutBranchException, SystemException {
1203 LayoutBranch layoutBranch = findByPrimaryKey(LayoutBranchId);
1204
1205 Session session = null;
1206
1207 try {
1208 session = openSession();
1209
1210 LayoutBranch[] array = new LayoutBranchImpl[3];
1211
1212 array[0] = getByL_P_PrevAndNext(session, layoutBranch,
1213 layoutSetBranchId, plid, orderByComparator, true);
1214
1215 array[1] = layoutBranch;
1216
1217 array[2] = getByL_P_PrevAndNext(session, layoutBranch,
1218 layoutSetBranchId, plid, orderByComparator, false);
1219
1220 return array;
1221 }
1222 catch (Exception e) {
1223 throw processException(e);
1224 }
1225 finally {
1226 closeSession(session);
1227 }
1228 }
1229
1230 protected LayoutBranch getByL_P_PrevAndNext(Session session,
1231 LayoutBranch layoutBranch, long layoutSetBranchId, long plid,
1232 OrderByComparator orderByComparator, boolean previous) {
1233 StringBundler query = null;
1234
1235 if (orderByComparator != null) {
1236 query = new StringBundler(6 +
1237 (orderByComparator.getOrderByFields().length * 6));
1238 }
1239 else {
1240 query = new StringBundler(3);
1241 }
1242
1243 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
1244
1245 query.append(_FINDER_COLUMN_L_P_LAYOUTSETBRANCHID_2);
1246
1247 query.append(_FINDER_COLUMN_L_P_PLID_2);
1248
1249 if (orderByComparator != null) {
1250 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1251
1252 if (orderByConditionFields.length > 0) {
1253 query.append(WHERE_AND);
1254 }
1255
1256 for (int i = 0; i < orderByConditionFields.length; i++) {
1257 query.append(_ORDER_BY_ENTITY_ALIAS);
1258 query.append(orderByConditionFields[i]);
1259
1260 if ((i + 1) < orderByConditionFields.length) {
1261 if (orderByComparator.isAscending() ^ previous) {
1262 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1263 }
1264 else {
1265 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1266 }
1267 }
1268 else {
1269 if (orderByComparator.isAscending() ^ previous) {
1270 query.append(WHERE_GREATER_THAN);
1271 }
1272 else {
1273 query.append(WHERE_LESSER_THAN);
1274 }
1275 }
1276 }
1277
1278 query.append(ORDER_BY_CLAUSE);
1279
1280 String[] orderByFields = orderByComparator.getOrderByFields();
1281
1282 for (int i = 0; i < orderByFields.length; i++) {
1283 query.append(_ORDER_BY_ENTITY_ALIAS);
1284 query.append(orderByFields[i]);
1285
1286 if ((i + 1) < orderByFields.length) {
1287 if (orderByComparator.isAscending() ^ previous) {
1288 query.append(ORDER_BY_ASC_HAS_NEXT);
1289 }
1290 else {
1291 query.append(ORDER_BY_DESC_HAS_NEXT);
1292 }
1293 }
1294 else {
1295 if (orderByComparator.isAscending() ^ previous) {
1296 query.append(ORDER_BY_ASC);
1297 }
1298 else {
1299 query.append(ORDER_BY_DESC);
1300 }
1301 }
1302 }
1303 }
1304
1305 String sql = query.toString();
1306
1307 Query q = session.createQuery(sql);
1308
1309 q.setFirstResult(0);
1310 q.setMaxResults(2);
1311
1312 QueryPos qPos = QueryPos.getInstance(q);
1313
1314 qPos.add(layoutSetBranchId);
1315
1316 qPos.add(plid);
1317
1318 if (orderByComparator != null) {
1319 Object[] values = orderByComparator.getOrderByConditionValues(layoutBranch);
1320
1321 for (Object value : values) {
1322 qPos.add(value);
1323 }
1324 }
1325
1326 List<LayoutBranch> list = q.list();
1327
1328 if (list.size() == 2) {
1329 return list.get(1);
1330 }
1331 else {
1332 return null;
1333 }
1334 }
1335
1336
1346 public LayoutBranch findByL_P_N(long layoutSetBranchId, long plid,
1347 String name) throws NoSuchLayoutBranchException, SystemException {
1348 LayoutBranch layoutBranch = fetchByL_P_N(layoutSetBranchId, plid, name);
1349
1350 if (layoutBranch == null) {
1351 StringBundler msg = new StringBundler(8);
1352
1353 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1354
1355 msg.append("layoutSetBranchId=");
1356 msg.append(layoutSetBranchId);
1357
1358 msg.append(", plid=");
1359 msg.append(plid);
1360
1361 msg.append(", name=");
1362 msg.append(name);
1363
1364 msg.append(StringPool.CLOSE_CURLY_BRACE);
1365
1366 if (_log.isWarnEnabled()) {
1367 _log.warn(msg.toString());
1368 }
1369
1370 throw new NoSuchLayoutBranchException(msg.toString());
1371 }
1372
1373 return layoutBranch;
1374 }
1375
1376
1385 public LayoutBranch fetchByL_P_N(long layoutSetBranchId, long plid,
1386 String name) throws SystemException {
1387 return fetchByL_P_N(layoutSetBranchId, plid, name, true);
1388 }
1389
1390
1400 public LayoutBranch fetchByL_P_N(long layoutSetBranchId, long plid,
1401 String name, boolean retrieveFromCache) throws SystemException {
1402 Object[] finderArgs = new Object[] { layoutSetBranchId, plid, name };
1403
1404 Object result = null;
1405
1406 if (retrieveFromCache) {
1407 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_L_P_N,
1408 finderArgs, this);
1409 }
1410
1411 if (result == null) {
1412 StringBundler query = new StringBundler(4);
1413
1414 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
1415
1416 query.append(_FINDER_COLUMN_L_P_N_LAYOUTSETBRANCHID_2);
1417
1418 query.append(_FINDER_COLUMN_L_P_N_PLID_2);
1419
1420 if (name == null) {
1421 query.append(_FINDER_COLUMN_L_P_N_NAME_1);
1422 }
1423 else {
1424 if (name.equals(StringPool.BLANK)) {
1425 query.append(_FINDER_COLUMN_L_P_N_NAME_3);
1426 }
1427 else {
1428 query.append(_FINDER_COLUMN_L_P_N_NAME_2);
1429 }
1430 }
1431
1432 String sql = query.toString();
1433
1434 Session session = null;
1435
1436 try {
1437 session = openSession();
1438
1439 Query q = session.createQuery(sql);
1440
1441 QueryPos qPos = QueryPos.getInstance(q);
1442
1443 qPos.add(layoutSetBranchId);
1444
1445 qPos.add(plid);
1446
1447 if (name != null) {
1448 qPos.add(name);
1449 }
1450
1451 List<LayoutBranch> list = q.list();
1452
1453 result = list;
1454
1455 LayoutBranch layoutBranch = null;
1456
1457 if (list.isEmpty()) {
1458 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_N,
1459 finderArgs, list);
1460 }
1461 else {
1462 layoutBranch = list.get(0);
1463
1464 cacheResult(layoutBranch);
1465
1466 if ((layoutBranch.getLayoutSetBranchId() != layoutSetBranchId) ||
1467 (layoutBranch.getPlid() != plid) ||
1468 (layoutBranch.getName() == null) ||
1469 !layoutBranch.getName().equals(name)) {
1470 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_N,
1471 finderArgs, layoutBranch);
1472 }
1473 }
1474
1475 return layoutBranch;
1476 }
1477 catch (Exception e) {
1478 throw processException(e);
1479 }
1480 finally {
1481 if (result == null) {
1482 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_L_P_N,
1483 finderArgs);
1484 }
1485
1486 closeSession(session);
1487 }
1488 }
1489 else {
1490 if (result instanceof List<?>) {
1491 return null;
1492 }
1493 else {
1494 return (LayoutBranch)result;
1495 }
1496 }
1497 }
1498
1499
1509 public LayoutBranch findByL_P_M(long layoutSetBranchId, long plid,
1510 boolean master) throws NoSuchLayoutBranchException, SystemException {
1511 LayoutBranch layoutBranch = fetchByL_P_M(layoutSetBranchId, plid, master);
1512
1513 if (layoutBranch == null) {
1514 StringBundler msg = new StringBundler(8);
1515
1516 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1517
1518 msg.append("layoutSetBranchId=");
1519 msg.append(layoutSetBranchId);
1520
1521 msg.append(", plid=");
1522 msg.append(plid);
1523
1524 msg.append(", master=");
1525 msg.append(master);
1526
1527 msg.append(StringPool.CLOSE_CURLY_BRACE);
1528
1529 if (_log.isWarnEnabled()) {
1530 _log.warn(msg.toString());
1531 }
1532
1533 throw new NoSuchLayoutBranchException(msg.toString());
1534 }
1535
1536 return layoutBranch;
1537 }
1538
1539
1548 public LayoutBranch fetchByL_P_M(long layoutSetBranchId, long plid,
1549 boolean master) throws SystemException {
1550 return fetchByL_P_M(layoutSetBranchId, plid, master, true);
1551 }
1552
1553
1563 public LayoutBranch fetchByL_P_M(long layoutSetBranchId, long plid,
1564 boolean master, boolean retrieveFromCache) throws SystemException {
1565 Object[] finderArgs = new Object[] { layoutSetBranchId, plid, master };
1566
1567 Object result = null;
1568
1569 if (retrieveFromCache) {
1570 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_L_P_M,
1571 finderArgs, this);
1572 }
1573
1574 if (result == null) {
1575 StringBundler query = new StringBundler(4);
1576
1577 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
1578
1579 query.append(_FINDER_COLUMN_L_P_M_LAYOUTSETBRANCHID_2);
1580
1581 query.append(_FINDER_COLUMN_L_P_M_PLID_2);
1582
1583 query.append(_FINDER_COLUMN_L_P_M_MASTER_2);
1584
1585 String sql = query.toString();
1586
1587 Session session = null;
1588
1589 try {
1590 session = openSession();
1591
1592 Query q = session.createQuery(sql);
1593
1594 QueryPos qPos = QueryPos.getInstance(q);
1595
1596 qPos.add(layoutSetBranchId);
1597
1598 qPos.add(plid);
1599
1600 qPos.add(master);
1601
1602 List<LayoutBranch> list = q.list();
1603
1604 result = list;
1605
1606 LayoutBranch layoutBranch = null;
1607
1608 if (list.isEmpty()) {
1609 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_M,
1610 finderArgs, list);
1611 }
1612 else {
1613 layoutBranch = list.get(0);
1614
1615 cacheResult(layoutBranch);
1616
1617 if ((layoutBranch.getLayoutSetBranchId() != layoutSetBranchId) ||
1618 (layoutBranch.getPlid() != plid) ||
1619 (layoutBranch.getMaster() != master)) {
1620 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_M,
1621 finderArgs, layoutBranch);
1622 }
1623 }
1624
1625 return layoutBranch;
1626 }
1627 catch (Exception e) {
1628 throw processException(e);
1629 }
1630 finally {
1631 if (result == null) {
1632 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_L_P_M,
1633 finderArgs);
1634 }
1635
1636 closeSession(session);
1637 }
1638 }
1639 else {
1640 if (result instanceof List<?>) {
1641 return null;
1642 }
1643 else {
1644 return (LayoutBranch)result;
1645 }
1646 }
1647 }
1648
1649
1655 public List<LayoutBranch> findAll() throws SystemException {
1656 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1657 }
1658
1659
1671 public List<LayoutBranch> findAll(int start, int end)
1672 throws SystemException {
1673 return findAll(start, end, null);
1674 }
1675
1676
1689 public List<LayoutBranch> findAll(int start, int end,
1690 OrderByComparator orderByComparator) throws SystemException {
1691 FinderPath finderPath = null;
1692 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1693
1694 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1695 (orderByComparator == null)) {
1696 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1697 finderArgs = FINDER_ARGS_EMPTY;
1698 }
1699 else {
1700 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1701 finderArgs = new Object[] { start, end, orderByComparator };
1702 }
1703
1704 List<LayoutBranch> list = (List<LayoutBranch>)FinderCacheUtil.getResult(finderPath,
1705 finderArgs, this);
1706
1707 if (list == null) {
1708 StringBundler query = null;
1709 String sql = null;
1710
1711 if (orderByComparator != null) {
1712 query = new StringBundler(2 +
1713 (orderByComparator.getOrderByFields().length * 3));
1714
1715 query.append(_SQL_SELECT_LAYOUTBRANCH);
1716
1717 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1718 orderByComparator);
1719
1720 sql = query.toString();
1721 }
1722 else {
1723 sql = _SQL_SELECT_LAYOUTBRANCH;
1724 }
1725
1726 Session session = null;
1727
1728 try {
1729 session = openSession();
1730
1731 Query q = session.createQuery(sql);
1732
1733 if (orderByComparator == null) {
1734 list = (List<LayoutBranch>)QueryUtil.list(q, getDialect(),
1735 start, end, false);
1736
1737 Collections.sort(list);
1738 }
1739 else {
1740 list = (List<LayoutBranch>)QueryUtil.list(q, getDialect(),
1741 start, end);
1742 }
1743 }
1744 catch (Exception e) {
1745 throw processException(e);
1746 }
1747 finally {
1748 if (list == null) {
1749 FinderCacheUtil.removeResult(finderPath, finderArgs);
1750 }
1751 else {
1752 cacheResult(list);
1753
1754 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1755 }
1756
1757 closeSession(session);
1758 }
1759 }
1760
1761 return list;
1762 }
1763
1764
1770 public void removeByLayoutSetBranchId(long layoutSetBranchId)
1771 throws SystemException {
1772 for (LayoutBranch layoutBranch : findByLayoutSetBranchId(
1773 layoutSetBranchId)) {
1774 remove(layoutBranch);
1775 }
1776 }
1777
1778
1785 public void removeByL_P(long layoutSetBranchId, long plid)
1786 throws SystemException {
1787 for (LayoutBranch layoutBranch : findByL_P(layoutSetBranchId, plid)) {
1788 remove(layoutBranch);
1789 }
1790 }
1791
1792
1800 public void removeByL_P_N(long layoutSetBranchId, long plid, String name)
1801 throws NoSuchLayoutBranchException, SystemException {
1802 LayoutBranch layoutBranch = findByL_P_N(layoutSetBranchId, plid, name);
1803
1804 remove(layoutBranch);
1805 }
1806
1807
1815 public void removeByL_P_M(long layoutSetBranchId, long plid, boolean master)
1816 throws NoSuchLayoutBranchException, SystemException {
1817 LayoutBranch layoutBranch = findByL_P_M(layoutSetBranchId, plid, master);
1818
1819 remove(layoutBranch);
1820 }
1821
1822
1827 public void removeAll() throws SystemException {
1828 for (LayoutBranch layoutBranch : findAll()) {
1829 remove(layoutBranch);
1830 }
1831 }
1832
1833
1840 public int countByLayoutSetBranchId(long layoutSetBranchId)
1841 throws SystemException {
1842 Object[] finderArgs = new Object[] { layoutSetBranchId };
1843
1844 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_LAYOUTSETBRANCHID,
1845 finderArgs, this);
1846
1847 if (count == null) {
1848 StringBundler query = new StringBundler(2);
1849
1850 query.append(_SQL_COUNT_LAYOUTBRANCH_WHERE);
1851
1852 query.append(_FINDER_COLUMN_LAYOUTSETBRANCHID_LAYOUTSETBRANCHID_2);
1853
1854 String sql = query.toString();
1855
1856 Session session = null;
1857
1858 try {
1859 session = openSession();
1860
1861 Query q = session.createQuery(sql);
1862
1863 QueryPos qPos = QueryPos.getInstance(q);
1864
1865 qPos.add(layoutSetBranchId);
1866
1867 count = (Long)q.uniqueResult();
1868 }
1869 catch (Exception e) {
1870 throw processException(e);
1871 }
1872 finally {
1873 if (count == null) {
1874 count = Long.valueOf(0);
1875 }
1876
1877 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_LAYOUTSETBRANCHID,
1878 finderArgs, count);
1879
1880 closeSession(session);
1881 }
1882 }
1883
1884 return count.intValue();
1885 }
1886
1887
1895 public int countByL_P(long layoutSetBranchId, long plid)
1896 throws SystemException {
1897 Object[] finderArgs = new Object[] { layoutSetBranchId, plid };
1898
1899 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_L_P,
1900 finderArgs, this);
1901
1902 if (count == null) {
1903 StringBundler query = new StringBundler(3);
1904
1905 query.append(_SQL_COUNT_LAYOUTBRANCH_WHERE);
1906
1907 query.append(_FINDER_COLUMN_L_P_LAYOUTSETBRANCHID_2);
1908
1909 query.append(_FINDER_COLUMN_L_P_PLID_2);
1910
1911 String sql = query.toString();
1912
1913 Session session = null;
1914
1915 try {
1916 session = openSession();
1917
1918 Query q = session.createQuery(sql);
1919
1920 QueryPos qPos = QueryPos.getInstance(q);
1921
1922 qPos.add(layoutSetBranchId);
1923
1924 qPos.add(plid);
1925
1926 count = (Long)q.uniqueResult();
1927 }
1928 catch (Exception e) {
1929 throw processException(e);
1930 }
1931 finally {
1932 if (count == null) {
1933 count = Long.valueOf(0);
1934 }
1935
1936 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_L_P, finderArgs,
1937 count);
1938
1939 closeSession(session);
1940 }
1941 }
1942
1943 return count.intValue();
1944 }
1945
1946
1955 public int countByL_P_N(long layoutSetBranchId, long plid, String name)
1956 throws SystemException {
1957 Object[] finderArgs = new Object[] { layoutSetBranchId, plid, name };
1958
1959 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_L_P_N,
1960 finderArgs, this);
1961
1962 if (count == null) {
1963 StringBundler query = new StringBundler(4);
1964
1965 query.append(_SQL_COUNT_LAYOUTBRANCH_WHERE);
1966
1967 query.append(_FINDER_COLUMN_L_P_N_LAYOUTSETBRANCHID_2);
1968
1969 query.append(_FINDER_COLUMN_L_P_N_PLID_2);
1970
1971 if (name == null) {
1972 query.append(_FINDER_COLUMN_L_P_N_NAME_1);
1973 }
1974 else {
1975 if (name.equals(StringPool.BLANK)) {
1976 query.append(_FINDER_COLUMN_L_P_N_NAME_3);
1977 }
1978 else {
1979 query.append(_FINDER_COLUMN_L_P_N_NAME_2);
1980 }
1981 }
1982
1983 String sql = query.toString();
1984
1985 Session session = null;
1986
1987 try {
1988 session = openSession();
1989
1990 Query q = session.createQuery(sql);
1991
1992 QueryPos qPos = QueryPos.getInstance(q);
1993
1994 qPos.add(layoutSetBranchId);
1995
1996 qPos.add(plid);
1997
1998 if (name != null) {
1999 qPos.add(name);
2000 }
2001
2002 count = (Long)q.uniqueResult();
2003 }
2004 catch (Exception e) {
2005 throw processException(e);
2006 }
2007 finally {
2008 if (count == null) {
2009 count = Long.valueOf(0);
2010 }
2011
2012 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_L_P_N,
2013 finderArgs, count);
2014
2015 closeSession(session);
2016 }
2017 }
2018
2019 return count.intValue();
2020 }
2021
2022
2031 public int countByL_P_M(long layoutSetBranchId, long plid, boolean master)
2032 throws SystemException {
2033 Object[] finderArgs = new Object[] { layoutSetBranchId, plid, master };
2034
2035 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_L_P_M,
2036 finderArgs, this);
2037
2038 if (count == null) {
2039 StringBundler query = new StringBundler(4);
2040
2041 query.append(_SQL_COUNT_LAYOUTBRANCH_WHERE);
2042
2043 query.append(_FINDER_COLUMN_L_P_M_LAYOUTSETBRANCHID_2);
2044
2045 query.append(_FINDER_COLUMN_L_P_M_PLID_2);
2046
2047 query.append(_FINDER_COLUMN_L_P_M_MASTER_2);
2048
2049 String sql = query.toString();
2050
2051 Session session = null;
2052
2053 try {
2054 session = openSession();
2055
2056 Query q = session.createQuery(sql);
2057
2058 QueryPos qPos = QueryPos.getInstance(q);
2059
2060 qPos.add(layoutSetBranchId);
2061
2062 qPos.add(plid);
2063
2064 qPos.add(master);
2065
2066 count = (Long)q.uniqueResult();
2067 }
2068 catch (Exception e) {
2069 throw processException(e);
2070 }
2071 finally {
2072 if (count == null) {
2073 count = Long.valueOf(0);
2074 }
2075
2076 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_L_P_M,
2077 finderArgs, count);
2078
2079 closeSession(session);
2080 }
2081 }
2082
2083 return count.intValue();
2084 }
2085
2086
2092 public int countAll() throws SystemException {
2093 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2094 FINDER_ARGS_EMPTY, this);
2095
2096 if (count == null) {
2097 Session session = null;
2098
2099 try {
2100 session = openSession();
2101
2102 Query q = session.createQuery(_SQL_COUNT_LAYOUTBRANCH);
2103
2104 count = (Long)q.uniqueResult();
2105 }
2106 catch (Exception e) {
2107 throw processException(e);
2108 }
2109 finally {
2110 if (count == null) {
2111 count = Long.valueOf(0);
2112 }
2113
2114 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2115 FINDER_ARGS_EMPTY, count);
2116
2117 closeSession(session);
2118 }
2119 }
2120
2121 return count.intValue();
2122 }
2123
2124
2127 public void afterPropertiesSet() {
2128 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2129 com.liferay.portal.util.PropsUtil.get(
2130 "value.object.listener.com.liferay.portal.model.LayoutBranch")));
2131
2132 if (listenerClassNames.length > 0) {
2133 try {
2134 List<ModelListener<LayoutBranch>> listenersList = new ArrayList<ModelListener<LayoutBranch>>();
2135
2136 for (String listenerClassName : listenerClassNames) {
2137 listenersList.add((ModelListener<LayoutBranch>)InstanceFactory.newInstance(
2138 listenerClassName));
2139 }
2140
2141 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2142 }
2143 catch (Exception e) {
2144 _log.error(e);
2145 }
2146 }
2147 }
2148
2149 public void destroy() {
2150 EntityCacheUtil.removeCache(LayoutBranchImpl.class.getName());
2151 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2152 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2153 }
2154
2155 @BeanReference(type = AccountPersistence.class)
2156 protected AccountPersistence accountPersistence;
2157 @BeanReference(type = AddressPersistence.class)
2158 protected AddressPersistence addressPersistence;
2159 @BeanReference(type = BrowserTrackerPersistence.class)
2160 protected BrowserTrackerPersistence browserTrackerPersistence;
2161 @BeanReference(type = ClassNamePersistence.class)
2162 protected ClassNamePersistence classNamePersistence;
2163 @BeanReference(type = ClusterGroupPersistence.class)
2164 protected ClusterGroupPersistence clusterGroupPersistence;
2165 @BeanReference(type = CompanyPersistence.class)
2166 protected CompanyPersistence companyPersistence;
2167 @BeanReference(type = ContactPersistence.class)
2168 protected ContactPersistence contactPersistence;
2169 @BeanReference(type = CountryPersistence.class)
2170 protected CountryPersistence countryPersistence;
2171 @BeanReference(type = EmailAddressPersistence.class)
2172 protected EmailAddressPersistence emailAddressPersistence;
2173 @BeanReference(type = GroupPersistence.class)
2174 protected GroupPersistence groupPersistence;
2175 @BeanReference(type = ImagePersistence.class)
2176 protected ImagePersistence imagePersistence;
2177 @BeanReference(type = LayoutPersistence.class)
2178 protected LayoutPersistence layoutPersistence;
2179 @BeanReference(type = LayoutBranchPersistence.class)
2180 protected LayoutBranchPersistence layoutBranchPersistence;
2181 @BeanReference(type = LayoutPrototypePersistence.class)
2182 protected LayoutPrototypePersistence layoutPrototypePersistence;
2183 @BeanReference(type = LayoutRevisionPersistence.class)
2184 protected LayoutRevisionPersistence layoutRevisionPersistence;
2185 @BeanReference(type = LayoutSetPersistence.class)
2186 protected LayoutSetPersistence layoutSetPersistence;
2187 @BeanReference(type = LayoutSetBranchPersistence.class)
2188 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
2189 @BeanReference(type = LayoutSetPrototypePersistence.class)
2190 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2191 @BeanReference(type = ListTypePersistence.class)
2192 protected ListTypePersistence listTypePersistence;
2193 @BeanReference(type = LockPersistence.class)
2194 protected LockPersistence lockPersistence;
2195 @BeanReference(type = MembershipRequestPersistence.class)
2196 protected MembershipRequestPersistence membershipRequestPersistence;
2197 @BeanReference(type = OrganizationPersistence.class)
2198 protected OrganizationPersistence organizationPersistence;
2199 @BeanReference(type = OrgGroupPermissionPersistence.class)
2200 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2201 @BeanReference(type = OrgGroupRolePersistence.class)
2202 protected OrgGroupRolePersistence orgGroupRolePersistence;
2203 @BeanReference(type = OrgLaborPersistence.class)
2204 protected OrgLaborPersistence orgLaborPersistence;
2205 @BeanReference(type = PasswordPolicyPersistence.class)
2206 protected PasswordPolicyPersistence passwordPolicyPersistence;
2207 @BeanReference(type = PasswordPolicyRelPersistence.class)
2208 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2209 @BeanReference(type = PasswordTrackerPersistence.class)
2210 protected PasswordTrackerPersistence passwordTrackerPersistence;
2211 @BeanReference(type = PermissionPersistence.class)
2212 protected PermissionPersistence permissionPersistence;
2213 @BeanReference(type = PhonePersistence.class)
2214 protected PhonePersistence phonePersistence;
2215 @BeanReference(type = PluginSettingPersistence.class)
2216 protected PluginSettingPersistence pluginSettingPersistence;
2217 @BeanReference(type = PortalPreferencesPersistence.class)
2218 protected PortalPreferencesPersistence portalPreferencesPersistence;
2219 @BeanReference(type = PortletPersistence.class)
2220 protected PortletPersistence portletPersistence;
2221 @BeanReference(type = PortletItemPersistence.class)
2222 protected PortletItemPersistence portletItemPersistence;
2223 @BeanReference(type = PortletPreferencesPersistence.class)
2224 protected PortletPreferencesPersistence portletPreferencesPersistence;
2225 @BeanReference(type = RegionPersistence.class)
2226 protected RegionPersistence regionPersistence;
2227 @BeanReference(type = ReleasePersistence.class)
2228 protected ReleasePersistence releasePersistence;
2229 @BeanReference(type = RepositoryPersistence.class)
2230 protected RepositoryPersistence repositoryPersistence;
2231 @BeanReference(type = RepositoryEntryPersistence.class)
2232 protected RepositoryEntryPersistence repositoryEntryPersistence;
2233 @BeanReference(type = ResourcePersistence.class)
2234 protected ResourcePersistence resourcePersistence;
2235 @BeanReference(type = ResourceActionPersistence.class)
2236 protected ResourceActionPersistence resourceActionPersistence;
2237 @BeanReference(type = ResourceBlockPersistence.class)
2238 protected ResourceBlockPersistence resourceBlockPersistence;
2239 @BeanReference(type = ResourceBlockPermissionPersistence.class)
2240 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
2241 @BeanReference(type = ResourceCodePersistence.class)
2242 protected ResourceCodePersistence resourceCodePersistence;
2243 @BeanReference(type = ResourcePermissionPersistence.class)
2244 protected ResourcePermissionPersistence resourcePermissionPersistence;
2245 @BeanReference(type = ResourceTypePermissionPersistence.class)
2246 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
2247 @BeanReference(type = RolePersistence.class)
2248 protected RolePersistence rolePersistence;
2249 @BeanReference(type = ServiceComponentPersistence.class)
2250 protected ServiceComponentPersistence serviceComponentPersistence;
2251 @BeanReference(type = ShardPersistence.class)
2252 protected ShardPersistence shardPersistence;
2253 @BeanReference(type = SubscriptionPersistence.class)
2254 protected SubscriptionPersistence subscriptionPersistence;
2255 @BeanReference(type = TeamPersistence.class)
2256 protected TeamPersistence teamPersistence;
2257 @BeanReference(type = TicketPersistence.class)
2258 protected TicketPersistence ticketPersistence;
2259 @BeanReference(type = UserPersistence.class)
2260 protected UserPersistence userPersistence;
2261 @BeanReference(type = UserGroupPersistence.class)
2262 protected UserGroupPersistence userGroupPersistence;
2263 @BeanReference(type = UserGroupGroupRolePersistence.class)
2264 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2265 @BeanReference(type = UserGroupRolePersistence.class)
2266 protected UserGroupRolePersistence userGroupRolePersistence;
2267 @BeanReference(type = UserIdMapperPersistence.class)
2268 protected UserIdMapperPersistence userIdMapperPersistence;
2269 @BeanReference(type = UserNotificationEventPersistence.class)
2270 protected UserNotificationEventPersistence userNotificationEventPersistence;
2271 @BeanReference(type = UserTrackerPersistence.class)
2272 protected UserTrackerPersistence userTrackerPersistence;
2273 @BeanReference(type = UserTrackerPathPersistence.class)
2274 protected UserTrackerPathPersistence userTrackerPathPersistence;
2275 @BeanReference(type = VirtualHostPersistence.class)
2276 protected VirtualHostPersistence virtualHostPersistence;
2277 @BeanReference(type = WebDAVPropsPersistence.class)
2278 protected WebDAVPropsPersistence webDAVPropsPersistence;
2279 @BeanReference(type = WebsitePersistence.class)
2280 protected WebsitePersistence websitePersistence;
2281 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2282 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2283 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2284 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2285 private static final String _SQL_SELECT_LAYOUTBRANCH = "SELECT layoutBranch FROM LayoutBranch layoutBranch";
2286 private static final String _SQL_SELECT_LAYOUTBRANCH_WHERE = "SELECT layoutBranch FROM LayoutBranch layoutBranch WHERE ";
2287 private static final String _SQL_COUNT_LAYOUTBRANCH = "SELECT COUNT(layoutBranch) FROM LayoutBranch layoutBranch";
2288 private static final String _SQL_COUNT_LAYOUTBRANCH_WHERE = "SELECT COUNT(layoutBranch) FROM LayoutBranch layoutBranch WHERE ";
2289 private static final String _FINDER_COLUMN_LAYOUTSETBRANCHID_LAYOUTSETBRANCHID_2 =
2290 "layoutBranch.layoutSetBranchId = ?";
2291 private static final String _FINDER_COLUMN_L_P_LAYOUTSETBRANCHID_2 = "layoutBranch.layoutSetBranchId = ? AND ";
2292 private static final String _FINDER_COLUMN_L_P_PLID_2 = "layoutBranch.plid = ?";
2293 private static final String _FINDER_COLUMN_L_P_N_LAYOUTSETBRANCHID_2 = "layoutBranch.layoutSetBranchId = ? AND ";
2294 private static final String _FINDER_COLUMN_L_P_N_PLID_2 = "layoutBranch.plid = ? AND ";
2295 private static final String _FINDER_COLUMN_L_P_N_NAME_1 = "layoutBranch.name IS NULL";
2296 private static final String _FINDER_COLUMN_L_P_N_NAME_2 = "layoutBranch.name = ?";
2297 private static final String _FINDER_COLUMN_L_P_N_NAME_3 = "(layoutBranch.name IS NULL OR layoutBranch.name = ?)";
2298 private static final String _FINDER_COLUMN_L_P_M_LAYOUTSETBRANCHID_2 = "layoutBranch.layoutSetBranchId = ? AND ";
2299 private static final String _FINDER_COLUMN_L_P_M_PLID_2 = "layoutBranch.plid = ? AND ";
2300 private static final String _FINDER_COLUMN_L_P_M_MASTER_2 = "layoutBranch.master = ?";
2301 private static final String _ORDER_BY_ENTITY_ALIAS = "layoutBranch.";
2302 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No LayoutBranch exists with the primary key ";
2303 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No LayoutBranch exists with the key {";
2304 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2305 private static Log _log = LogFactoryUtil.getLog(LayoutBranchPersistenceImpl.class);
2306 private static LayoutBranch _nullLayoutBranch = new LayoutBranchImpl() {
2307 @Override
2308 public Object clone() {
2309 return this;
2310 }
2311
2312 @Override
2313 public CacheModel<LayoutBranch> toCacheModel() {
2314 return _nullLayoutBranchCacheModel;
2315 }
2316 };
2317
2318 private static CacheModel<LayoutBranch> _nullLayoutBranchCacheModel = new CacheModel<LayoutBranch>() {
2319 public LayoutBranch toEntityModel() {
2320 return _nullLayoutBranch;
2321 }
2322 };
2323 }