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 clearUniqueFindersCache(portletPreferences);
252 }
253
254 @Override
255 public void clearCache(List<PortletPreferences> portletPreferenceses) {
256 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
257 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
258
259 for (PortletPreferences portletPreferences : portletPreferenceses) {
260 EntityCacheUtil.removeResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
261 PortletPreferencesImpl.class, portletPreferences.getPrimaryKey());
262
263 clearUniqueFindersCache(portletPreferences);
264 }
265 }
266
267 protected void clearUniqueFindersCache(
268 PortletPreferences portletPreferences) {
269 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O_P_P,
270 new Object[] {
271 Long.valueOf(portletPreferences.getOwnerId()),
272 Integer.valueOf(portletPreferences.getOwnerType()),
273 Long.valueOf(portletPreferences.getPlid()),
274
275 portletPreferences.getPortletId()
276 });
277 }
278
279
285 public PortletPreferences create(long portletPreferencesId) {
286 PortletPreferences portletPreferences = new PortletPreferencesImpl();
287
288 portletPreferences.setNew(true);
289 portletPreferences.setPrimaryKey(portletPreferencesId);
290
291 return portletPreferences;
292 }
293
294
302 public PortletPreferences remove(long portletPreferencesId)
303 throws NoSuchPortletPreferencesException, SystemException {
304 return remove(Long.valueOf(portletPreferencesId));
305 }
306
307
315 @Override
316 public PortletPreferences remove(Serializable primaryKey)
317 throws NoSuchPortletPreferencesException, SystemException {
318 Session session = null;
319
320 try {
321 session = openSession();
322
323 PortletPreferences portletPreferences = (PortletPreferences)session.get(PortletPreferencesImpl.class,
324 primaryKey);
325
326 if (portletPreferences == null) {
327 if (_log.isWarnEnabled()) {
328 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
329 }
330
331 throw new NoSuchPortletPreferencesException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
332 primaryKey);
333 }
334
335 return remove(portletPreferences);
336 }
337 catch (NoSuchPortletPreferencesException nsee) {
338 throw nsee;
339 }
340 catch (Exception e) {
341 throw processException(e);
342 }
343 finally {
344 closeSession(session);
345 }
346 }
347
348 @Override
349 protected PortletPreferences removeImpl(
350 PortletPreferences portletPreferences) throws SystemException {
351 portletPreferences = toUnwrappedModel(portletPreferences);
352
353 Session session = null;
354
355 try {
356 session = openSession();
357
358 BatchSessionUtil.delete(session, portletPreferences);
359 }
360 catch (Exception e) {
361 throw processException(e);
362 }
363 finally {
364 closeSession(session);
365 }
366
367 clearCache(portletPreferences);
368
369 return portletPreferences;
370 }
371
372 @Override
373 public PortletPreferences updateImpl(
374 com.liferay.portal.model.PortletPreferences portletPreferences,
375 boolean merge) throws SystemException {
376 portletPreferences = toUnwrappedModel(portletPreferences);
377
378 boolean isNew = portletPreferences.isNew();
379
380 PortletPreferencesModelImpl portletPreferencesModelImpl = (PortletPreferencesModelImpl)portletPreferences;
381
382 Session session = null;
383
384 try {
385 session = openSession();
386
387 BatchSessionUtil.update(session, portletPreferences, merge);
388
389 portletPreferences.setNew(false);
390 }
391 catch (Exception e) {
392 throw processException(e);
393 }
394 finally {
395 closeSession(session);
396 }
397
398 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
399
400 if (isNew || !PortletPreferencesModelImpl.COLUMN_BITMASK_ENABLED) {
401 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
402 }
403
404 else {
405 if ((portletPreferencesModelImpl.getColumnBitmask() &
406 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID.getColumnBitmask()) != 0) {
407 Object[] args = new Object[] {
408 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid())
409 };
410
411 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PLID, args);
412 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID,
413 args);
414
415 args = new Object[] {
416 Long.valueOf(portletPreferencesModelImpl.getPlid())
417 };
418
419 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PLID, args);
420 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID,
421 args);
422 }
423
424 if ((portletPreferencesModelImpl.getColumnBitmask() &
425 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P.getColumnBitmask()) != 0) {
426 Object[] args = new Object[] {
427 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid()),
428
429 portletPreferencesModelImpl.getOriginalPortletId()
430 };
431
432 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_P_P, args);
433 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P,
434 args);
435
436 args = new Object[] {
437 Long.valueOf(portletPreferencesModelImpl.getPlid()),
438
439 portletPreferencesModelImpl.getPortletId()
440 };
441
442 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_P_P, args);
443 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P,
444 args);
445 }
446
447 if ((portletPreferencesModelImpl.getColumnBitmask() &
448 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P.getColumnBitmask()) != 0) {
449 Object[] args = new Object[] {
450 Long.valueOf(portletPreferencesModelImpl.getOriginalOwnerId()),
451 Integer.valueOf(portletPreferencesModelImpl.getOriginalOwnerType()),
452 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid())
453 };
454
455 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_O_P, args);
456 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P,
457 args);
458
459 args = new Object[] {
460 Long.valueOf(portletPreferencesModelImpl.getOwnerId()),
461 Integer.valueOf(portletPreferencesModelImpl.getOwnerType()),
462 Long.valueOf(portletPreferencesModelImpl.getPlid())
463 };
464
465 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_O_P, args);
466 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P,
467 args);
468 }
469 }
470
471 EntityCacheUtil.putResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
472 PortletPreferencesImpl.class, portletPreferences.getPrimaryKey(),
473 portletPreferences);
474
475 if (isNew) {
476 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
477 new Object[] {
478 Long.valueOf(portletPreferences.getOwnerId()),
479 Integer.valueOf(portletPreferences.getOwnerType()),
480 Long.valueOf(portletPreferences.getPlid()),
481
482 portletPreferences.getPortletId()
483 }, portletPreferences);
484 }
485 else {
486 if ((portletPreferencesModelImpl.getColumnBitmask() &
487 FINDER_PATH_FETCH_BY_O_O_P_P.getColumnBitmask()) != 0) {
488 Object[] args = new Object[] {
489 Long.valueOf(portletPreferencesModelImpl.getOriginalOwnerId()),
490 Integer.valueOf(portletPreferencesModelImpl.getOriginalOwnerType()),
491 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid()),
492
493 portletPreferencesModelImpl.getOriginalPortletId()
494 };
495
496 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_O_P_P, args);
497 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O_P_P, args);
498
499 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
500 new Object[] {
501 Long.valueOf(portletPreferences.getOwnerId()),
502 Integer.valueOf(portletPreferences.getOwnerType()),
503 Long.valueOf(portletPreferences.getPlid()),
504
505 portletPreferences.getPortletId()
506 }, portletPreferences);
507 }
508 }
509
510 return portletPreferences;
511 }
512
513 protected PortletPreferences toUnwrappedModel(
514 PortletPreferences portletPreferences) {
515 if (portletPreferences instanceof PortletPreferencesImpl) {
516 return portletPreferences;
517 }
518
519 PortletPreferencesImpl portletPreferencesImpl = new PortletPreferencesImpl();
520
521 portletPreferencesImpl.setNew(portletPreferences.isNew());
522 portletPreferencesImpl.setPrimaryKey(portletPreferences.getPrimaryKey());
523
524 portletPreferencesImpl.setPortletPreferencesId(portletPreferences.getPortletPreferencesId());
525 portletPreferencesImpl.setOwnerId(portletPreferences.getOwnerId());
526 portletPreferencesImpl.setOwnerType(portletPreferences.getOwnerType());
527 portletPreferencesImpl.setPlid(portletPreferences.getPlid());
528 portletPreferencesImpl.setPortletId(portletPreferences.getPortletId());
529 portletPreferencesImpl.setPreferences(portletPreferences.getPreferences());
530
531 return portletPreferencesImpl;
532 }
533
534
542 @Override
543 public PortletPreferences findByPrimaryKey(Serializable primaryKey)
544 throws NoSuchModelException, SystemException {
545 return findByPrimaryKey(((Long)primaryKey).longValue());
546 }
547
548
556 public PortletPreferences findByPrimaryKey(long portletPreferencesId)
557 throws NoSuchPortletPreferencesException, SystemException {
558 PortletPreferences portletPreferences = fetchByPrimaryKey(portletPreferencesId);
559
560 if (portletPreferences == null) {
561 if (_log.isWarnEnabled()) {
562 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
563 portletPreferencesId);
564 }
565
566 throw new NoSuchPortletPreferencesException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
567 portletPreferencesId);
568 }
569
570 return portletPreferences;
571 }
572
573
580 @Override
581 public PortletPreferences fetchByPrimaryKey(Serializable primaryKey)
582 throws SystemException {
583 return fetchByPrimaryKey(((Long)primaryKey).longValue());
584 }
585
586
593 public PortletPreferences fetchByPrimaryKey(long portletPreferencesId)
594 throws SystemException {
595 PortletPreferences portletPreferences = (PortletPreferences)EntityCacheUtil.getResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
596 PortletPreferencesImpl.class, portletPreferencesId);
597
598 if (portletPreferences == _nullPortletPreferences) {
599 return null;
600 }
601
602 if (portletPreferences == null) {
603 Session session = null;
604
605 boolean hasException = false;
606
607 try {
608 session = openSession();
609
610 portletPreferences = (PortletPreferences)session.get(PortletPreferencesImpl.class,
611 Long.valueOf(portletPreferencesId));
612 }
613 catch (Exception e) {
614 hasException = true;
615
616 throw processException(e);
617 }
618 finally {
619 if (portletPreferences != null) {
620 cacheResult(portletPreferences);
621 }
622 else if (!hasException) {
623 EntityCacheUtil.putResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
624 PortletPreferencesImpl.class, portletPreferencesId,
625 _nullPortletPreferences);
626 }
627
628 closeSession(session);
629 }
630 }
631
632 return portletPreferences;
633 }
634
635
642 public List<PortletPreferences> findByPlid(long plid)
643 throws SystemException {
644 return findByPlid(plid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
645 }
646
647
660 public List<PortletPreferences> findByPlid(long plid, int start, int end)
661 throws SystemException {
662 return findByPlid(plid, start, end, null);
663 }
664
665
679 public List<PortletPreferences> findByPlid(long plid, int start, int end,
680 OrderByComparator orderByComparator) throws SystemException {
681 FinderPath finderPath = null;
682 Object[] finderArgs = null;
683
684 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
685 (orderByComparator == null)) {
686 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID;
687 finderArgs = new Object[] { plid };
688 }
689 else {
690 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_PLID;
691 finderArgs = new Object[] { plid, start, end, orderByComparator };
692 }
693
694 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
695 finderArgs, this);
696
697 if (list == null) {
698 StringBundler query = null;
699
700 if (orderByComparator != null) {
701 query = new StringBundler(3 +
702 (orderByComparator.getOrderByFields().length * 3));
703 }
704 else {
705 query = new StringBundler(2);
706 }
707
708 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
709
710 query.append(_FINDER_COLUMN_PLID_PLID_2);
711
712 if (orderByComparator != null) {
713 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
714 orderByComparator);
715 }
716
717 String sql = query.toString();
718
719 Session session = null;
720
721 try {
722 session = openSession();
723
724 Query q = session.createQuery(sql);
725
726 QueryPos qPos = QueryPos.getInstance(q);
727
728 qPos.add(plid);
729
730 list = (List<PortletPreferences>)QueryUtil.list(q,
731 getDialect(), start, end);
732 }
733 catch (Exception e) {
734 throw processException(e);
735 }
736 finally {
737 if (list == null) {
738 FinderCacheUtil.removeResult(finderPath, finderArgs);
739 }
740 else {
741 cacheResult(list);
742
743 FinderCacheUtil.putResult(finderPath, finderArgs, list);
744 }
745
746 closeSession(session);
747 }
748 }
749
750 return list;
751 }
752
753
766 public PortletPreferences findByPlid_First(long plid,
767 OrderByComparator orderByComparator)
768 throws NoSuchPortletPreferencesException, SystemException {
769 List<PortletPreferences> list = findByPlid(plid, 0, 1, orderByComparator);
770
771 if (list.isEmpty()) {
772 StringBundler msg = new StringBundler(4);
773
774 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
775
776 msg.append("plid=");
777 msg.append(plid);
778
779 msg.append(StringPool.CLOSE_CURLY_BRACE);
780
781 throw new NoSuchPortletPreferencesException(msg.toString());
782 }
783 else {
784 return list.get(0);
785 }
786 }
787
788
801 public PortletPreferences findByPlid_Last(long plid,
802 OrderByComparator orderByComparator)
803 throws NoSuchPortletPreferencesException, SystemException {
804 int count = countByPlid(plid);
805
806 List<PortletPreferences> list = findByPlid(plid, count - 1, count,
807 orderByComparator);
808
809 if (list.isEmpty()) {
810 StringBundler msg = new StringBundler(4);
811
812 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
813
814 msg.append("plid=");
815 msg.append(plid);
816
817 msg.append(StringPool.CLOSE_CURLY_BRACE);
818
819 throw new NoSuchPortletPreferencesException(msg.toString());
820 }
821 else {
822 return list.get(0);
823 }
824 }
825
826
840 public PortletPreferences[] findByPlid_PrevAndNext(
841 long portletPreferencesId, long plid,
842 OrderByComparator orderByComparator)
843 throws NoSuchPortletPreferencesException, SystemException {
844 PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesId);
845
846 Session session = null;
847
848 try {
849 session = openSession();
850
851 PortletPreferences[] array = new PortletPreferencesImpl[3];
852
853 array[0] = getByPlid_PrevAndNext(session, portletPreferences, plid,
854 orderByComparator, true);
855
856 array[1] = portletPreferences;
857
858 array[2] = getByPlid_PrevAndNext(session, portletPreferences, plid,
859 orderByComparator, false);
860
861 return array;
862 }
863 catch (Exception e) {
864 throw processException(e);
865 }
866 finally {
867 closeSession(session);
868 }
869 }
870
871 protected PortletPreferences getByPlid_PrevAndNext(Session session,
872 PortletPreferences portletPreferences, long plid,
873 OrderByComparator orderByComparator, boolean previous) {
874 StringBundler query = null;
875
876 if (orderByComparator != null) {
877 query = new StringBundler(6 +
878 (orderByComparator.getOrderByFields().length * 6));
879 }
880 else {
881 query = new StringBundler(3);
882 }
883
884 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
885
886 query.append(_FINDER_COLUMN_PLID_PLID_2);
887
888 if (orderByComparator != null) {
889 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
890
891 if (orderByConditionFields.length > 0) {
892 query.append(WHERE_AND);
893 }
894
895 for (int i = 0; i < orderByConditionFields.length; i++) {
896 query.append(_ORDER_BY_ENTITY_ALIAS);
897 query.append(orderByConditionFields[i]);
898
899 if ((i + 1) < orderByConditionFields.length) {
900 if (orderByComparator.isAscending() ^ previous) {
901 query.append(WHERE_GREATER_THAN_HAS_NEXT);
902 }
903 else {
904 query.append(WHERE_LESSER_THAN_HAS_NEXT);
905 }
906 }
907 else {
908 if (orderByComparator.isAscending() ^ previous) {
909 query.append(WHERE_GREATER_THAN);
910 }
911 else {
912 query.append(WHERE_LESSER_THAN);
913 }
914 }
915 }
916
917 query.append(ORDER_BY_CLAUSE);
918
919 String[] orderByFields = orderByComparator.getOrderByFields();
920
921 for (int i = 0; i < orderByFields.length; i++) {
922 query.append(_ORDER_BY_ENTITY_ALIAS);
923 query.append(orderByFields[i]);
924
925 if ((i + 1) < orderByFields.length) {
926 if (orderByComparator.isAscending() ^ previous) {
927 query.append(ORDER_BY_ASC_HAS_NEXT);
928 }
929 else {
930 query.append(ORDER_BY_DESC_HAS_NEXT);
931 }
932 }
933 else {
934 if (orderByComparator.isAscending() ^ previous) {
935 query.append(ORDER_BY_ASC);
936 }
937 else {
938 query.append(ORDER_BY_DESC);
939 }
940 }
941 }
942 }
943
944 String sql = query.toString();
945
946 Query q = session.createQuery(sql);
947
948 q.setFirstResult(0);
949 q.setMaxResults(2);
950
951 QueryPos qPos = QueryPos.getInstance(q);
952
953 qPos.add(plid);
954
955 if (orderByComparator != null) {
956 Object[] values = orderByComparator.getOrderByConditionValues(portletPreferences);
957
958 for (Object value : values) {
959 qPos.add(value);
960 }
961 }
962
963 List<PortletPreferences> list = q.list();
964
965 if (list.size() == 2) {
966 return list.get(1);
967 }
968 else {
969 return null;
970 }
971 }
972
973
981 public List<PortletPreferences> findByP_P(long plid, String portletId)
982 throws SystemException {
983 return findByP_P(plid, portletId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
984 null);
985 }
986
987
1001 public List<PortletPreferences> findByP_P(long plid, String portletId,
1002 int start, int end) throws SystemException {
1003 return findByP_P(plid, portletId, start, end, null);
1004 }
1005
1006
1021 public List<PortletPreferences> findByP_P(long plid, String portletId,
1022 int start, int end, OrderByComparator orderByComparator)
1023 throws SystemException {
1024 FinderPath finderPath = null;
1025 Object[] finderArgs = null;
1026
1027 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1028 (orderByComparator == null)) {
1029 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P;
1030 finderArgs = new Object[] { plid, portletId };
1031 }
1032 else {
1033 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_P_P;
1034 finderArgs = new Object[] {
1035 plid, portletId,
1036
1037 start, end, orderByComparator
1038 };
1039 }
1040
1041 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
1042 finderArgs, this);
1043
1044 if (list == null) {
1045 StringBundler query = null;
1046
1047 if (orderByComparator != null) {
1048 query = new StringBundler(4 +
1049 (orderByComparator.getOrderByFields().length * 3));
1050 }
1051 else {
1052 query = new StringBundler(3);
1053 }
1054
1055 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1056
1057 query.append(_FINDER_COLUMN_P_P_PLID_2);
1058
1059 if (portletId == null) {
1060 query.append(_FINDER_COLUMN_P_P_PORTLETID_1);
1061 }
1062 else {
1063 if (portletId.equals(StringPool.BLANK)) {
1064 query.append(_FINDER_COLUMN_P_P_PORTLETID_3);
1065 }
1066 else {
1067 query.append(_FINDER_COLUMN_P_P_PORTLETID_2);
1068 }
1069 }
1070
1071 if (orderByComparator != null) {
1072 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1073 orderByComparator);
1074 }
1075
1076 String sql = query.toString();
1077
1078 Session session = null;
1079
1080 try {
1081 session = openSession();
1082
1083 Query q = session.createQuery(sql);
1084
1085 QueryPos qPos = QueryPos.getInstance(q);
1086
1087 qPos.add(plid);
1088
1089 if (portletId != null) {
1090 qPos.add(portletId);
1091 }
1092
1093 list = (List<PortletPreferences>)QueryUtil.list(q,
1094 getDialect(), start, end);
1095 }
1096 catch (Exception e) {
1097 throw processException(e);
1098 }
1099 finally {
1100 if (list == null) {
1101 FinderCacheUtil.removeResult(finderPath, finderArgs);
1102 }
1103 else {
1104 cacheResult(list);
1105
1106 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1107 }
1108
1109 closeSession(session);
1110 }
1111 }
1112
1113 return list;
1114 }
1115
1116
1130 public PortletPreferences findByP_P_First(long plid, String portletId,
1131 OrderByComparator orderByComparator)
1132 throws NoSuchPortletPreferencesException, SystemException {
1133 List<PortletPreferences> list = findByP_P(plid, portletId, 0, 1,
1134 orderByComparator);
1135
1136 if (list.isEmpty()) {
1137 StringBundler msg = new StringBundler(6);
1138
1139 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1140
1141 msg.append("plid=");
1142 msg.append(plid);
1143
1144 msg.append(", portletId=");
1145 msg.append(portletId);
1146
1147 msg.append(StringPool.CLOSE_CURLY_BRACE);
1148
1149 throw new NoSuchPortletPreferencesException(msg.toString());
1150 }
1151 else {
1152 return list.get(0);
1153 }
1154 }
1155
1156
1170 public PortletPreferences findByP_P_Last(long plid, String portletId,
1171 OrderByComparator orderByComparator)
1172 throws NoSuchPortletPreferencesException, SystemException {
1173 int count = countByP_P(plid, portletId);
1174
1175 List<PortletPreferences> list = findByP_P(plid, portletId, count - 1,
1176 count, orderByComparator);
1177
1178 if (list.isEmpty()) {
1179 StringBundler msg = new StringBundler(6);
1180
1181 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1182
1183 msg.append("plid=");
1184 msg.append(plid);
1185
1186 msg.append(", portletId=");
1187 msg.append(portletId);
1188
1189 msg.append(StringPool.CLOSE_CURLY_BRACE);
1190
1191 throw new NoSuchPortletPreferencesException(msg.toString());
1192 }
1193 else {
1194 return list.get(0);
1195 }
1196 }
1197
1198
1213 public PortletPreferences[] findByP_P_PrevAndNext(
1214 long portletPreferencesId, long plid, String portletId,
1215 OrderByComparator orderByComparator)
1216 throws NoSuchPortletPreferencesException, SystemException {
1217 PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesId);
1218
1219 Session session = null;
1220
1221 try {
1222 session = openSession();
1223
1224 PortletPreferences[] array = new PortletPreferencesImpl[3];
1225
1226 array[0] = getByP_P_PrevAndNext(session, portletPreferences, plid,
1227 portletId, orderByComparator, true);
1228
1229 array[1] = portletPreferences;
1230
1231 array[2] = getByP_P_PrevAndNext(session, portletPreferences, plid,
1232 portletId, orderByComparator, false);
1233
1234 return array;
1235 }
1236 catch (Exception e) {
1237 throw processException(e);
1238 }
1239 finally {
1240 closeSession(session);
1241 }
1242 }
1243
1244 protected PortletPreferences getByP_P_PrevAndNext(Session session,
1245 PortletPreferences portletPreferences, long plid, String portletId,
1246 OrderByComparator orderByComparator, boolean previous) {
1247 StringBundler query = null;
1248
1249 if (orderByComparator != null) {
1250 query = new StringBundler(6 +
1251 (orderByComparator.getOrderByFields().length * 6));
1252 }
1253 else {
1254 query = new StringBundler(3);
1255 }
1256
1257 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1258
1259 query.append(_FINDER_COLUMN_P_P_PLID_2);
1260
1261 if (portletId == null) {
1262 query.append(_FINDER_COLUMN_P_P_PORTLETID_1);
1263 }
1264 else {
1265 if (portletId.equals(StringPool.BLANK)) {
1266 query.append(_FINDER_COLUMN_P_P_PORTLETID_3);
1267 }
1268 else {
1269 query.append(_FINDER_COLUMN_P_P_PORTLETID_2);
1270 }
1271 }
1272
1273 if (orderByComparator != null) {
1274 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1275
1276 if (orderByConditionFields.length > 0) {
1277 query.append(WHERE_AND);
1278 }
1279
1280 for (int i = 0; i < orderByConditionFields.length; i++) {
1281 query.append(_ORDER_BY_ENTITY_ALIAS);
1282 query.append(orderByConditionFields[i]);
1283
1284 if ((i + 1) < orderByConditionFields.length) {
1285 if (orderByComparator.isAscending() ^ previous) {
1286 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1287 }
1288 else {
1289 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1290 }
1291 }
1292 else {
1293 if (orderByComparator.isAscending() ^ previous) {
1294 query.append(WHERE_GREATER_THAN);
1295 }
1296 else {
1297 query.append(WHERE_LESSER_THAN);
1298 }
1299 }
1300 }
1301
1302 query.append(ORDER_BY_CLAUSE);
1303
1304 String[] orderByFields = orderByComparator.getOrderByFields();
1305
1306 for (int i = 0; i < orderByFields.length; i++) {
1307 query.append(_ORDER_BY_ENTITY_ALIAS);
1308 query.append(orderByFields[i]);
1309
1310 if ((i + 1) < orderByFields.length) {
1311 if (orderByComparator.isAscending() ^ previous) {
1312 query.append(ORDER_BY_ASC_HAS_NEXT);
1313 }
1314 else {
1315 query.append(ORDER_BY_DESC_HAS_NEXT);
1316 }
1317 }
1318 else {
1319 if (orderByComparator.isAscending() ^ previous) {
1320 query.append(ORDER_BY_ASC);
1321 }
1322 else {
1323 query.append(ORDER_BY_DESC);
1324 }
1325 }
1326 }
1327 }
1328
1329 String sql = query.toString();
1330
1331 Query q = session.createQuery(sql);
1332
1333 q.setFirstResult(0);
1334 q.setMaxResults(2);
1335
1336 QueryPos qPos = QueryPos.getInstance(q);
1337
1338 qPos.add(plid);
1339
1340 if (portletId != null) {
1341 qPos.add(portletId);
1342 }
1343
1344 if (orderByComparator != null) {
1345 Object[] values = orderByComparator.getOrderByConditionValues(portletPreferences);
1346
1347 for (Object value : values) {
1348 qPos.add(value);
1349 }
1350 }
1351
1352 List<PortletPreferences> list = q.list();
1353
1354 if (list.size() == 2) {
1355 return list.get(1);
1356 }
1357 else {
1358 return null;
1359 }
1360 }
1361
1362
1371 public List<PortletPreferences> findByO_O_P(long ownerId, int ownerType,
1372 long plid) throws SystemException {
1373 return findByO_O_P(ownerId, ownerType, plid, QueryUtil.ALL_POS,
1374 QueryUtil.ALL_POS, null);
1375 }
1376
1377
1392 public List<PortletPreferences> findByO_O_P(long ownerId, int ownerType,
1393 long plid, int start, int end) throws SystemException {
1394 return findByO_O_P(ownerId, ownerType, plid, start, end, null);
1395 }
1396
1397
1413 public List<PortletPreferences> findByO_O_P(long ownerId, int ownerType,
1414 long plid, int start, int end, OrderByComparator orderByComparator)
1415 throws SystemException {
1416 FinderPath finderPath = null;
1417 Object[] finderArgs = null;
1418
1419 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1420 (orderByComparator == null)) {
1421 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P;
1422 finderArgs = new Object[] { ownerId, ownerType, plid };
1423 }
1424 else {
1425 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_O_O_P;
1426 finderArgs = new Object[] {
1427 ownerId, ownerType, plid,
1428
1429 start, end, orderByComparator
1430 };
1431 }
1432
1433 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
1434 finderArgs, this);
1435
1436 if (list == null) {
1437 StringBundler query = null;
1438
1439 if (orderByComparator != null) {
1440 query = new StringBundler(5 +
1441 (orderByComparator.getOrderByFields().length * 3));
1442 }
1443 else {
1444 query = new StringBundler(4);
1445 }
1446
1447 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1448
1449 query.append(_FINDER_COLUMN_O_O_P_OWNERID_2);
1450
1451 query.append(_FINDER_COLUMN_O_O_P_OWNERTYPE_2);
1452
1453 query.append(_FINDER_COLUMN_O_O_P_PLID_2);
1454
1455 if (orderByComparator != null) {
1456 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1457 orderByComparator);
1458 }
1459
1460 String sql = query.toString();
1461
1462 Session session = null;
1463
1464 try {
1465 session = openSession();
1466
1467 Query q = session.createQuery(sql);
1468
1469 QueryPos qPos = QueryPos.getInstance(q);
1470
1471 qPos.add(ownerId);
1472
1473 qPos.add(ownerType);
1474
1475 qPos.add(plid);
1476
1477 list = (List<PortletPreferences>)QueryUtil.list(q,
1478 getDialect(), start, end);
1479 }
1480 catch (Exception e) {
1481 throw processException(e);
1482 }
1483 finally {
1484 if (list == null) {
1485 FinderCacheUtil.removeResult(finderPath, finderArgs);
1486 }
1487 else {
1488 cacheResult(list);
1489
1490 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1491 }
1492
1493 closeSession(session);
1494 }
1495 }
1496
1497 return list;
1498 }
1499
1500
1515 public PortletPreferences findByO_O_P_First(long ownerId, int ownerType,
1516 long plid, OrderByComparator orderByComparator)
1517 throws NoSuchPortletPreferencesException, SystemException {
1518 List<PortletPreferences> list = findByO_O_P(ownerId, ownerType, plid,
1519 0, 1, orderByComparator);
1520
1521 if (list.isEmpty()) {
1522 StringBundler msg = new StringBundler(8);
1523
1524 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1525
1526 msg.append("ownerId=");
1527 msg.append(ownerId);
1528
1529 msg.append(", ownerType=");
1530 msg.append(ownerType);
1531
1532 msg.append(", plid=");
1533 msg.append(plid);
1534
1535 msg.append(StringPool.CLOSE_CURLY_BRACE);
1536
1537 throw new NoSuchPortletPreferencesException(msg.toString());
1538 }
1539 else {
1540 return list.get(0);
1541 }
1542 }
1543
1544
1559 public PortletPreferences findByO_O_P_Last(long ownerId, int ownerType,
1560 long plid, OrderByComparator orderByComparator)
1561 throws NoSuchPortletPreferencesException, SystemException {
1562 int count = countByO_O_P(ownerId, ownerType, plid);
1563
1564 List<PortletPreferences> list = findByO_O_P(ownerId, ownerType, plid,
1565 count - 1, count, orderByComparator);
1566
1567 if (list.isEmpty()) {
1568 StringBundler msg = new StringBundler(8);
1569
1570 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1571
1572 msg.append("ownerId=");
1573 msg.append(ownerId);
1574
1575 msg.append(", ownerType=");
1576 msg.append(ownerType);
1577
1578 msg.append(", plid=");
1579 msg.append(plid);
1580
1581 msg.append(StringPool.CLOSE_CURLY_BRACE);
1582
1583 throw new NoSuchPortletPreferencesException(msg.toString());
1584 }
1585 else {
1586 return list.get(0);
1587 }
1588 }
1589
1590
1606 public PortletPreferences[] findByO_O_P_PrevAndNext(
1607 long portletPreferencesId, long ownerId, int ownerType, long plid,
1608 OrderByComparator orderByComparator)
1609 throws NoSuchPortletPreferencesException, SystemException {
1610 PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesId);
1611
1612 Session session = null;
1613
1614 try {
1615 session = openSession();
1616
1617 PortletPreferences[] array = new PortletPreferencesImpl[3];
1618
1619 array[0] = getByO_O_P_PrevAndNext(session, portletPreferences,
1620 ownerId, ownerType, plid, orderByComparator, true);
1621
1622 array[1] = portletPreferences;
1623
1624 array[2] = getByO_O_P_PrevAndNext(session, portletPreferences,
1625 ownerId, ownerType, plid, orderByComparator, false);
1626
1627 return array;
1628 }
1629 catch (Exception e) {
1630 throw processException(e);
1631 }
1632 finally {
1633 closeSession(session);
1634 }
1635 }
1636
1637 protected PortletPreferences getByO_O_P_PrevAndNext(Session session,
1638 PortletPreferences portletPreferences, long ownerId, int ownerType,
1639 long plid, OrderByComparator orderByComparator, boolean previous) {
1640 StringBundler query = null;
1641
1642 if (orderByComparator != null) {
1643 query = new StringBundler(6 +
1644 (orderByComparator.getOrderByFields().length * 6));
1645 }
1646 else {
1647 query = new StringBundler(3);
1648 }
1649
1650 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1651
1652 query.append(_FINDER_COLUMN_O_O_P_OWNERID_2);
1653
1654 query.append(_FINDER_COLUMN_O_O_P_OWNERTYPE_2);
1655
1656 query.append(_FINDER_COLUMN_O_O_P_PLID_2);
1657
1658 if (orderByComparator != null) {
1659 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1660
1661 if (orderByConditionFields.length > 0) {
1662 query.append(WHERE_AND);
1663 }
1664
1665 for (int i = 0; i < orderByConditionFields.length; i++) {
1666 query.append(_ORDER_BY_ENTITY_ALIAS);
1667 query.append(orderByConditionFields[i]);
1668
1669 if ((i + 1) < orderByConditionFields.length) {
1670 if (orderByComparator.isAscending() ^ previous) {
1671 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1672 }
1673 else {
1674 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1675 }
1676 }
1677 else {
1678 if (orderByComparator.isAscending() ^ previous) {
1679 query.append(WHERE_GREATER_THAN);
1680 }
1681 else {
1682 query.append(WHERE_LESSER_THAN);
1683 }
1684 }
1685 }
1686
1687 query.append(ORDER_BY_CLAUSE);
1688
1689 String[] orderByFields = orderByComparator.getOrderByFields();
1690
1691 for (int i = 0; i < orderByFields.length; i++) {
1692 query.append(_ORDER_BY_ENTITY_ALIAS);
1693 query.append(orderByFields[i]);
1694
1695 if ((i + 1) < orderByFields.length) {
1696 if (orderByComparator.isAscending() ^ previous) {
1697 query.append(ORDER_BY_ASC_HAS_NEXT);
1698 }
1699 else {
1700 query.append(ORDER_BY_DESC_HAS_NEXT);
1701 }
1702 }
1703 else {
1704 if (orderByComparator.isAscending() ^ previous) {
1705 query.append(ORDER_BY_ASC);
1706 }
1707 else {
1708 query.append(ORDER_BY_DESC);
1709 }
1710 }
1711 }
1712 }
1713
1714 String sql = query.toString();
1715
1716 Query q = session.createQuery(sql);
1717
1718 q.setFirstResult(0);
1719 q.setMaxResults(2);
1720
1721 QueryPos qPos = QueryPos.getInstance(q);
1722
1723 qPos.add(ownerId);
1724
1725 qPos.add(ownerType);
1726
1727 qPos.add(plid);
1728
1729 if (orderByComparator != null) {
1730 Object[] values = orderByComparator.getOrderByConditionValues(portletPreferences);
1731
1732 for (Object value : values) {
1733 qPos.add(value);
1734 }
1735 }
1736
1737 List<PortletPreferences> list = q.list();
1738
1739 if (list.size() == 2) {
1740 return list.get(1);
1741 }
1742 else {
1743 return null;
1744 }
1745 }
1746
1747
1758 public PortletPreferences findByO_O_P_P(long ownerId, int ownerType,
1759 long plid, String portletId)
1760 throws NoSuchPortletPreferencesException, SystemException {
1761 PortletPreferences portletPreferences = fetchByO_O_P_P(ownerId,
1762 ownerType, plid, portletId);
1763
1764 if (portletPreferences == null) {
1765 StringBundler msg = new StringBundler(10);
1766
1767 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1768
1769 msg.append("ownerId=");
1770 msg.append(ownerId);
1771
1772 msg.append(", ownerType=");
1773 msg.append(ownerType);
1774
1775 msg.append(", plid=");
1776 msg.append(plid);
1777
1778 msg.append(", portletId=");
1779 msg.append(portletId);
1780
1781 msg.append(StringPool.CLOSE_CURLY_BRACE);
1782
1783 if (_log.isWarnEnabled()) {
1784 _log.warn(msg.toString());
1785 }
1786
1787 throw new NoSuchPortletPreferencesException(msg.toString());
1788 }
1789
1790 return portletPreferences;
1791 }
1792
1793
1803 public PortletPreferences fetchByO_O_P_P(long ownerId, int ownerType,
1804 long plid, String portletId) throws SystemException {
1805 return fetchByO_O_P_P(ownerId, ownerType, plid, portletId, true);
1806 }
1807
1808
1819 public PortletPreferences fetchByO_O_P_P(long ownerId, int ownerType,
1820 long plid, String portletId, boolean retrieveFromCache)
1821 throws SystemException {
1822 Object[] finderArgs = new Object[] { ownerId, ownerType, plid, portletId };
1823
1824 Object result = null;
1825
1826 if (retrieveFromCache) {
1827 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_O_O_P_P,
1828 finderArgs, this);
1829 }
1830
1831 if (result == null) {
1832 StringBundler query = new StringBundler(5);
1833
1834 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1835
1836 query.append(_FINDER_COLUMN_O_O_P_P_OWNERID_2);
1837
1838 query.append(_FINDER_COLUMN_O_O_P_P_OWNERTYPE_2);
1839
1840 query.append(_FINDER_COLUMN_O_O_P_P_PLID_2);
1841
1842 if (portletId == null) {
1843 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_1);
1844 }
1845 else {
1846 if (portletId.equals(StringPool.BLANK)) {
1847 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_3);
1848 }
1849 else {
1850 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_2);
1851 }
1852 }
1853
1854 String sql = query.toString();
1855
1856 Session session = null;
1857
1858 try {
1859 session = openSession();
1860
1861 Query q = session.createQuery(sql);
1862
1863 QueryPos qPos = QueryPos.getInstance(q);
1864
1865 qPos.add(ownerId);
1866
1867 qPos.add(ownerType);
1868
1869 qPos.add(plid);
1870
1871 if (portletId != null) {
1872 qPos.add(portletId);
1873 }
1874
1875 List<PortletPreferences> list = q.list();
1876
1877 result = list;
1878
1879 PortletPreferences portletPreferences = null;
1880
1881 if (list.isEmpty()) {
1882 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
1883 finderArgs, list);
1884 }
1885 else {
1886 portletPreferences = list.get(0);
1887
1888 cacheResult(portletPreferences);
1889
1890 if ((portletPreferences.getOwnerId() != ownerId) ||
1891 (portletPreferences.getOwnerType() != ownerType) ||
1892 (portletPreferences.getPlid() != plid) ||
1893 (portletPreferences.getPortletId() == null) ||
1894 !portletPreferences.getPortletId().equals(portletId)) {
1895 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
1896 finderArgs, portletPreferences);
1897 }
1898 }
1899
1900 return portletPreferences;
1901 }
1902 catch (Exception e) {
1903 throw processException(e);
1904 }
1905 finally {
1906 if (result == null) {
1907 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O_P_P,
1908 finderArgs);
1909 }
1910
1911 closeSession(session);
1912 }
1913 }
1914 else {
1915 if (result instanceof List<?>) {
1916 return null;
1917 }
1918 else {
1919 return (PortletPreferences)result;
1920 }
1921 }
1922 }
1923
1924
1930 public List<PortletPreferences> findAll() throws SystemException {
1931 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1932 }
1933
1934
1946 public List<PortletPreferences> findAll(int start, int end)
1947 throws SystemException {
1948 return findAll(start, end, null);
1949 }
1950
1951
1964 public List<PortletPreferences> findAll(int start, int end,
1965 OrderByComparator orderByComparator) throws SystemException {
1966 FinderPath finderPath = null;
1967 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1968
1969 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1970 (orderByComparator == null)) {
1971 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1972 finderArgs = FINDER_ARGS_EMPTY;
1973 }
1974 else {
1975 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1976 finderArgs = new Object[] { start, end, orderByComparator };
1977 }
1978
1979 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
1980 finderArgs, this);
1981
1982 if (list == null) {
1983 StringBundler query = null;
1984 String sql = null;
1985
1986 if (orderByComparator != null) {
1987 query = new StringBundler(2 +
1988 (orderByComparator.getOrderByFields().length * 3));
1989
1990 query.append(_SQL_SELECT_PORTLETPREFERENCES);
1991
1992 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1993 orderByComparator);
1994
1995 sql = query.toString();
1996 }
1997 else {
1998 sql = _SQL_SELECT_PORTLETPREFERENCES;
1999 }
2000
2001 Session session = null;
2002
2003 try {
2004 session = openSession();
2005
2006 Query q = session.createQuery(sql);
2007
2008 if (orderByComparator == null) {
2009 list = (List<PortletPreferences>)QueryUtil.list(q,
2010 getDialect(), start, end, false);
2011
2012 Collections.sort(list);
2013 }
2014 else {
2015 list = (List<PortletPreferences>)QueryUtil.list(q,
2016 getDialect(), start, end);
2017 }
2018 }
2019 catch (Exception e) {
2020 throw processException(e);
2021 }
2022 finally {
2023 if (list == null) {
2024 FinderCacheUtil.removeResult(finderPath, finderArgs);
2025 }
2026 else {
2027 cacheResult(list);
2028
2029 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2030 }
2031
2032 closeSession(session);
2033 }
2034 }
2035
2036 return list;
2037 }
2038
2039
2045 public void removeByPlid(long plid) throws SystemException {
2046 for (PortletPreferences portletPreferences : findByPlid(plid)) {
2047 remove(portletPreferences);
2048 }
2049 }
2050
2051
2058 public void removeByP_P(long plid, String portletId)
2059 throws SystemException {
2060 for (PortletPreferences portletPreferences : findByP_P(plid, portletId)) {
2061 remove(portletPreferences);
2062 }
2063 }
2064
2065
2073 public void removeByO_O_P(long ownerId, int ownerType, long plid)
2074 throws SystemException {
2075 for (PortletPreferences portletPreferences : findByO_O_P(ownerId,
2076 ownerType, plid)) {
2077 remove(portletPreferences);
2078 }
2079 }
2080
2081
2090 public void removeByO_O_P_P(long ownerId, int ownerType, long plid,
2091 String portletId)
2092 throws NoSuchPortletPreferencesException, SystemException {
2093 PortletPreferences portletPreferences = findByO_O_P_P(ownerId,
2094 ownerType, plid, portletId);
2095
2096 remove(portletPreferences);
2097 }
2098
2099
2104 public void removeAll() throws SystemException {
2105 for (PortletPreferences portletPreferences : findAll()) {
2106 remove(portletPreferences);
2107 }
2108 }
2109
2110
2117 public int countByPlid(long plid) throws SystemException {
2118 Object[] finderArgs = new Object[] { plid };
2119
2120 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PLID,
2121 finderArgs, this);
2122
2123 if (count == null) {
2124 StringBundler query = new StringBundler(2);
2125
2126 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2127
2128 query.append(_FINDER_COLUMN_PLID_PLID_2);
2129
2130 String sql = query.toString();
2131
2132 Session session = null;
2133
2134 try {
2135 session = openSession();
2136
2137 Query q = session.createQuery(sql);
2138
2139 QueryPos qPos = QueryPos.getInstance(q);
2140
2141 qPos.add(plid);
2142
2143 count = (Long)q.uniqueResult();
2144 }
2145 catch (Exception e) {
2146 throw processException(e);
2147 }
2148 finally {
2149 if (count == null) {
2150 count = Long.valueOf(0);
2151 }
2152
2153 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_PLID,
2154 finderArgs, count);
2155
2156 closeSession(session);
2157 }
2158 }
2159
2160 return count.intValue();
2161 }
2162
2163
2171 public int countByP_P(long plid, String portletId)
2172 throws SystemException {
2173 Object[] finderArgs = new Object[] { plid, portletId };
2174
2175 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_P,
2176 finderArgs, this);
2177
2178 if (count == null) {
2179 StringBundler query = new StringBundler(3);
2180
2181 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2182
2183 query.append(_FINDER_COLUMN_P_P_PLID_2);
2184
2185 if (portletId == null) {
2186 query.append(_FINDER_COLUMN_P_P_PORTLETID_1);
2187 }
2188 else {
2189 if (portletId.equals(StringPool.BLANK)) {
2190 query.append(_FINDER_COLUMN_P_P_PORTLETID_3);
2191 }
2192 else {
2193 query.append(_FINDER_COLUMN_P_P_PORTLETID_2);
2194 }
2195 }
2196
2197 String sql = query.toString();
2198
2199 Session session = null;
2200
2201 try {
2202 session = openSession();
2203
2204 Query q = session.createQuery(sql);
2205
2206 QueryPos qPos = QueryPos.getInstance(q);
2207
2208 qPos.add(plid);
2209
2210 if (portletId != null) {
2211 qPos.add(portletId);
2212 }
2213
2214 count = (Long)q.uniqueResult();
2215 }
2216 catch (Exception e) {
2217 throw processException(e);
2218 }
2219 finally {
2220 if (count == null) {
2221 count = Long.valueOf(0);
2222 }
2223
2224 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_P, finderArgs,
2225 count);
2226
2227 closeSession(session);
2228 }
2229 }
2230
2231 return count.intValue();
2232 }
2233
2234
2243 public int countByO_O_P(long ownerId, int ownerType, long plid)
2244 throws SystemException {
2245 Object[] finderArgs = new Object[] { ownerId, ownerType, plid };
2246
2247 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_O_O_P,
2248 finderArgs, this);
2249
2250 if (count == null) {
2251 StringBundler query = new StringBundler(4);
2252
2253 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2254
2255 query.append(_FINDER_COLUMN_O_O_P_OWNERID_2);
2256
2257 query.append(_FINDER_COLUMN_O_O_P_OWNERTYPE_2);
2258
2259 query.append(_FINDER_COLUMN_O_O_P_PLID_2);
2260
2261 String sql = query.toString();
2262
2263 Session session = null;
2264
2265 try {
2266 session = openSession();
2267
2268 Query q = session.createQuery(sql);
2269
2270 QueryPos qPos = QueryPos.getInstance(q);
2271
2272 qPos.add(ownerId);
2273
2274 qPos.add(ownerType);
2275
2276 qPos.add(plid);
2277
2278 count = (Long)q.uniqueResult();
2279 }
2280 catch (Exception e) {
2281 throw processException(e);
2282 }
2283 finally {
2284 if (count == null) {
2285 count = Long.valueOf(0);
2286 }
2287
2288 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_O_O_P,
2289 finderArgs, count);
2290
2291 closeSession(session);
2292 }
2293 }
2294
2295 return count.intValue();
2296 }
2297
2298
2308 public int countByO_O_P_P(long ownerId, int ownerType, long plid,
2309 String portletId) throws SystemException {
2310 Object[] finderArgs = new Object[] { ownerId, ownerType, plid, portletId };
2311
2312 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_O_O_P_P,
2313 finderArgs, this);
2314
2315 if (count == null) {
2316 StringBundler query = new StringBundler(5);
2317
2318 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2319
2320 query.append(_FINDER_COLUMN_O_O_P_P_OWNERID_2);
2321
2322 query.append(_FINDER_COLUMN_O_O_P_P_OWNERTYPE_2);
2323
2324 query.append(_FINDER_COLUMN_O_O_P_P_PLID_2);
2325
2326 if (portletId == null) {
2327 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_1);
2328 }
2329 else {
2330 if (portletId.equals(StringPool.BLANK)) {
2331 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_3);
2332 }
2333 else {
2334 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_2);
2335 }
2336 }
2337
2338 String sql = query.toString();
2339
2340 Session session = null;
2341
2342 try {
2343 session = openSession();
2344
2345 Query q = session.createQuery(sql);
2346
2347 QueryPos qPos = QueryPos.getInstance(q);
2348
2349 qPos.add(ownerId);
2350
2351 qPos.add(ownerType);
2352
2353 qPos.add(plid);
2354
2355 if (portletId != null) {
2356 qPos.add(portletId);
2357 }
2358
2359 count = (Long)q.uniqueResult();
2360 }
2361 catch (Exception e) {
2362 throw processException(e);
2363 }
2364 finally {
2365 if (count == null) {
2366 count = Long.valueOf(0);
2367 }
2368
2369 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_O_O_P_P,
2370 finderArgs, count);
2371
2372 closeSession(session);
2373 }
2374 }
2375
2376 return count.intValue();
2377 }
2378
2379
2385 public int countAll() throws SystemException {
2386 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2387 FINDER_ARGS_EMPTY, this);
2388
2389 if (count == null) {
2390 Session session = null;
2391
2392 try {
2393 session = openSession();
2394
2395 Query q = session.createQuery(_SQL_COUNT_PORTLETPREFERENCES);
2396
2397 count = (Long)q.uniqueResult();
2398 }
2399 catch (Exception e) {
2400 throw processException(e);
2401 }
2402 finally {
2403 if (count == null) {
2404 count = Long.valueOf(0);
2405 }
2406
2407 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2408 FINDER_ARGS_EMPTY, count);
2409
2410 closeSession(session);
2411 }
2412 }
2413
2414 return count.intValue();
2415 }
2416
2417
2420 public void afterPropertiesSet() {
2421 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2422 com.liferay.portal.util.PropsUtil.get(
2423 "value.object.listener.com.liferay.portal.model.PortletPreferences")));
2424
2425 if (listenerClassNames.length > 0) {
2426 try {
2427 List<ModelListener<PortletPreferences>> listenersList = new ArrayList<ModelListener<PortletPreferences>>();
2428
2429 for (String listenerClassName : listenerClassNames) {
2430 listenersList.add((ModelListener<PortletPreferences>)InstanceFactory.newInstance(
2431 listenerClassName));
2432 }
2433
2434 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2435 }
2436 catch (Exception e) {
2437 _log.error(e);
2438 }
2439 }
2440 }
2441
2442 public void destroy() {
2443 EntityCacheUtil.removeCache(PortletPreferencesImpl.class.getName());
2444 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2445 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2446 }
2447
2448 @BeanReference(type = AccountPersistence.class)
2449 protected AccountPersistence accountPersistence;
2450 @BeanReference(type = AddressPersistence.class)
2451 protected AddressPersistence addressPersistence;
2452 @BeanReference(type = BrowserTrackerPersistence.class)
2453 protected BrowserTrackerPersistence browserTrackerPersistence;
2454 @BeanReference(type = ClassNamePersistence.class)
2455 protected ClassNamePersistence classNamePersistence;
2456 @BeanReference(type = ClusterGroupPersistence.class)
2457 protected ClusterGroupPersistence clusterGroupPersistence;
2458 @BeanReference(type = CompanyPersistence.class)
2459 protected CompanyPersistence companyPersistence;
2460 @BeanReference(type = ContactPersistence.class)
2461 protected ContactPersistence contactPersistence;
2462 @BeanReference(type = CountryPersistence.class)
2463 protected CountryPersistence countryPersistence;
2464 @BeanReference(type = EmailAddressPersistence.class)
2465 protected EmailAddressPersistence emailAddressPersistence;
2466 @BeanReference(type = GroupPersistence.class)
2467 protected GroupPersistence groupPersistence;
2468 @BeanReference(type = ImagePersistence.class)
2469 protected ImagePersistence imagePersistence;
2470 @BeanReference(type = LayoutPersistence.class)
2471 protected LayoutPersistence layoutPersistence;
2472 @BeanReference(type = LayoutBranchPersistence.class)
2473 protected LayoutBranchPersistence layoutBranchPersistence;
2474 @BeanReference(type = LayoutPrototypePersistence.class)
2475 protected LayoutPrototypePersistence layoutPrototypePersistence;
2476 @BeanReference(type = LayoutRevisionPersistence.class)
2477 protected LayoutRevisionPersistence layoutRevisionPersistence;
2478 @BeanReference(type = LayoutSetPersistence.class)
2479 protected LayoutSetPersistence layoutSetPersistence;
2480 @BeanReference(type = LayoutSetBranchPersistence.class)
2481 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
2482 @BeanReference(type = LayoutSetPrototypePersistence.class)
2483 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2484 @BeanReference(type = ListTypePersistence.class)
2485 protected ListTypePersistence listTypePersistence;
2486 @BeanReference(type = LockPersistence.class)
2487 protected LockPersistence lockPersistence;
2488 @BeanReference(type = MembershipRequestPersistence.class)
2489 protected MembershipRequestPersistence membershipRequestPersistence;
2490 @BeanReference(type = OrganizationPersistence.class)
2491 protected OrganizationPersistence organizationPersistence;
2492 @BeanReference(type = OrgGroupPermissionPersistence.class)
2493 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2494 @BeanReference(type = OrgGroupRolePersistence.class)
2495 protected OrgGroupRolePersistence orgGroupRolePersistence;
2496 @BeanReference(type = OrgLaborPersistence.class)
2497 protected OrgLaborPersistence orgLaborPersistence;
2498 @BeanReference(type = PasswordPolicyPersistence.class)
2499 protected PasswordPolicyPersistence passwordPolicyPersistence;
2500 @BeanReference(type = PasswordPolicyRelPersistence.class)
2501 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2502 @BeanReference(type = PasswordTrackerPersistence.class)
2503 protected PasswordTrackerPersistence passwordTrackerPersistence;
2504 @BeanReference(type = PermissionPersistence.class)
2505 protected PermissionPersistence permissionPersistence;
2506 @BeanReference(type = PhonePersistence.class)
2507 protected PhonePersistence phonePersistence;
2508 @BeanReference(type = PluginSettingPersistence.class)
2509 protected PluginSettingPersistence pluginSettingPersistence;
2510 @BeanReference(type = PortalPreferencesPersistence.class)
2511 protected PortalPreferencesPersistence portalPreferencesPersistence;
2512 @BeanReference(type = PortletPersistence.class)
2513 protected PortletPersistence portletPersistence;
2514 @BeanReference(type = PortletItemPersistence.class)
2515 protected PortletItemPersistence portletItemPersistence;
2516 @BeanReference(type = PortletPreferencesPersistence.class)
2517 protected PortletPreferencesPersistence portletPreferencesPersistence;
2518 @BeanReference(type = RegionPersistence.class)
2519 protected RegionPersistence regionPersistence;
2520 @BeanReference(type = ReleasePersistence.class)
2521 protected ReleasePersistence releasePersistence;
2522 @BeanReference(type = RepositoryPersistence.class)
2523 protected RepositoryPersistence repositoryPersistence;
2524 @BeanReference(type = RepositoryEntryPersistence.class)
2525 protected RepositoryEntryPersistence repositoryEntryPersistence;
2526 @BeanReference(type = ResourcePersistence.class)
2527 protected ResourcePersistence resourcePersistence;
2528 @BeanReference(type = ResourceActionPersistence.class)
2529 protected ResourceActionPersistence resourceActionPersistence;
2530 @BeanReference(type = ResourceBlockPersistence.class)
2531 protected ResourceBlockPersistence resourceBlockPersistence;
2532 @BeanReference(type = ResourceBlockPermissionPersistence.class)
2533 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
2534 @BeanReference(type = ResourceCodePersistence.class)
2535 protected ResourceCodePersistence resourceCodePersistence;
2536 @BeanReference(type = ResourcePermissionPersistence.class)
2537 protected ResourcePermissionPersistence resourcePermissionPersistence;
2538 @BeanReference(type = ResourceTypePermissionPersistence.class)
2539 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
2540 @BeanReference(type = RolePersistence.class)
2541 protected RolePersistence rolePersistence;
2542 @BeanReference(type = ServiceComponentPersistence.class)
2543 protected ServiceComponentPersistence serviceComponentPersistence;
2544 @BeanReference(type = ShardPersistence.class)
2545 protected ShardPersistence shardPersistence;
2546 @BeanReference(type = SubscriptionPersistence.class)
2547 protected SubscriptionPersistence subscriptionPersistence;
2548 @BeanReference(type = TeamPersistence.class)
2549 protected TeamPersistence teamPersistence;
2550 @BeanReference(type = TicketPersistence.class)
2551 protected TicketPersistence ticketPersistence;
2552 @BeanReference(type = UserPersistence.class)
2553 protected UserPersistence userPersistence;
2554 @BeanReference(type = UserGroupPersistence.class)
2555 protected UserGroupPersistence userGroupPersistence;
2556 @BeanReference(type = UserGroupGroupRolePersistence.class)
2557 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2558 @BeanReference(type = UserGroupRolePersistence.class)
2559 protected UserGroupRolePersistence userGroupRolePersistence;
2560 @BeanReference(type = UserIdMapperPersistence.class)
2561 protected UserIdMapperPersistence userIdMapperPersistence;
2562 @BeanReference(type = UserNotificationEventPersistence.class)
2563 protected UserNotificationEventPersistence userNotificationEventPersistence;
2564 @BeanReference(type = UserTrackerPersistence.class)
2565 protected UserTrackerPersistence userTrackerPersistence;
2566 @BeanReference(type = UserTrackerPathPersistence.class)
2567 protected UserTrackerPathPersistence userTrackerPathPersistence;
2568 @BeanReference(type = VirtualHostPersistence.class)
2569 protected VirtualHostPersistence virtualHostPersistence;
2570 @BeanReference(type = WebDAVPropsPersistence.class)
2571 protected WebDAVPropsPersistence webDAVPropsPersistence;
2572 @BeanReference(type = WebsitePersistence.class)
2573 protected WebsitePersistence websitePersistence;
2574 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2575 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2576 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2577 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2578 private static final String _SQL_SELECT_PORTLETPREFERENCES = "SELECT portletPreferences FROM PortletPreferences portletPreferences";
2579 private static final String _SQL_SELECT_PORTLETPREFERENCES_WHERE = "SELECT portletPreferences FROM PortletPreferences portletPreferences WHERE ";
2580 private static final String _SQL_COUNT_PORTLETPREFERENCES = "SELECT COUNT(portletPreferences) FROM PortletPreferences portletPreferences";
2581 private static final String _SQL_COUNT_PORTLETPREFERENCES_WHERE = "SELECT COUNT(portletPreferences) FROM PortletPreferences portletPreferences WHERE ";
2582 private static final String _FINDER_COLUMN_PLID_PLID_2 = "portletPreferences.plid = ?";
2583 private static final String _FINDER_COLUMN_P_P_PLID_2 = "portletPreferences.plid = ? AND ";
2584 private static final String _FINDER_COLUMN_P_P_PORTLETID_1 = "portletPreferences.portletId IS NULL";
2585 private static final String _FINDER_COLUMN_P_P_PORTLETID_2 = "portletPreferences.portletId = ?";
2586 private static final String _FINDER_COLUMN_P_P_PORTLETID_3 = "(portletPreferences.portletId IS NULL OR portletPreferences.portletId = ?)";
2587 private static final String _FINDER_COLUMN_O_O_P_OWNERID_2 = "portletPreferences.ownerId = ? AND ";
2588 private static final String _FINDER_COLUMN_O_O_P_OWNERTYPE_2 = "portletPreferences.ownerType = ? AND ";
2589 private static final String _FINDER_COLUMN_O_O_P_PLID_2 = "portletPreferences.plid = ?";
2590 private static final String _FINDER_COLUMN_O_O_P_P_OWNERID_2 = "portletPreferences.ownerId = ? AND ";
2591 private static final String _FINDER_COLUMN_O_O_P_P_OWNERTYPE_2 = "portletPreferences.ownerType = ? AND ";
2592 private static final String _FINDER_COLUMN_O_O_P_P_PLID_2 = "portletPreferences.plid = ? AND ";
2593 private static final String _FINDER_COLUMN_O_O_P_P_PORTLETID_1 = "portletPreferences.portletId IS NULL";
2594 private static final String _FINDER_COLUMN_O_O_P_P_PORTLETID_2 = "portletPreferences.portletId = ?";
2595 private static final String _FINDER_COLUMN_O_O_P_P_PORTLETID_3 = "(portletPreferences.portletId IS NULL OR portletPreferences.portletId = ?)";
2596 private static final String _ORDER_BY_ENTITY_ALIAS = "portletPreferences.";
2597 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PortletPreferences exists with the primary key ";
2598 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PortletPreferences exists with the key {";
2599 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2600 private static Log _log = LogFactoryUtil.getLog(PortletPreferencesPersistenceImpl.class);
2601 private static PortletPreferences _nullPortletPreferences = new PortletPreferencesImpl() {
2602 @Override
2603 public Object clone() {
2604 return this;
2605 }
2606
2607 @Override
2608 public CacheModel<PortletPreferences> toCacheModel() {
2609 return _nullPortletPreferencesCacheModel;
2610 }
2611 };
2612
2613 private static CacheModel<PortletPreferences> _nullPortletPreferencesCacheModel =
2614 new CacheModel<PortletPreferences>() {
2615 public PortletPreferences toEntityModel() {
2616 return _nullPortletPreferences;
2617 }
2618 };
2619 }