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_WITH_PAGINATION_FIND_BY_L_P_M = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
132 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
133 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByL_P_M",
134 new String[] {
135 Long.class.getName(), Long.class.getName(),
136 Boolean.class.getName(),
137
138 "java.lang.Integer", "java.lang.Integer",
139 "com.liferay.portal.kernel.util.OrderByComparator"
140 });
141 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P_M = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
142 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
143 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByL_P_M",
144 new String[] {
145 Long.class.getName(), Long.class.getName(),
146 Boolean.class.getName()
147 },
148 LayoutBranchModelImpl.LAYOUTSETBRANCHID_COLUMN_BITMASK |
149 LayoutBranchModelImpl.PLID_COLUMN_BITMASK |
150 LayoutBranchModelImpl.MASTER_COLUMN_BITMASK);
151 public static final FinderPath FINDER_PATH_COUNT_BY_L_P_M = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
152 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
153 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByL_P_M",
154 new String[] {
155 Long.class.getName(), Long.class.getName(),
156 Boolean.class.getName()
157 });
158 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
159 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
160 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
161 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
162 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, LayoutBranchImpl.class,
163 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
164 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
165 LayoutBranchModelImpl.FINDER_CACHE_ENABLED, Long.class,
166 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
167
168
173 public void cacheResult(LayoutBranch layoutBranch) {
174 EntityCacheUtil.putResult(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
175 LayoutBranchImpl.class, layoutBranch.getPrimaryKey(), layoutBranch);
176
177 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_N,
178 new Object[] {
179 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
180 Long.valueOf(layoutBranch.getPlid()),
181
182 layoutBranch.getName()
183 }, layoutBranch);
184
185 layoutBranch.resetOriginalValues();
186 }
187
188
193 public void cacheResult(List<LayoutBranch> layoutBranchs) {
194 for (LayoutBranch layoutBranch : layoutBranchs) {
195 if (EntityCacheUtil.getResult(
196 LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
197 LayoutBranchImpl.class, layoutBranch.getPrimaryKey()) == null) {
198 cacheResult(layoutBranch);
199 }
200 else {
201 layoutBranch.resetOriginalValues();
202 }
203 }
204 }
205
206
213 @Override
214 public void clearCache() {
215 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
216 CacheRegistryUtil.clear(LayoutBranchImpl.class.getName());
217 }
218
219 EntityCacheUtil.clearCache(LayoutBranchImpl.class.getName());
220
221 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
222 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
223 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
224 }
225
226
233 @Override
234 public void clearCache(LayoutBranch layoutBranch) {
235 EntityCacheUtil.removeResult(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
236 LayoutBranchImpl.class, layoutBranch.getPrimaryKey());
237
238 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
239 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
240
241 clearUniqueFindersCache(layoutBranch);
242 }
243
244 @Override
245 public void clearCache(List<LayoutBranch> layoutBranchs) {
246 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
247 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
248
249 for (LayoutBranch layoutBranch : layoutBranchs) {
250 EntityCacheUtil.removeResult(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
251 LayoutBranchImpl.class, layoutBranch.getPrimaryKey());
252
253 clearUniqueFindersCache(layoutBranch);
254 }
255 }
256
257 protected void cacheUniqueFindersCache(LayoutBranch layoutBranch) {
258 if (layoutBranch.isNew()) {
259 Object[] args = new Object[] {
260 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
261 Long.valueOf(layoutBranch.getPlid()),
262
263 layoutBranch.getName()
264 };
265
266 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_L_P_N, args,
267 Long.valueOf(1));
268 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_N, args,
269 layoutBranch);
270 }
271 else {
272 LayoutBranchModelImpl layoutBranchModelImpl = (LayoutBranchModelImpl)layoutBranch;
273
274 if ((layoutBranchModelImpl.getColumnBitmask() &
275 FINDER_PATH_FETCH_BY_L_P_N.getColumnBitmask()) != 0) {
276 Object[] args = new Object[] {
277 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
278 Long.valueOf(layoutBranch.getPlid()),
279
280 layoutBranch.getName()
281 };
282
283 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_L_P_N, args,
284 Long.valueOf(1));
285 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_N, args,
286 layoutBranch);
287 }
288 }
289 }
290
291 protected void clearUniqueFindersCache(LayoutBranch layoutBranch) {
292 LayoutBranchModelImpl layoutBranchModelImpl = (LayoutBranchModelImpl)layoutBranch;
293
294 Object[] args = new Object[] {
295 Long.valueOf(layoutBranch.getLayoutSetBranchId()),
296 Long.valueOf(layoutBranch.getPlid()),
297
298 layoutBranch.getName()
299 };
300
301 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_L_P_N, args);
302 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_L_P_N, args);
303
304 if ((layoutBranchModelImpl.getColumnBitmask() &
305 FINDER_PATH_FETCH_BY_L_P_N.getColumnBitmask()) != 0) {
306 args = new Object[] {
307 Long.valueOf(layoutBranchModelImpl.getOriginalLayoutSetBranchId()),
308 Long.valueOf(layoutBranchModelImpl.getOriginalPlid()),
309
310 layoutBranchModelImpl.getOriginalName()
311 };
312
313 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_L_P_N, args);
314 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_L_P_N, args);
315 }
316 }
317
318
324 public LayoutBranch create(long LayoutBranchId) {
325 LayoutBranch layoutBranch = new LayoutBranchImpl();
326
327 layoutBranch.setNew(true);
328 layoutBranch.setPrimaryKey(LayoutBranchId);
329
330 return layoutBranch;
331 }
332
333
341 public LayoutBranch remove(long LayoutBranchId)
342 throws NoSuchLayoutBranchException, SystemException {
343 return remove(Long.valueOf(LayoutBranchId));
344 }
345
346
354 @Override
355 public LayoutBranch remove(Serializable primaryKey)
356 throws NoSuchLayoutBranchException, SystemException {
357 Session session = null;
358
359 try {
360 session = openSession();
361
362 LayoutBranch layoutBranch = (LayoutBranch)session.get(LayoutBranchImpl.class,
363 primaryKey);
364
365 if (layoutBranch == null) {
366 if (_log.isWarnEnabled()) {
367 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
368 }
369
370 throw new NoSuchLayoutBranchException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
371 primaryKey);
372 }
373
374 return remove(layoutBranch);
375 }
376 catch (NoSuchLayoutBranchException nsee) {
377 throw nsee;
378 }
379 catch (Exception e) {
380 throw processException(e);
381 }
382 finally {
383 closeSession(session);
384 }
385 }
386
387 @Override
388 protected LayoutBranch removeImpl(LayoutBranch layoutBranch)
389 throws SystemException {
390 layoutBranch = toUnwrappedModel(layoutBranch);
391
392 Session session = null;
393
394 try {
395 session = openSession();
396
397 BatchSessionUtil.delete(session, layoutBranch);
398 }
399 catch (Exception e) {
400 throw processException(e);
401 }
402 finally {
403 closeSession(session);
404 }
405
406 clearCache(layoutBranch);
407
408 return layoutBranch;
409 }
410
411 @Override
412 public LayoutBranch updateImpl(
413 com.liferay.portal.model.LayoutBranch layoutBranch, boolean merge)
414 throws SystemException {
415 layoutBranch = toUnwrappedModel(layoutBranch);
416
417 boolean isNew = layoutBranch.isNew();
418
419 LayoutBranchModelImpl layoutBranchModelImpl = (LayoutBranchModelImpl)layoutBranch;
420
421 Session session = null;
422
423 try {
424 session = openSession();
425
426 BatchSessionUtil.update(session, layoutBranch, merge);
427
428 layoutBranch.setNew(false);
429 }
430 catch (Exception e) {
431 throw processException(e);
432 }
433 finally {
434 closeSession(session);
435 }
436
437 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
438
439 if (isNew || !LayoutBranchModelImpl.COLUMN_BITMASK_ENABLED) {
440 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
441 }
442
443 else {
444 if ((layoutBranchModelImpl.getColumnBitmask() &
445 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_LAYOUTSETBRANCHID.getColumnBitmask()) != 0) {
446 Object[] args = new Object[] {
447 Long.valueOf(layoutBranchModelImpl.getOriginalLayoutSetBranchId())
448 };
449
450 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_LAYOUTSETBRANCHID,
451 args);
452 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_LAYOUTSETBRANCHID,
453 args);
454
455 args = new Object[] {
456 Long.valueOf(layoutBranchModelImpl.getLayoutSetBranchId())
457 };
458
459 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_LAYOUTSETBRANCHID,
460 args);
461 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_LAYOUTSETBRANCHID,
462 args);
463 }
464
465 if ((layoutBranchModelImpl.getColumnBitmask() &
466 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P.getColumnBitmask()) != 0) {
467 Object[] args = new Object[] {
468 Long.valueOf(layoutBranchModelImpl.getOriginalLayoutSetBranchId()),
469 Long.valueOf(layoutBranchModelImpl.getOriginalPlid())
470 };
471
472 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_L_P, args);
473 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P,
474 args);
475
476 args = new Object[] {
477 Long.valueOf(layoutBranchModelImpl.getLayoutSetBranchId()),
478 Long.valueOf(layoutBranchModelImpl.getPlid())
479 };
480
481 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_L_P, args);
482 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P,
483 args);
484 }
485
486 if ((layoutBranchModelImpl.getColumnBitmask() &
487 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P_M.getColumnBitmask()) != 0) {
488 Object[] args = new Object[] {
489 Long.valueOf(layoutBranchModelImpl.getOriginalLayoutSetBranchId()),
490 Long.valueOf(layoutBranchModelImpl.getOriginalPlid()),
491 Boolean.valueOf(layoutBranchModelImpl.getOriginalMaster())
492 };
493
494 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_L_P_M, args);
495 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P_M,
496 args);
497
498 args = new Object[] {
499 Long.valueOf(layoutBranchModelImpl.getLayoutSetBranchId()),
500 Long.valueOf(layoutBranchModelImpl.getPlid()),
501 Boolean.valueOf(layoutBranchModelImpl.getMaster())
502 };
503
504 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_L_P_M, args);
505 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P_M,
506 args);
507 }
508 }
509
510 EntityCacheUtil.putResult(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
511 LayoutBranchImpl.class, layoutBranch.getPrimaryKey(), layoutBranch);
512
513 clearUniqueFindersCache(layoutBranch);
514 cacheUniqueFindersCache(layoutBranch);
515
516 return layoutBranch;
517 }
518
519 protected LayoutBranch toUnwrappedModel(LayoutBranch layoutBranch) {
520 if (layoutBranch instanceof LayoutBranchImpl) {
521 return layoutBranch;
522 }
523
524 LayoutBranchImpl layoutBranchImpl = new LayoutBranchImpl();
525
526 layoutBranchImpl.setNew(layoutBranch.isNew());
527 layoutBranchImpl.setPrimaryKey(layoutBranch.getPrimaryKey());
528
529 layoutBranchImpl.setLayoutBranchId(layoutBranch.getLayoutBranchId());
530 layoutBranchImpl.setGroupId(layoutBranch.getGroupId());
531 layoutBranchImpl.setCompanyId(layoutBranch.getCompanyId());
532 layoutBranchImpl.setUserId(layoutBranch.getUserId());
533 layoutBranchImpl.setUserName(layoutBranch.getUserName());
534 layoutBranchImpl.setLayoutSetBranchId(layoutBranch.getLayoutSetBranchId());
535 layoutBranchImpl.setPlid(layoutBranch.getPlid());
536 layoutBranchImpl.setName(layoutBranch.getName());
537 layoutBranchImpl.setDescription(layoutBranch.getDescription());
538 layoutBranchImpl.setMaster(layoutBranch.isMaster());
539
540 return layoutBranchImpl;
541 }
542
543
551 @Override
552 public LayoutBranch findByPrimaryKey(Serializable primaryKey)
553 throws NoSuchModelException, SystemException {
554 return findByPrimaryKey(((Long)primaryKey).longValue());
555 }
556
557
565 public LayoutBranch findByPrimaryKey(long LayoutBranchId)
566 throws NoSuchLayoutBranchException, SystemException {
567 LayoutBranch layoutBranch = fetchByPrimaryKey(LayoutBranchId);
568
569 if (layoutBranch == null) {
570 if (_log.isWarnEnabled()) {
571 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + LayoutBranchId);
572 }
573
574 throw new NoSuchLayoutBranchException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
575 LayoutBranchId);
576 }
577
578 return layoutBranch;
579 }
580
581
588 @Override
589 public LayoutBranch fetchByPrimaryKey(Serializable primaryKey)
590 throws SystemException {
591 return fetchByPrimaryKey(((Long)primaryKey).longValue());
592 }
593
594
601 public LayoutBranch fetchByPrimaryKey(long LayoutBranchId)
602 throws SystemException {
603 LayoutBranch layoutBranch = (LayoutBranch)EntityCacheUtil.getResult(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
604 LayoutBranchImpl.class, LayoutBranchId);
605
606 if (layoutBranch == _nullLayoutBranch) {
607 return null;
608 }
609
610 if (layoutBranch == null) {
611 Session session = null;
612
613 boolean hasException = false;
614
615 try {
616 session = openSession();
617
618 layoutBranch = (LayoutBranch)session.get(LayoutBranchImpl.class,
619 Long.valueOf(LayoutBranchId));
620 }
621 catch (Exception e) {
622 hasException = true;
623
624 throw processException(e);
625 }
626 finally {
627 if (layoutBranch != null) {
628 cacheResult(layoutBranch);
629 }
630 else if (!hasException) {
631 EntityCacheUtil.putResult(LayoutBranchModelImpl.ENTITY_CACHE_ENABLED,
632 LayoutBranchImpl.class, LayoutBranchId,
633 _nullLayoutBranch);
634 }
635
636 closeSession(session);
637 }
638 }
639
640 return layoutBranch;
641 }
642
643
650 public List<LayoutBranch> findByLayoutSetBranchId(long layoutSetBranchId)
651 throws SystemException {
652 return findByLayoutSetBranchId(layoutSetBranchId, QueryUtil.ALL_POS,
653 QueryUtil.ALL_POS, null);
654 }
655
656
669 public List<LayoutBranch> findByLayoutSetBranchId(long layoutSetBranchId,
670 int start, int end) throws SystemException {
671 return findByLayoutSetBranchId(layoutSetBranchId, start, end, null);
672 }
673
674
688 public List<LayoutBranch> findByLayoutSetBranchId(long layoutSetBranchId,
689 int start, int end, OrderByComparator orderByComparator)
690 throws SystemException {
691 FinderPath finderPath = null;
692 Object[] finderArgs = null;
693
694 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
695 (orderByComparator == null)) {
696 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_LAYOUTSETBRANCHID;
697 finderArgs = new Object[] { layoutSetBranchId };
698 }
699 else {
700 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_LAYOUTSETBRANCHID;
701 finderArgs = new Object[] {
702 layoutSetBranchId,
703
704 start, end, orderByComparator
705 };
706 }
707
708 List<LayoutBranch> list = (List<LayoutBranch>)FinderCacheUtil.getResult(finderPath,
709 finderArgs, this);
710
711 if ((list != null) && !list.isEmpty()) {
712 for (LayoutBranch layoutBranch : list) {
713 if ((layoutSetBranchId != layoutBranch.getLayoutSetBranchId())) {
714 list = null;
715
716 break;
717 }
718 }
719 }
720
721 if (list == null) {
722 StringBundler query = null;
723
724 if (orderByComparator != null) {
725 query = new StringBundler(3 +
726 (orderByComparator.getOrderByFields().length * 3));
727 }
728 else {
729 query = new StringBundler(2);
730 }
731
732 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
733
734 query.append(_FINDER_COLUMN_LAYOUTSETBRANCHID_LAYOUTSETBRANCHID_2);
735
736 if (orderByComparator != null) {
737 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
738 orderByComparator);
739 }
740
741 String sql = query.toString();
742
743 Session session = null;
744
745 try {
746 session = openSession();
747
748 Query q = session.createQuery(sql);
749
750 QueryPos qPos = QueryPos.getInstance(q);
751
752 qPos.add(layoutSetBranchId);
753
754 list = (List<LayoutBranch>)QueryUtil.list(q, getDialect(),
755 start, end);
756 }
757 catch (Exception e) {
758 throw processException(e);
759 }
760 finally {
761 if (list == null) {
762 FinderCacheUtil.removeResult(finderPath, finderArgs);
763 }
764 else {
765 cacheResult(list);
766
767 FinderCacheUtil.putResult(finderPath, finderArgs, list);
768 }
769
770 closeSession(session);
771 }
772 }
773
774 return list;
775 }
776
777
786 public LayoutBranch findByLayoutSetBranchId_First(long layoutSetBranchId,
787 OrderByComparator orderByComparator)
788 throws NoSuchLayoutBranchException, SystemException {
789 LayoutBranch layoutBranch = fetchByLayoutSetBranchId_First(layoutSetBranchId,
790 orderByComparator);
791
792 if (layoutBranch != null) {
793 return layoutBranch;
794 }
795
796 StringBundler msg = new StringBundler(4);
797
798 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
799
800 msg.append("layoutSetBranchId=");
801 msg.append(layoutSetBranchId);
802
803 msg.append(StringPool.CLOSE_CURLY_BRACE);
804
805 throw new NoSuchLayoutBranchException(msg.toString());
806 }
807
808
816 public LayoutBranch fetchByLayoutSetBranchId_First(long layoutSetBranchId,
817 OrderByComparator orderByComparator) throws SystemException {
818 List<LayoutBranch> list = findByLayoutSetBranchId(layoutSetBranchId, 0,
819 1, orderByComparator);
820
821 if (!list.isEmpty()) {
822 return list.get(0);
823 }
824
825 return null;
826 }
827
828
837 public LayoutBranch findByLayoutSetBranchId_Last(long layoutSetBranchId,
838 OrderByComparator orderByComparator)
839 throws NoSuchLayoutBranchException, SystemException {
840 LayoutBranch layoutBranch = fetchByLayoutSetBranchId_Last(layoutSetBranchId,
841 orderByComparator);
842
843 if (layoutBranch != null) {
844 return layoutBranch;
845 }
846
847 StringBundler msg = new StringBundler(4);
848
849 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
850
851 msg.append("layoutSetBranchId=");
852 msg.append(layoutSetBranchId);
853
854 msg.append(StringPool.CLOSE_CURLY_BRACE);
855
856 throw new NoSuchLayoutBranchException(msg.toString());
857 }
858
859
867 public LayoutBranch fetchByLayoutSetBranchId_Last(long layoutSetBranchId,
868 OrderByComparator orderByComparator) throws SystemException {
869 int count = countByLayoutSetBranchId(layoutSetBranchId);
870
871 List<LayoutBranch> list = findByLayoutSetBranchId(layoutSetBranchId,
872 count - 1, count, orderByComparator);
873
874 if (!list.isEmpty()) {
875 return list.get(0);
876 }
877
878 return null;
879 }
880
881
891 public LayoutBranch[] findByLayoutSetBranchId_PrevAndNext(
892 long LayoutBranchId, long layoutSetBranchId,
893 OrderByComparator orderByComparator)
894 throws NoSuchLayoutBranchException, SystemException {
895 LayoutBranch layoutBranch = findByPrimaryKey(LayoutBranchId);
896
897 Session session = null;
898
899 try {
900 session = openSession();
901
902 LayoutBranch[] array = new LayoutBranchImpl[3];
903
904 array[0] = getByLayoutSetBranchId_PrevAndNext(session,
905 layoutBranch, layoutSetBranchId, orderByComparator, true);
906
907 array[1] = layoutBranch;
908
909 array[2] = getByLayoutSetBranchId_PrevAndNext(session,
910 layoutBranch, layoutSetBranchId, orderByComparator, false);
911
912 return array;
913 }
914 catch (Exception e) {
915 throw processException(e);
916 }
917 finally {
918 closeSession(session);
919 }
920 }
921
922 protected LayoutBranch getByLayoutSetBranchId_PrevAndNext(Session session,
923 LayoutBranch layoutBranch, long layoutSetBranchId,
924 OrderByComparator orderByComparator, boolean previous) {
925 StringBundler query = null;
926
927 if (orderByComparator != null) {
928 query = new StringBundler(6 +
929 (orderByComparator.getOrderByFields().length * 6));
930 }
931 else {
932 query = new StringBundler(3);
933 }
934
935 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
936
937 query.append(_FINDER_COLUMN_LAYOUTSETBRANCHID_LAYOUTSETBRANCHID_2);
938
939 if (orderByComparator != null) {
940 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
941
942 if (orderByConditionFields.length > 0) {
943 query.append(WHERE_AND);
944 }
945
946 for (int i = 0; i < orderByConditionFields.length; i++) {
947 query.append(_ORDER_BY_ENTITY_ALIAS);
948 query.append(orderByConditionFields[i]);
949
950 if ((i + 1) < orderByConditionFields.length) {
951 if (orderByComparator.isAscending() ^ previous) {
952 query.append(WHERE_GREATER_THAN_HAS_NEXT);
953 }
954 else {
955 query.append(WHERE_LESSER_THAN_HAS_NEXT);
956 }
957 }
958 else {
959 if (orderByComparator.isAscending() ^ previous) {
960 query.append(WHERE_GREATER_THAN);
961 }
962 else {
963 query.append(WHERE_LESSER_THAN);
964 }
965 }
966 }
967
968 query.append(ORDER_BY_CLAUSE);
969
970 String[] orderByFields = orderByComparator.getOrderByFields();
971
972 for (int i = 0; i < orderByFields.length; i++) {
973 query.append(_ORDER_BY_ENTITY_ALIAS);
974 query.append(orderByFields[i]);
975
976 if ((i + 1) < orderByFields.length) {
977 if (orderByComparator.isAscending() ^ previous) {
978 query.append(ORDER_BY_ASC_HAS_NEXT);
979 }
980 else {
981 query.append(ORDER_BY_DESC_HAS_NEXT);
982 }
983 }
984 else {
985 if (orderByComparator.isAscending() ^ previous) {
986 query.append(ORDER_BY_ASC);
987 }
988 else {
989 query.append(ORDER_BY_DESC);
990 }
991 }
992 }
993 }
994
995 String sql = query.toString();
996
997 Query q = session.createQuery(sql);
998
999 q.setFirstResult(0);
1000 q.setMaxResults(2);
1001
1002 QueryPos qPos = QueryPos.getInstance(q);
1003
1004 qPos.add(layoutSetBranchId);
1005
1006 if (orderByComparator != null) {
1007 Object[] values = orderByComparator.getOrderByConditionValues(layoutBranch);
1008
1009 for (Object value : values) {
1010 qPos.add(value);
1011 }
1012 }
1013
1014 List<LayoutBranch> list = q.list();
1015
1016 if (list.size() == 2) {
1017 return list.get(1);
1018 }
1019 else {
1020 return null;
1021 }
1022 }
1023
1024
1032 public List<LayoutBranch> findByL_P(long layoutSetBranchId, long plid)
1033 throws SystemException {
1034 return findByL_P(layoutSetBranchId, plid, QueryUtil.ALL_POS,
1035 QueryUtil.ALL_POS, null);
1036 }
1037
1038
1052 public List<LayoutBranch> findByL_P(long layoutSetBranchId, long plid,
1053 int start, int end) throws SystemException {
1054 return findByL_P(layoutSetBranchId, plid, start, end, null);
1055 }
1056
1057
1072 public List<LayoutBranch> findByL_P(long layoutSetBranchId, long plid,
1073 int start, int end, OrderByComparator orderByComparator)
1074 throws SystemException {
1075 FinderPath finderPath = null;
1076 Object[] finderArgs = null;
1077
1078 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1079 (orderByComparator == null)) {
1080 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P;
1081 finderArgs = new Object[] { layoutSetBranchId, plid };
1082 }
1083 else {
1084 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_L_P;
1085 finderArgs = new Object[] {
1086 layoutSetBranchId, plid,
1087
1088 start, end, orderByComparator
1089 };
1090 }
1091
1092 List<LayoutBranch> list = (List<LayoutBranch>)FinderCacheUtil.getResult(finderPath,
1093 finderArgs, this);
1094
1095 if ((list != null) && !list.isEmpty()) {
1096 for (LayoutBranch layoutBranch : list) {
1097 if ((layoutSetBranchId != layoutBranch.getLayoutSetBranchId()) ||
1098 (plid != layoutBranch.getPlid())) {
1099 list = null;
1100
1101 break;
1102 }
1103 }
1104 }
1105
1106 if (list == null) {
1107 StringBundler query = null;
1108
1109 if (orderByComparator != null) {
1110 query = new StringBundler(4 +
1111 (orderByComparator.getOrderByFields().length * 3));
1112 }
1113 else {
1114 query = new StringBundler(3);
1115 }
1116
1117 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
1118
1119 query.append(_FINDER_COLUMN_L_P_LAYOUTSETBRANCHID_2);
1120
1121 query.append(_FINDER_COLUMN_L_P_PLID_2);
1122
1123 if (orderByComparator != null) {
1124 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1125 orderByComparator);
1126 }
1127
1128 String sql = query.toString();
1129
1130 Session session = null;
1131
1132 try {
1133 session = openSession();
1134
1135 Query q = session.createQuery(sql);
1136
1137 QueryPos qPos = QueryPos.getInstance(q);
1138
1139 qPos.add(layoutSetBranchId);
1140
1141 qPos.add(plid);
1142
1143 list = (List<LayoutBranch>)QueryUtil.list(q, getDialect(),
1144 start, end);
1145 }
1146 catch (Exception e) {
1147 throw processException(e);
1148 }
1149 finally {
1150 if (list == null) {
1151 FinderCacheUtil.removeResult(finderPath, finderArgs);
1152 }
1153 else {
1154 cacheResult(list);
1155
1156 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1157 }
1158
1159 closeSession(session);
1160 }
1161 }
1162
1163 return list;
1164 }
1165
1166
1176 public LayoutBranch findByL_P_First(long layoutSetBranchId, long plid,
1177 OrderByComparator orderByComparator)
1178 throws NoSuchLayoutBranchException, SystemException {
1179 LayoutBranch layoutBranch = fetchByL_P_First(layoutSetBranchId, plid,
1180 orderByComparator);
1181
1182 if (layoutBranch != null) {
1183 return layoutBranch;
1184 }
1185
1186 StringBundler msg = new StringBundler(6);
1187
1188 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1189
1190 msg.append("layoutSetBranchId=");
1191 msg.append(layoutSetBranchId);
1192
1193 msg.append(", plid=");
1194 msg.append(plid);
1195
1196 msg.append(StringPool.CLOSE_CURLY_BRACE);
1197
1198 throw new NoSuchLayoutBranchException(msg.toString());
1199 }
1200
1201
1210 public LayoutBranch fetchByL_P_First(long layoutSetBranchId, long plid,
1211 OrderByComparator orderByComparator) throws SystemException {
1212 List<LayoutBranch> list = findByL_P(layoutSetBranchId, plid, 0, 1,
1213 orderByComparator);
1214
1215 if (!list.isEmpty()) {
1216 return list.get(0);
1217 }
1218
1219 return null;
1220 }
1221
1222
1232 public LayoutBranch findByL_P_Last(long layoutSetBranchId, long plid,
1233 OrderByComparator orderByComparator)
1234 throws NoSuchLayoutBranchException, SystemException {
1235 LayoutBranch layoutBranch = fetchByL_P_Last(layoutSetBranchId, plid,
1236 orderByComparator);
1237
1238 if (layoutBranch != null) {
1239 return layoutBranch;
1240 }
1241
1242 StringBundler msg = new StringBundler(6);
1243
1244 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1245
1246 msg.append("layoutSetBranchId=");
1247 msg.append(layoutSetBranchId);
1248
1249 msg.append(", plid=");
1250 msg.append(plid);
1251
1252 msg.append(StringPool.CLOSE_CURLY_BRACE);
1253
1254 throw new NoSuchLayoutBranchException(msg.toString());
1255 }
1256
1257
1266 public LayoutBranch fetchByL_P_Last(long layoutSetBranchId, long plid,
1267 OrderByComparator orderByComparator) throws SystemException {
1268 int count = countByL_P(layoutSetBranchId, plid);
1269
1270 List<LayoutBranch> list = findByL_P(layoutSetBranchId, plid, count - 1,
1271 count, orderByComparator);
1272
1273 if (!list.isEmpty()) {
1274 return list.get(0);
1275 }
1276
1277 return null;
1278 }
1279
1280
1291 public LayoutBranch[] findByL_P_PrevAndNext(long LayoutBranchId,
1292 long layoutSetBranchId, long plid, OrderByComparator orderByComparator)
1293 throws NoSuchLayoutBranchException, SystemException {
1294 LayoutBranch layoutBranch = findByPrimaryKey(LayoutBranchId);
1295
1296 Session session = null;
1297
1298 try {
1299 session = openSession();
1300
1301 LayoutBranch[] array = new LayoutBranchImpl[3];
1302
1303 array[0] = getByL_P_PrevAndNext(session, layoutBranch,
1304 layoutSetBranchId, plid, orderByComparator, true);
1305
1306 array[1] = layoutBranch;
1307
1308 array[2] = getByL_P_PrevAndNext(session, layoutBranch,
1309 layoutSetBranchId, plid, orderByComparator, false);
1310
1311 return array;
1312 }
1313 catch (Exception e) {
1314 throw processException(e);
1315 }
1316 finally {
1317 closeSession(session);
1318 }
1319 }
1320
1321 protected LayoutBranch getByL_P_PrevAndNext(Session session,
1322 LayoutBranch layoutBranch, long layoutSetBranchId, long plid,
1323 OrderByComparator orderByComparator, boolean previous) {
1324 StringBundler query = null;
1325
1326 if (orderByComparator != null) {
1327 query = new StringBundler(6 +
1328 (orderByComparator.getOrderByFields().length * 6));
1329 }
1330 else {
1331 query = new StringBundler(3);
1332 }
1333
1334 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
1335
1336 query.append(_FINDER_COLUMN_L_P_LAYOUTSETBRANCHID_2);
1337
1338 query.append(_FINDER_COLUMN_L_P_PLID_2);
1339
1340 if (orderByComparator != null) {
1341 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1342
1343 if (orderByConditionFields.length > 0) {
1344 query.append(WHERE_AND);
1345 }
1346
1347 for (int i = 0; i < orderByConditionFields.length; i++) {
1348 query.append(_ORDER_BY_ENTITY_ALIAS);
1349 query.append(orderByConditionFields[i]);
1350
1351 if ((i + 1) < orderByConditionFields.length) {
1352 if (orderByComparator.isAscending() ^ previous) {
1353 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1354 }
1355 else {
1356 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1357 }
1358 }
1359 else {
1360 if (orderByComparator.isAscending() ^ previous) {
1361 query.append(WHERE_GREATER_THAN);
1362 }
1363 else {
1364 query.append(WHERE_LESSER_THAN);
1365 }
1366 }
1367 }
1368
1369 query.append(ORDER_BY_CLAUSE);
1370
1371 String[] orderByFields = orderByComparator.getOrderByFields();
1372
1373 for (int i = 0; i < orderByFields.length; i++) {
1374 query.append(_ORDER_BY_ENTITY_ALIAS);
1375 query.append(orderByFields[i]);
1376
1377 if ((i + 1) < orderByFields.length) {
1378 if (orderByComparator.isAscending() ^ previous) {
1379 query.append(ORDER_BY_ASC_HAS_NEXT);
1380 }
1381 else {
1382 query.append(ORDER_BY_DESC_HAS_NEXT);
1383 }
1384 }
1385 else {
1386 if (orderByComparator.isAscending() ^ previous) {
1387 query.append(ORDER_BY_ASC);
1388 }
1389 else {
1390 query.append(ORDER_BY_DESC);
1391 }
1392 }
1393 }
1394 }
1395
1396 String sql = query.toString();
1397
1398 Query q = session.createQuery(sql);
1399
1400 q.setFirstResult(0);
1401 q.setMaxResults(2);
1402
1403 QueryPos qPos = QueryPos.getInstance(q);
1404
1405 qPos.add(layoutSetBranchId);
1406
1407 qPos.add(plid);
1408
1409 if (orderByComparator != null) {
1410 Object[] values = orderByComparator.getOrderByConditionValues(layoutBranch);
1411
1412 for (Object value : values) {
1413 qPos.add(value);
1414 }
1415 }
1416
1417 List<LayoutBranch> list = q.list();
1418
1419 if (list.size() == 2) {
1420 return list.get(1);
1421 }
1422 else {
1423 return null;
1424 }
1425 }
1426
1427
1437 public LayoutBranch findByL_P_N(long layoutSetBranchId, long plid,
1438 String name) throws NoSuchLayoutBranchException, SystemException {
1439 LayoutBranch layoutBranch = fetchByL_P_N(layoutSetBranchId, plid, name);
1440
1441 if (layoutBranch == null) {
1442 StringBundler msg = new StringBundler(8);
1443
1444 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1445
1446 msg.append("layoutSetBranchId=");
1447 msg.append(layoutSetBranchId);
1448
1449 msg.append(", plid=");
1450 msg.append(plid);
1451
1452 msg.append(", name=");
1453 msg.append(name);
1454
1455 msg.append(StringPool.CLOSE_CURLY_BRACE);
1456
1457 if (_log.isWarnEnabled()) {
1458 _log.warn(msg.toString());
1459 }
1460
1461 throw new NoSuchLayoutBranchException(msg.toString());
1462 }
1463
1464 return layoutBranch;
1465 }
1466
1467
1476 public LayoutBranch fetchByL_P_N(long layoutSetBranchId, long plid,
1477 String name) throws SystemException {
1478 return fetchByL_P_N(layoutSetBranchId, plid, name, true);
1479 }
1480
1481
1491 public LayoutBranch fetchByL_P_N(long layoutSetBranchId, long plid,
1492 String name, boolean retrieveFromCache) throws SystemException {
1493 Object[] finderArgs = new Object[] { layoutSetBranchId, plid, name };
1494
1495 Object result = null;
1496
1497 if (retrieveFromCache) {
1498 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_L_P_N,
1499 finderArgs, this);
1500 }
1501
1502 if (result instanceof LayoutBranch) {
1503 LayoutBranch layoutBranch = (LayoutBranch)result;
1504
1505 if ((layoutSetBranchId != layoutBranch.getLayoutSetBranchId()) ||
1506 (plid != layoutBranch.getPlid()) ||
1507 !Validator.equals(name, layoutBranch.getName())) {
1508 result = null;
1509 }
1510 }
1511
1512 if (result == null) {
1513 StringBundler query = new StringBundler(4);
1514
1515 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
1516
1517 query.append(_FINDER_COLUMN_L_P_N_LAYOUTSETBRANCHID_2);
1518
1519 query.append(_FINDER_COLUMN_L_P_N_PLID_2);
1520
1521 if (name == null) {
1522 query.append(_FINDER_COLUMN_L_P_N_NAME_1);
1523 }
1524 else {
1525 if (name.equals(StringPool.BLANK)) {
1526 query.append(_FINDER_COLUMN_L_P_N_NAME_3);
1527 }
1528 else {
1529 query.append(_FINDER_COLUMN_L_P_N_NAME_2);
1530 }
1531 }
1532
1533 String sql = query.toString();
1534
1535 Session session = null;
1536
1537 try {
1538 session = openSession();
1539
1540 Query q = session.createQuery(sql);
1541
1542 QueryPos qPos = QueryPos.getInstance(q);
1543
1544 qPos.add(layoutSetBranchId);
1545
1546 qPos.add(plid);
1547
1548 if (name != null) {
1549 qPos.add(name);
1550 }
1551
1552 List<LayoutBranch> list = q.list();
1553
1554 result = list;
1555
1556 LayoutBranch layoutBranch = null;
1557
1558 if (list.isEmpty()) {
1559 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_N,
1560 finderArgs, list);
1561 }
1562 else {
1563 layoutBranch = list.get(0);
1564
1565 cacheResult(layoutBranch);
1566
1567 if ((layoutBranch.getLayoutSetBranchId() != layoutSetBranchId) ||
1568 (layoutBranch.getPlid() != plid) ||
1569 (layoutBranch.getName() == null) ||
1570 !layoutBranch.getName().equals(name)) {
1571 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_L_P_N,
1572 finderArgs, layoutBranch);
1573 }
1574 }
1575
1576 return layoutBranch;
1577 }
1578 catch (Exception e) {
1579 throw processException(e);
1580 }
1581 finally {
1582 if (result == null) {
1583 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_L_P_N,
1584 finderArgs);
1585 }
1586
1587 closeSession(session);
1588 }
1589 }
1590 else {
1591 if (result instanceof List<?>) {
1592 return null;
1593 }
1594 else {
1595 return (LayoutBranch)result;
1596 }
1597 }
1598 }
1599
1600
1609 public List<LayoutBranch> findByL_P_M(long layoutSetBranchId, long plid,
1610 boolean master) throws SystemException {
1611 return findByL_P_M(layoutSetBranchId, plid, master, QueryUtil.ALL_POS,
1612 QueryUtil.ALL_POS, null);
1613 }
1614
1615
1630 public List<LayoutBranch> findByL_P_M(long layoutSetBranchId, long plid,
1631 boolean master, int start, int end) throws SystemException {
1632 return findByL_P_M(layoutSetBranchId, plid, master, start, end, null);
1633 }
1634
1635
1651 public List<LayoutBranch> findByL_P_M(long layoutSetBranchId, long plid,
1652 boolean master, int start, int end, OrderByComparator orderByComparator)
1653 throws SystemException {
1654 FinderPath finderPath = null;
1655 Object[] finderArgs = null;
1656
1657 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1658 (orderByComparator == null)) {
1659 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_L_P_M;
1660 finderArgs = new Object[] { layoutSetBranchId, plid, master };
1661 }
1662 else {
1663 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_L_P_M;
1664 finderArgs = new Object[] {
1665 layoutSetBranchId, plid, master,
1666
1667 start, end, orderByComparator
1668 };
1669 }
1670
1671 List<LayoutBranch> list = (List<LayoutBranch>)FinderCacheUtil.getResult(finderPath,
1672 finderArgs, this);
1673
1674 if ((list != null) && !list.isEmpty()) {
1675 for (LayoutBranch layoutBranch : list) {
1676 if ((layoutSetBranchId != layoutBranch.getLayoutSetBranchId()) ||
1677 (plid != layoutBranch.getPlid()) ||
1678 (master != layoutBranch.getMaster())) {
1679 list = null;
1680
1681 break;
1682 }
1683 }
1684 }
1685
1686 if (list == null) {
1687 StringBundler query = null;
1688
1689 if (orderByComparator != null) {
1690 query = new StringBundler(5 +
1691 (orderByComparator.getOrderByFields().length * 3));
1692 }
1693 else {
1694 query = new StringBundler(4);
1695 }
1696
1697 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
1698
1699 query.append(_FINDER_COLUMN_L_P_M_LAYOUTSETBRANCHID_2);
1700
1701 query.append(_FINDER_COLUMN_L_P_M_PLID_2);
1702
1703 query.append(_FINDER_COLUMN_L_P_M_MASTER_2);
1704
1705 if (orderByComparator != null) {
1706 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1707 orderByComparator);
1708 }
1709
1710 String sql = query.toString();
1711
1712 Session session = null;
1713
1714 try {
1715 session = openSession();
1716
1717 Query q = session.createQuery(sql);
1718
1719 QueryPos qPos = QueryPos.getInstance(q);
1720
1721 qPos.add(layoutSetBranchId);
1722
1723 qPos.add(plid);
1724
1725 qPos.add(master);
1726
1727 list = (List<LayoutBranch>)QueryUtil.list(q, getDialect(),
1728 start, end);
1729 }
1730 catch (Exception e) {
1731 throw processException(e);
1732 }
1733 finally {
1734 if (list == null) {
1735 FinderCacheUtil.removeResult(finderPath, finderArgs);
1736 }
1737 else {
1738 cacheResult(list);
1739
1740 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1741 }
1742
1743 closeSession(session);
1744 }
1745 }
1746
1747 return list;
1748 }
1749
1750
1761 public LayoutBranch findByL_P_M_First(long layoutSetBranchId, long plid,
1762 boolean master, OrderByComparator orderByComparator)
1763 throws NoSuchLayoutBranchException, SystemException {
1764 LayoutBranch layoutBranch = fetchByL_P_M_First(layoutSetBranchId, plid,
1765 master, orderByComparator);
1766
1767 if (layoutBranch != null) {
1768 return layoutBranch;
1769 }
1770
1771 StringBundler msg = new StringBundler(8);
1772
1773 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1774
1775 msg.append("layoutSetBranchId=");
1776 msg.append(layoutSetBranchId);
1777
1778 msg.append(", plid=");
1779 msg.append(plid);
1780
1781 msg.append(", master=");
1782 msg.append(master);
1783
1784 msg.append(StringPool.CLOSE_CURLY_BRACE);
1785
1786 throw new NoSuchLayoutBranchException(msg.toString());
1787 }
1788
1789
1799 public LayoutBranch fetchByL_P_M_First(long layoutSetBranchId, long plid,
1800 boolean master, OrderByComparator orderByComparator)
1801 throws SystemException {
1802 List<LayoutBranch> list = findByL_P_M(layoutSetBranchId, plid, master,
1803 0, 1, orderByComparator);
1804
1805 if (!list.isEmpty()) {
1806 return list.get(0);
1807 }
1808
1809 return null;
1810 }
1811
1812
1823 public LayoutBranch findByL_P_M_Last(long layoutSetBranchId, long plid,
1824 boolean master, OrderByComparator orderByComparator)
1825 throws NoSuchLayoutBranchException, SystemException {
1826 LayoutBranch layoutBranch = fetchByL_P_M_Last(layoutSetBranchId, plid,
1827 master, orderByComparator);
1828
1829 if (layoutBranch != null) {
1830 return layoutBranch;
1831 }
1832
1833 StringBundler msg = new StringBundler(8);
1834
1835 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1836
1837 msg.append("layoutSetBranchId=");
1838 msg.append(layoutSetBranchId);
1839
1840 msg.append(", plid=");
1841 msg.append(plid);
1842
1843 msg.append(", master=");
1844 msg.append(master);
1845
1846 msg.append(StringPool.CLOSE_CURLY_BRACE);
1847
1848 throw new NoSuchLayoutBranchException(msg.toString());
1849 }
1850
1851
1861 public LayoutBranch fetchByL_P_M_Last(long layoutSetBranchId, long plid,
1862 boolean master, OrderByComparator orderByComparator)
1863 throws SystemException {
1864 int count = countByL_P_M(layoutSetBranchId, plid, master);
1865
1866 List<LayoutBranch> list = findByL_P_M(layoutSetBranchId, plid, master,
1867 count - 1, count, orderByComparator);
1868
1869 if (!list.isEmpty()) {
1870 return list.get(0);
1871 }
1872
1873 return null;
1874 }
1875
1876
1888 public LayoutBranch[] findByL_P_M_PrevAndNext(long LayoutBranchId,
1889 long layoutSetBranchId, long plid, boolean master,
1890 OrderByComparator orderByComparator)
1891 throws NoSuchLayoutBranchException, SystemException {
1892 LayoutBranch layoutBranch = findByPrimaryKey(LayoutBranchId);
1893
1894 Session session = null;
1895
1896 try {
1897 session = openSession();
1898
1899 LayoutBranch[] array = new LayoutBranchImpl[3];
1900
1901 array[0] = getByL_P_M_PrevAndNext(session, layoutBranch,
1902 layoutSetBranchId, plid, master, orderByComparator, true);
1903
1904 array[1] = layoutBranch;
1905
1906 array[2] = getByL_P_M_PrevAndNext(session, layoutBranch,
1907 layoutSetBranchId, plid, master, orderByComparator, false);
1908
1909 return array;
1910 }
1911 catch (Exception e) {
1912 throw processException(e);
1913 }
1914 finally {
1915 closeSession(session);
1916 }
1917 }
1918
1919 protected LayoutBranch getByL_P_M_PrevAndNext(Session session,
1920 LayoutBranch layoutBranch, long layoutSetBranchId, long plid,
1921 boolean master, OrderByComparator orderByComparator, boolean previous) {
1922 StringBundler query = null;
1923
1924 if (orderByComparator != null) {
1925 query = new StringBundler(6 +
1926 (orderByComparator.getOrderByFields().length * 6));
1927 }
1928 else {
1929 query = new StringBundler(3);
1930 }
1931
1932 query.append(_SQL_SELECT_LAYOUTBRANCH_WHERE);
1933
1934 query.append(_FINDER_COLUMN_L_P_M_LAYOUTSETBRANCHID_2);
1935
1936 query.append(_FINDER_COLUMN_L_P_M_PLID_2);
1937
1938 query.append(_FINDER_COLUMN_L_P_M_MASTER_2);
1939
1940 if (orderByComparator != null) {
1941 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1942
1943 if (orderByConditionFields.length > 0) {
1944 query.append(WHERE_AND);
1945 }
1946
1947 for (int i = 0; i < orderByConditionFields.length; i++) {
1948 query.append(_ORDER_BY_ENTITY_ALIAS);
1949 query.append(orderByConditionFields[i]);
1950
1951 if ((i + 1) < orderByConditionFields.length) {
1952 if (orderByComparator.isAscending() ^ previous) {
1953 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1954 }
1955 else {
1956 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1957 }
1958 }
1959 else {
1960 if (orderByComparator.isAscending() ^ previous) {
1961 query.append(WHERE_GREATER_THAN);
1962 }
1963 else {
1964 query.append(WHERE_LESSER_THAN);
1965 }
1966 }
1967 }
1968
1969 query.append(ORDER_BY_CLAUSE);
1970
1971 String[] orderByFields = orderByComparator.getOrderByFields();
1972
1973 for (int i = 0; i < orderByFields.length; i++) {
1974 query.append(_ORDER_BY_ENTITY_ALIAS);
1975 query.append(orderByFields[i]);
1976
1977 if ((i + 1) < orderByFields.length) {
1978 if (orderByComparator.isAscending() ^ previous) {
1979 query.append(ORDER_BY_ASC_HAS_NEXT);
1980 }
1981 else {
1982 query.append(ORDER_BY_DESC_HAS_NEXT);
1983 }
1984 }
1985 else {
1986 if (orderByComparator.isAscending() ^ previous) {
1987 query.append(ORDER_BY_ASC);
1988 }
1989 else {
1990 query.append(ORDER_BY_DESC);
1991 }
1992 }
1993 }
1994 }
1995
1996 String sql = query.toString();
1997
1998 Query q = session.createQuery(sql);
1999
2000 q.setFirstResult(0);
2001 q.setMaxResults(2);
2002
2003 QueryPos qPos = QueryPos.getInstance(q);
2004
2005 qPos.add(layoutSetBranchId);
2006
2007 qPos.add(plid);
2008
2009 qPos.add(master);
2010
2011 if (orderByComparator != null) {
2012 Object[] values = orderByComparator.getOrderByConditionValues(layoutBranch);
2013
2014 for (Object value : values) {
2015 qPos.add(value);
2016 }
2017 }
2018
2019 List<LayoutBranch> list = q.list();
2020
2021 if (list.size() == 2) {
2022 return list.get(1);
2023 }
2024 else {
2025 return null;
2026 }
2027 }
2028
2029
2035 public List<LayoutBranch> findAll() throws SystemException {
2036 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2037 }
2038
2039
2051 public List<LayoutBranch> findAll(int start, int end)
2052 throws SystemException {
2053 return findAll(start, end, null);
2054 }
2055
2056
2069 public List<LayoutBranch> findAll(int start, int end,
2070 OrderByComparator orderByComparator) throws SystemException {
2071 FinderPath finderPath = null;
2072 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2073
2074 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2075 (orderByComparator == null)) {
2076 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2077 finderArgs = FINDER_ARGS_EMPTY;
2078 }
2079 else {
2080 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2081 finderArgs = new Object[] { start, end, orderByComparator };
2082 }
2083
2084 List<LayoutBranch> list = (List<LayoutBranch>)FinderCacheUtil.getResult(finderPath,
2085 finderArgs, this);
2086
2087 if (list == null) {
2088 StringBundler query = null;
2089 String sql = null;
2090
2091 if (orderByComparator != null) {
2092 query = new StringBundler(2 +
2093 (orderByComparator.getOrderByFields().length * 3));
2094
2095 query.append(_SQL_SELECT_LAYOUTBRANCH);
2096
2097 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2098 orderByComparator);
2099
2100 sql = query.toString();
2101 }
2102 else {
2103 sql = _SQL_SELECT_LAYOUTBRANCH;
2104 }
2105
2106 Session session = null;
2107
2108 try {
2109 session = openSession();
2110
2111 Query q = session.createQuery(sql);
2112
2113 if (orderByComparator == null) {
2114 list = (List<LayoutBranch>)QueryUtil.list(q, getDialect(),
2115 start, end, false);
2116
2117 Collections.sort(list);
2118 }
2119 else {
2120 list = (List<LayoutBranch>)QueryUtil.list(q, getDialect(),
2121 start, end);
2122 }
2123 }
2124 catch (Exception e) {
2125 throw processException(e);
2126 }
2127 finally {
2128 if (list == null) {
2129 FinderCacheUtil.removeResult(finderPath, finderArgs);
2130 }
2131 else {
2132 cacheResult(list);
2133
2134 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2135 }
2136
2137 closeSession(session);
2138 }
2139 }
2140
2141 return list;
2142 }
2143
2144
2150 public void removeByLayoutSetBranchId(long layoutSetBranchId)
2151 throws SystemException {
2152 for (LayoutBranch layoutBranch : findByLayoutSetBranchId(
2153 layoutSetBranchId)) {
2154 remove(layoutBranch);
2155 }
2156 }
2157
2158
2165 public void removeByL_P(long layoutSetBranchId, long plid)
2166 throws SystemException {
2167 for (LayoutBranch layoutBranch : findByL_P(layoutSetBranchId, plid)) {
2168 remove(layoutBranch);
2169 }
2170 }
2171
2172
2181 public LayoutBranch removeByL_P_N(long layoutSetBranchId, long plid,
2182 String name) throws NoSuchLayoutBranchException, SystemException {
2183 LayoutBranch layoutBranch = findByL_P_N(layoutSetBranchId, plid, name);
2184
2185 return remove(layoutBranch);
2186 }
2187
2188
2196 public void removeByL_P_M(long layoutSetBranchId, long plid, boolean master)
2197 throws SystemException {
2198 for (LayoutBranch layoutBranch : findByL_P_M(layoutSetBranchId, plid,
2199 master)) {
2200 remove(layoutBranch);
2201 }
2202 }
2203
2204
2209 public void removeAll() throws SystemException {
2210 for (LayoutBranch layoutBranch : findAll()) {
2211 remove(layoutBranch);
2212 }
2213 }
2214
2215
2222 public int countByLayoutSetBranchId(long layoutSetBranchId)
2223 throws SystemException {
2224 Object[] finderArgs = new Object[] { layoutSetBranchId };
2225
2226 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_LAYOUTSETBRANCHID,
2227 finderArgs, this);
2228
2229 if (count == null) {
2230 StringBundler query = new StringBundler(2);
2231
2232 query.append(_SQL_COUNT_LAYOUTBRANCH_WHERE);
2233
2234 query.append(_FINDER_COLUMN_LAYOUTSETBRANCHID_LAYOUTSETBRANCHID_2);
2235
2236 String sql = query.toString();
2237
2238 Session session = null;
2239
2240 try {
2241 session = openSession();
2242
2243 Query q = session.createQuery(sql);
2244
2245 QueryPos qPos = QueryPos.getInstance(q);
2246
2247 qPos.add(layoutSetBranchId);
2248
2249 count = (Long)q.uniqueResult();
2250 }
2251 catch (Exception e) {
2252 throw processException(e);
2253 }
2254 finally {
2255 if (count == null) {
2256 count = Long.valueOf(0);
2257 }
2258
2259 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_LAYOUTSETBRANCHID,
2260 finderArgs, count);
2261
2262 closeSession(session);
2263 }
2264 }
2265
2266 return count.intValue();
2267 }
2268
2269
2277 public int countByL_P(long layoutSetBranchId, long plid)
2278 throws SystemException {
2279 Object[] finderArgs = new Object[] { layoutSetBranchId, plid };
2280
2281 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_L_P,
2282 finderArgs, this);
2283
2284 if (count == null) {
2285 StringBundler query = new StringBundler(3);
2286
2287 query.append(_SQL_COUNT_LAYOUTBRANCH_WHERE);
2288
2289 query.append(_FINDER_COLUMN_L_P_LAYOUTSETBRANCHID_2);
2290
2291 query.append(_FINDER_COLUMN_L_P_PLID_2);
2292
2293 String sql = query.toString();
2294
2295 Session session = null;
2296
2297 try {
2298 session = openSession();
2299
2300 Query q = session.createQuery(sql);
2301
2302 QueryPos qPos = QueryPos.getInstance(q);
2303
2304 qPos.add(layoutSetBranchId);
2305
2306 qPos.add(plid);
2307
2308 count = (Long)q.uniqueResult();
2309 }
2310 catch (Exception e) {
2311 throw processException(e);
2312 }
2313 finally {
2314 if (count == null) {
2315 count = Long.valueOf(0);
2316 }
2317
2318 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_L_P, finderArgs,
2319 count);
2320
2321 closeSession(session);
2322 }
2323 }
2324
2325 return count.intValue();
2326 }
2327
2328
2337 public int countByL_P_N(long layoutSetBranchId, long plid, String name)
2338 throws SystemException {
2339 Object[] finderArgs = new Object[] { layoutSetBranchId, plid, name };
2340
2341 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_L_P_N,
2342 finderArgs, this);
2343
2344 if (count == null) {
2345 StringBundler query = new StringBundler(4);
2346
2347 query.append(_SQL_COUNT_LAYOUTBRANCH_WHERE);
2348
2349 query.append(_FINDER_COLUMN_L_P_N_LAYOUTSETBRANCHID_2);
2350
2351 query.append(_FINDER_COLUMN_L_P_N_PLID_2);
2352
2353 if (name == null) {
2354 query.append(_FINDER_COLUMN_L_P_N_NAME_1);
2355 }
2356 else {
2357 if (name.equals(StringPool.BLANK)) {
2358 query.append(_FINDER_COLUMN_L_P_N_NAME_3);
2359 }
2360 else {
2361 query.append(_FINDER_COLUMN_L_P_N_NAME_2);
2362 }
2363 }
2364
2365 String sql = query.toString();
2366
2367 Session session = null;
2368
2369 try {
2370 session = openSession();
2371
2372 Query q = session.createQuery(sql);
2373
2374 QueryPos qPos = QueryPos.getInstance(q);
2375
2376 qPos.add(layoutSetBranchId);
2377
2378 qPos.add(plid);
2379
2380 if (name != null) {
2381 qPos.add(name);
2382 }
2383
2384 count = (Long)q.uniqueResult();
2385 }
2386 catch (Exception e) {
2387 throw processException(e);
2388 }
2389 finally {
2390 if (count == null) {
2391 count = Long.valueOf(0);
2392 }
2393
2394 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_L_P_N,
2395 finderArgs, count);
2396
2397 closeSession(session);
2398 }
2399 }
2400
2401 return count.intValue();
2402 }
2403
2404
2413 public int countByL_P_M(long layoutSetBranchId, long plid, boolean master)
2414 throws SystemException {
2415 Object[] finderArgs = new Object[] { layoutSetBranchId, plid, master };
2416
2417 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_L_P_M,
2418 finderArgs, this);
2419
2420 if (count == null) {
2421 StringBundler query = new StringBundler(4);
2422
2423 query.append(_SQL_COUNT_LAYOUTBRANCH_WHERE);
2424
2425 query.append(_FINDER_COLUMN_L_P_M_LAYOUTSETBRANCHID_2);
2426
2427 query.append(_FINDER_COLUMN_L_P_M_PLID_2);
2428
2429 query.append(_FINDER_COLUMN_L_P_M_MASTER_2);
2430
2431 String sql = query.toString();
2432
2433 Session session = null;
2434
2435 try {
2436 session = openSession();
2437
2438 Query q = session.createQuery(sql);
2439
2440 QueryPos qPos = QueryPos.getInstance(q);
2441
2442 qPos.add(layoutSetBranchId);
2443
2444 qPos.add(plid);
2445
2446 qPos.add(master);
2447
2448 count = (Long)q.uniqueResult();
2449 }
2450 catch (Exception e) {
2451 throw processException(e);
2452 }
2453 finally {
2454 if (count == null) {
2455 count = Long.valueOf(0);
2456 }
2457
2458 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_L_P_M,
2459 finderArgs, count);
2460
2461 closeSession(session);
2462 }
2463 }
2464
2465 return count.intValue();
2466 }
2467
2468
2474 public int countAll() throws SystemException {
2475 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2476 FINDER_ARGS_EMPTY, this);
2477
2478 if (count == null) {
2479 Session session = null;
2480
2481 try {
2482 session = openSession();
2483
2484 Query q = session.createQuery(_SQL_COUNT_LAYOUTBRANCH);
2485
2486 count = (Long)q.uniqueResult();
2487 }
2488 catch (Exception e) {
2489 throw processException(e);
2490 }
2491 finally {
2492 if (count == null) {
2493 count = Long.valueOf(0);
2494 }
2495
2496 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2497 FINDER_ARGS_EMPTY, count);
2498
2499 closeSession(session);
2500 }
2501 }
2502
2503 return count.intValue();
2504 }
2505
2506
2509 public void afterPropertiesSet() {
2510 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2511 com.liferay.portal.util.PropsUtil.get(
2512 "value.object.listener.com.liferay.portal.model.LayoutBranch")));
2513
2514 if (listenerClassNames.length > 0) {
2515 try {
2516 List<ModelListener<LayoutBranch>> listenersList = new ArrayList<ModelListener<LayoutBranch>>();
2517
2518 for (String listenerClassName : listenerClassNames) {
2519 Class<?> clazz = getClass();
2520
2521 listenersList.add((ModelListener<LayoutBranch>)InstanceFactory.newInstance(
2522 clazz.getClassLoader(), listenerClassName));
2523 }
2524
2525 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2526 }
2527 catch (Exception e) {
2528 _log.error(e);
2529 }
2530 }
2531 }
2532
2533 public void destroy() {
2534 EntityCacheUtil.removeCache(LayoutBranchImpl.class.getName());
2535 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2536 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2537 }
2538
2539 @BeanReference(type = AccountPersistence.class)
2540 protected AccountPersistence accountPersistence;
2541 @BeanReference(type = AddressPersistence.class)
2542 protected AddressPersistence addressPersistence;
2543 @BeanReference(type = BrowserTrackerPersistence.class)
2544 protected BrowserTrackerPersistence browserTrackerPersistence;
2545 @BeanReference(type = ClassNamePersistence.class)
2546 protected ClassNamePersistence classNamePersistence;
2547 @BeanReference(type = ClusterGroupPersistence.class)
2548 protected ClusterGroupPersistence clusterGroupPersistence;
2549 @BeanReference(type = CompanyPersistence.class)
2550 protected CompanyPersistence companyPersistence;
2551 @BeanReference(type = ContactPersistence.class)
2552 protected ContactPersistence contactPersistence;
2553 @BeanReference(type = CountryPersistence.class)
2554 protected CountryPersistence countryPersistence;
2555 @BeanReference(type = EmailAddressPersistence.class)
2556 protected EmailAddressPersistence emailAddressPersistence;
2557 @BeanReference(type = GroupPersistence.class)
2558 protected GroupPersistence groupPersistence;
2559 @BeanReference(type = ImagePersistence.class)
2560 protected ImagePersistence imagePersistence;
2561 @BeanReference(type = LayoutPersistence.class)
2562 protected LayoutPersistence layoutPersistence;
2563 @BeanReference(type = LayoutBranchPersistence.class)
2564 protected LayoutBranchPersistence layoutBranchPersistence;
2565 @BeanReference(type = LayoutPrototypePersistence.class)
2566 protected LayoutPrototypePersistence layoutPrototypePersistence;
2567 @BeanReference(type = LayoutRevisionPersistence.class)
2568 protected LayoutRevisionPersistence layoutRevisionPersistence;
2569 @BeanReference(type = LayoutSetPersistence.class)
2570 protected LayoutSetPersistence layoutSetPersistence;
2571 @BeanReference(type = LayoutSetBranchPersistence.class)
2572 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
2573 @BeanReference(type = LayoutSetPrototypePersistence.class)
2574 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2575 @BeanReference(type = ListTypePersistence.class)
2576 protected ListTypePersistence listTypePersistence;
2577 @BeanReference(type = LockPersistence.class)
2578 protected LockPersistence lockPersistence;
2579 @BeanReference(type = MembershipRequestPersistence.class)
2580 protected MembershipRequestPersistence membershipRequestPersistence;
2581 @BeanReference(type = OrganizationPersistence.class)
2582 protected OrganizationPersistence organizationPersistence;
2583 @BeanReference(type = OrgGroupPermissionPersistence.class)
2584 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2585 @BeanReference(type = OrgGroupRolePersistence.class)
2586 protected OrgGroupRolePersistence orgGroupRolePersistence;
2587 @BeanReference(type = OrgLaborPersistence.class)
2588 protected OrgLaborPersistence orgLaborPersistence;
2589 @BeanReference(type = PasswordPolicyPersistence.class)
2590 protected PasswordPolicyPersistence passwordPolicyPersistence;
2591 @BeanReference(type = PasswordPolicyRelPersistence.class)
2592 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2593 @BeanReference(type = PasswordTrackerPersistence.class)
2594 protected PasswordTrackerPersistence passwordTrackerPersistence;
2595 @BeanReference(type = PermissionPersistence.class)
2596 protected PermissionPersistence permissionPersistence;
2597 @BeanReference(type = PhonePersistence.class)
2598 protected PhonePersistence phonePersistence;
2599 @BeanReference(type = PluginSettingPersistence.class)
2600 protected PluginSettingPersistence pluginSettingPersistence;
2601 @BeanReference(type = PortalPreferencesPersistence.class)
2602 protected PortalPreferencesPersistence portalPreferencesPersistence;
2603 @BeanReference(type = PortletPersistence.class)
2604 protected PortletPersistence portletPersistence;
2605 @BeanReference(type = PortletItemPersistence.class)
2606 protected PortletItemPersistence portletItemPersistence;
2607 @BeanReference(type = PortletPreferencesPersistence.class)
2608 protected PortletPreferencesPersistence portletPreferencesPersistence;
2609 @BeanReference(type = RegionPersistence.class)
2610 protected RegionPersistence regionPersistence;
2611 @BeanReference(type = ReleasePersistence.class)
2612 protected ReleasePersistence releasePersistence;
2613 @BeanReference(type = RepositoryPersistence.class)
2614 protected RepositoryPersistence repositoryPersistence;
2615 @BeanReference(type = RepositoryEntryPersistence.class)
2616 protected RepositoryEntryPersistence repositoryEntryPersistence;
2617 @BeanReference(type = ResourcePersistence.class)
2618 protected ResourcePersistence resourcePersistence;
2619 @BeanReference(type = ResourceActionPersistence.class)
2620 protected ResourceActionPersistence resourceActionPersistence;
2621 @BeanReference(type = ResourceBlockPersistence.class)
2622 protected ResourceBlockPersistence resourceBlockPersistence;
2623 @BeanReference(type = ResourceBlockPermissionPersistence.class)
2624 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
2625 @BeanReference(type = ResourceCodePersistence.class)
2626 protected ResourceCodePersistence resourceCodePersistence;
2627 @BeanReference(type = ResourcePermissionPersistence.class)
2628 protected ResourcePermissionPersistence resourcePermissionPersistence;
2629 @BeanReference(type = ResourceTypePermissionPersistence.class)
2630 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
2631 @BeanReference(type = RolePersistence.class)
2632 protected RolePersistence rolePersistence;
2633 @BeanReference(type = ServiceComponentPersistence.class)
2634 protected ServiceComponentPersistence serviceComponentPersistence;
2635 @BeanReference(type = ShardPersistence.class)
2636 protected ShardPersistence shardPersistence;
2637 @BeanReference(type = SubscriptionPersistence.class)
2638 protected SubscriptionPersistence subscriptionPersistence;
2639 @BeanReference(type = TeamPersistence.class)
2640 protected TeamPersistence teamPersistence;
2641 @BeanReference(type = TicketPersistence.class)
2642 protected TicketPersistence ticketPersistence;
2643 @BeanReference(type = UserPersistence.class)
2644 protected UserPersistence userPersistence;
2645 @BeanReference(type = UserGroupPersistence.class)
2646 protected UserGroupPersistence userGroupPersistence;
2647 @BeanReference(type = UserGroupGroupRolePersistence.class)
2648 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2649 @BeanReference(type = UserGroupRolePersistence.class)
2650 protected UserGroupRolePersistence userGroupRolePersistence;
2651 @BeanReference(type = UserIdMapperPersistence.class)
2652 protected UserIdMapperPersistence userIdMapperPersistence;
2653 @BeanReference(type = UserNotificationEventPersistence.class)
2654 protected UserNotificationEventPersistence userNotificationEventPersistence;
2655 @BeanReference(type = UserTrackerPersistence.class)
2656 protected UserTrackerPersistence userTrackerPersistence;
2657 @BeanReference(type = UserTrackerPathPersistence.class)
2658 protected UserTrackerPathPersistence userTrackerPathPersistence;
2659 @BeanReference(type = VirtualHostPersistence.class)
2660 protected VirtualHostPersistence virtualHostPersistence;
2661 @BeanReference(type = WebDAVPropsPersistence.class)
2662 protected WebDAVPropsPersistence webDAVPropsPersistence;
2663 @BeanReference(type = WebsitePersistence.class)
2664 protected WebsitePersistence websitePersistence;
2665 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2666 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2667 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2668 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2669 private static final String _SQL_SELECT_LAYOUTBRANCH = "SELECT layoutBranch FROM LayoutBranch layoutBranch";
2670 private static final String _SQL_SELECT_LAYOUTBRANCH_WHERE = "SELECT layoutBranch FROM LayoutBranch layoutBranch WHERE ";
2671 private static final String _SQL_COUNT_LAYOUTBRANCH = "SELECT COUNT(layoutBranch) FROM LayoutBranch layoutBranch";
2672 private static final String _SQL_COUNT_LAYOUTBRANCH_WHERE = "SELECT COUNT(layoutBranch) FROM LayoutBranch layoutBranch WHERE ";
2673 private static final String _FINDER_COLUMN_LAYOUTSETBRANCHID_LAYOUTSETBRANCHID_2 =
2674 "layoutBranch.layoutSetBranchId = ?";
2675 private static final String _FINDER_COLUMN_L_P_LAYOUTSETBRANCHID_2 = "layoutBranch.layoutSetBranchId = ? AND ";
2676 private static final String _FINDER_COLUMN_L_P_PLID_2 = "layoutBranch.plid = ?";
2677 private static final String _FINDER_COLUMN_L_P_N_LAYOUTSETBRANCHID_2 = "layoutBranch.layoutSetBranchId = ? AND ";
2678 private static final String _FINDER_COLUMN_L_P_N_PLID_2 = "layoutBranch.plid = ? AND ";
2679 private static final String _FINDER_COLUMN_L_P_N_NAME_1 = "layoutBranch.name IS NULL";
2680 private static final String _FINDER_COLUMN_L_P_N_NAME_2 = "layoutBranch.name = ?";
2681 private static final String _FINDER_COLUMN_L_P_N_NAME_3 = "(layoutBranch.name IS NULL OR layoutBranch.name = ?)";
2682 private static final String _FINDER_COLUMN_L_P_M_LAYOUTSETBRANCHID_2 = "layoutBranch.layoutSetBranchId = ? AND ";
2683 private static final String _FINDER_COLUMN_L_P_M_PLID_2 = "layoutBranch.plid = ? AND ";
2684 private static final String _FINDER_COLUMN_L_P_M_MASTER_2 = "layoutBranch.master = ?";
2685 private static final String _ORDER_BY_ENTITY_ALIAS = "layoutBranch.";
2686 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No LayoutBranch exists with the primary key ";
2687 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No LayoutBranch exists with the key {";
2688 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2689 private static Log _log = LogFactoryUtil.getLog(LayoutBranchPersistenceImpl.class);
2690 private static LayoutBranch _nullLayoutBranch = new LayoutBranchImpl() {
2691 @Override
2692 public Object clone() {
2693 return this;
2694 }
2695
2696 @Override
2697 public CacheModel<LayoutBranch> toCacheModel() {
2698 return _nullLayoutBranchCacheModel;
2699 }
2700 };
2701
2702 private static CacheModel<LayoutBranch> _nullLayoutBranchCacheModel = new CacheModel<LayoutBranch>() {
2703 public LayoutBranch toEntityModel() {
2704 return _nullLayoutBranch;
2705 }
2706 };
2707 }