001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.NoSuchPortletPreferencesException;
019 import com.liferay.portal.kernel.bean.BeanReference;
020 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023 import com.liferay.portal.kernel.dao.orm.FinderPath;
024 import com.liferay.portal.kernel.dao.orm.Query;
025 import com.liferay.portal.kernel.dao.orm.QueryPos;
026 import com.liferay.portal.kernel.dao.orm.QueryUtil;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.GetterUtil;
032 import com.liferay.portal.kernel.util.InstanceFactory;
033 import com.liferay.portal.kernel.util.OrderByComparator;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.model.CacheModel;
038 import com.liferay.portal.model.ModelListener;
039 import com.liferay.portal.model.PortletPreferences;
040 import com.liferay.portal.model.impl.PortletPreferencesImpl;
041 import com.liferay.portal.model.impl.PortletPreferencesModelImpl;
042 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043
044 import java.io.Serializable;
045
046 import java.util.ArrayList;
047 import java.util.Collections;
048 import java.util.List;
049
050
062 public class PortletPreferencesPersistenceImpl extends BasePersistenceImpl<PortletPreferences>
063 implements PortletPreferencesPersistence {
064
069 public static final String FINDER_CLASS_NAME_ENTITY = PortletPreferencesImpl.class.getName();
070 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
071 ".List1";
072 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
073 ".List2";
074 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_PLID = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
075 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
076 PortletPreferencesImpl.class,
077 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByPlid",
078 new String[] {
079 Long.class.getName(),
080
081 "java.lang.Integer", "java.lang.Integer",
082 "com.liferay.portal.kernel.util.OrderByComparator"
083 });
084 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
085 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
086 PortletPreferencesImpl.class,
087 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByPlid",
088 new String[] { Long.class.getName() },
089 PortletPreferencesModelImpl.PLID_COLUMN_BITMASK);
090 public static final FinderPath FINDER_PATH_COUNT_BY_PLID = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
091 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
092 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByPlid",
093 new String[] { Long.class.getName() });
094 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
095 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
096 PortletPreferencesImpl.class,
097 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByP_P",
098 new String[] {
099 Long.class.getName(), String.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_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
105 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
106 PortletPreferencesImpl.class,
107 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByP_P",
108 new String[] { Long.class.getName(), String.class.getName() },
109 PortletPreferencesModelImpl.PLID_COLUMN_BITMASK |
110 PortletPreferencesModelImpl.PORTLETID_COLUMN_BITMASK);
111 public static final FinderPath FINDER_PATH_COUNT_BY_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
112 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
113 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByP_P",
114 new String[] { Long.class.getName(), String.class.getName() });
115 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_O_O_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
116 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
117 PortletPreferencesImpl.class,
118 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByO_O_P",
119 new String[] {
120 Long.class.getName(), Integer.class.getName(),
121 Long.class.getName(),
122
123 "java.lang.Integer", "java.lang.Integer",
124 "com.liferay.portal.kernel.util.OrderByComparator"
125 });
126 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
127 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
128 PortletPreferencesImpl.class,
129 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByO_O_P",
130 new String[] {
131 Long.class.getName(), Integer.class.getName(),
132 Long.class.getName()
133 },
134 PortletPreferencesModelImpl.OWNERID_COLUMN_BITMASK |
135 PortletPreferencesModelImpl.OWNERTYPE_COLUMN_BITMASK |
136 PortletPreferencesModelImpl.PLID_COLUMN_BITMASK);
137 public static final FinderPath FINDER_PATH_COUNT_BY_O_O_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
138 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
139 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByO_O_P",
140 new String[] {
141 Long.class.getName(), Integer.class.getName(),
142 Long.class.getName()
143 });
144 public static final FinderPath FINDER_PATH_FETCH_BY_O_O_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
145 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
146 PortletPreferencesImpl.class, FINDER_CLASS_NAME_ENTITY,
147 "fetchByO_O_P_P",
148 new String[] {
149 Long.class.getName(), Integer.class.getName(),
150 Long.class.getName(), String.class.getName()
151 },
152 PortletPreferencesModelImpl.OWNERID_COLUMN_BITMASK |
153 PortletPreferencesModelImpl.OWNERTYPE_COLUMN_BITMASK |
154 PortletPreferencesModelImpl.PLID_COLUMN_BITMASK |
155 PortletPreferencesModelImpl.PORTLETID_COLUMN_BITMASK);
156 public static final FinderPath FINDER_PATH_COUNT_BY_O_O_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
157 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
158 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByO_O_P_P",
159 new String[] {
160 Long.class.getName(), Integer.class.getName(),
161 Long.class.getName(), String.class.getName()
162 });
163 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
164 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
165 PortletPreferencesImpl.class,
166 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
167 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
168 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
169 PortletPreferencesImpl.class,
170 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
171 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
172 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
173 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
174
175
180 public void cacheResult(PortletPreferences portletPreferences) {
181 EntityCacheUtil.putResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
182 PortletPreferencesImpl.class, portletPreferences.getPrimaryKey(),
183 portletPreferences);
184
185 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
186 new Object[] {
187 Long.valueOf(portletPreferences.getOwnerId()),
188 Integer.valueOf(portletPreferences.getOwnerType()),
189 Long.valueOf(portletPreferences.getPlid()),
190
191 portletPreferences.getPortletId()
192 }, portletPreferences);
193
194 portletPreferences.resetOriginalValues();
195 }
196
197
202 public void cacheResult(List<PortletPreferences> portletPreferenceses) {
203 for (PortletPreferences portletPreferences : portletPreferenceses) {
204 if (EntityCacheUtil.getResult(
205 PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
206 PortletPreferencesImpl.class,
207 portletPreferences.getPrimaryKey()) == null) {
208 cacheResult(portletPreferences);
209 }
210 else {
211 portletPreferences.resetOriginalValues();
212 }
213 }
214 }
215
216
223 @Override
224 public void clearCache() {
225 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
226 CacheRegistryUtil.clear(PortletPreferencesImpl.class.getName());
227 }
228
229 EntityCacheUtil.clearCache(PortletPreferencesImpl.class.getName());
230
231 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
232 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
233 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
234 }
235
236
243 @Override
244 public void clearCache(PortletPreferences portletPreferences) {
245 EntityCacheUtil.removeResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
246 PortletPreferencesImpl.class, portletPreferences.getPrimaryKey());
247
248 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
249 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
250
251 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O_P_P,
252 new Object[] {
253 Long.valueOf(portletPreferences.getOwnerId()),
254 Integer.valueOf(portletPreferences.getOwnerType()),
255 Long.valueOf(portletPreferences.getPlid()),
256
257 portletPreferences.getPortletId()
258 });
259 }
260
261
267 public PortletPreferences create(long portletPreferencesId) {
268 PortletPreferences portletPreferences = new PortletPreferencesImpl();
269
270 portletPreferences.setNew(true);
271 portletPreferences.setPrimaryKey(portletPreferencesId);
272
273 return portletPreferences;
274 }
275
276
284 @Override
285 public PortletPreferences remove(Serializable primaryKey)
286 throws NoSuchModelException, SystemException {
287 return remove(((Long)primaryKey).longValue());
288 }
289
290
298 public PortletPreferences remove(long portletPreferencesId)
299 throws NoSuchPortletPreferencesException, SystemException {
300 Session session = null;
301
302 try {
303 session = openSession();
304
305 PortletPreferences portletPreferences = (PortletPreferences)session.get(PortletPreferencesImpl.class,
306 Long.valueOf(portletPreferencesId));
307
308 if (portletPreferences == null) {
309 if (_log.isWarnEnabled()) {
310 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
311 portletPreferencesId);
312 }
313
314 throw new NoSuchPortletPreferencesException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
315 portletPreferencesId);
316 }
317
318 return portletPreferencesPersistence.remove(portletPreferences);
319 }
320 catch (NoSuchPortletPreferencesException nsee) {
321 throw nsee;
322 }
323 catch (Exception e) {
324 throw processException(e);
325 }
326 finally {
327 closeSession(session);
328 }
329 }
330
331
338 @Override
339 public PortletPreferences remove(PortletPreferences portletPreferences)
340 throws SystemException {
341 return super.remove(portletPreferences);
342 }
343
344 @Override
345 protected PortletPreferences removeImpl(
346 PortletPreferences portletPreferences) throws SystemException {
347 portletPreferences = toUnwrappedModel(portletPreferences);
348
349 Session session = null;
350
351 try {
352 session = openSession();
353
354 BatchSessionUtil.delete(session, portletPreferences);
355 }
356 catch (Exception e) {
357 throw processException(e);
358 }
359 finally {
360 closeSession(session);
361 }
362
363 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
364 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
365
366 PortletPreferencesModelImpl portletPreferencesModelImpl = (PortletPreferencesModelImpl)portletPreferences;
367
368 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O_P_P,
369 new Object[] {
370 Long.valueOf(portletPreferencesModelImpl.getOwnerId()),
371 Integer.valueOf(portletPreferencesModelImpl.getOwnerType()),
372 Long.valueOf(portletPreferencesModelImpl.getPlid()),
373
374 portletPreferencesModelImpl.getPortletId()
375 });
376
377 EntityCacheUtil.removeResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
378 PortletPreferencesImpl.class, portletPreferences.getPrimaryKey());
379
380 return portletPreferences;
381 }
382
383 @Override
384 public PortletPreferences updateImpl(
385 com.liferay.portal.model.PortletPreferences portletPreferences,
386 boolean merge) throws SystemException {
387 portletPreferences = toUnwrappedModel(portletPreferences);
388
389 boolean isNew = portletPreferences.isNew();
390
391 PortletPreferencesModelImpl portletPreferencesModelImpl = (PortletPreferencesModelImpl)portletPreferences;
392
393 Session session = null;
394
395 try {
396 session = openSession();
397
398 BatchSessionUtil.update(session, portletPreferences, merge);
399
400 portletPreferences.setNew(false);
401 }
402 catch (Exception e) {
403 throw processException(e);
404 }
405 finally {
406 closeSession(session);
407 }
408
409 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
410
411 if (isNew || !PortletPreferencesModelImpl.COLUMN_BITMASK_ENABLED) {
412 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
413 }
414
415 else {
416 if ((portletPreferencesModelImpl.getColumnBitmask() &
417 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID.getColumnBitmask()) != 0) {
418 Object[] args = new Object[] {
419 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid())
420 };
421
422 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PLID, args);
423 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID,
424 args);
425
426 args = new Object[] {
427 Long.valueOf(portletPreferencesModelImpl.getPlid())
428 };
429
430 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PLID, args);
431 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID,
432 args);
433 }
434
435 if ((portletPreferencesModelImpl.getColumnBitmask() &
436 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P.getColumnBitmask()) != 0) {
437 Object[] args = new Object[] {
438 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid()),
439
440 portletPreferencesModelImpl.getOriginalPortletId()
441 };
442
443 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_P_P, args);
444 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P,
445 args);
446
447 args = new Object[] {
448 Long.valueOf(portletPreferencesModelImpl.getPlid()),
449
450 portletPreferencesModelImpl.getPortletId()
451 };
452
453 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_P_P, args);
454 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P,
455 args);
456 }
457
458 if ((portletPreferencesModelImpl.getColumnBitmask() &
459 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P.getColumnBitmask()) != 0) {
460 Object[] args = new Object[] {
461 Long.valueOf(portletPreferencesModelImpl.getOriginalOwnerId()),
462 Integer.valueOf(portletPreferencesModelImpl.getOriginalOwnerType()),
463 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid())
464 };
465
466 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_O_P, args);
467 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P,
468 args);
469
470 args = new Object[] {
471 Long.valueOf(portletPreferencesModelImpl.getOwnerId()),
472 Integer.valueOf(portletPreferencesModelImpl.getOwnerType()),
473 Long.valueOf(portletPreferencesModelImpl.getPlid())
474 };
475
476 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_O_P, args);
477 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P,
478 args);
479 }
480 }
481
482 EntityCacheUtil.putResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
483 PortletPreferencesImpl.class, portletPreferences.getPrimaryKey(),
484 portletPreferences);
485
486 if (isNew) {
487 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
488 new Object[] {
489 Long.valueOf(portletPreferences.getOwnerId()),
490 Integer.valueOf(portletPreferences.getOwnerType()),
491 Long.valueOf(portletPreferences.getPlid()),
492
493 portletPreferences.getPortletId()
494 }, portletPreferences);
495 }
496 else {
497 if ((portletPreferencesModelImpl.getColumnBitmask() &
498 FINDER_PATH_FETCH_BY_O_O_P_P.getColumnBitmask()) != 0) {
499 Object[] args = new Object[] {
500 Long.valueOf(portletPreferencesModelImpl.getOriginalOwnerId()),
501 Integer.valueOf(portletPreferencesModelImpl.getOriginalOwnerType()),
502 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid()),
503
504 portletPreferencesModelImpl.getOriginalPortletId()
505 };
506
507 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_O_P_P, args);
508 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O_P_P, args);
509
510 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
511 new Object[] {
512 Long.valueOf(portletPreferences.getOwnerId()),
513 Integer.valueOf(portletPreferences.getOwnerType()),
514 Long.valueOf(portletPreferences.getPlid()),
515
516 portletPreferences.getPortletId()
517 }, portletPreferences);
518 }
519 }
520
521 return portletPreferences;
522 }
523
524 protected PortletPreferences toUnwrappedModel(
525 PortletPreferences portletPreferences) {
526 if (portletPreferences instanceof PortletPreferencesImpl) {
527 return portletPreferences;
528 }
529
530 PortletPreferencesImpl portletPreferencesImpl = new PortletPreferencesImpl();
531
532 portletPreferencesImpl.setNew(portletPreferences.isNew());
533 portletPreferencesImpl.setPrimaryKey(portletPreferences.getPrimaryKey());
534
535 portletPreferencesImpl.setPortletPreferencesId(portletPreferences.getPortletPreferencesId());
536 portletPreferencesImpl.setOwnerId(portletPreferences.getOwnerId());
537 portletPreferencesImpl.setOwnerType(portletPreferences.getOwnerType());
538 portletPreferencesImpl.setPlid(portletPreferences.getPlid());
539 portletPreferencesImpl.setPortletId(portletPreferences.getPortletId());
540 portletPreferencesImpl.setPreferences(portletPreferences.getPreferences());
541
542 return portletPreferencesImpl;
543 }
544
545
553 @Override
554 public PortletPreferences findByPrimaryKey(Serializable primaryKey)
555 throws NoSuchModelException, SystemException {
556 return findByPrimaryKey(((Long)primaryKey).longValue());
557 }
558
559
567 public PortletPreferences findByPrimaryKey(long portletPreferencesId)
568 throws NoSuchPortletPreferencesException, SystemException {
569 PortletPreferences portletPreferences = fetchByPrimaryKey(portletPreferencesId);
570
571 if (portletPreferences == null) {
572 if (_log.isWarnEnabled()) {
573 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
574 portletPreferencesId);
575 }
576
577 throw new NoSuchPortletPreferencesException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
578 portletPreferencesId);
579 }
580
581 return portletPreferences;
582 }
583
584
591 @Override
592 public PortletPreferences fetchByPrimaryKey(Serializable primaryKey)
593 throws SystemException {
594 return fetchByPrimaryKey(((Long)primaryKey).longValue());
595 }
596
597
604 public PortletPreferences fetchByPrimaryKey(long portletPreferencesId)
605 throws SystemException {
606 PortletPreferences portletPreferences = (PortletPreferences)EntityCacheUtil.getResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
607 PortletPreferencesImpl.class, portletPreferencesId);
608
609 if (portletPreferences == _nullPortletPreferences) {
610 return null;
611 }
612
613 if (portletPreferences == null) {
614 Session session = null;
615
616 boolean hasException = false;
617
618 try {
619 session = openSession();
620
621 portletPreferences = (PortletPreferences)session.get(PortletPreferencesImpl.class,
622 Long.valueOf(portletPreferencesId));
623 }
624 catch (Exception e) {
625 hasException = true;
626
627 throw processException(e);
628 }
629 finally {
630 if (portletPreferences != null) {
631 cacheResult(portletPreferences);
632 }
633 else if (!hasException) {
634 EntityCacheUtil.putResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
635 PortletPreferencesImpl.class, portletPreferencesId,
636 _nullPortletPreferences);
637 }
638
639 closeSession(session);
640 }
641 }
642
643 return portletPreferences;
644 }
645
646
653 public List<PortletPreferences> findByPlid(long plid)
654 throws SystemException {
655 return findByPlid(plid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
656 }
657
658
671 public List<PortletPreferences> findByPlid(long plid, int start, int end)
672 throws SystemException {
673 return findByPlid(plid, start, end, null);
674 }
675
676
690 public List<PortletPreferences> findByPlid(long plid, int start, int end,
691 OrderByComparator orderByComparator) throws SystemException {
692 FinderPath finderPath = null;
693 Object[] finderArgs = null;
694
695 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
696 (orderByComparator == null)) {
697 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID;
698 finderArgs = new Object[] { plid };
699 }
700 else {
701 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_PLID;
702 finderArgs = new Object[] { plid, start, end, orderByComparator };
703 }
704
705 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
706 finderArgs, this);
707
708 if (list == null) {
709 StringBundler query = null;
710
711 if (orderByComparator != null) {
712 query = new StringBundler(3 +
713 (orderByComparator.getOrderByFields().length * 3));
714 }
715 else {
716 query = new StringBundler(2);
717 }
718
719 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
720
721 query.append(_FINDER_COLUMN_PLID_PLID_2);
722
723 if (orderByComparator != null) {
724 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
725 orderByComparator);
726 }
727
728 String sql = query.toString();
729
730 Session session = null;
731
732 try {
733 session = openSession();
734
735 Query q = session.createQuery(sql);
736
737 QueryPos qPos = QueryPos.getInstance(q);
738
739 qPos.add(plid);
740
741 list = (List<PortletPreferences>)QueryUtil.list(q,
742 getDialect(), start, end);
743 }
744 catch (Exception e) {
745 throw processException(e);
746 }
747 finally {
748 if (list == null) {
749 FinderCacheUtil.removeResult(finderPath, finderArgs);
750 }
751 else {
752 cacheResult(list);
753
754 FinderCacheUtil.putResult(finderPath, finderArgs, list);
755 }
756
757 closeSession(session);
758 }
759 }
760
761 return list;
762 }
763
764
777 public PortletPreferences findByPlid_First(long plid,
778 OrderByComparator orderByComparator)
779 throws NoSuchPortletPreferencesException, SystemException {
780 List<PortletPreferences> list = findByPlid(plid, 0, 1, orderByComparator);
781
782 if (list.isEmpty()) {
783 StringBundler msg = new StringBundler(4);
784
785 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
786
787 msg.append("plid=");
788 msg.append(plid);
789
790 msg.append(StringPool.CLOSE_CURLY_BRACE);
791
792 throw new NoSuchPortletPreferencesException(msg.toString());
793 }
794 else {
795 return list.get(0);
796 }
797 }
798
799
812 public PortletPreferences findByPlid_Last(long plid,
813 OrderByComparator orderByComparator)
814 throws NoSuchPortletPreferencesException, SystemException {
815 int count = countByPlid(plid);
816
817 List<PortletPreferences> list = findByPlid(plid, count - 1, count,
818 orderByComparator);
819
820 if (list.isEmpty()) {
821 StringBundler msg = new StringBundler(4);
822
823 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
824
825 msg.append("plid=");
826 msg.append(plid);
827
828 msg.append(StringPool.CLOSE_CURLY_BRACE);
829
830 throw new NoSuchPortletPreferencesException(msg.toString());
831 }
832 else {
833 return list.get(0);
834 }
835 }
836
837
851 public PortletPreferences[] findByPlid_PrevAndNext(
852 long portletPreferencesId, long plid,
853 OrderByComparator orderByComparator)
854 throws NoSuchPortletPreferencesException, SystemException {
855 PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesId);
856
857 Session session = null;
858
859 try {
860 session = openSession();
861
862 PortletPreferences[] array = new PortletPreferencesImpl[3];
863
864 array[0] = getByPlid_PrevAndNext(session, portletPreferences, plid,
865 orderByComparator, true);
866
867 array[1] = portletPreferences;
868
869 array[2] = getByPlid_PrevAndNext(session, portletPreferences, plid,
870 orderByComparator, false);
871
872 return array;
873 }
874 catch (Exception e) {
875 throw processException(e);
876 }
877 finally {
878 closeSession(session);
879 }
880 }
881
882 protected PortletPreferences getByPlid_PrevAndNext(Session session,
883 PortletPreferences portletPreferences, long plid,
884 OrderByComparator orderByComparator, boolean previous) {
885 StringBundler query = null;
886
887 if (orderByComparator != null) {
888 query = new StringBundler(6 +
889 (orderByComparator.getOrderByFields().length * 6));
890 }
891 else {
892 query = new StringBundler(3);
893 }
894
895 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
896
897 query.append(_FINDER_COLUMN_PLID_PLID_2);
898
899 if (orderByComparator != null) {
900 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
901
902 if (orderByConditionFields.length > 0) {
903 query.append(WHERE_AND);
904 }
905
906 for (int i = 0; i < orderByConditionFields.length; i++) {
907 query.append(_ORDER_BY_ENTITY_ALIAS);
908 query.append(orderByConditionFields[i]);
909
910 if ((i + 1) < orderByConditionFields.length) {
911 if (orderByComparator.isAscending() ^ previous) {
912 query.append(WHERE_GREATER_THAN_HAS_NEXT);
913 }
914 else {
915 query.append(WHERE_LESSER_THAN_HAS_NEXT);
916 }
917 }
918 else {
919 if (orderByComparator.isAscending() ^ previous) {
920 query.append(WHERE_GREATER_THAN);
921 }
922 else {
923 query.append(WHERE_LESSER_THAN);
924 }
925 }
926 }
927
928 query.append(ORDER_BY_CLAUSE);
929
930 String[] orderByFields = orderByComparator.getOrderByFields();
931
932 for (int i = 0; i < orderByFields.length; i++) {
933 query.append(_ORDER_BY_ENTITY_ALIAS);
934 query.append(orderByFields[i]);
935
936 if ((i + 1) < orderByFields.length) {
937 if (orderByComparator.isAscending() ^ previous) {
938 query.append(ORDER_BY_ASC_HAS_NEXT);
939 }
940 else {
941 query.append(ORDER_BY_DESC_HAS_NEXT);
942 }
943 }
944 else {
945 if (orderByComparator.isAscending() ^ previous) {
946 query.append(ORDER_BY_ASC);
947 }
948 else {
949 query.append(ORDER_BY_DESC);
950 }
951 }
952 }
953 }
954
955 String sql = query.toString();
956
957 Query q = session.createQuery(sql);
958
959 q.setFirstResult(0);
960 q.setMaxResults(2);
961
962 QueryPos qPos = QueryPos.getInstance(q);
963
964 qPos.add(plid);
965
966 if (orderByComparator != null) {
967 Object[] values = orderByComparator.getOrderByConditionValues(portletPreferences);
968
969 for (Object value : values) {
970 qPos.add(value);
971 }
972 }
973
974 List<PortletPreferences> list = q.list();
975
976 if (list.size() == 2) {
977 return list.get(1);
978 }
979 else {
980 return null;
981 }
982 }
983
984
992 public List<PortletPreferences> findByP_P(long plid, String portletId)
993 throws SystemException {
994 return findByP_P(plid, portletId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
995 null);
996 }
997
998
1012 public List<PortletPreferences> findByP_P(long plid, String portletId,
1013 int start, int end) throws SystemException {
1014 return findByP_P(plid, portletId, start, end, null);
1015 }
1016
1017
1032 public List<PortletPreferences> findByP_P(long plid, String portletId,
1033 int start, int end, OrderByComparator orderByComparator)
1034 throws SystemException {
1035 FinderPath finderPath = null;
1036 Object[] finderArgs = null;
1037
1038 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1039 (orderByComparator == null)) {
1040 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P;
1041 finderArgs = new Object[] { plid, portletId };
1042 }
1043 else {
1044 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_P_P;
1045 finderArgs = new Object[] {
1046 plid, portletId,
1047
1048 start, end, orderByComparator
1049 };
1050 }
1051
1052 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
1053 finderArgs, this);
1054
1055 if (list == null) {
1056 StringBundler query = null;
1057
1058 if (orderByComparator != null) {
1059 query = new StringBundler(4 +
1060 (orderByComparator.getOrderByFields().length * 3));
1061 }
1062 else {
1063 query = new StringBundler(3);
1064 }
1065
1066 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1067
1068 query.append(_FINDER_COLUMN_P_P_PLID_2);
1069
1070 if (portletId == null) {
1071 query.append(_FINDER_COLUMN_P_P_PORTLETID_1);
1072 }
1073 else {
1074 if (portletId.equals(StringPool.BLANK)) {
1075 query.append(_FINDER_COLUMN_P_P_PORTLETID_3);
1076 }
1077 else {
1078 query.append(_FINDER_COLUMN_P_P_PORTLETID_2);
1079 }
1080 }
1081
1082 if (orderByComparator != null) {
1083 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1084 orderByComparator);
1085 }
1086
1087 String sql = query.toString();
1088
1089 Session session = null;
1090
1091 try {
1092 session = openSession();
1093
1094 Query q = session.createQuery(sql);
1095
1096 QueryPos qPos = QueryPos.getInstance(q);
1097
1098 qPos.add(plid);
1099
1100 if (portletId != null) {
1101 qPos.add(portletId);
1102 }
1103
1104 list = (List<PortletPreferences>)QueryUtil.list(q,
1105 getDialect(), start, end);
1106 }
1107 catch (Exception e) {
1108 throw processException(e);
1109 }
1110 finally {
1111 if (list == null) {
1112 FinderCacheUtil.removeResult(finderPath, finderArgs);
1113 }
1114 else {
1115 cacheResult(list);
1116
1117 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1118 }
1119
1120 closeSession(session);
1121 }
1122 }
1123
1124 return list;
1125 }
1126
1127
1141 public PortletPreferences findByP_P_First(long plid, String portletId,
1142 OrderByComparator orderByComparator)
1143 throws NoSuchPortletPreferencesException, SystemException {
1144 List<PortletPreferences> list = findByP_P(plid, portletId, 0, 1,
1145 orderByComparator);
1146
1147 if (list.isEmpty()) {
1148 StringBundler msg = new StringBundler(6);
1149
1150 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1151
1152 msg.append("plid=");
1153 msg.append(plid);
1154
1155 msg.append(", portletId=");
1156 msg.append(portletId);
1157
1158 msg.append(StringPool.CLOSE_CURLY_BRACE);
1159
1160 throw new NoSuchPortletPreferencesException(msg.toString());
1161 }
1162 else {
1163 return list.get(0);
1164 }
1165 }
1166
1167
1181 public PortletPreferences findByP_P_Last(long plid, String portletId,
1182 OrderByComparator orderByComparator)
1183 throws NoSuchPortletPreferencesException, SystemException {
1184 int count = countByP_P(plid, portletId);
1185
1186 List<PortletPreferences> list = findByP_P(plid, portletId, count - 1,
1187 count, orderByComparator);
1188
1189 if (list.isEmpty()) {
1190 StringBundler msg = new StringBundler(6);
1191
1192 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1193
1194 msg.append("plid=");
1195 msg.append(plid);
1196
1197 msg.append(", portletId=");
1198 msg.append(portletId);
1199
1200 msg.append(StringPool.CLOSE_CURLY_BRACE);
1201
1202 throw new NoSuchPortletPreferencesException(msg.toString());
1203 }
1204 else {
1205 return list.get(0);
1206 }
1207 }
1208
1209
1224 public PortletPreferences[] findByP_P_PrevAndNext(
1225 long portletPreferencesId, long plid, String portletId,
1226 OrderByComparator orderByComparator)
1227 throws NoSuchPortletPreferencesException, SystemException {
1228 PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesId);
1229
1230 Session session = null;
1231
1232 try {
1233 session = openSession();
1234
1235 PortletPreferences[] array = new PortletPreferencesImpl[3];
1236
1237 array[0] = getByP_P_PrevAndNext(session, portletPreferences, plid,
1238 portletId, orderByComparator, true);
1239
1240 array[1] = portletPreferences;
1241
1242 array[2] = getByP_P_PrevAndNext(session, portletPreferences, plid,
1243 portletId, orderByComparator, false);
1244
1245 return array;
1246 }
1247 catch (Exception e) {
1248 throw processException(e);
1249 }
1250 finally {
1251 closeSession(session);
1252 }
1253 }
1254
1255 protected PortletPreferences getByP_P_PrevAndNext(Session session,
1256 PortletPreferences portletPreferences, long plid, String portletId,
1257 OrderByComparator orderByComparator, boolean previous) {
1258 StringBundler query = null;
1259
1260 if (orderByComparator != null) {
1261 query = new StringBundler(6 +
1262 (orderByComparator.getOrderByFields().length * 6));
1263 }
1264 else {
1265 query = new StringBundler(3);
1266 }
1267
1268 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1269
1270 query.append(_FINDER_COLUMN_P_P_PLID_2);
1271
1272 if (portletId == null) {
1273 query.append(_FINDER_COLUMN_P_P_PORTLETID_1);
1274 }
1275 else {
1276 if (portletId.equals(StringPool.BLANK)) {
1277 query.append(_FINDER_COLUMN_P_P_PORTLETID_3);
1278 }
1279 else {
1280 query.append(_FINDER_COLUMN_P_P_PORTLETID_2);
1281 }
1282 }
1283
1284 if (orderByComparator != null) {
1285 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1286
1287 if (orderByConditionFields.length > 0) {
1288 query.append(WHERE_AND);
1289 }
1290
1291 for (int i = 0; i < orderByConditionFields.length; i++) {
1292 query.append(_ORDER_BY_ENTITY_ALIAS);
1293 query.append(orderByConditionFields[i]);
1294
1295 if ((i + 1) < orderByConditionFields.length) {
1296 if (orderByComparator.isAscending() ^ previous) {
1297 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1298 }
1299 else {
1300 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1301 }
1302 }
1303 else {
1304 if (orderByComparator.isAscending() ^ previous) {
1305 query.append(WHERE_GREATER_THAN);
1306 }
1307 else {
1308 query.append(WHERE_LESSER_THAN);
1309 }
1310 }
1311 }
1312
1313 query.append(ORDER_BY_CLAUSE);
1314
1315 String[] orderByFields = orderByComparator.getOrderByFields();
1316
1317 for (int i = 0; i < orderByFields.length; i++) {
1318 query.append(_ORDER_BY_ENTITY_ALIAS);
1319 query.append(orderByFields[i]);
1320
1321 if ((i + 1) < orderByFields.length) {
1322 if (orderByComparator.isAscending() ^ previous) {
1323 query.append(ORDER_BY_ASC_HAS_NEXT);
1324 }
1325 else {
1326 query.append(ORDER_BY_DESC_HAS_NEXT);
1327 }
1328 }
1329 else {
1330 if (orderByComparator.isAscending() ^ previous) {
1331 query.append(ORDER_BY_ASC);
1332 }
1333 else {
1334 query.append(ORDER_BY_DESC);
1335 }
1336 }
1337 }
1338 }
1339
1340 String sql = query.toString();
1341
1342 Query q = session.createQuery(sql);
1343
1344 q.setFirstResult(0);
1345 q.setMaxResults(2);
1346
1347 QueryPos qPos = QueryPos.getInstance(q);
1348
1349 qPos.add(plid);
1350
1351 if (portletId != null) {
1352 qPos.add(portletId);
1353 }
1354
1355 if (orderByComparator != null) {
1356 Object[] values = orderByComparator.getOrderByConditionValues(portletPreferences);
1357
1358 for (Object value : values) {
1359 qPos.add(value);
1360 }
1361 }
1362
1363 List<PortletPreferences> list = q.list();
1364
1365 if (list.size() == 2) {
1366 return list.get(1);
1367 }
1368 else {
1369 return null;
1370 }
1371 }
1372
1373
1382 public List<PortletPreferences> findByO_O_P(long ownerId, int ownerType,
1383 long plid) throws SystemException {
1384 return findByO_O_P(ownerId, ownerType, plid, QueryUtil.ALL_POS,
1385 QueryUtil.ALL_POS, null);
1386 }
1387
1388
1403 public List<PortletPreferences> findByO_O_P(long ownerId, int ownerType,
1404 long plid, int start, int end) throws SystemException {
1405 return findByO_O_P(ownerId, ownerType, plid, start, end, null);
1406 }
1407
1408
1424 public List<PortletPreferences> findByO_O_P(long ownerId, int ownerType,
1425 long plid, int start, int end, OrderByComparator orderByComparator)
1426 throws SystemException {
1427 FinderPath finderPath = null;
1428 Object[] finderArgs = null;
1429
1430 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1431 (orderByComparator == null)) {
1432 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P;
1433 finderArgs = new Object[] { ownerId, ownerType, plid };
1434 }
1435 else {
1436 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_O_O_P;
1437 finderArgs = new Object[] {
1438 ownerId, ownerType, plid,
1439
1440 start, end, orderByComparator
1441 };
1442 }
1443
1444 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
1445 finderArgs, this);
1446
1447 if (list == null) {
1448 StringBundler query = null;
1449
1450 if (orderByComparator != null) {
1451 query = new StringBundler(5 +
1452 (orderByComparator.getOrderByFields().length * 3));
1453 }
1454 else {
1455 query = new StringBundler(4);
1456 }
1457
1458 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1459
1460 query.append(_FINDER_COLUMN_O_O_P_OWNERID_2);
1461
1462 query.append(_FINDER_COLUMN_O_O_P_OWNERTYPE_2);
1463
1464 query.append(_FINDER_COLUMN_O_O_P_PLID_2);
1465
1466 if (orderByComparator != null) {
1467 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1468 orderByComparator);
1469 }
1470
1471 String sql = query.toString();
1472
1473 Session session = null;
1474
1475 try {
1476 session = openSession();
1477
1478 Query q = session.createQuery(sql);
1479
1480 QueryPos qPos = QueryPos.getInstance(q);
1481
1482 qPos.add(ownerId);
1483
1484 qPos.add(ownerType);
1485
1486 qPos.add(plid);
1487
1488 list = (List<PortletPreferences>)QueryUtil.list(q,
1489 getDialect(), start, end);
1490 }
1491 catch (Exception e) {
1492 throw processException(e);
1493 }
1494 finally {
1495 if (list == null) {
1496 FinderCacheUtil.removeResult(finderPath, finderArgs);
1497 }
1498 else {
1499 cacheResult(list);
1500
1501 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1502 }
1503
1504 closeSession(session);
1505 }
1506 }
1507
1508 return list;
1509 }
1510
1511
1526 public PortletPreferences findByO_O_P_First(long ownerId, int ownerType,
1527 long plid, OrderByComparator orderByComparator)
1528 throws NoSuchPortletPreferencesException, SystemException {
1529 List<PortletPreferences> list = findByO_O_P(ownerId, ownerType, plid,
1530 0, 1, orderByComparator);
1531
1532 if (list.isEmpty()) {
1533 StringBundler msg = new StringBundler(8);
1534
1535 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1536
1537 msg.append("ownerId=");
1538 msg.append(ownerId);
1539
1540 msg.append(", ownerType=");
1541 msg.append(ownerType);
1542
1543 msg.append(", plid=");
1544 msg.append(plid);
1545
1546 msg.append(StringPool.CLOSE_CURLY_BRACE);
1547
1548 throw new NoSuchPortletPreferencesException(msg.toString());
1549 }
1550 else {
1551 return list.get(0);
1552 }
1553 }
1554
1555
1570 public PortletPreferences findByO_O_P_Last(long ownerId, int ownerType,
1571 long plid, OrderByComparator orderByComparator)
1572 throws NoSuchPortletPreferencesException, SystemException {
1573 int count = countByO_O_P(ownerId, ownerType, plid);
1574
1575 List<PortletPreferences> list = findByO_O_P(ownerId, ownerType, plid,
1576 count - 1, count, orderByComparator);
1577
1578 if (list.isEmpty()) {
1579 StringBundler msg = new StringBundler(8);
1580
1581 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1582
1583 msg.append("ownerId=");
1584 msg.append(ownerId);
1585
1586 msg.append(", ownerType=");
1587 msg.append(ownerType);
1588
1589 msg.append(", plid=");
1590 msg.append(plid);
1591
1592 msg.append(StringPool.CLOSE_CURLY_BRACE);
1593
1594 throw new NoSuchPortletPreferencesException(msg.toString());
1595 }
1596 else {
1597 return list.get(0);
1598 }
1599 }
1600
1601
1617 public PortletPreferences[] findByO_O_P_PrevAndNext(
1618 long portletPreferencesId, long ownerId, int ownerType, long plid,
1619 OrderByComparator orderByComparator)
1620 throws NoSuchPortletPreferencesException, SystemException {
1621 PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesId);
1622
1623 Session session = null;
1624
1625 try {
1626 session = openSession();
1627
1628 PortletPreferences[] array = new PortletPreferencesImpl[3];
1629
1630 array[0] = getByO_O_P_PrevAndNext(session, portletPreferences,
1631 ownerId, ownerType, plid, orderByComparator, true);
1632
1633 array[1] = portletPreferences;
1634
1635 array[2] = getByO_O_P_PrevAndNext(session, portletPreferences,
1636 ownerId, ownerType, plid, orderByComparator, false);
1637
1638 return array;
1639 }
1640 catch (Exception e) {
1641 throw processException(e);
1642 }
1643 finally {
1644 closeSession(session);
1645 }
1646 }
1647
1648 protected PortletPreferences getByO_O_P_PrevAndNext(Session session,
1649 PortletPreferences portletPreferences, long ownerId, int ownerType,
1650 long plid, OrderByComparator orderByComparator, boolean previous) {
1651 StringBundler query = null;
1652
1653 if (orderByComparator != null) {
1654 query = new StringBundler(6 +
1655 (orderByComparator.getOrderByFields().length * 6));
1656 }
1657 else {
1658 query = new StringBundler(3);
1659 }
1660
1661 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1662
1663 query.append(_FINDER_COLUMN_O_O_P_OWNERID_2);
1664
1665 query.append(_FINDER_COLUMN_O_O_P_OWNERTYPE_2);
1666
1667 query.append(_FINDER_COLUMN_O_O_P_PLID_2);
1668
1669 if (orderByComparator != null) {
1670 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1671
1672 if (orderByConditionFields.length > 0) {
1673 query.append(WHERE_AND);
1674 }
1675
1676 for (int i = 0; i < orderByConditionFields.length; i++) {
1677 query.append(_ORDER_BY_ENTITY_ALIAS);
1678 query.append(orderByConditionFields[i]);
1679
1680 if ((i + 1) < orderByConditionFields.length) {
1681 if (orderByComparator.isAscending() ^ previous) {
1682 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1683 }
1684 else {
1685 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1686 }
1687 }
1688 else {
1689 if (orderByComparator.isAscending() ^ previous) {
1690 query.append(WHERE_GREATER_THAN);
1691 }
1692 else {
1693 query.append(WHERE_LESSER_THAN);
1694 }
1695 }
1696 }
1697
1698 query.append(ORDER_BY_CLAUSE);
1699
1700 String[] orderByFields = orderByComparator.getOrderByFields();
1701
1702 for (int i = 0; i < orderByFields.length; i++) {
1703 query.append(_ORDER_BY_ENTITY_ALIAS);
1704 query.append(orderByFields[i]);
1705
1706 if ((i + 1) < orderByFields.length) {
1707 if (orderByComparator.isAscending() ^ previous) {
1708 query.append(ORDER_BY_ASC_HAS_NEXT);
1709 }
1710 else {
1711 query.append(ORDER_BY_DESC_HAS_NEXT);
1712 }
1713 }
1714 else {
1715 if (orderByComparator.isAscending() ^ previous) {
1716 query.append(ORDER_BY_ASC);
1717 }
1718 else {
1719 query.append(ORDER_BY_DESC);
1720 }
1721 }
1722 }
1723 }
1724
1725 String sql = query.toString();
1726
1727 Query q = session.createQuery(sql);
1728
1729 q.setFirstResult(0);
1730 q.setMaxResults(2);
1731
1732 QueryPos qPos = QueryPos.getInstance(q);
1733
1734 qPos.add(ownerId);
1735
1736 qPos.add(ownerType);
1737
1738 qPos.add(plid);
1739
1740 if (orderByComparator != null) {
1741 Object[] values = orderByComparator.getOrderByConditionValues(portletPreferences);
1742
1743 for (Object value : values) {
1744 qPos.add(value);
1745 }
1746 }
1747
1748 List<PortletPreferences> list = q.list();
1749
1750 if (list.size() == 2) {
1751 return list.get(1);
1752 }
1753 else {
1754 return null;
1755 }
1756 }
1757
1758
1769 public PortletPreferences findByO_O_P_P(long ownerId, int ownerType,
1770 long plid, String portletId)
1771 throws NoSuchPortletPreferencesException, SystemException {
1772 PortletPreferences portletPreferences = fetchByO_O_P_P(ownerId,
1773 ownerType, plid, portletId);
1774
1775 if (portletPreferences == null) {
1776 StringBundler msg = new StringBundler(10);
1777
1778 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1779
1780 msg.append("ownerId=");
1781 msg.append(ownerId);
1782
1783 msg.append(", ownerType=");
1784 msg.append(ownerType);
1785
1786 msg.append(", plid=");
1787 msg.append(plid);
1788
1789 msg.append(", portletId=");
1790 msg.append(portletId);
1791
1792 msg.append(StringPool.CLOSE_CURLY_BRACE);
1793
1794 if (_log.isWarnEnabled()) {
1795 _log.warn(msg.toString());
1796 }
1797
1798 throw new NoSuchPortletPreferencesException(msg.toString());
1799 }
1800
1801 return portletPreferences;
1802 }
1803
1804
1814 public PortletPreferences fetchByO_O_P_P(long ownerId, int ownerType,
1815 long plid, String portletId) throws SystemException {
1816 return fetchByO_O_P_P(ownerId, ownerType, plid, portletId, true);
1817 }
1818
1819
1830 public PortletPreferences fetchByO_O_P_P(long ownerId, int ownerType,
1831 long plid, String portletId, boolean retrieveFromCache)
1832 throws SystemException {
1833 Object[] finderArgs = new Object[] { ownerId, ownerType, plid, portletId };
1834
1835 Object result = null;
1836
1837 if (retrieveFromCache) {
1838 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_O_O_P_P,
1839 finderArgs, this);
1840 }
1841
1842 if (result == null) {
1843 StringBundler query = new StringBundler(5);
1844
1845 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1846
1847 query.append(_FINDER_COLUMN_O_O_P_P_OWNERID_2);
1848
1849 query.append(_FINDER_COLUMN_O_O_P_P_OWNERTYPE_2);
1850
1851 query.append(_FINDER_COLUMN_O_O_P_P_PLID_2);
1852
1853 if (portletId == null) {
1854 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_1);
1855 }
1856 else {
1857 if (portletId.equals(StringPool.BLANK)) {
1858 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_3);
1859 }
1860 else {
1861 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_2);
1862 }
1863 }
1864
1865 String sql = query.toString();
1866
1867 Session session = null;
1868
1869 try {
1870 session = openSession();
1871
1872 Query q = session.createQuery(sql);
1873
1874 QueryPos qPos = QueryPos.getInstance(q);
1875
1876 qPos.add(ownerId);
1877
1878 qPos.add(ownerType);
1879
1880 qPos.add(plid);
1881
1882 if (portletId != null) {
1883 qPos.add(portletId);
1884 }
1885
1886 List<PortletPreferences> list = q.list();
1887
1888 result = list;
1889
1890 PortletPreferences portletPreferences = null;
1891
1892 if (list.isEmpty()) {
1893 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
1894 finderArgs, list);
1895 }
1896 else {
1897 portletPreferences = list.get(0);
1898
1899 cacheResult(portletPreferences);
1900
1901 if ((portletPreferences.getOwnerId() != ownerId) ||
1902 (portletPreferences.getOwnerType() != ownerType) ||
1903 (portletPreferences.getPlid() != plid) ||
1904 (portletPreferences.getPortletId() == null) ||
1905 !portletPreferences.getPortletId().equals(portletId)) {
1906 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
1907 finderArgs, portletPreferences);
1908 }
1909 }
1910
1911 return portletPreferences;
1912 }
1913 catch (Exception e) {
1914 throw processException(e);
1915 }
1916 finally {
1917 if (result == null) {
1918 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O_P_P,
1919 finderArgs);
1920 }
1921
1922 closeSession(session);
1923 }
1924 }
1925 else {
1926 if (result instanceof List<?>) {
1927 return null;
1928 }
1929 else {
1930 return (PortletPreferences)result;
1931 }
1932 }
1933 }
1934
1935
1941 public List<PortletPreferences> findAll() throws SystemException {
1942 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1943 }
1944
1945
1957 public List<PortletPreferences> findAll(int start, int end)
1958 throws SystemException {
1959 return findAll(start, end, null);
1960 }
1961
1962
1975 public List<PortletPreferences> findAll(int start, int end,
1976 OrderByComparator orderByComparator) throws SystemException {
1977 FinderPath finderPath = null;
1978 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1979
1980 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1981 (orderByComparator == null)) {
1982 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1983 finderArgs = FINDER_ARGS_EMPTY;
1984 }
1985 else {
1986 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1987 finderArgs = new Object[] { start, end, orderByComparator };
1988 }
1989
1990 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
1991 finderArgs, this);
1992
1993 if (list == null) {
1994 StringBundler query = null;
1995 String sql = null;
1996
1997 if (orderByComparator != null) {
1998 query = new StringBundler(2 +
1999 (orderByComparator.getOrderByFields().length * 3));
2000
2001 query.append(_SQL_SELECT_PORTLETPREFERENCES);
2002
2003 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2004 orderByComparator);
2005
2006 sql = query.toString();
2007 }
2008 else {
2009 sql = _SQL_SELECT_PORTLETPREFERENCES;
2010 }
2011
2012 Session session = null;
2013
2014 try {
2015 session = openSession();
2016
2017 Query q = session.createQuery(sql);
2018
2019 if (orderByComparator == null) {
2020 list = (List<PortletPreferences>)QueryUtil.list(q,
2021 getDialect(), start, end, false);
2022
2023 Collections.sort(list);
2024 }
2025 else {
2026 list = (List<PortletPreferences>)QueryUtil.list(q,
2027 getDialect(), start, end);
2028 }
2029 }
2030 catch (Exception e) {
2031 throw processException(e);
2032 }
2033 finally {
2034 if (list == null) {
2035 FinderCacheUtil.removeResult(finderPath, finderArgs);
2036 }
2037 else {
2038 cacheResult(list);
2039
2040 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2041 }
2042
2043 closeSession(session);
2044 }
2045 }
2046
2047 return list;
2048 }
2049
2050
2056 public void removeByPlid(long plid) throws SystemException {
2057 for (PortletPreferences portletPreferences : findByPlid(plid)) {
2058 portletPreferencesPersistence.remove(portletPreferences);
2059 }
2060 }
2061
2062
2069 public void removeByP_P(long plid, String portletId)
2070 throws SystemException {
2071 for (PortletPreferences portletPreferences : findByP_P(plid, portletId)) {
2072 portletPreferencesPersistence.remove(portletPreferences);
2073 }
2074 }
2075
2076
2084 public void removeByO_O_P(long ownerId, int ownerType, long plid)
2085 throws SystemException {
2086 for (PortletPreferences portletPreferences : findByO_O_P(ownerId,
2087 ownerType, plid)) {
2088 portletPreferencesPersistence.remove(portletPreferences);
2089 }
2090 }
2091
2092
2101 public void removeByO_O_P_P(long ownerId, int ownerType, long plid,
2102 String portletId)
2103 throws NoSuchPortletPreferencesException, SystemException {
2104 PortletPreferences portletPreferences = findByO_O_P_P(ownerId,
2105 ownerType, plid, portletId);
2106
2107 portletPreferencesPersistence.remove(portletPreferences);
2108 }
2109
2110
2115 public void removeAll() throws SystemException {
2116 for (PortletPreferences portletPreferences : findAll()) {
2117 portletPreferencesPersistence.remove(portletPreferences);
2118 }
2119 }
2120
2121
2128 public int countByPlid(long plid) throws SystemException {
2129 Object[] finderArgs = new Object[] { plid };
2130
2131 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PLID,
2132 finderArgs, this);
2133
2134 if (count == null) {
2135 StringBundler query = new StringBundler(2);
2136
2137 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2138
2139 query.append(_FINDER_COLUMN_PLID_PLID_2);
2140
2141 String sql = query.toString();
2142
2143 Session session = null;
2144
2145 try {
2146 session = openSession();
2147
2148 Query q = session.createQuery(sql);
2149
2150 QueryPos qPos = QueryPos.getInstance(q);
2151
2152 qPos.add(plid);
2153
2154 count = (Long)q.uniqueResult();
2155 }
2156 catch (Exception e) {
2157 throw processException(e);
2158 }
2159 finally {
2160 if (count == null) {
2161 count = Long.valueOf(0);
2162 }
2163
2164 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_PLID,
2165 finderArgs, count);
2166
2167 closeSession(session);
2168 }
2169 }
2170
2171 return count.intValue();
2172 }
2173
2174
2182 public int countByP_P(long plid, String portletId)
2183 throws SystemException {
2184 Object[] finderArgs = new Object[] { plid, portletId };
2185
2186 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_P,
2187 finderArgs, this);
2188
2189 if (count == null) {
2190 StringBundler query = new StringBundler(3);
2191
2192 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2193
2194 query.append(_FINDER_COLUMN_P_P_PLID_2);
2195
2196 if (portletId == null) {
2197 query.append(_FINDER_COLUMN_P_P_PORTLETID_1);
2198 }
2199 else {
2200 if (portletId.equals(StringPool.BLANK)) {
2201 query.append(_FINDER_COLUMN_P_P_PORTLETID_3);
2202 }
2203 else {
2204 query.append(_FINDER_COLUMN_P_P_PORTLETID_2);
2205 }
2206 }
2207
2208 String sql = query.toString();
2209
2210 Session session = null;
2211
2212 try {
2213 session = openSession();
2214
2215 Query q = session.createQuery(sql);
2216
2217 QueryPos qPos = QueryPos.getInstance(q);
2218
2219 qPos.add(plid);
2220
2221 if (portletId != null) {
2222 qPos.add(portletId);
2223 }
2224
2225 count = (Long)q.uniqueResult();
2226 }
2227 catch (Exception e) {
2228 throw processException(e);
2229 }
2230 finally {
2231 if (count == null) {
2232 count = Long.valueOf(0);
2233 }
2234
2235 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_P, finderArgs,
2236 count);
2237
2238 closeSession(session);
2239 }
2240 }
2241
2242 return count.intValue();
2243 }
2244
2245
2254 public int countByO_O_P(long ownerId, int ownerType, long plid)
2255 throws SystemException {
2256 Object[] finderArgs = new Object[] { ownerId, ownerType, plid };
2257
2258 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_O_O_P,
2259 finderArgs, this);
2260
2261 if (count == null) {
2262 StringBundler query = new StringBundler(4);
2263
2264 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2265
2266 query.append(_FINDER_COLUMN_O_O_P_OWNERID_2);
2267
2268 query.append(_FINDER_COLUMN_O_O_P_OWNERTYPE_2);
2269
2270 query.append(_FINDER_COLUMN_O_O_P_PLID_2);
2271
2272 String sql = query.toString();
2273
2274 Session session = null;
2275
2276 try {
2277 session = openSession();
2278
2279 Query q = session.createQuery(sql);
2280
2281 QueryPos qPos = QueryPos.getInstance(q);
2282
2283 qPos.add(ownerId);
2284
2285 qPos.add(ownerType);
2286
2287 qPos.add(plid);
2288
2289 count = (Long)q.uniqueResult();
2290 }
2291 catch (Exception e) {
2292 throw processException(e);
2293 }
2294 finally {
2295 if (count == null) {
2296 count = Long.valueOf(0);
2297 }
2298
2299 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_O_O_P,
2300 finderArgs, count);
2301
2302 closeSession(session);
2303 }
2304 }
2305
2306 return count.intValue();
2307 }
2308
2309
2319 public int countByO_O_P_P(long ownerId, int ownerType, long plid,
2320 String portletId) throws SystemException {
2321 Object[] finderArgs = new Object[] { ownerId, ownerType, plid, portletId };
2322
2323 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_O_O_P_P,
2324 finderArgs, this);
2325
2326 if (count == null) {
2327 StringBundler query = new StringBundler(5);
2328
2329 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2330
2331 query.append(_FINDER_COLUMN_O_O_P_P_OWNERID_2);
2332
2333 query.append(_FINDER_COLUMN_O_O_P_P_OWNERTYPE_2);
2334
2335 query.append(_FINDER_COLUMN_O_O_P_P_PLID_2);
2336
2337 if (portletId == null) {
2338 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_1);
2339 }
2340 else {
2341 if (portletId.equals(StringPool.BLANK)) {
2342 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_3);
2343 }
2344 else {
2345 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_2);
2346 }
2347 }
2348
2349 String sql = query.toString();
2350
2351 Session session = null;
2352
2353 try {
2354 session = openSession();
2355
2356 Query q = session.createQuery(sql);
2357
2358 QueryPos qPos = QueryPos.getInstance(q);
2359
2360 qPos.add(ownerId);
2361
2362 qPos.add(ownerType);
2363
2364 qPos.add(plid);
2365
2366 if (portletId != null) {
2367 qPos.add(portletId);
2368 }
2369
2370 count = (Long)q.uniqueResult();
2371 }
2372 catch (Exception e) {
2373 throw processException(e);
2374 }
2375 finally {
2376 if (count == null) {
2377 count = Long.valueOf(0);
2378 }
2379
2380 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_O_O_P_P,
2381 finderArgs, count);
2382
2383 closeSession(session);
2384 }
2385 }
2386
2387 return count.intValue();
2388 }
2389
2390
2396 public int countAll() throws SystemException {
2397 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2398 FINDER_ARGS_EMPTY, this);
2399
2400 if (count == null) {
2401 Session session = null;
2402
2403 try {
2404 session = openSession();
2405
2406 Query q = session.createQuery(_SQL_COUNT_PORTLETPREFERENCES);
2407
2408 count = (Long)q.uniqueResult();
2409 }
2410 catch (Exception e) {
2411 throw processException(e);
2412 }
2413 finally {
2414 if (count == null) {
2415 count = Long.valueOf(0);
2416 }
2417
2418 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2419 FINDER_ARGS_EMPTY, count);
2420
2421 closeSession(session);
2422 }
2423 }
2424
2425 return count.intValue();
2426 }
2427
2428
2431 public void afterPropertiesSet() {
2432 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2433 com.liferay.portal.util.PropsUtil.get(
2434 "value.object.listener.com.liferay.portal.model.PortletPreferences")));
2435
2436 if (listenerClassNames.length > 0) {
2437 try {
2438 List<ModelListener<PortletPreferences>> listenersList = new ArrayList<ModelListener<PortletPreferences>>();
2439
2440 for (String listenerClassName : listenerClassNames) {
2441 listenersList.add((ModelListener<PortletPreferences>)InstanceFactory.newInstance(
2442 listenerClassName));
2443 }
2444
2445 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2446 }
2447 catch (Exception e) {
2448 _log.error(e);
2449 }
2450 }
2451 }
2452
2453 public void destroy() {
2454 EntityCacheUtil.removeCache(PortletPreferencesImpl.class.getName());
2455 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2456 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2457 }
2458
2459 @BeanReference(type = AccountPersistence.class)
2460 protected AccountPersistence accountPersistence;
2461 @BeanReference(type = AddressPersistence.class)
2462 protected AddressPersistence addressPersistence;
2463 @BeanReference(type = BrowserTrackerPersistence.class)
2464 protected BrowserTrackerPersistence browserTrackerPersistence;
2465 @BeanReference(type = ClassNamePersistence.class)
2466 protected ClassNamePersistence classNamePersistence;
2467 @BeanReference(type = ClusterGroupPersistence.class)
2468 protected ClusterGroupPersistence clusterGroupPersistence;
2469 @BeanReference(type = CompanyPersistence.class)
2470 protected CompanyPersistence companyPersistence;
2471 @BeanReference(type = ContactPersistence.class)
2472 protected ContactPersistence contactPersistence;
2473 @BeanReference(type = CountryPersistence.class)
2474 protected CountryPersistence countryPersistence;
2475 @BeanReference(type = EmailAddressPersistence.class)
2476 protected EmailAddressPersistence emailAddressPersistence;
2477 @BeanReference(type = GroupPersistence.class)
2478 protected GroupPersistence groupPersistence;
2479 @BeanReference(type = ImagePersistence.class)
2480 protected ImagePersistence imagePersistence;
2481 @BeanReference(type = LayoutPersistence.class)
2482 protected LayoutPersistence layoutPersistence;
2483 @BeanReference(type = LayoutBranchPersistence.class)
2484 protected LayoutBranchPersistence layoutBranchPersistence;
2485 @BeanReference(type = LayoutPrototypePersistence.class)
2486 protected LayoutPrototypePersistence layoutPrototypePersistence;
2487 @BeanReference(type = LayoutRevisionPersistence.class)
2488 protected LayoutRevisionPersistence layoutRevisionPersistence;
2489 @BeanReference(type = LayoutSetPersistence.class)
2490 protected LayoutSetPersistence layoutSetPersistence;
2491 @BeanReference(type = LayoutSetBranchPersistence.class)
2492 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
2493 @BeanReference(type = LayoutSetPrototypePersistence.class)
2494 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2495 @BeanReference(type = ListTypePersistence.class)
2496 protected ListTypePersistence listTypePersistence;
2497 @BeanReference(type = LockPersistence.class)
2498 protected LockPersistence lockPersistence;
2499 @BeanReference(type = MembershipRequestPersistence.class)
2500 protected MembershipRequestPersistence membershipRequestPersistence;
2501 @BeanReference(type = OrganizationPersistence.class)
2502 protected OrganizationPersistence organizationPersistence;
2503 @BeanReference(type = OrgGroupPermissionPersistence.class)
2504 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2505 @BeanReference(type = OrgGroupRolePersistence.class)
2506 protected OrgGroupRolePersistence orgGroupRolePersistence;
2507 @BeanReference(type = OrgLaborPersistence.class)
2508 protected OrgLaborPersistence orgLaborPersistence;
2509 @BeanReference(type = PasswordPolicyPersistence.class)
2510 protected PasswordPolicyPersistence passwordPolicyPersistence;
2511 @BeanReference(type = PasswordPolicyRelPersistence.class)
2512 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2513 @BeanReference(type = PasswordTrackerPersistence.class)
2514 protected PasswordTrackerPersistence passwordTrackerPersistence;
2515 @BeanReference(type = PermissionPersistence.class)
2516 protected PermissionPersistence permissionPersistence;
2517 @BeanReference(type = PhonePersistence.class)
2518 protected PhonePersistence phonePersistence;
2519 @BeanReference(type = PluginSettingPersistence.class)
2520 protected PluginSettingPersistence pluginSettingPersistence;
2521 @BeanReference(type = PortalPreferencesPersistence.class)
2522 protected PortalPreferencesPersistence portalPreferencesPersistence;
2523 @BeanReference(type = PortletPersistence.class)
2524 protected PortletPersistence portletPersistence;
2525 @BeanReference(type = PortletItemPersistence.class)
2526 protected PortletItemPersistence portletItemPersistence;
2527 @BeanReference(type = PortletPreferencesPersistence.class)
2528 protected PortletPreferencesPersistence portletPreferencesPersistence;
2529 @BeanReference(type = RegionPersistence.class)
2530 protected RegionPersistence regionPersistence;
2531 @BeanReference(type = ReleasePersistence.class)
2532 protected ReleasePersistence releasePersistence;
2533 @BeanReference(type = RepositoryPersistence.class)
2534 protected RepositoryPersistence repositoryPersistence;
2535 @BeanReference(type = RepositoryEntryPersistence.class)
2536 protected RepositoryEntryPersistence repositoryEntryPersistence;
2537 @BeanReference(type = ResourcePersistence.class)
2538 protected ResourcePersistence resourcePersistence;
2539 @BeanReference(type = ResourceActionPersistence.class)
2540 protected ResourceActionPersistence resourceActionPersistence;
2541 @BeanReference(type = ResourceBlockPersistence.class)
2542 protected ResourceBlockPersistence resourceBlockPersistence;
2543 @BeanReference(type = ResourceBlockPermissionPersistence.class)
2544 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
2545 @BeanReference(type = ResourceCodePersistence.class)
2546 protected ResourceCodePersistence resourceCodePersistence;
2547 @BeanReference(type = ResourcePermissionPersistence.class)
2548 protected ResourcePermissionPersistence resourcePermissionPersistence;
2549 @BeanReference(type = ResourceTypePermissionPersistence.class)
2550 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
2551 @BeanReference(type = RolePersistence.class)
2552 protected RolePersistence rolePersistence;
2553 @BeanReference(type = ServiceComponentPersistence.class)
2554 protected ServiceComponentPersistence serviceComponentPersistence;
2555 @BeanReference(type = ShardPersistence.class)
2556 protected ShardPersistence shardPersistence;
2557 @BeanReference(type = SubscriptionPersistence.class)
2558 protected SubscriptionPersistence subscriptionPersistence;
2559 @BeanReference(type = TeamPersistence.class)
2560 protected TeamPersistence teamPersistence;
2561 @BeanReference(type = TicketPersistence.class)
2562 protected TicketPersistence ticketPersistence;
2563 @BeanReference(type = UserPersistence.class)
2564 protected UserPersistence userPersistence;
2565 @BeanReference(type = UserGroupPersistence.class)
2566 protected UserGroupPersistence userGroupPersistence;
2567 @BeanReference(type = UserGroupGroupRolePersistence.class)
2568 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2569 @BeanReference(type = UserGroupRolePersistence.class)
2570 protected UserGroupRolePersistence userGroupRolePersistence;
2571 @BeanReference(type = UserIdMapperPersistence.class)
2572 protected UserIdMapperPersistence userIdMapperPersistence;
2573 @BeanReference(type = UserNotificationEventPersistence.class)
2574 protected UserNotificationEventPersistence userNotificationEventPersistence;
2575 @BeanReference(type = UserTrackerPersistence.class)
2576 protected UserTrackerPersistence userTrackerPersistence;
2577 @BeanReference(type = UserTrackerPathPersistence.class)
2578 protected UserTrackerPathPersistence userTrackerPathPersistence;
2579 @BeanReference(type = VirtualHostPersistence.class)
2580 protected VirtualHostPersistence virtualHostPersistence;
2581 @BeanReference(type = WebDAVPropsPersistence.class)
2582 protected WebDAVPropsPersistence webDAVPropsPersistence;
2583 @BeanReference(type = WebsitePersistence.class)
2584 protected WebsitePersistence websitePersistence;
2585 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2586 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2587 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2588 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2589 private static final String _SQL_SELECT_PORTLETPREFERENCES = "SELECT portletPreferences FROM PortletPreferences portletPreferences";
2590 private static final String _SQL_SELECT_PORTLETPREFERENCES_WHERE = "SELECT portletPreferences FROM PortletPreferences portletPreferences WHERE ";
2591 private static final String _SQL_COUNT_PORTLETPREFERENCES = "SELECT COUNT(portletPreferences) FROM PortletPreferences portletPreferences";
2592 private static final String _SQL_COUNT_PORTLETPREFERENCES_WHERE = "SELECT COUNT(portletPreferences) FROM PortletPreferences portletPreferences WHERE ";
2593 private static final String _FINDER_COLUMN_PLID_PLID_2 = "portletPreferences.plid = ?";
2594 private static final String _FINDER_COLUMN_P_P_PLID_2 = "portletPreferences.plid = ? AND ";
2595 private static final String _FINDER_COLUMN_P_P_PORTLETID_1 = "portletPreferences.portletId IS NULL";
2596 private static final String _FINDER_COLUMN_P_P_PORTLETID_2 = "portletPreferences.portletId = ?";
2597 private static final String _FINDER_COLUMN_P_P_PORTLETID_3 = "(portletPreferences.portletId IS NULL OR portletPreferences.portletId = ?)";
2598 private static final String _FINDER_COLUMN_O_O_P_OWNERID_2 = "portletPreferences.ownerId = ? AND ";
2599 private static final String _FINDER_COLUMN_O_O_P_OWNERTYPE_2 = "portletPreferences.ownerType = ? AND ";
2600 private static final String _FINDER_COLUMN_O_O_P_PLID_2 = "portletPreferences.plid = ?";
2601 private static final String _FINDER_COLUMN_O_O_P_P_OWNERID_2 = "portletPreferences.ownerId = ? AND ";
2602 private static final String _FINDER_COLUMN_O_O_P_P_OWNERTYPE_2 = "portletPreferences.ownerType = ? AND ";
2603 private static final String _FINDER_COLUMN_O_O_P_P_PLID_2 = "portletPreferences.plid = ? AND ";
2604 private static final String _FINDER_COLUMN_O_O_P_P_PORTLETID_1 = "portletPreferences.portletId IS NULL";
2605 private static final String _FINDER_COLUMN_O_O_P_P_PORTLETID_2 = "portletPreferences.portletId = ?";
2606 private static final String _FINDER_COLUMN_O_O_P_P_PORTLETID_3 = "(portletPreferences.portletId IS NULL OR portletPreferences.portletId = ?)";
2607 private static final String _ORDER_BY_ENTITY_ALIAS = "portletPreferences.";
2608 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PortletPreferences exists with the primary key ";
2609 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PortletPreferences exists with the key {";
2610 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2611 private static Log _log = LogFactoryUtil.getLog(PortletPreferencesPersistenceImpl.class);
2612 private static PortletPreferences _nullPortletPreferences = new PortletPreferencesImpl() {
2613 @Override
2614 public Object clone() {
2615 return this;
2616 }
2617
2618 @Override
2619 public CacheModel<PortletPreferences> toCacheModel() {
2620 return _nullPortletPreferencesCacheModel;
2621 }
2622 };
2623
2624 private static CacheModel<PortletPreferences> _nullPortletPreferencesCacheModel =
2625 new CacheModel<PortletPreferences>() {
2626 public PortletPreferences toEntityModel() {
2627 return _nullPortletPreferences;
2628 }
2629 };
2630 }