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.kernel.util.Validator;
038 import com.liferay.portal.model.CacheModel;
039 import com.liferay.portal.model.LayoutBranch;
040 import com.liferay.portal.model.ModelListener;
041 import com.liferay.portal.model.impl.LayoutBranchImpl;
042 import com.liferay.portal.model.impl.LayoutBranchModelImpl;
043 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
044
045 import java.io.Serializable;
046
047 import java.util.ArrayList;
048 import java.util.Collections;
049 import java.util.List;
050
051
063 public class LayoutBranchPersistenceImpl extends BasePersistenceImpl<LayoutBranch>
064 implements LayoutBranchPersistence {
065
070 public static final String FINDER_CLASS_NAME_ENTITY = LayoutBranchImpl.class.getName();
071 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
072 ".List1";
073 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
074 ".List2";
075 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_LAYOUTSETBRANCHID =
076 new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
077 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
078 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByLayoutSetBranchId",
079 new String[] {
080 Long.class.getName(),
081
082 "java.lang.Integer", "java.lang.Integer",
083 "com.liferay.portal.kernel.util.OrderByComparator"
084 });
085 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_LAYOUTSETBRANCHID =
086 new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
087 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
088 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
089 "findByLayoutSetBranchId", new String[] { Long.class.getName() },
090 LayoutBranchModelImpl.LAYOUTSETBRANCHID_COLUMN_BITMASK);
091 public static final FinderPath FINDER_PATH_COUNT_BY_LAYOUTSETBRANCHID = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
092 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
093 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
094 "countByLayoutSetBranchId", new String[] { Long.class.getName() });
095 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_L_P = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
096 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
097 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByL_P",
098 new String[] {
099 Long.class.getName(), Long.class.getName(),
100
101 "java.lang.Integer", "java.lang.Integer",
102 "com.liferay.portal.kernel.util.OrderByComparator"
103 });
104 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
105 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
106 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByL_P",
107 new String[] { Long.class.getName(), Long.class.getName() },
108 LayoutBranchModelImpl.LAYOUTSETBRANCHID_COLUMN_BITMASK |
109 LayoutBranchModelImpl.PLID_COLUMN_BITMASK);
110 public static final FinderPath FINDER_PATH_COUNT_BY_L_P = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
111 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
112 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByL_P",
113 new String[] { Long.class.getName(), Long.class.getName() });
114 public static final FinderPath FINDER_PATH_FETCH_BY_L_P_N = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
115 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
116 FINDER_CLASS_NAME_ENTITY, "fetchByL_P_N",
117 new String[] {
118 Long.class.getName(), Long.class.getName(),
119 String.class.getName()
120 },
121 LayoutBranchModelImpl.LAYOUTSETBRANCHID_COLUMN_BITMASK |
122 LayoutBranchModelImpl.PLID_COLUMN_BITMASK |
123 LayoutBranchModelImpl.NAME_COLUMN_BITMASK);
124 public static final FinderPath FINDER_PATH_COUNT_BY_L_P_N = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
125 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
126 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByL_P_N",
127 new String[] {
128 Long.class.getName(), Long.class.getName(),
129 String.class.getName()
130 });
131 public static final FinderPath FINDER_PATH_FETCH_BY_L_P_M = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
132 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
133 FINDER_CLASS_NAME_ENTITY, "fetchByL_P_M",
134 new String[] {
135 Long.class.getName(), Long.class.getName(),
136 Boolean.class.getName()
137 },
138 LayoutBranchModelImpl.LAYOUTSETBRANCHID_COLUMN_BITMASK |
139 LayoutBranchModelImpl.PLID_COLUMN_BITMASK |
140 LayoutBranchModelImpl.MASTER_COLUMN_BITMASK);
141 public static final FinderPath FINDER_PATH_COUNT_BY_L_P_M = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
142 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
143 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByL_P_M",
144 new String[] {
145 Long.class.getName(), Long.class.getName(),
146 Boolean.class.getName()
147 });
148 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
149 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
150 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
151 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
152 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
153 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
154 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
155 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
156 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
157
158
163 public void cacheResult(LayoutBranch layoutBranch) {
164 EntityCacheUtil.putResult(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
165 LayoutBranchImpl.class, layoutBranch.getPrimaryKey(), layoutBranch);
166
167 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_N,
168 new Object[] {
169 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
170 Long.valueOf(layoutBranch.getPlid()),
171
172 layoutBranch.getName()
173 }, layoutBranch);
174
175 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_M,
176 new Object[] {
177 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
178 Long.valueOf(layoutBranch.getPlid()),
179 Boolean.valueOf(layoutBranch.getMaster())
180 }, layoutBranch);
181
182 layoutBranch.resetOriginalValues();
183 }
184
185
190 public void cacheResult(List<LayoutBranch> layoutBranchs) {
191 for (LayoutBranch layoutBranch : layoutBranchs) {
192 if (EntityCacheUtil.getResult(
193 LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
194 LayoutBranchImpl.class, layoutBranch.getPrimaryKey()) == null) {
195 cacheResult(layoutBranch);
196 }
197 else {
198 layoutBranch.resetOriginalValues();
199 }
200 }
201 }
202
203
210 @Override
211 public void clearCache() {
212 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
213 CacheRegistryUtil.clear(LayoutBranchImpl.class.getName());
214 }
215
216 EntityCacheUtil.clearCache(LayoutBranchImpl.class.getName());
217
218 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
219 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
220 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
221 }
222
223
230 @Override
231 public void clearCache(LayoutBranch layoutBranch) {
232 EntityCacheUtil.removeResult(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
233 LayoutBranchImpl.class, layoutBranch.getPrimaryKey());
234
235 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
236 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
237
238 clearUniqueFindersCache(layoutBranch);
239 }
240
241 @Override
242 public void clearCache(List<LayoutBranch> layoutBranchs) {
243 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
244 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
245
246 for (LayoutBranch layoutBranch : layoutBranchs) {
247 EntityCacheUtil.removeResult(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
248 LayoutBranchImpl.class, layoutBranch.getPrimaryKey());
249
250 clearUniqueFindersCache(layoutBranch);
251 }
252 }
253
254 protected void clearUniqueFindersCache(LayoutBranch layoutBranch) {
255 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_L_P_N,
256 new Object[] {
257 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
258 Long.valueOf(layoutBranch.getPlid()),
259
260 layoutBranch.getName()
261 });
262
263 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_L_P_M,
264 new Object[] {
265 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
266 Long.valueOf(layoutBranch.getPlid()),
267 Boolean.valueOf(layoutBranch.getMaster())
268 });
269 }
270
271
277 public LayoutBranch create(long LayoutBranchId) {
278 LayoutBranch layoutBranch = new LayoutBranchImpl();
279
280 layoutBranch.setNew(true);
281 layoutBranch.setPrimaryKey(LayoutBranchId);
282
283 return layoutBranch;
284 }
285
286
294 public LayoutBranch remove(long LayoutBranchId)
295 throws NoSuchLayoutBranchException, SystemException {
296 return remove(Long.valueOf(LayoutBranchId));
297 }
298
299
307 @Override
308 public LayoutBranch remove(Serializable primaryKey)
309 throws NoSuchLayoutBranchException, SystemException {
310 Session session = null;
311
312 try {
313 session = openSession();
314
315 LayoutBranch layoutBranch = (LayoutBranch)session.get(LayoutBranchImpl.class,
316 primaryKey);
317
318 if (layoutBranch == null) {
319 if (_log.isWarnEnabled()) {
320 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
321 }
322
323 throw new NoSuchLayoutBranchException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
324 primaryKey);
325 }
326
327 return remove(layoutBranch);
328 }
329 catch (NoSuchLayoutBranchException nsee) {
330 throw nsee;
331 }
332 catch (Exception e) {
333 throw processException(e);
334 }
335 finally {
336 closeSession(session);
337 }
338 }
339
340 @Override
341 protected LayoutBranch removeImpl(LayoutBranch layoutBranch)
342 throws SystemException {
343 layoutBranch = toUnwrappedModel(layoutBranch);
344
345 Session session = null;
346
347 try {
348 session = openSession();
349
350 BatchSessionUtil.delete(session, layoutBranch);
351 }
352 catch (Exception e) {
353 throw processException(e);
354 }
355 finally {
356 closeSession(session);
357 }
358
359 clearCache(layoutBranch);
360
361 return layoutBranch;
362 }
363
364 @Override
365 public LayoutBranch updateImpl(
366 com.liferay.portal.model.LayoutBranch layoutBranch, boolean merge)
367 throws SystemException {
368 layoutBranch = toUnwrappedModel(layoutBranch);
369
370 boolean isNew = layoutBranch.isNew();
371
372 LayoutBranchModelImpl layoutBranchModelImpl = (LayoutBranchModelImpl)layoutBranch;
373
374 Session session = null;
375
376 try {
377 session = openSession();
378
379 BatchSessionUtil.update(session, layoutBranch, merge);
380
381 layoutBranch.setNew(false);
382 }
383 catch (Exception e) {
384 throw processException(e);
385 }
386 finally {
387 closeSession(session);
388 }
389
390 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
391
392 if (isNew || !LayoutBranchModelImpl.COLUMN_BITMASK_ENABLED) {
393 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
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) && !list.isEmpty()) {
696 for (LayoutBranch layoutBranch : list) {
697 if ((layoutSetBranchId != layoutBranch.getLayoutSetBranchId())) {
698 list = null;
699
700 break;
701 }
702 }
703 }
704
705 if (list == null) {
706 StringBundler query = null;
707
708 if (orderByComparator != null) {
709 query = new StringBundler(3 +
710 (orderByComparator.getOrderByFields().length * 3));
711 }
712 else {
713 query = new StringBundler(2);
714 }
715
716 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
717
718 query.append(_FINDER_COLUMN_LAYOUTSETBRANCHID_LAYOUTSETBRANCHID_2);
719
720 if (orderByComparator != null) {
721 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
722 orderByComparator);
723 }
724
725 String sql = query.toString();
726
727 Session session = null;
728
729 try {
730 session = openSession();
731
732 Query q = session.createQuery(sql);
733
734 QueryPos qPos = QueryPos.getInstance(q);
735
736 qPos.add(layoutSetBranchId);
737
738 list = (List<LayoutBranch>)QueryUtil.list(q, getDialect(),
739 start, end);
740 }
741 catch (Exception e) {
742 throw processException(e);
743 }
744 finally {
745 if (list == null) {
746 FinderCacheUtil.removeResult(finderPath, finderArgs);
747 }
748 else {
749 cacheResult(list);
750
751 FinderCacheUtil.putResult(finderPath, finderArgs, list);
752 }
753
754 closeSession(session);
755 }
756 }
757
758 return list;
759 }
760
761
774 public LayoutBranch findByLayoutSetBranchId_First(long layoutSetBranchId,
775 OrderByComparator orderByComparator)
776 throws NoSuchLayoutBranchException, SystemException {
777 List<LayoutBranch> list = findByLayoutSetBranchId(layoutSetBranchId, 0,
778 1, orderByComparator);
779
780 if (list.isEmpty()) {
781 StringBundler msg = new StringBundler(4);
782
783 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
784
785 msg.append("layoutSetBranchId=");
786 msg.append(layoutSetBranchId);
787
788 msg.append(StringPool.CLOSE_CURLY_BRACE);
789
790 throw new NoSuchLayoutBranchException(msg.toString());
791 }
792 else {
793 return list.get(0);
794 }
795 }
796
797
810 public LayoutBranch findByLayoutSetBranchId_Last(long layoutSetBranchId,
811 OrderByComparator orderByComparator)
812 throws NoSuchLayoutBranchException, SystemException {
813 int count = countByLayoutSetBranchId(layoutSetBranchId);
814
815 List<LayoutBranch> list = findByLayoutSetBranchId(layoutSetBranchId,
816 count - 1, count, orderByComparator);
817
818 if (list.isEmpty()) {
819 StringBundler msg = new StringBundler(4);
820
821 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
822
823 msg.append("layoutSetBranchId=");
824 msg.append(layoutSetBranchId);
825
826 msg.append(StringPool.CLOSE_CURLY_BRACE);
827
828 throw new NoSuchLayoutBranchException(msg.toString());
829 }
830 else {
831 return list.get(0);
832 }
833 }
834
835
849 public LayoutBranch[] findByLayoutSetBranchId_PrevAndNext(
850 long LayoutBranchId, long layoutSetBranchId,
851 OrderByComparator orderByComparator)
852 throws NoSuchLayoutBranchException, SystemException {
853 LayoutBranch layoutBranch = findByPrimaryKey(LayoutBranchId);
854
855 Session session = null;
856
857 try {
858 session = openSession();
859
860 LayoutBranch[] array = new LayoutBranchImpl[3];
861
862 array[0] = getByLayoutSetBranchId_PrevAndNext(session,
863 layoutBranch, layoutSetBranchId, orderByComparator, true);
864
865 array[1] = layoutBranch;
866
867 array[2] = getByLayoutSetBranchId_PrevAndNext(session,
868 layoutBranch, layoutSetBranchId, orderByComparator, false);
869
870 return array;
871 }
872 catch (Exception e) {
873 throw processException(e);
874 }
875 finally {
876 closeSession(session);
877 }
878 }
879
880 protected LayoutBranch getByLayoutSetBranchId_PrevAndNext(Session session,
881 LayoutBranch layoutBranch, long layoutSetBranchId,
882 OrderByComparator orderByComparator, boolean previous) {
883 StringBundler query = null;
884
885 if (orderByComparator != null) {
886 query = new StringBundler(6 +
887 (orderByComparator.getOrderByFields().length * 6));
888 }
889 else {
890 query = new StringBundler(3);
891 }
892
893 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
894
895 query.append(_FINDER_COLUMN_LAYOUTSETBRANCHID_LAYOUTSETBRANCHID_2);
896
897 if (orderByComparator != null) {
898 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
899
900 if (orderByConditionFields.length > 0) {
901 query.append(WHERE_AND);
902 }
903
904 for (int i = 0; i < orderByConditionFields.length; i++) {
905 query.append(_ORDER_BY_ENTITY_ALIAS);
906 query.append(orderByConditionFields[i]);
907
908 if ((i + 1) < orderByConditionFields.length) {
909 if (orderByComparator.isAscending() ^ previous) {
910 query.append(WHERE_GREATER_THAN_HAS_NEXT);
911 }
912 else {
913 query.append(WHERE_LESSER_THAN_HAS_NEXT);
914 }
915 }
916 else {
917 if (orderByComparator.isAscending() ^ previous) {
918 query.append(WHERE_GREATER_THAN);
919 }
920 else {
921 query.append(WHERE_LESSER_THAN);
922 }
923 }
924 }
925
926 query.append(ORDER_BY_CLAUSE);
927
928 String[] orderByFields = orderByComparator.getOrderByFields();
929
930 for (int i = 0; i < orderByFields.length; i++) {
931 query.append(_ORDER_BY_ENTITY_ALIAS);
932 query.append(orderByFields[i]);
933
934 if ((i + 1) < orderByFields.length) {
935 if (orderByComparator.isAscending() ^ previous) {
936 query.append(ORDER_BY_ASC_HAS_NEXT);
937 }
938 else {
939 query.append(ORDER_BY_DESC_HAS_NEXT);
940 }
941 }
942 else {
943 if (orderByComparator.isAscending() ^ previous) {
944 query.append(ORDER_BY_ASC);
945 }
946 else {
947 query.append(ORDER_BY_DESC);
948 }
949 }
950 }
951 }
952
953 String sql = query.toString();
954
955 Query q = session.createQuery(sql);
956
957 q.setFirstResult(0);
958 q.setMaxResults(2);
959
960 QueryPos qPos = QueryPos.getInstance(q);
961
962 qPos.add(layoutSetBranchId);
963
964 if (orderByComparator != null) {
965 Object[] values = orderByComparator.getOrderByConditionValues(layoutBranch);
966
967 for (Object value : values) {
968 qPos.add(value);
969 }
970 }
971
972 List<LayoutBranch> list = q.list();
973
974 if (list.size() == 2) {
975 return list.get(1);
976 }
977 else {
978 return null;
979 }
980 }
981
982
990 public List<LayoutBranch> findByL_P(long layoutSetBranchId, long plid)
991 throws SystemException {
992 return findByL_P(layoutSetBranchId, plid, QueryUtil.ALL_POS,
993 QueryUtil.ALL_POS, null);
994 }
995
996
1010 public List<LayoutBranch> findByL_P(long layoutSetBranchId, long plid,
1011 int start, int end) throws SystemException {
1012 return findByL_P(layoutSetBranchId, plid, start, end, null);
1013 }
1014
1015
1030 public List<LayoutBranch> findByL_P(long layoutSetBranchId, long plid,
1031 int start, int end, OrderByComparator orderByComparator)
1032 throws SystemException {
1033 FinderPath finderPath = null;
1034 Object[] finderArgs = null;
1035
1036 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1037 (orderByComparator == null)) {
1038 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P;
1039 finderArgs = new Object[] { layoutSetBranchId, plid };
1040 }
1041 else {
1042 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_L_P;
1043 finderArgs = new Object[] {
1044 layoutSetBranchId, plid,
1045
1046 start, end, orderByComparator
1047 };
1048 }
1049
1050 List<LayoutBranch> list = (List<LayoutBranch>)FinderCacheUtil.getResult(finderPath,
1051 finderArgs, this);
1052
1053 if ((list != null) && !list.isEmpty()) {
1054 for (LayoutBranch layoutBranch : list) {
1055 if ((layoutSetBranchId != layoutBranch.getLayoutSetBranchId()) ||
1056 (plid != layoutBranch.getPlid())) {
1057 list = null;
1058
1059 break;
1060 }
1061 }
1062 }
1063
1064 if (list == null) {
1065 StringBundler query = null;
1066
1067 if (orderByComparator != null) {
1068 query = new StringBundler(4 +
1069 (orderByComparator.getOrderByFields().length * 3));
1070 }
1071 else {
1072 query = new StringBundler(3);
1073 }
1074
1075 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
1076
1077 query.append(_FINDER_COLUMN_L_P_LAYOUTSETBRANCHID_2);
1078
1079 query.append(_FINDER_COLUMN_L_P_PLID_2);
1080
1081 if (orderByComparator != null) {
1082 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1083 orderByComparator);
1084 }
1085
1086 String sql = query.toString();
1087
1088 Session session = null;
1089
1090 try {
1091 session = openSession();
1092
1093 Query q = session.createQuery(sql);
1094
1095 QueryPos qPos = QueryPos.getInstance(q);
1096
1097 qPos.add(layoutSetBranchId);
1098
1099 qPos.add(plid);
1100
1101 list = (List<LayoutBranch>)QueryUtil.list(q, getDialect(),
1102 start, end);
1103 }
1104 catch (Exception e) {
1105 throw processException(e);
1106 }
1107 finally {
1108 if (list == null) {
1109 FinderCacheUtil.removeResult(finderPath, finderArgs);
1110 }
1111 else {
1112 cacheResult(list);
1113
1114 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1115 }
1116
1117 closeSession(session);
1118 }
1119 }
1120
1121 return list;
1122 }
1123
1124
1138 public LayoutBranch findByL_P_First(long layoutSetBranchId, long plid,
1139 OrderByComparator orderByComparator)
1140 throws NoSuchLayoutBranchException, SystemException {
1141 List<LayoutBranch> list = findByL_P(layoutSetBranchId, plid, 0, 1,
1142 orderByComparator);
1143
1144 if (list.isEmpty()) {
1145 StringBundler msg = new StringBundler(6);
1146
1147 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1148
1149 msg.append("layoutSetBranchId=");
1150 msg.append(layoutSetBranchId);
1151
1152 msg.append(", plid=");
1153 msg.append(plid);
1154
1155 msg.append(StringPool.CLOSE_CURLY_BRACE);
1156
1157 throw new NoSuchLayoutBranchException(msg.toString());
1158 }
1159 else {
1160 return list.get(0);
1161 }
1162 }
1163
1164
1178 public LayoutBranch findByL_P_Last(long layoutSetBranchId, long plid,
1179 OrderByComparator orderByComparator)
1180 throws NoSuchLayoutBranchException, SystemException {
1181 int count = countByL_P(layoutSetBranchId, plid);
1182
1183 List<LayoutBranch> list = findByL_P(layoutSetBranchId, plid, count - 1,
1184 count, orderByComparator);
1185
1186 if (list.isEmpty()) {
1187 StringBundler msg = new StringBundler(6);
1188
1189 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1190
1191 msg.append("layoutSetBranchId=");
1192 msg.append(layoutSetBranchId);
1193
1194 msg.append(", plid=");
1195 msg.append(plid);
1196
1197 msg.append(StringPool.CLOSE_CURLY_BRACE);
1198
1199 throw new NoSuchLayoutBranchException(msg.toString());
1200 }
1201 else {
1202 return list.get(0);
1203 }
1204 }
1205
1206
1221 public LayoutBranch[] findByL_P_PrevAndNext(long LayoutBranchId,
1222 long layoutSetBranchId, long plid, OrderByComparator orderByComparator)
1223 throws NoSuchLayoutBranchException, SystemException {
1224 LayoutBranch layoutBranch = findByPrimaryKey(LayoutBranchId);
1225
1226 Session session = null;
1227
1228 try {
1229 session = openSession();
1230
1231 LayoutBranch[] array = new LayoutBranchImpl[3];
1232
1233 array[0] = getByL_P_PrevAndNext(session, layoutBranch,
1234 layoutSetBranchId, plid, orderByComparator, true);
1235
1236 array[1] = layoutBranch;
1237
1238 array[2] = getByL_P_PrevAndNext(session, layoutBranch,
1239 layoutSetBranchId, plid, orderByComparator, false);
1240
1241 return array;
1242 }
1243 catch (Exception e) {
1244 throw processException(e);
1245 }
1246 finally {
1247 closeSession(session);
1248 }
1249 }
1250
1251 protected LayoutBranch getByL_P_PrevAndNext(Session session,
1252 LayoutBranch layoutBranch, long layoutSetBranchId, long plid,
1253 OrderByComparator orderByComparator, boolean previous) {
1254 StringBundler query = null;
1255
1256 if (orderByComparator != null) {
1257 query = new StringBundler(6 +
1258 (orderByComparator.getOrderByFields().length * 6));
1259 }
1260 else {
1261 query = new StringBundler(3);
1262 }
1263
1264 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
1265
1266 query.append(_FINDER_COLUMN_L_P_LAYOUTSETBRANCHID_2);
1267
1268 query.append(_FINDER_COLUMN_L_P_PLID_2);
1269
1270 if (orderByComparator != null) {
1271 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1272
1273 if (orderByConditionFields.length > 0) {
1274 query.append(WHERE_AND);
1275 }
1276
1277 for (int i = 0; i < orderByConditionFields.length; i++) {
1278 query.append(_ORDER_BY_ENTITY_ALIAS);
1279 query.append(orderByConditionFields[i]);
1280
1281 if ((i + 1) < orderByConditionFields.length) {
1282 if (orderByComparator.isAscending() ^ previous) {
1283 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1284 }
1285 else {
1286 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1287 }
1288 }
1289 else {
1290 if (orderByComparator.isAscending() ^ previous) {
1291 query.append(WHERE_GREATER_THAN);
1292 }
1293 else {
1294 query.append(WHERE_LESSER_THAN);
1295 }
1296 }
1297 }
1298
1299 query.append(ORDER_BY_CLAUSE);
1300
1301 String[] orderByFields = orderByComparator.getOrderByFields();
1302
1303 for (int i = 0; i < orderByFields.length; i++) {
1304 query.append(_ORDER_BY_ENTITY_ALIAS);
1305 query.append(orderByFields[i]);
1306
1307 if ((i + 1) < orderByFields.length) {
1308 if (orderByComparator.isAscending() ^ previous) {
1309 query.append(ORDER_BY_ASC_HAS_NEXT);
1310 }
1311 else {
1312 query.append(ORDER_BY_DESC_HAS_NEXT);
1313 }
1314 }
1315 else {
1316 if (orderByComparator.isAscending() ^ previous) {
1317 query.append(ORDER_BY_ASC);
1318 }
1319 else {
1320 query.append(ORDER_BY_DESC);
1321 }
1322 }
1323 }
1324 }
1325
1326 String sql = query.toString();
1327
1328 Query q = session.createQuery(sql);
1329
1330 q.setFirstResult(0);
1331 q.setMaxResults(2);
1332
1333 QueryPos qPos = QueryPos.getInstance(q);
1334
1335 qPos.add(layoutSetBranchId);
1336
1337 qPos.add(plid);
1338
1339 if (orderByComparator != null) {
1340 Object[] values = orderByComparator.getOrderByConditionValues(layoutBranch);
1341
1342 for (Object value : values) {
1343 qPos.add(value);
1344 }
1345 }
1346
1347 List<LayoutBranch> list = q.list();
1348
1349 if (list.size() == 2) {
1350 return list.get(1);
1351 }
1352 else {
1353 return null;
1354 }
1355 }
1356
1357
1367 public LayoutBranch findByL_P_N(long layoutSetBranchId, long plid,
1368 String name) throws NoSuchLayoutBranchException, SystemException {
1369 LayoutBranch layoutBranch = fetchByL_P_N(layoutSetBranchId, plid, name);
1370
1371 if (layoutBranch == null) {
1372 StringBundler msg = new StringBundler(8);
1373
1374 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1375
1376 msg.append("layoutSetBranchId=");
1377 msg.append(layoutSetBranchId);
1378
1379 msg.append(", plid=");
1380 msg.append(plid);
1381
1382 msg.append(", name=");
1383 msg.append(name);
1384
1385 msg.append(StringPool.CLOSE_CURLY_BRACE);
1386
1387 if (_log.isWarnEnabled()) {
1388 _log.warn(msg.toString());
1389 }
1390
1391 throw new NoSuchLayoutBranchException(msg.toString());
1392 }
1393
1394 return layoutBranch;
1395 }
1396
1397
1406 public LayoutBranch fetchByL_P_N(long layoutSetBranchId, long plid,
1407 String name) throws SystemException {
1408 return fetchByL_P_N(layoutSetBranchId, plid, name, true);
1409 }
1410
1411
1421 public LayoutBranch fetchByL_P_N(long layoutSetBranchId, long plid,
1422 String name, boolean retrieveFromCache) throws SystemException {
1423 Object[] finderArgs = new Object[] { layoutSetBranchId, plid, name };
1424
1425 Object result = null;
1426
1427 if (retrieveFromCache) {
1428 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_L_P_N,
1429 finderArgs, this);
1430 }
1431
1432 if (result instanceof LayoutBranch) {
1433 LayoutBranch layoutBranch = (LayoutBranch)result;
1434
1435 if ((layoutSetBranchId != layoutBranch.getLayoutSetBranchId()) ||
1436 (plid != layoutBranch.getPlid()) ||
1437 !Validator.equals(name, layoutBranch.getName())) {
1438 result = null;
1439 }
1440 }
1441
1442 if (result == null) {
1443 StringBundler query = new StringBundler(4);
1444
1445 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
1446
1447 query.append(_FINDER_COLUMN_L_P_N_LAYOUTSETBRANCHID_2);
1448
1449 query.append(_FINDER_COLUMN_L_P_N_PLID_2);
1450
1451 if (name == null) {
1452 query.append(_FINDER_COLUMN_L_P_N_NAME_1);
1453 }
1454 else {
1455 if (name.equals(StringPool.BLANK)) {
1456 query.append(_FINDER_COLUMN_L_P_N_NAME_3);
1457 }
1458 else {
1459 query.append(_FINDER_COLUMN_L_P_N_NAME_2);
1460 }
1461 }
1462
1463 String sql = query.toString();
1464
1465 Session session = null;
1466
1467 try {
1468 session = openSession();
1469
1470 Query q = session.createQuery(sql);
1471
1472 QueryPos qPos = QueryPos.getInstance(q);
1473
1474 qPos.add(layoutSetBranchId);
1475
1476 qPos.add(plid);
1477
1478 if (name != null) {
1479 qPos.add(name);
1480 }
1481
1482 List<LayoutBranch> list = q.list();
1483
1484 result = list;
1485
1486 LayoutBranch layoutBranch = null;
1487
1488 if (list.isEmpty()) {
1489 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_N,
1490 finderArgs, list);
1491 }
1492 else {
1493 layoutBranch = list.get(0);
1494
1495 cacheResult(layoutBranch);
1496
1497 if ((layoutBranch.getLayoutSetBranchId() != layoutSetBranchId) ||
1498 (layoutBranch.getPlid() != plid) ||
1499 (layoutBranch.getName() == null) ||
1500 !layoutBranch.getName().equals(name)) {
1501 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_N,
1502 finderArgs, layoutBranch);
1503 }
1504 }
1505
1506 return layoutBranch;
1507 }
1508 catch (Exception e) {
1509 throw processException(e);
1510 }
1511 finally {
1512 if (result == null) {
1513 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_L_P_N,
1514 finderArgs);
1515 }
1516
1517 closeSession(session);
1518 }
1519 }
1520 else {
1521 if (result instanceof List<?>) {
1522 return null;
1523 }
1524 else {
1525 return (LayoutBranch)result;
1526 }
1527 }
1528 }
1529
1530
1540 public LayoutBranch findByL_P_M(long layoutSetBranchId, long plid,
1541 boolean master) throws NoSuchLayoutBranchException, SystemException {
1542 LayoutBranch layoutBranch = fetchByL_P_M(layoutSetBranchId, plid, master);
1543
1544 if (layoutBranch == null) {
1545 StringBundler msg = new StringBundler(8);
1546
1547 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1548
1549 msg.append("layoutSetBranchId=");
1550 msg.append(layoutSetBranchId);
1551
1552 msg.append(", plid=");
1553 msg.append(plid);
1554
1555 msg.append(", master=");
1556 msg.append(master);
1557
1558 msg.append(StringPool.CLOSE_CURLY_BRACE);
1559
1560 if (_log.isWarnEnabled()) {
1561 _log.warn(msg.toString());
1562 }
1563
1564 throw new NoSuchLayoutBranchException(msg.toString());
1565 }
1566
1567 return layoutBranch;
1568 }
1569
1570
1579 public LayoutBranch fetchByL_P_M(long layoutSetBranchId, long plid,
1580 boolean master) throws SystemException {
1581 return fetchByL_P_M(layoutSetBranchId, plid, master, true);
1582 }
1583
1584
1594 public LayoutBranch fetchByL_P_M(long layoutSetBranchId, long plid,
1595 boolean master, boolean retrieveFromCache) throws SystemException {
1596 Object[] finderArgs = new Object[] { layoutSetBranchId, plid, master };
1597
1598 Object result = null;
1599
1600 if (retrieveFromCache) {
1601 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_L_P_M,
1602 finderArgs, this);
1603 }
1604
1605 if (result instanceof LayoutBranch) {
1606 LayoutBranch layoutBranch = (LayoutBranch)result;
1607
1608 if ((layoutSetBranchId != layoutBranch.getLayoutSetBranchId()) ||
1609 (plid != layoutBranch.getPlid()) ||
1610 (master != layoutBranch.getMaster())) {
1611 result = null;
1612 }
1613 }
1614
1615 if (result == null) {
1616 StringBundler query = new StringBundler(4);
1617
1618 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
1619
1620 query.append(_FINDER_COLUMN_L_P_M_LAYOUTSETBRANCHID_2);
1621
1622 query.append(_FINDER_COLUMN_L_P_M_PLID_2);
1623
1624 query.append(_FINDER_COLUMN_L_P_M_MASTER_2);
1625
1626 String sql = query.toString();
1627
1628 Session session = null;
1629
1630 try {
1631 session = openSession();
1632
1633 Query q = session.createQuery(sql);
1634
1635 QueryPos qPos = QueryPos.getInstance(q);
1636
1637 qPos.add(layoutSetBranchId);
1638
1639 qPos.add(plid);
1640
1641 qPos.add(master);
1642
1643 List<LayoutBranch> list = q.list();
1644
1645 result = list;
1646
1647 LayoutBranch layoutBranch = null;
1648
1649 if (list.isEmpty()) {
1650 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_M,
1651 finderArgs, list);
1652 }
1653 else {
1654 layoutBranch = list.get(0);
1655
1656 cacheResult(layoutBranch);
1657
1658 if ((layoutBranch.getLayoutSetBranchId() != layoutSetBranchId) ||
1659 (layoutBranch.getPlid() != plid) ||
1660 (layoutBranch.getMaster() != master)) {
1661 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_M,
1662 finderArgs, layoutBranch);
1663 }
1664 }
1665
1666 return layoutBranch;
1667 }
1668 catch (Exception e) {
1669 throw processException(e);
1670 }
1671 finally {
1672 if (result == null) {
1673 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_L_P_M,
1674 finderArgs);
1675 }
1676
1677 closeSession(session);
1678 }
1679 }
1680 else {
1681 if (result instanceof List<?>) {
1682 return null;
1683 }
1684 else {
1685 return (LayoutBranch)result;
1686 }
1687 }
1688 }
1689
1690
1696 public List<LayoutBranch> findAll() throws SystemException {
1697 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1698 }
1699
1700
1712 public List<LayoutBranch> findAll(int start, int end)
1713 throws SystemException {
1714 return findAll(start, end, null);
1715 }
1716
1717
1730 public List<LayoutBranch> findAll(int start, int end,
1731 OrderByComparator orderByComparator) throws SystemException {
1732 FinderPath finderPath = null;
1733 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1734
1735 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1736 (orderByComparator == null)) {
1737 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1738 finderArgs = FINDER_ARGS_EMPTY;
1739 }
1740 else {
1741 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1742 finderArgs = new Object[] { start, end, orderByComparator };
1743 }
1744
1745 List<LayoutBranch> list = (List<LayoutBranch>)FinderCacheUtil.getResult(finderPath,
1746 finderArgs, this);
1747
1748 if (list == null) {
1749 StringBundler query = null;
1750 String sql = null;
1751
1752 if (orderByComparator != null) {
1753 query = new StringBundler(2 +
1754 (orderByComparator.getOrderByFields().length * 3));
1755
1756 query.append(_SQL_SELECT_LAYOUTBRANCH);
1757
1758 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1759 orderByComparator);
1760
1761 sql = query.toString();
1762 }
1763 else {
1764 sql = _SQL_SELECT_LAYOUTBRANCH;
1765 }
1766
1767 Session session = null;
1768
1769 try {
1770 session = openSession();
1771
1772 Query q = session.createQuery(sql);
1773
1774 if (orderByComparator == null) {
1775 list = (List<LayoutBranch>)QueryUtil.list(q, getDialect(),
1776 start, end, false);
1777
1778 Collections.sort(list);
1779 }
1780 else {
1781 list = (List<LayoutBranch>)QueryUtil.list(q, getDialect(),
1782 start, end);
1783 }
1784 }
1785 catch (Exception e) {
1786 throw processException(e);
1787 }
1788 finally {
1789 if (list == null) {
1790 FinderCacheUtil.removeResult(finderPath, finderArgs);
1791 }
1792 else {
1793 cacheResult(list);
1794
1795 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1796 }
1797
1798 closeSession(session);
1799 }
1800 }
1801
1802 return list;
1803 }
1804
1805
1811 public void removeByLayoutSetBranchId(long layoutSetBranchId)
1812 throws SystemException {
1813 for (LayoutBranch layoutBranch : findByLayoutSetBranchId(
1814 layoutSetBranchId)) {
1815 remove(layoutBranch);
1816 }
1817 }
1818
1819
1826 public void removeByL_P(long layoutSetBranchId, long plid)
1827 throws SystemException {
1828 for (LayoutBranch layoutBranch : findByL_P(layoutSetBranchId, plid)) {
1829 remove(layoutBranch);
1830 }
1831 }
1832
1833
1841 public void removeByL_P_N(long layoutSetBranchId, long plid, String name)
1842 throws NoSuchLayoutBranchException, SystemException {
1843 LayoutBranch layoutBranch = findByL_P_N(layoutSetBranchId, plid, name);
1844
1845 remove(layoutBranch);
1846 }
1847
1848
1856 public void removeByL_P_M(long layoutSetBranchId, long plid, boolean master)
1857 throws NoSuchLayoutBranchException, SystemException {
1858 LayoutBranch layoutBranch = findByL_P_M(layoutSetBranchId, plid, master);
1859
1860 remove(layoutBranch);
1861 }
1862
1863
1868 public void removeAll() throws SystemException {
1869 for (LayoutBranch layoutBranch : findAll()) {
1870 remove(layoutBranch);
1871 }
1872 }
1873
1874
1881 public int countByLayoutSetBranchId(long layoutSetBranchId)
1882 throws SystemException {
1883 Object[] finderArgs = new Object[] { layoutSetBranchId };
1884
1885 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_LAYOUTSETBRANCHID,
1886 finderArgs, this);
1887
1888 if (count == null) {
1889 StringBundler query = new StringBundler(2);
1890
1891 query.append(_SQL_COUNT_LAYOUTBRANCH_WHERE);
1892
1893 query.append(_FINDER_COLUMN_LAYOUTSETBRANCHID_LAYOUTSETBRANCHID_2);
1894
1895 String sql = query.toString();
1896
1897 Session session = null;
1898
1899 try {
1900 session = openSession();
1901
1902 Query q = session.createQuery(sql);
1903
1904 QueryPos qPos = QueryPos.getInstance(q);
1905
1906 qPos.add(layoutSetBranchId);
1907
1908 count = (Long)q.uniqueResult();
1909 }
1910 catch (Exception e) {
1911 throw processException(e);
1912 }
1913 finally {
1914 if (count == null) {
1915 count = Long.valueOf(0);
1916 }
1917
1918 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_LAYOUTSETBRANCHID,
1919 finderArgs, count);
1920
1921 closeSession(session);
1922 }
1923 }
1924
1925 return count.intValue();
1926 }
1927
1928
1936 public int countByL_P(long layoutSetBranchId, long plid)
1937 throws SystemException {
1938 Object[] finderArgs = new Object[] { layoutSetBranchId, plid };
1939
1940 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_L_P,
1941 finderArgs, this);
1942
1943 if (count == null) {
1944 StringBundler query = new StringBundler(3);
1945
1946 query.append(_SQL_COUNT_LAYOUTBRANCH_WHERE);
1947
1948 query.append(_FINDER_COLUMN_L_P_LAYOUTSETBRANCHID_2);
1949
1950 query.append(_FINDER_COLUMN_L_P_PLID_2);
1951
1952 String sql = query.toString();
1953
1954 Session session = null;
1955
1956 try {
1957 session = openSession();
1958
1959 Query q = session.createQuery(sql);
1960
1961 QueryPos qPos = QueryPos.getInstance(q);
1962
1963 qPos.add(layoutSetBranchId);
1964
1965 qPos.add(plid);
1966
1967 count = (Long)q.uniqueResult();
1968 }
1969 catch (Exception e) {
1970 throw processException(e);
1971 }
1972 finally {
1973 if (count == null) {
1974 count = Long.valueOf(0);
1975 }
1976
1977 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_L_P, finderArgs,
1978 count);
1979
1980 closeSession(session);
1981 }
1982 }
1983
1984 return count.intValue();
1985 }
1986
1987
1996 public int countByL_P_N(long layoutSetBranchId, long plid, String name)
1997 throws SystemException {
1998 Object[] finderArgs = new Object[] { layoutSetBranchId, plid, name };
1999
2000 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_L_P_N,
2001 finderArgs, this);
2002
2003 if (count == null) {
2004 StringBundler query = new StringBundler(4);
2005
2006 query.append(_SQL_COUNT_LAYOUTBRANCH_WHERE);
2007
2008 query.append(_FINDER_COLUMN_L_P_N_LAYOUTSETBRANCHID_2);
2009
2010 query.append(_FINDER_COLUMN_L_P_N_PLID_2);
2011
2012 if (name == null) {
2013 query.append(_FINDER_COLUMN_L_P_N_NAME_1);
2014 }
2015 else {
2016 if (name.equals(StringPool.BLANK)) {
2017 query.append(_FINDER_COLUMN_L_P_N_NAME_3);
2018 }
2019 else {
2020 query.append(_FINDER_COLUMN_L_P_N_NAME_2);
2021 }
2022 }
2023
2024 String sql = query.toString();
2025
2026 Session session = null;
2027
2028 try {
2029 session = openSession();
2030
2031 Query q = session.createQuery(sql);
2032
2033 QueryPos qPos = QueryPos.getInstance(q);
2034
2035 qPos.add(layoutSetBranchId);
2036
2037 qPos.add(plid);
2038
2039 if (name != null) {
2040 qPos.add(name);
2041 }
2042
2043 count = (Long)q.uniqueResult();
2044 }
2045 catch (Exception e) {
2046 throw processException(e);
2047 }
2048 finally {
2049 if (count == null) {
2050 count = Long.valueOf(0);
2051 }
2052
2053 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_L_P_N,
2054 finderArgs, count);
2055
2056 closeSession(session);
2057 }
2058 }
2059
2060 return count.intValue();
2061 }
2062
2063
2072 public int countByL_P_M(long layoutSetBranchId, long plid, boolean master)
2073 throws SystemException {
2074 Object[] finderArgs = new Object[] { layoutSetBranchId, plid, master };
2075
2076 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_L_P_M,
2077 finderArgs, this);
2078
2079 if (count == null) {
2080 StringBundler query = new StringBundler(4);
2081
2082 query.append(_SQL_COUNT_LAYOUTBRANCH_WHERE);
2083
2084 query.append(_FINDER_COLUMN_L_P_M_LAYOUTSETBRANCHID_2);
2085
2086 query.append(_FINDER_COLUMN_L_P_M_PLID_2);
2087
2088 query.append(_FINDER_COLUMN_L_P_M_MASTER_2);
2089
2090 String sql = query.toString();
2091
2092 Session session = null;
2093
2094 try {
2095 session = openSession();
2096
2097 Query q = session.createQuery(sql);
2098
2099 QueryPos qPos = QueryPos.getInstance(q);
2100
2101 qPos.add(layoutSetBranchId);
2102
2103 qPos.add(plid);
2104
2105 qPos.add(master);
2106
2107 count = (Long)q.uniqueResult();
2108 }
2109 catch (Exception e) {
2110 throw processException(e);
2111 }
2112 finally {
2113 if (count == null) {
2114 count = Long.valueOf(0);
2115 }
2116
2117 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_L_P_M,
2118 finderArgs, count);
2119
2120 closeSession(session);
2121 }
2122 }
2123
2124 return count.intValue();
2125 }
2126
2127
2133 public int countAll() throws SystemException {
2134 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2135 FINDER_ARGS_EMPTY, this);
2136
2137 if (count == null) {
2138 Session session = null;
2139
2140 try {
2141 session = openSession();
2142
2143 Query q = session.createQuery(_SQL_COUNT_LAYOUTBRANCH);
2144
2145 count = (Long)q.uniqueResult();
2146 }
2147 catch (Exception e) {
2148 throw processException(e);
2149 }
2150 finally {
2151 if (count == null) {
2152 count = Long.valueOf(0);
2153 }
2154
2155 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2156 FINDER_ARGS_EMPTY, count);
2157
2158 closeSession(session);
2159 }
2160 }
2161
2162 return count.intValue();
2163 }
2164
2165
2168 public void afterPropertiesSet() {
2169 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2170 com.liferay.portal.util.PropsUtil.get(
2171 "value.object.listener.com.liferay.portal.model.LayoutBranch")));
2172
2173 if (listenerClassNames.length > 0) {
2174 try {
2175 List<ModelListener<LayoutBranch>> listenersList = new ArrayList<ModelListener<LayoutBranch>>();
2176
2177 for (String listenerClassName : listenerClassNames) {
2178 listenersList.add((ModelListener<LayoutBranch>)InstanceFactory.newInstance(
2179 listenerClassName));
2180 }
2181
2182 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2183 }
2184 catch (Exception e) {
2185 _log.error(e);
2186 }
2187 }
2188 }
2189
2190 public void destroy() {
2191 EntityCacheUtil.removeCache(LayoutBranchImpl.class.getName());
2192 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2193 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2194 }
2195
2196 @BeanReference(type = AccountPersistence.class)
2197 protected AccountPersistence accountPersistence;
2198 @BeanReference(type = AddressPersistence.class)
2199 protected AddressPersistence addressPersistence;
2200 @BeanReference(type = BrowserTrackerPersistence.class)
2201 protected BrowserTrackerPersistence browserTrackerPersistence;
2202 @BeanReference(type = ClassNamePersistence.class)
2203 protected ClassNamePersistence classNamePersistence;
2204 @BeanReference(type = ClusterGroupPersistence.class)
2205 protected ClusterGroupPersistence clusterGroupPersistence;
2206 @BeanReference(type = CompanyPersistence.class)
2207 protected CompanyPersistence companyPersistence;
2208 @BeanReference(type = ContactPersistence.class)
2209 protected ContactPersistence contactPersistence;
2210 @BeanReference(type = CountryPersistence.class)
2211 protected CountryPersistence countryPersistence;
2212 @BeanReference(type = EmailAddressPersistence.class)
2213 protected EmailAddressPersistence emailAddressPersistence;
2214 @BeanReference(type = GroupPersistence.class)
2215 protected GroupPersistence groupPersistence;
2216 @BeanReference(type = ImagePersistence.class)
2217 protected ImagePersistence imagePersistence;
2218 @BeanReference(type = LayoutPersistence.class)
2219 protected LayoutPersistence layoutPersistence;
2220 @BeanReference(type = LayoutBranchPersistence.class)
2221 protected LayoutBranchPersistence layoutBranchPersistence;
2222 @BeanReference(type = LayoutPrototypePersistence.class)
2223 protected LayoutPrototypePersistence layoutPrototypePersistence;
2224 @BeanReference(type = LayoutRevisionPersistence.class)
2225 protected LayoutRevisionPersistence layoutRevisionPersistence;
2226 @BeanReference(type = LayoutSetPersistence.class)
2227 protected LayoutSetPersistence layoutSetPersistence;
2228 @BeanReference(type = LayoutSetBranchPersistence.class)
2229 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
2230 @BeanReference(type = LayoutSetPrototypePersistence.class)
2231 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2232 @BeanReference(type = ListTypePersistence.class)
2233 protected ListTypePersistence listTypePersistence;
2234 @BeanReference(type = LockPersistence.class)
2235 protected LockPersistence lockPersistence;
2236 @BeanReference(type = MembershipRequestPersistence.class)
2237 protected MembershipRequestPersistence membershipRequestPersistence;
2238 @BeanReference(type = OrganizationPersistence.class)
2239 protected OrganizationPersistence organizationPersistence;
2240 @BeanReference(type = OrgGroupPermissionPersistence.class)
2241 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2242 @BeanReference(type = OrgGroupRolePersistence.class)
2243 protected OrgGroupRolePersistence orgGroupRolePersistence;
2244 @BeanReference(type = OrgLaborPersistence.class)
2245 protected OrgLaborPersistence orgLaborPersistence;
2246 @BeanReference(type = PasswordPolicyPersistence.class)
2247 protected PasswordPolicyPersistence passwordPolicyPersistence;
2248 @BeanReference(type = PasswordPolicyRelPersistence.class)
2249 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2250 @BeanReference(type = PasswordTrackerPersistence.class)
2251 protected PasswordTrackerPersistence passwordTrackerPersistence;
2252 @BeanReference(type = PermissionPersistence.class)
2253 protected PermissionPersistence permissionPersistence;
2254 @BeanReference(type = PhonePersistence.class)
2255 protected PhonePersistence phonePersistence;
2256 @BeanReference(type = PluginSettingPersistence.class)
2257 protected PluginSettingPersistence pluginSettingPersistence;
2258 @BeanReference(type = PortalPreferencesPersistence.class)
2259 protected PortalPreferencesPersistence portalPreferencesPersistence;
2260 @BeanReference(type = PortletPersistence.class)
2261 protected PortletPersistence portletPersistence;
2262 @BeanReference(type = PortletItemPersistence.class)
2263 protected PortletItemPersistence portletItemPersistence;
2264 @BeanReference(type = PortletPreferencesPersistence.class)
2265 protected PortletPreferencesPersistence portletPreferencesPersistence;
2266 @BeanReference(type = RegionPersistence.class)
2267 protected RegionPersistence regionPersistence;
2268 @BeanReference(type = ReleasePersistence.class)
2269 protected ReleasePersistence releasePersistence;
2270 @BeanReference(type = RepositoryPersistence.class)
2271 protected RepositoryPersistence repositoryPersistence;
2272 @BeanReference(type = RepositoryEntryPersistence.class)
2273 protected RepositoryEntryPersistence repositoryEntryPersistence;
2274 @BeanReference(type = ResourcePersistence.class)
2275 protected ResourcePersistence resourcePersistence;
2276 @BeanReference(type = ResourceActionPersistence.class)
2277 protected ResourceActionPersistence resourceActionPersistence;
2278 @BeanReference(type = ResourceBlockPersistence.class)
2279 protected ResourceBlockPersistence resourceBlockPersistence;
2280 @BeanReference(type = ResourceBlockPermissionPersistence.class)
2281 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
2282 @BeanReference(type = ResourceCodePersistence.class)
2283 protected ResourceCodePersistence resourceCodePersistence;
2284 @BeanReference(type = ResourcePermissionPersistence.class)
2285 protected ResourcePermissionPersistence resourcePermissionPersistence;
2286 @BeanReference(type = ResourceTypePermissionPersistence.class)
2287 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
2288 @BeanReference(type = RolePersistence.class)
2289 protected RolePersistence rolePersistence;
2290 @BeanReference(type = ServiceComponentPersistence.class)
2291 protected ServiceComponentPersistence serviceComponentPersistence;
2292 @BeanReference(type = ShardPersistence.class)
2293 protected ShardPersistence shardPersistence;
2294 @BeanReference(type = SubscriptionPersistence.class)
2295 protected SubscriptionPersistence subscriptionPersistence;
2296 @BeanReference(type = TeamPersistence.class)
2297 protected TeamPersistence teamPersistence;
2298 @BeanReference(type = TicketPersistence.class)
2299 protected TicketPersistence ticketPersistence;
2300 @BeanReference(type = UserPersistence.class)
2301 protected UserPersistence userPersistence;
2302 @BeanReference(type = UserGroupPersistence.class)
2303 protected UserGroupPersistence userGroupPersistence;
2304 @BeanReference(type = UserGroupGroupRolePersistence.class)
2305 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2306 @BeanReference(type = UserGroupRolePersistence.class)
2307 protected UserGroupRolePersistence userGroupRolePersistence;
2308 @BeanReference(type = UserIdMapperPersistence.class)
2309 protected UserIdMapperPersistence userIdMapperPersistence;
2310 @BeanReference(type = UserNotificationEventPersistence.class)
2311 protected UserNotificationEventPersistence userNotificationEventPersistence;
2312 @BeanReference(type = UserTrackerPersistence.class)
2313 protected UserTrackerPersistence userTrackerPersistence;
2314 @BeanReference(type = UserTrackerPathPersistence.class)
2315 protected UserTrackerPathPersistence userTrackerPathPersistence;
2316 @BeanReference(type = VirtualHostPersistence.class)
2317 protected VirtualHostPersistence virtualHostPersistence;
2318 @BeanReference(type = WebDAVPropsPersistence.class)
2319 protected WebDAVPropsPersistence webDAVPropsPersistence;
2320 @BeanReference(type = WebsitePersistence.class)
2321 protected WebsitePersistence websitePersistence;
2322 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2323 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2324 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2325 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2326 private static final String _SQL_SELECT_LAYOUTBRANCH = "SELECT layoutBranch FROM LayoutBranch layoutBranch";
2327 private static final String _SQL_SELECT_LAYOUTBRANCH_WHERE = "SELECT layoutBranch FROM LayoutBranch layoutBranch WHERE ";
2328 private static final String _SQL_COUNT_LAYOUTBRANCH = "SELECT COUNT(layoutBranch) FROM LayoutBranch layoutBranch";
2329 private static final String _SQL_COUNT_LAYOUTBRANCH_WHERE = "SELECT COUNT(layoutBranch) FROM LayoutBranch layoutBranch WHERE ";
2330 private static final String _FINDER_COLUMN_LAYOUTSETBRANCHID_LAYOUTSETBRANCHID_2 =
2331 "layoutBranch.layoutSetBranchId = ?";
2332 private static final String _FINDER_COLUMN_L_P_LAYOUTSETBRANCHID_2 = "layoutBranch.layoutSetBranchId = ? AND ";
2333 private static final String _FINDER_COLUMN_L_P_PLID_2 = "layoutBranch.plid = ?";
2334 private static final String _FINDER_COLUMN_L_P_N_LAYOUTSETBRANCHID_2 = "layoutBranch.layoutSetBranchId = ? AND ";
2335 private static final String _FINDER_COLUMN_L_P_N_PLID_2 = "layoutBranch.plid = ? AND ";
2336 private static final String _FINDER_COLUMN_L_P_N_NAME_1 = "layoutBranch.name IS NULL";
2337 private static final String _FINDER_COLUMN_L_P_N_NAME_2 = "layoutBranch.name = ?";
2338 private static final String _FINDER_COLUMN_L_P_N_NAME_3 = "(layoutBranch.name IS NULL OR layoutBranch.name = ?)";
2339 private static final String _FINDER_COLUMN_L_P_M_LAYOUTSETBRANCHID_2 = "layoutBranch.layoutSetBranchId = ? AND ";
2340 private static final String _FINDER_COLUMN_L_P_M_PLID_2 = "layoutBranch.plid = ? AND ";
2341 private static final String _FINDER_COLUMN_L_P_M_MASTER_2 = "layoutBranch.master = ?";
2342 private static final String _ORDER_BY_ENTITY_ALIAS = "layoutBranch.";
2343 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No LayoutBranch exists with the primary key ";
2344 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No LayoutBranch exists with the key {";
2345 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2346 private static Log _log = LogFactoryUtil.getLog(LayoutBranchPersistenceImpl.class);
2347 private static LayoutBranch _nullLayoutBranch = new LayoutBranchImpl() {
2348 @Override
2349 public Object clone() {
2350 return this;
2351 }
2352
2353 @Override
2354 public CacheModel<LayoutBranch> toCacheModel() {
2355 return _nullLayoutBranchCacheModel;
2356 }
2357 };
2358
2359 private static CacheModel<LayoutBranch> _nullLayoutBranchCacheModel = new CacheModel<LayoutBranch>() {
2360 public LayoutBranch toEntityModel() {
2361 return _nullLayoutBranch;
2362 }
2363 };
2364 }