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_WITH_PAGINATION_FIND_BY_O_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
145 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
146 PortletPreferencesImpl.class,
147 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByO_P_P",
148 new String[] {
149 Integer.class.getName(), Long.class.getName(),
150 String.class.getName(),
151
152 "java.lang.Integer", "java.lang.Integer",
153 "com.liferay.portal.kernel.util.OrderByComparator"
154 });
155 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
156 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
157 PortletPreferencesImpl.class,
158 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByO_P_P",
159 new String[] {
160 Integer.class.getName(), Long.class.getName(),
161 String.class.getName()
162 },
163 PortletPreferencesModelImpl.OWNERTYPE_COLUMN_BITMASK |
164 PortletPreferencesModelImpl.PLID_COLUMN_BITMASK |
165 PortletPreferencesModelImpl.PORTLETID_COLUMN_BITMASK);
166 public static final FinderPath FINDER_PATH_COUNT_BY_O_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
167 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
168 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByO_P_P",
169 new String[] {
170 Integer.class.getName(), Long.class.getName(),
171 String.class.getName()
172 });
173 public static final FinderPath FINDER_PATH_FETCH_BY_O_O_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
174 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
175 PortletPreferencesImpl.class, FINDER_CLASS_NAME_ENTITY,
176 "fetchByO_O_P_P",
177 new String[] {
178 Long.class.getName(), Integer.class.getName(),
179 Long.class.getName(), String.class.getName()
180 },
181 PortletPreferencesModelImpl.OWNERID_COLUMN_BITMASK |
182 PortletPreferencesModelImpl.OWNERTYPE_COLUMN_BITMASK |
183 PortletPreferencesModelImpl.PLID_COLUMN_BITMASK |
184 PortletPreferencesModelImpl.PORTLETID_COLUMN_BITMASK);
185 public static final FinderPath FINDER_PATH_COUNT_BY_O_O_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
186 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
187 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByO_O_P_P",
188 new String[] {
189 Long.class.getName(), Integer.class.getName(),
190 Long.class.getName(), String.class.getName()
191 });
192 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
193 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
194 PortletPreferencesImpl.class,
195 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
196 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
197 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
198 PortletPreferencesImpl.class,
199 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
200 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
201 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
202 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
203
204
209 public void cacheResult(PortletPreferences portletPreferences) {
210 EntityCacheUtil.putResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
211 PortletPreferencesImpl.class, portletPreferences.getPrimaryKey(),
212 portletPreferences);
213
214 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
215 new Object[] {
216 Long.valueOf(portletPreferences.getOwnerId()),
217 Integer.valueOf(portletPreferences.getOwnerType()),
218 Long.valueOf(portletPreferences.getPlid()),
219
220 portletPreferences.getPortletId()
221 }, portletPreferences);
222
223 portletPreferences.resetOriginalValues();
224 }
225
226
231 public void cacheResult(List<PortletPreferences> portletPreferenceses) {
232 for (PortletPreferences portletPreferences : portletPreferenceses) {
233 if (EntityCacheUtil.getResult(
234 PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
235 PortletPreferencesImpl.class,
236 portletPreferences.getPrimaryKey()) == null) {
237 cacheResult(portletPreferences);
238 }
239 else {
240 portletPreferences.resetOriginalValues();
241 }
242 }
243 }
244
245
252 @Override
253 public void clearCache() {
254 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
255 CacheRegistryUtil.clear(PortletPreferencesImpl.class.getName());
256 }
257
258 EntityCacheUtil.clearCache(PortletPreferencesImpl.class.getName());
259
260 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
261 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
262 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
263 }
264
265
272 @Override
273 public void clearCache(PortletPreferences portletPreferences) {
274 EntityCacheUtil.removeResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
275 PortletPreferencesImpl.class, portletPreferences.getPrimaryKey());
276
277 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
278 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
279
280 clearUniqueFindersCache(portletPreferences);
281 }
282
283 @Override
284 public void clearCache(List<PortletPreferences> portletPreferenceses) {
285 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
286 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
287
288 for (PortletPreferences portletPreferences : portletPreferenceses) {
289 EntityCacheUtil.removeResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
290 PortletPreferencesImpl.class, portletPreferences.getPrimaryKey());
291
292 clearUniqueFindersCache(portletPreferences);
293 }
294 }
295
296 protected void clearUniqueFindersCache(
297 PortletPreferences portletPreferences) {
298 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O_P_P,
299 new Object[] {
300 Long.valueOf(portletPreferences.getOwnerId()),
301 Integer.valueOf(portletPreferences.getOwnerType()),
302 Long.valueOf(portletPreferences.getPlid()),
303
304 portletPreferences.getPortletId()
305 });
306 }
307
308
314 public PortletPreferences create(long portletPreferencesId) {
315 PortletPreferences portletPreferences = new PortletPreferencesImpl();
316
317 portletPreferences.setNew(true);
318 portletPreferences.setPrimaryKey(portletPreferencesId);
319
320 return portletPreferences;
321 }
322
323
331 public PortletPreferences remove(long portletPreferencesId)
332 throws NoSuchPortletPreferencesException, SystemException {
333 return remove(Long.valueOf(portletPreferencesId));
334 }
335
336
344 @Override
345 public PortletPreferences remove(Serializable primaryKey)
346 throws NoSuchPortletPreferencesException, SystemException {
347 Session session = null;
348
349 try {
350 session = openSession();
351
352 PortletPreferences portletPreferences = (PortletPreferences)session.get(PortletPreferencesImpl.class,
353 primaryKey);
354
355 if (portletPreferences == null) {
356 if (_log.isWarnEnabled()) {
357 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
358 }
359
360 throw new NoSuchPortletPreferencesException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
361 primaryKey);
362 }
363
364 return remove(portletPreferences);
365 }
366 catch (NoSuchPortletPreferencesException nsee) {
367 throw nsee;
368 }
369 catch (Exception e) {
370 throw processException(e);
371 }
372 finally {
373 closeSession(session);
374 }
375 }
376
377 @Override
378 protected PortletPreferences removeImpl(
379 PortletPreferences portletPreferences) throws SystemException {
380 portletPreferences = toUnwrappedModel(portletPreferences);
381
382 Session session = null;
383
384 try {
385 session = openSession();
386
387 BatchSessionUtil.delete(session, portletPreferences);
388 }
389 catch (Exception e) {
390 throw processException(e);
391 }
392 finally {
393 closeSession(session);
394 }
395
396 clearCache(portletPreferences);
397
398 return portletPreferences;
399 }
400
401 @Override
402 public PortletPreferences updateImpl(
403 com.liferay.portal.model.PortletPreferences portletPreferences,
404 boolean merge) throws SystemException {
405 portletPreferences = toUnwrappedModel(portletPreferences);
406
407 boolean isNew = portletPreferences.isNew();
408
409 PortletPreferencesModelImpl portletPreferencesModelImpl = (PortletPreferencesModelImpl)portletPreferences;
410
411 Session session = null;
412
413 try {
414 session = openSession();
415
416 BatchSessionUtil.update(session, portletPreferences, merge);
417
418 portletPreferences.setNew(false);
419 }
420 catch (Exception e) {
421 throw processException(e);
422 }
423 finally {
424 closeSession(session);
425 }
426
427 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
428
429 if (isNew || !PortletPreferencesModelImpl.COLUMN_BITMASK_ENABLED) {
430 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
431 }
432
433 else {
434 if ((portletPreferencesModelImpl.getColumnBitmask() &
435 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID.getColumnBitmask()) != 0) {
436 Object[] args = new Object[] {
437 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid())
438 };
439
440 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PLID, args);
441 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID,
442 args);
443
444 args = new Object[] {
445 Long.valueOf(portletPreferencesModelImpl.getPlid())
446 };
447
448 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PLID, args);
449 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID,
450 args);
451 }
452
453 if ((portletPreferencesModelImpl.getColumnBitmask() &
454 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P.getColumnBitmask()) != 0) {
455 Object[] args = new Object[] {
456 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid()),
457
458 portletPreferencesModelImpl.getOriginalPortletId()
459 };
460
461 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_P_P, args);
462 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P,
463 args);
464
465 args = new Object[] {
466 Long.valueOf(portletPreferencesModelImpl.getPlid()),
467
468 portletPreferencesModelImpl.getPortletId()
469 };
470
471 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_P_P, args);
472 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P,
473 args);
474 }
475
476 if ((portletPreferencesModelImpl.getColumnBitmask() &
477 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P.getColumnBitmask()) != 0) {
478 Object[] args = new Object[] {
479 Long.valueOf(portletPreferencesModelImpl.getOriginalOwnerId()),
480 Integer.valueOf(portletPreferencesModelImpl.getOriginalOwnerType()),
481 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid())
482 };
483
484 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_O_P, args);
485 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P,
486 args);
487
488 args = new Object[] {
489 Long.valueOf(portletPreferencesModelImpl.getOwnerId()),
490 Integer.valueOf(portletPreferencesModelImpl.getOwnerType()),
491 Long.valueOf(portletPreferencesModelImpl.getPlid())
492 };
493
494 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_O_P, args);
495 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P,
496 args);
497 }
498
499 if ((portletPreferencesModelImpl.getColumnBitmask() &
500 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_P_P.getColumnBitmask()) != 0) {
501 Object[] args = new Object[] {
502 Integer.valueOf(portletPreferencesModelImpl.getOriginalOwnerType()),
503 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid()),
504
505 portletPreferencesModelImpl.getOriginalPortletId()
506 };
507
508 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_P_P, args);
509 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_P_P,
510 args);
511
512 args = new Object[] {
513 Integer.valueOf(portletPreferencesModelImpl.getOwnerType()),
514 Long.valueOf(portletPreferencesModelImpl.getPlid()),
515
516 portletPreferencesModelImpl.getPortletId()
517 };
518
519 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_P_P, args);
520 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_P_P,
521 args);
522 }
523 }
524
525 EntityCacheUtil.putResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
526 PortletPreferencesImpl.class, portletPreferences.getPrimaryKey(),
527 portletPreferences);
528
529 if (isNew) {
530 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
531 new Object[] {
532 Long.valueOf(portletPreferences.getOwnerId()),
533 Integer.valueOf(portletPreferences.getOwnerType()),
534 Long.valueOf(portletPreferences.getPlid()),
535
536 portletPreferences.getPortletId()
537 }, portletPreferences);
538 }
539 else {
540 if ((portletPreferencesModelImpl.getColumnBitmask() &
541 FINDER_PATH_FETCH_BY_O_O_P_P.getColumnBitmask()) != 0) {
542 Object[] args = new Object[] {
543 Long.valueOf(portletPreferencesModelImpl.getOriginalOwnerId()),
544 Integer.valueOf(portletPreferencesModelImpl.getOriginalOwnerType()),
545 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid()),
546
547 portletPreferencesModelImpl.getOriginalPortletId()
548 };
549
550 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_O_P_P, args);
551 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O_P_P, args);
552
553 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
554 new Object[] {
555 Long.valueOf(portletPreferences.getOwnerId()),
556 Integer.valueOf(portletPreferences.getOwnerType()),
557 Long.valueOf(portletPreferences.getPlid()),
558
559 portletPreferences.getPortletId()
560 }, portletPreferences);
561 }
562 }
563
564 return portletPreferences;
565 }
566
567 protected PortletPreferences toUnwrappedModel(
568 PortletPreferences portletPreferences) {
569 if (portletPreferences instanceof PortletPreferencesImpl) {
570 return portletPreferences;
571 }
572
573 PortletPreferencesImpl portletPreferencesImpl = new PortletPreferencesImpl();
574
575 portletPreferencesImpl.setNew(portletPreferences.isNew());
576 portletPreferencesImpl.setPrimaryKey(portletPreferences.getPrimaryKey());
577
578 portletPreferencesImpl.setPortletPreferencesId(portletPreferences.getPortletPreferencesId());
579 portletPreferencesImpl.setOwnerId(portletPreferences.getOwnerId());
580 portletPreferencesImpl.setOwnerType(portletPreferences.getOwnerType());
581 portletPreferencesImpl.setPlid(portletPreferences.getPlid());
582 portletPreferencesImpl.setPortletId(portletPreferences.getPortletId());
583 portletPreferencesImpl.setPreferences(portletPreferences.getPreferences());
584
585 return portletPreferencesImpl;
586 }
587
588
596 @Override
597 public PortletPreferences findByPrimaryKey(Serializable primaryKey)
598 throws NoSuchModelException, SystemException {
599 return findByPrimaryKey(((Long)primaryKey).longValue());
600 }
601
602
610 public PortletPreferences findByPrimaryKey(long portletPreferencesId)
611 throws NoSuchPortletPreferencesException, SystemException {
612 PortletPreferences portletPreferences = fetchByPrimaryKey(portletPreferencesId);
613
614 if (portletPreferences == null) {
615 if (_log.isWarnEnabled()) {
616 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
617 portletPreferencesId);
618 }
619
620 throw new NoSuchPortletPreferencesException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
621 portletPreferencesId);
622 }
623
624 return portletPreferences;
625 }
626
627
634 @Override
635 public PortletPreferences fetchByPrimaryKey(Serializable primaryKey)
636 throws SystemException {
637 return fetchByPrimaryKey(((Long)primaryKey).longValue());
638 }
639
640
647 public PortletPreferences fetchByPrimaryKey(long portletPreferencesId)
648 throws SystemException {
649 PortletPreferences portletPreferences = (PortletPreferences)EntityCacheUtil.getResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
650 PortletPreferencesImpl.class, portletPreferencesId);
651
652 if (portletPreferences == _nullPortletPreferences) {
653 return null;
654 }
655
656 if (portletPreferences == null) {
657 Session session = null;
658
659 boolean hasException = false;
660
661 try {
662 session = openSession();
663
664 portletPreferences = (PortletPreferences)session.get(PortletPreferencesImpl.class,
665 Long.valueOf(portletPreferencesId));
666 }
667 catch (Exception e) {
668 hasException = true;
669
670 throw processException(e);
671 }
672 finally {
673 if (portletPreferences != null) {
674 cacheResult(portletPreferences);
675 }
676 else if (!hasException) {
677 EntityCacheUtil.putResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
678 PortletPreferencesImpl.class, portletPreferencesId,
679 _nullPortletPreferences);
680 }
681
682 closeSession(session);
683 }
684 }
685
686 return portletPreferences;
687 }
688
689
696 public List<PortletPreferences> findByPlid(long plid)
697 throws SystemException {
698 return findByPlid(plid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
699 }
700
701
714 public List<PortletPreferences> findByPlid(long plid, int start, int end)
715 throws SystemException {
716 return findByPlid(plid, start, end, null);
717 }
718
719
733 public List<PortletPreferences> findByPlid(long plid, int start, int end,
734 OrderByComparator orderByComparator) throws SystemException {
735 FinderPath finderPath = null;
736 Object[] finderArgs = null;
737
738 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
739 (orderByComparator == null)) {
740 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID;
741 finderArgs = new Object[] { plid };
742 }
743 else {
744 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_PLID;
745 finderArgs = new Object[] { plid, start, end, orderByComparator };
746 }
747
748 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
749 finderArgs, this);
750
751 if (list == null) {
752 StringBundler query = null;
753
754 if (orderByComparator != null) {
755 query = new StringBundler(3 +
756 (orderByComparator.getOrderByFields().length * 3));
757 }
758 else {
759 query = new StringBundler(2);
760 }
761
762 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
763
764 query.append(_FINDER_COLUMN_PLID_PLID_2);
765
766 if (orderByComparator != null) {
767 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
768 orderByComparator);
769 }
770
771 String sql = query.toString();
772
773 Session session = null;
774
775 try {
776 session = openSession();
777
778 Query q = session.createQuery(sql);
779
780 QueryPos qPos = QueryPos.getInstance(q);
781
782 qPos.add(plid);
783
784 list = (List<PortletPreferences>)QueryUtil.list(q,
785 getDialect(), start, end);
786 }
787 catch (Exception e) {
788 throw processException(e);
789 }
790 finally {
791 if (list == null) {
792 FinderCacheUtil.removeResult(finderPath, finderArgs);
793 }
794 else {
795 cacheResult(list);
796
797 FinderCacheUtil.putResult(finderPath, finderArgs, list);
798 }
799
800 closeSession(session);
801 }
802 }
803
804 return list;
805 }
806
807
820 public PortletPreferences findByPlid_First(long plid,
821 OrderByComparator orderByComparator)
822 throws NoSuchPortletPreferencesException, SystemException {
823 List<PortletPreferences> list = findByPlid(plid, 0, 1, orderByComparator);
824
825 if (list.isEmpty()) {
826 StringBundler msg = new StringBundler(4);
827
828 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
829
830 msg.append("plid=");
831 msg.append(plid);
832
833 msg.append(StringPool.CLOSE_CURLY_BRACE);
834
835 throw new NoSuchPortletPreferencesException(msg.toString());
836 }
837 else {
838 return list.get(0);
839 }
840 }
841
842
855 public PortletPreferences findByPlid_Last(long plid,
856 OrderByComparator orderByComparator)
857 throws NoSuchPortletPreferencesException, SystemException {
858 int count = countByPlid(plid);
859
860 List<PortletPreferences> list = findByPlid(plid, count - 1, count,
861 orderByComparator);
862
863 if (list.isEmpty()) {
864 StringBundler msg = new StringBundler(4);
865
866 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
867
868 msg.append("plid=");
869 msg.append(plid);
870
871 msg.append(StringPool.CLOSE_CURLY_BRACE);
872
873 throw new NoSuchPortletPreferencesException(msg.toString());
874 }
875 else {
876 return list.get(0);
877 }
878 }
879
880
894 public PortletPreferences[] findByPlid_PrevAndNext(
895 long portletPreferencesId, long plid,
896 OrderByComparator orderByComparator)
897 throws NoSuchPortletPreferencesException, SystemException {
898 PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesId);
899
900 Session session = null;
901
902 try {
903 session = openSession();
904
905 PortletPreferences[] array = new PortletPreferencesImpl[3];
906
907 array[0] = getByPlid_PrevAndNext(session, portletPreferences, plid,
908 orderByComparator, true);
909
910 array[1] = portletPreferences;
911
912 array[2] = getByPlid_PrevAndNext(session, portletPreferences, plid,
913 orderByComparator, false);
914
915 return array;
916 }
917 catch (Exception e) {
918 throw processException(e);
919 }
920 finally {
921 closeSession(session);
922 }
923 }
924
925 protected PortletPreferences getByPlid_PrevAndNext(Session session,
926 PortletPreferences portletPreferences, long plid,
927 OrderByComparator orderByComparator, boolean previous) {
928 StringBundler query = null;
929
930 if (orderByComparator != null) {
931 query = new StringBundler(6 +
932 (orderByComparator.getOrderByFields().length * 6));
933 }
934 else {
935 query = new StringBundler(3);
936 }
937
938 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
939
940 query.append(_FINDER_COLUMN_PLID_PLID_2);
941
942 if (orderByComparator != null) {
943 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
944
945 if (orderByConditionFields.length > 0) {
946 query.append(WHERE_AND);
947 }
948
949 for (int i = 0; i < orderByConditionFields.length; i++) {
950 query.append(_ORDER_BY_ENTITY_ALIAS);
951 query.append(orderByConditionFields[i]);
952
953 if ((i + 1) < orderByConditionFields.length) {
954 if (orderByComparator.isAscending() ^ previous) {
955 query.append(WHERE_GREATER_THAN_HAS_NEXT);
956 }
957 else {
958 query.append(WHERE_LESSER_THAN_HAS_NEXT);
959 }
960 }
961 else {
962 if (orderByComparator.isAscending() ^ previous) {
963 query.append(WHERE_GREATER_THAN);
964 }
965 else {
966 query.append(WHERE_LESSER_THAN);
967 }
968 }
969 }
970
971 query.append(ORDER_BY_CLAUSE);
972
973 String[] orderByFields = orderByComparator.getOrderByFields();
974
975 for (int i = 0; i < orderByFields.length; i++) {
976 query.append(_ORDER_BY_ENTITY_ALIAS);
977 query.append(orderByFields[i]);
978
979 if ((i + 1) < orderByFields.length) {
980 if (orderByComparator.isAscending() ^ previous) {
981 query.append(ORDER_BY_ASC_HAS_NEXT);
982 }
983 else {
984 query.append(ORDER_BY_DESC_HAS_NEXT);
985 }
986 }
987 else {
988 if (orderByComparator.isAscending() ^ previous) {
989 query.append(ORDER_BY_ASC);
990 }
991 else {
992 query.append(ORDER_BY_DESC);
993 }
994 }
995 }
996 }
997
998 String sql = query.toString();
999
1000 Query q = session.createQuery(sql);
1001
1002 q.setFirstResult(0);
1003 q.setMaxResults(2);
1004
1005 QueryPos qPos = QueryPos.getInstance(q);
1006
1007 qPos.add(plid);
1008
1009 if (orderByComparator != null) {
1010 Object[] values = orderByComparator.getOrderByConditionValues(portletPreferences);
1011
1012 for (Object value : values) {
1013 qPos.add(value);
1014 }
1015 }
1016
1017 List<PortletPreferences> list = q.list();
1018
1019 if (list.size() == 2) {
1020 return list.get(1);
1021 }
1022 else {
1023 return null;
1024 }
1025 }
1026
1027
1035 public List<PortletPreferences> findByP_P(long plid, String portletId)
1036 throws SystemException {
1037 return findByP_P(plid, portletId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1038 null);
1039 }
1040
1041
1055 public List<PortletPreferences> findByP_P(long plid, String portletId,
1056 int start, int end) throws SystemException {
1057 return findByP_P(plid, portletId, start, end, null);
1058 }
1059
1060
1075 public List<PortletPreferences> findByP_P(long plid, String portletId,
1076 int start, int end, OrderByComparator orderByComparator)
1077 throws SystemException {
1078 FinderPath finderPath = null;
1079 Object[] finderArgs = null;
1080
1081 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1082 (orderByComparator == null)) {
1083 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P;
1084 finderArgs = new Object[] { plid, portletId };
1085 }
1086 else {
1087 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_P_P;
1088 finderArgs = new Object[] {
1089 plid, portletId,
1090
1091 start, end, orderByComparator
1092 };
1093 }
1094
1095 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
1096 finderArgs, this);
1097
1098 if (list == null) {
1099 StringBundler query = null;
1100
1101 if (orderByComparator != null) {
1102 query = new StringBundler(4 +
1103 (orderByComparator.getOrderByFields().length * 3));
1104 }
1105 else {
1106 query = new StringBundler(3);
1107 }
1108
1109 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1110
1111 query.append(_FINDER_COLUMN_P_P_PLID_2);
1112
1113 if (portletId == null) {
1114 query.append(_FINDER_COLUMN_P_P_PORTLETID_1);
1115 }
1116 else {
1117 if (portletId.equals(StringPool.BLANK)) {
1118 query.append(_FINDER_COLUMN_P_P_PORTLETID_3);
1119 }
1120 else {
1121 query.append(_FINDER_COLUMN_P_P_PORTLETID_2);
1122 }
1123 }
1124
1125 if (orderByComparator != null) {
1126 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1127 orderByComparator);
1128 }
1129
1130 String sql = query.toString();
1131
1132 Session session = null;
1133
1134 try {
1135 session = openSession();
1136
1137 Query q = session.createQuery(sql);
1138
1139 QueryPos qPos = QueryPos.getInstance(q);
1140
1141 qPos.add(plid);
1142
1143 if (portletId != null) {
1144 qPos.add(portletId);
1145 }
1146
1147 list = (List<PortletPreferences>)QueryUtil.list(q,
1148 getDialect(), start, end);
1149 }
1150 catch (Exception e) {
1151 throw processException(e);
1152 }
1153 finally {
1154 if (list == null) {
1155 FinderCacheUtil.removeResult(finderPath, finderArgs);
1156 }
1157 else {
1158 cacheResult(list);
1159
1160 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1161 }
1162
1163 closeSession(session);
1164 }
1165 }
1166
1167 return list;
1168 }
1169
1170
1184 public PortletPreferences findByP_P_First(long plid, String portletId,
1185 OrderByComparator orderByComparator)
1186 throws NoSuchPortletPreferencesException, SystemException {
1187 List<PortletPreferences> list = findByP_P(plid, portletId, 0, 1,
1188 orderByComparator);
1189
1190 if (list.isEmpty()) {
1191 StringBundler msg = new StringBundler(6);
1192
1193 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1194
1195 msg.append("plid=");
1196 msg.append(plid);
1197
1198 msg.append(", portletId=");
1199 msg.append(portletId);
1200
1201 msg.append(StringPool.CLOSE_CURLY_BRACE);
1202
1203 throw new NoSuchPortletPreferencesException(msg.toString());
1204 }
1205 else {
1206 return list.get(0);
1207 }
1208 }
1209
1210
1224 public PortletPreferences findByP_P_Last(long plid, String portletId,
1225 OrderByComparator orderByComparator)
1226 throws NoSuchPortletPreferencesException, SystemException {
1227 int count = countByP_P(plid, portletId);
1228
1229 List<PortletPreferences> list = findByP_P(plid, portletId, count - 1,
1230 count, orderByComparator);
1231
1232 if (list.isEmpty()) {
1233 StringBundler msg = new StringBundler(6);
1234
1235 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1236
1237 msg.append("plid=");
1238 msg.append(plid);
1239
1240 msg.append(", portletId=");
1241 msg.append(portletId);
1242
1243 msg.append(StringPool.CLOSE_CURLY_BRACE);
1244
1245 throw new NoSuchPortletPreferencesException(msg.toString());
1246 }
1247 else {
1248 return list.get(0);
1249 }
1250 }
1251
1252
1267 public PortletPreferences[] findByP_P_PrevAndNext(
1268 long portletPreferencesId, long plid, String portletId,
1269 OrderByComparator orderByComparator)
1270 throws NoSuchPortletPreferencesException, SystemException {
1271 PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesId);
1272
1273 Session session = null;
1274
1275 try {
1276 session = openSession();
1277
1278 PortletPreferences[] array = new PortletPreferencesImpl[3];
1279
1280 array[0] = getByP_P_PrevAndNext(session, portletPreferences, plid,
1281 portletId, orderByComparator, true);
1282
1283 array[1] = portletPreferences;
1284
1285 array[2] = getByP_P_PrevAndNext(session, portletPreferences, plid,
1286 portletId, orderByComparator, false);
1287
1288 return array;
1289 }
1290 catch (Exception e) {
1291 throw processException(e);
1292 }
1293 finally {
1294 closeSession(session);
1295 }
1296 }
1297
1298 protected PortletPreferences getByP_P_PrevAndNext(Session session,
1299 PortletPreferences portletPreferences, long plid, String portletId,
1300 OrderByComparator orderByComparator, boolean previous) {
1301 StringBundler query = null;
1302
1303 if (orderByComparator != null) {
1304 query = new StringBundler(6 +
1305 (orderByComparator.getOrderByFields().length * 6));
1306 }
1307 else {
1308 query = new StringBundler(3);
1309 }
1310
1311 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1312
1313 query.append(_FINDER_COLUMN_P_P_PLID_2);
1314
1315 if (portletId == null) {
1316 query.append(_FINDER_COLUMN_P_P_PORTLETID_1);
1317 }
1318 else {
1319 if (portletId.equals(StringPool.BLANK)) {
1320 query.append(_FINDER_COLUMN_P_P_PORTLETID_3);
1321 }
1322 else {
1323 query.append(_FINDER_COLUMN_P_P_PORTLETID_2);
1324 }
1325 }
1326
1327 if (orderByComparator != null) {
1328 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1329
1330 if (orderByConditionFields.length > 0) {
1331 query.append(WHERE_AND);
1332 }
1333
1334 for (int i = 0; i < orderByConditionFields.length; i++) {
1335 query.append(_ORDER_BY_ENTITY_ALIAS);
1336 query.append(orderByConditionFields[i]);
1337
1338 if ((i + 1) < orderByConditionFields.length) {
1339 if (orderByComparator.isAscending() ^ previous) {
1340 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1341 }
1342 else {
1343 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1344 }
1345 }
1346 else {
1347 if (orderByComparator.isAscending() ^ previous) {
1348 query.append(WHERE_GREATER_THAN);
1349 }
1350 else {
1351 query.append(WHERE_LESSER_THAN);
1352 }
1353 }
1354 }
1355
1356 query.append(ORDER_BY_CLAUSE);
1357
1358 String[] orderByFields = orderByComparator.getOrderByFields();
1359
1360 for (int i = 0; i < orderByFields.length; i++) {
1361 query.append(_ORDER_BY_ENTITY_ALIAS);
1362 query.append(orderByFields[i]);
1363
1364 if ((i + 1) < orderByFields.length) {
1365 if (orderByComparator.isAscending() ^ previous) {
1366 query.append(ORDER_BY_ASC_HAS_NEXT);
1367 }
1368 else {
1369 query.append(ORDER_BY_DESC_HAS_NEXT);
1370 }
1371 }
1372 else {
1373 if (orderByComparator.isAscending() ^ previous) {
1374 query.append(ORDER_BY_ASC);
1375 }
1376 else {
1377 query.append(ORDER_BY_DESC);
1378 }
1379 }
1380 }
1381 }
1382
1383 String sql = query.toString();
1384
1385 Query q = session.createQuery(sql);
1386
1387 q.setFirstResult(0);
1388 q.setMaxResults(2);
1389
1390 QueryPos qPos = QueryPos.getInstance(q);
1391
1392 qPos.add(plid);
1393
1394 if (portletId != null) {
1395 qPos.add(portletId);
1396 }
1397
1398 if (orderByComparator != null) {
1399 Object[] values = orderByComparator.getOrderByConditionValues(portletPreferences);
1400
1401 for (Object value : values) {
1402 qPos.add(value);
1403 }
1404 }
1405
1406 List<PortletPreferences> list = q.list();
1407
1408 if (list.size() == 2) {
1409 return list.get(1);
1410 }
1411 else {
1412 return null;
1413 }
1414 }
1415
1416
1425 public List<PortletPreferences> findByO_O_P(long ownerId, int ownerType,
1426 long plid) throws SystemException {
1427 return findByO_O_P(ownerId, ownerType, plid, QueryUtil.ALL_POS,
1428 QueryUtil.ALL_POS, null);
1429 }
1430
1431
1446 public List<PortletPreferences> findByO_O_P(long ownerId, int ownerType,
1447 long plid, int start, int end) throws SystemException {
1448 return findByO_O_P(ownerId, ownerType, plid, start, end, null);
1449 }
1450
1451
1467 public List<PortletPreferences> findByO_O_P(long ownerId, int ownerType,
1468 long plid, int start, int end, OrderByComparator orderByComparator)
1469 throws SystemException {
1470 FinderPath finderPath = null;
1471 Object[] finderArgs = null;
1472
1473 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1474 (orderByComparator == null)) {
1475 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P;
1476 finderArgs = new Object[] { ownerId, ownerType, plid };
1477 }
1478 else {
1479 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_O_O_P;
1480 finderArgs = new Object[] {
1481 ownerId, ownerType, plid,
1482
1483 start, end, orderByComparator
1484 };
1485 }
1486
1487 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
1488 finderArgs, this);
1489
1490 if (list == null) {
1491 StringBundler query = null;
1492
1493 if (orderByComparator != null) {
1494 query = new StringBundler(5 +
1495 (orderByComparator.getOrderByFields().length * 3));
1496 }
1497 else {
1498 query = new StringBundler(4);
1499 }
1500
1501 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1502
1503 query.append(_FINDER_COLUMN_O_O_P_OWNERID_2);
1504
1505 query.append(_FINDER_COLUMN_O_O_P_OWNERTYPE_2);
1506
1507 query.append(_FINDER_COLUMN_O_O_P_PLID_2);
1508
1509 if (orderByComparator != null) {
1510 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1511 orderByComparator);
1512 }
1513
1514 String sql = query.toString();
1515
1516 Session session = null;
1517
1518 try {
1519 session = openSession();
1520
1521 Query q = session.createQuery(sql);
1522
1523 QueryPos qPos = QueryPos.getInstance(q);
1524
1525 qPos.add(ownerId);
1526
1527 qPos.add(ownerType);
1528
1529 qPos.add(plid);
1530
1531 list = (List<PortletPreferences>)QueryUtil.list(q,
1532 getDialect(), start, end);
1533 }
1534 catch (Exception e) {
1535 throw processException(e);
1536 }
1537 finally {
1538 if (list == null) {
1539 FinderCacheUtil.removeResult(finderPath, finderArgs);
1540 }
1541 else {
1542 cacheResult(list);
1543
1544 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1545 }
1546
1547 closeSession(session);
1548 }
1549 }
1550
1551 return list;
1552 }
1553
1554
1569 public PortletPreferences findByO_O_P_First(long ownerId, int ownerType,
1570 long plid, OrderByComparator orderByComparator)
1571 throws NoSuchPortletPreferencesException, SystemException {
1572 List<PortletPreferences> list = findByO_O_P(ownerId, ownerType, plid,
1573 0, 1, orderByComparator);
1574
1575 if (list.isEmpty()) {
1576 StringBundler msg = new StringBundler(8);
1577
1578 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1579
1580 msg.append("ownerId=");
1581 msg.append(ownerId);
1582
1583 msg.append(", ownerType=");
1584 msg.append(ownerType);
1585
1586 msg.append(", plid=");
1587 msg.append(plid);
1588
1589 msg.append(StringPool.CLOSE_CURLY_BRACE);
1590
1591 throw new NoSuchPortletPreferencesException(msg.toString());
1592 }
1593 else {
1594 return list.get(0);
1595 }
1596 }
1597
1598
1613 public PortletPreferences findByO_O_P_Last(long ownerId, int ownerType,
1614 long plid, OrderByComparator orderByComparator)
1615 throws NoSuchPortletPreferencesException, SystemException {
1616 int count = countByO_O_P(ownerId, ownerType, plid);
1617
1618 List<PortletPreferences> list = findByO_O_P(ownerId, ownerType, plid,
1619 count - 1, count, orderByComparator);
1620
1621 if (list.isEmpty()) {
1622 StringBundler msg = new StringBundler(8);
1623
1624 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1625
1626 msg.append("ownerId=");
1627 msg.append(ownerId);
1628
1629 msg.append(", ownerType=");
1630 msg.append(ownerType);
1631
1632 msg.append(", plid=");
1633 msg.append(plid);
1634
1635 msg.append(StringPool.CLOSE_CURLY_BRACE);
1636
1637 throw new NoSuchPortletPreferencesException(msg.toString());
1638 }
1639 else {
1640 return list.get(0);
1641 }
1642 }
1643
1644
1660 public PortletPreferences[] findByO_O_P_PrevAndNext(
1661 long portletPreferencesId, long ownerId, int ownerType, long plid,
1662 OrderByComparator orderByComparator)
1663 throws NoSuchPortletPreferencesException, SystemException {
1664 PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesId);
1665
1666 Session session = null;
1667
1668 try {
1669 session = openSession();
1670
1671 PortletPreferences[] array = new PortletPreferencesImpl[3];
1672
1673 array[0] = getByO_O_P_PrevAndNext(session, portletPreferences,
1674 ownerId, ownerType, plid, orderByComparator, true);
1675
1676 array[1] = portletPreferences;
1677
1678 array[2] = getByO_O_P_PrevAndNext(session, portletPreferences,
1679 ownerId, ownerType, plid, orderByComparator, false);
1680
1681 return array;
1682 }
1683 catch (Exception e) {
1684 throw processException(e);
1685 }
1686 finally {
1687 closeSession(session);
1688 }
1689 }
1690
1691 protected PortletPreferences getByO_O_P_PrevAndNext(Session session,
1692 PortletPreferences portletPreferences, long ownerId, int ownerType,
1693 long plid, OrderByComparator orderByComparator, boolean previous) {
1694 StringBundler query = null;
1695
1696 if (orderByComparator != null) {
1697 query = new StringBundler(6 +
1698 (orderByComparator.getOrderByFields().length * 6));
1699 }
1700 else {
1701 query = new StringBundler(3);
1702 }
1703
1704 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1705
1706 query.append(_FINDER_COLUMN_O_O_P_OWNERID_2);
1707
1708 query.append(_FINDER_COLUMN_O_O_P_OWNERTYPE_2);
1709
1710 query.append(_FINDER_COLUMN_O_O_P_PLID_2);
1711
1712 if (orderByComparator != null) {
1713 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1714
1715 if (orderByConditionFields.length > 0) {
1716 query.append(WHERE_AND);
1717 }
1718
1719 for (int i = 0; i < orderByConditionFields.length; i++) {
1720 query.append(_ORDER_BY_ENTITY_ALIAS);
1721 query.append(orderByConditionFields[i]);
1722
1723 if ((i + 1) < orderByConditionFields.length) {
1724 if (orderByComparator.isAscending() ^ previous) {
1725 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1726 }
1727 else {
1728 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1729 }
1730 }
1731 else {
1732 if (orderByComparator.isAscending() ^ previous) {
1733 query.append(WHERE_GREATER_THAN);
1734 }
1735 else {
1736 query.append(WHERE_LESSER_THAN);
1737 }
1738 }
1739 }
1740
1741 query.append(ORDER_BY_CLAUSE);
1742
1743 String[] orderByFields = orderByComparator.getOrderByFields();
1744
1745 for (int i = 0; i < orderByFields.length; i++) {
1746 query.append(_ORDER_BY_ENTITY_ALIAS);
1747 query.append(orderByFields[i]);
1748
1749 if ((i + 1) < orderByFields.length) {
1750 if (orderByComparator.isAscending() ^ previous) {
1751 query.append(ORDER_BY_ASC_HAS_NEXT);
1752 }
1753 else {
1754 query.append(ORDER_BY_DESC_HAS_NEXT);
1755 }
1756 }
1757 else {
1758 if (orderByComparator.isAscending() ^ previous) {
1759 query.append(ORDER_BY_ASC);
1760 }
1761 else {
1762 query.append(ORDER_BY_DESC);
1763 }
1764 }
1765 }
1766 }
1767
1768 String sql = query.toString();
1769
1770 Query q = session.createQuery(sql);
1771
1772 q.setFirstResult(0);
1773 q.setMaxResults(2);
1774
1775 QueryPos qPos = QueryPos.getInstance(q);
1776
1777 qPos.add(ownerId);
1778
1779 qPos.add(ownerType);
1780
1781 qPos.add(plid);
1782
1783 if (orderByComparator != null) {
1784 Object[] values = orderByComparator.getOrderByConditionValues(portletPreferences);
1785
1786 for (Object value : values) {
1787 qPos.add(value);
1788 }
1789 }
1790
1791 List<PortletPreferences> list = q.list();
1792
1793 if (list.size() == 2) {
1794 return list.get(1);
1795 }
1796 else {
1797 return null;
1798 }
1799 }
1800
1801
1810 public List<PortletPreferences> findByO_P_P(int ownerType, long plid,
1811 String portletId) throws SystemException {
1812 return findByO_P_P(ownerType, plid, portletId, QueryUtil.ALL_POS,
1813 QueryUtil.ALL_POS, null);
1814 }
1815
1816
1831 public List<PortletPreferences> findByO_P_P(int ownerType, long plid,
1832 String portletId, int start, int end) throws SystemException {
1833 return findByO_P_P(ownerType, plid, portletId, start, end, null);
1834 }
1835
1836
1852 public List<PortletPreferences> findByO_P_P(int ownerType, long plid,
1853 String portletId, int start, int end,
1854 OrderByComparator orderByComparator) throws SystemException {
1855 FinderPath finderPath = null;
1856 Object[] finderArgs = null;
1857
1858 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1859 (orderByComparator == null)) {
1860 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_P_P;
1861 finderArgs = new Object[] { ownerType, plid, portletId };
1862 }
1863 else {
1864 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_O_P_P;
1865 finderArgs = new Object[] {
1866 ownerType, plid, portletId,
1867
1868 start, end, orderByComparator
1869 };
1870 }
1871
1872 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
1873 finderArgs, this);
1874
1875 if (list == null) {
1876 StringBundler query = null;
1877
1878 if (orderByComparator != null) {
1879 query = new StringBundler(5 +
1880 (orderByComparator.getOrderByFields().length * 3));
1881 }
1882 else {
1883 query = new StringBundler(4);
1884 }
1885
1886 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1887
1888 query.append(_FINDER_COLUMN_O_P_P_OWNERTYPE_2);
1889
1890 query.append(_FINDER_COLUMN_O_P_P_PLID_2);
1891
1892 if (portletId == null) {
1893 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_1);
1894 }
1895 else {
1896 if (portletId.equals(StringPool.BLANK)) {
1897 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_3);
1898 }
1899 else {
1900 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_2);
1901 }
1902 }
1903
1904 if (orderByComparator != null) {
1905 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1906 orderByComparator);
1907 }
1908
1909 String sql = query.toString();
1910
1911 Session session = null;
1912
1913 try {
1914 session = openSession();
1915
1916 Query q = session.createQuery(sql);
1917
1918 QueryPos qPos = QueryPos.getInstance(q);
1919
1920 qPos.add(ownerType);
1921
1922 qPos.add(plid);
1923
1924 if (portletId != null) {
1925 qPos.add(portletId);
1926 }
1927
1928 list = (List<PortletPreferences>)QueryUtil.list(q,
1929 getDialect(), start, end);
1930 }
1931 catch (Exception e) {
1932 throw processException(e);
1933 }
1934 finally {
1935 if (list == null) {
1936 FinderCacheUtil.removeResult(finderPath, finderArgs);
1937 }
1938 else {
1939 cacheResult(list);
1940
1941 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1942 }
1943
1944 closeSession(session);
1945 }
1946 }
1947
1948 return list;
1949 }
1950
1951
1966 public PortletPreferences findByO_P_P_First(int ownerType, long plid,
1967 String portletId, OrderByComparator orderByComparator)
1968 throws NoSuchPortletPreferencesException, SystemException {
1969 List<PortletPreferences> list = findByO_P_P(ownerType, plid, portletId,
1970 0, 1, orderByComparator);
1971
1972 if (list.isEmpty()) {
1973 StringBundler msg = new StringBundler(8);
1974
1975 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1976
1977 msg.append("ownerType=");
1978 msg.append(ownerType);
1979
1980 msg.append(", plid=");
1981 msg.append(plid);
1982
1983 msg.append(", portletId=");
1984 msg.append(portletId);
1985
1986 msg.append(StringPool.CLOSE_CURLY_BRACE);
1987
1988 throw new NoSuchPortletPreferencesException(msg.toString());
1989 }
1990 else {
1991 return list.get(0);
1992 }
1993 }
1994
1995
2010 public PortletPreferences findByO_P_P_Last(int ownerType, long plid,
2011 String portletId, OrderByComparator orderByComparator)
2012 throws NoSuchPortletPreferencesException, SystemException {
2013 int count = countByO_P_P(ownerType, plid, portletId);
2014
2015 List<PortletPreferences> list = findByO_P_P(ownerType, plid, portletId,
2016 count - 1, count, orderByComparator);
2017
2018 if (list.isEmpty()) {
2019 StringBundler msg = new StringBundler(8);
2020
2021 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2022
2023 msg.append("ownerType=");
2024 msg.append(ownerType);
2025
2026 msg.append(", plid=");
2027 msg.append(plid);
2028
2029 msg.append(", portletId=");
2030 msg.append(portletId);
2031
2032 msg.append(StringPool.CLOSE_CURLY_BRACE);
2033
2034 throw new NoSuchPortletPreferencesException(msg.toString());
2035 }
2036 else {
2037 return list.get(0);
2038 }
2039 }
2040
2041
2057 public PortletPreferences[] findByO_P_P_PrevAndNext(
2058 long portletPreferencesId, int ownerType, long plid, String portletId,
2059 OrderByComparator orderByComparator)
2060 throws NoSuchPortletPreferencesException, SystemException {
2061 PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesId);
2062
2063 Session session = null;
2064
2065 try {
2066 session = openSession();
2067
2068 PortletPreferences[] array = new PortletPreferencesImpl[3];
2069
2070 array[0] = getByO_P_P_PrevAndNext(session, portletPreferences,
2071 ownerType, plid, portletId, orderByComparator, true);
2072
2073 array[1] = portletPreferences;
2074
2075 array[2] = getByO_P_P_PrevAndNext(session, portletPreferences,
2076 ownerType, plid, portletId, orderByComparator, false);
2077
2078 return array;
2079 }
2080 catch (Exception e) {
2081 throw processException(e);
2082 }
2083 finally {
2084 closeSession(session);
2085 }
2086 }
2087
2088 protected PortletPreferences getByO_P_P_PrevAndNext(Session session,
2089 PortletPreferences portletPreferences, int ownerType, long plid,
2090 String portletId, OrderByComparator orderByComparator, boolean previous) {
2091 StringBundler query = null;
2092
2093 if (orderByComparator != null) {
2094 query = new StringBundler(6 +
2095 (orderByComparator.getOrderByFields().length * 6));
2096 }
2097 else {
2098 query = new StringBundler(3);
2099 }
2100
2101 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
2102
2103 query.append(_FINDER_COLUMN_O_P_P_OWNERTYPE_2);
2104
2105 query.append(_FINDER_COLUMN_O_P_P_PLID_2);
2106
2107 if (portletId == null) {
2108 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_1);
2109 }
2110 else {
2111 if (portletId.equals(StringPool.BLANK)) {
2112 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_3);
2113 }
2114 else {
2115 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_2);
2116 }
2117 }
2118
2119 if (orderByComparator != null) {
2120 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2121
2122 if (orderByConditionFields.length > 0) {
2123 query.append(WHERE_AND);
2124 }
2125
2126 for (int i = 0; i < orderByConditionFields.length; i++) {
2127 query.append(_ORDER_BY_ENTITY_ALIAS);
2128 query.append(orderByConditionFields[i]);
2129
2130 if ((i + 1) < orderByConditionFields.length) {
2131 if (orderByComparator.isAscending() ^ previous) {
2132 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2133 }
2134 else {
2135 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2136 }
2137 }
2138 else {
2139 if (orderByComparator.isAscending() ^ previous) {
2140 query.append(WHERE_GREATER_THAN);
2141 }
2142 else {
2143 query.append(WHERE_LESSER_THAN);
2144 }
2145 }
2146 }
2147
2148 query.append(ORDER_BY_CLAUSE);
2149
2150 String[] orderByFields = orderByComparator.getOrderByFields();
2151
2152 for (int i = 0; i < orderByFields.length; i++) {
2153 query.append(_ORDER_BY_ENTITY_ALIAS);
2154 query.append(orderByFields[i]);
2155
2156 if ((i + 1) < orderByFields.length) {
2157 if (orderByComparator.isAscending() ^ previous) {
2158 query.append(ORDER_BY_ASC_HAS_NEXT);
2159 }
2160 else {
2161 query.append(ORDER_BY_DESC_HAS_NEXT);
2162 }
2163 }
2164 else {
2165 if (orderByComparator.isAscending() ^ previous) {
2166 query.append(ORDER_BY_ASC);
2167 }
2168 else {
2169 query.append(ORDER_BY_DESC);
2170 }
2171 }
2172 }
2173 }
2174
2175 String sql = query.toString();
2176
2177 Query q = session.createQuery(sql);
2178
2179 q.setFirstResult(0);
2180 q.setMaxResults(2);
2181
2182 QueryPos qPos = QueryPos.getInstance(q);
2183
2184 qPos.add(ownerType);
2185
2186 qPos.add(plid);
2187
2188 if (portletId != null) {
2189 qPos.add(portletId);
2190 }
2191
2192 if (orderByComparator != null) {
2193 Object[] values = orderByComparator.getOrderByConditionValues(portletPreferences);
2194
2195 for (Object value : values) {
2196 qPos.add(value);
2197 }
2198 }
2199
2200 List<PortletPreferences> list = q.list();
2201
2202 if (list.size() == 2) {
2203 return list.get(1);
2204 }
2205 else {
2206 return null;
2207 }
2208 }
2209
2210
2221 public PortletPreferences findByO_O_P_P(long ownerId, int ownerType,
2222 long plid, String portletId)
2223 throws NoSuchPortletPreferencesException, SystemException {
2224 PortletPreferences portletPreferences = fetchByO_O_P_P(ownerId,
2225 ownerType, plid, portletId);
2226
2227 if (portletPreferences == null) {
2228 StringBundler msg = new StringBundler(10);
2229
2230 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2231
2232 msg.append("ownerId=");
2233 msg.append(ownerId);
2234
2235 msg.append(", ownerType=");
2236 msg.append(ownerType);
2237
2238 msg.append(", plid=");
2239 msg.append(plid);
2240
2241 msg.append(", portletId=");
2242 msg.append(portletId);
2243
2244 msg.append(StringPool.CLOSE_CURLY_BRACE);
2245
2246 if (_log.isWarnEnabled()) {
2247 _log.warn(msg.toString());
2248 }
2249
2250 throw new NoSuchPortletPreferencesException(msg.toString());
2251 }
2252
2253 return portletPreferences;
2254 }
2255
2256
2266 public PortletPreferences fetchByO_O_P_P(long ownerId, int ownerType,
2267 long plid, String portletId) throws SystemException {
2268 return fetchByO_O_P_P(ownerId, ownerType, plid, portletId, true);
2269 }
2270
2271
2282 public PortletPreferences fetchByO_O_P_P(long ownerId, int ownerType,
2283 long plid, String portletId, boolean retrieveFromCache)
2284 throws SystemException {
2285 Object[] finderArgs = new Object[] { ownerId, ownerType, plid, portletId };
2286
2287 Object result = null;
2288
2289 if (retrieveFromCache) {
2290 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_O_O_P_P,
2291 finderArgs, this);
2292 }
2293
2294 if (result == null) {
2295 StringBundler query = new StringBundler(5);
2296
2297 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
2298
2299 query.append(_FINDER_COLUMN_O_O_P_P_OWNERID_2);
2300
2301 query.append(_FINDER_COLUMN_O_O_P_P_OWNERTYPE_2);
2302
2303 query.append(_FINDER_COLUMN_O_O_P_P_PLID_2);
2304
2305 if (portletId == null) {
2306 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_1);
2307 }
2308 else {
2309 if (portletId.equals(StringPool.BLANK)) {
2310 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_3);
2311 }
2312 else {
2313 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_2);
2314 }
2315 }
2316
2317 String sql = query.toString();
2318
2319 Session session = null;
2320
2321 try {
2322 session = openSession();
2323
2324 Query q = session.createQuery(sql);
2325
2326 QueryPos qPos = QueryPos.getInstance(q);
2327
2328 qPos.add(ownerId);
2329
2330 qPos.add(ownerType);
2331
2332 qPos.add(plid);
2333
2334 if (portletId != null) {
2335 qPos.add(portletId);
2336 }
2337
2338 List<PortletPreferences> list = q.list();
2339
2340 result = list;
2341
2342 PortletPreferences portletPreferences = null;
2343
2344 if (list.isEmpty()) {
2345 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
2346 finderArgs, list);
2347 }
2348 else {
2349 portletPreferences = list.get(0);
2350
2351 cacheResult(portletPreferences);
2352
2353 if ((portletPreferences.getOwnerId() != ownerId) ||
2354 (portletPreferences.getOwnerType() != ownerType) ||
2355 (portletPreferences.getPlid() != plid) ||
2356 (portletPreferences.getPortletId() == null) ||
2357 !portletPreferences.getPortletId().equals(portletId)) {
2358 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
2359 finderArgs, portletPreferences);
2360 }
2361 }
2362
2363 return portletPreferences;
2364 }
2365 catch (Exception e) {
2366 throw processException(e);
2367 }
2368 finally {
2369 if (result == null) {
2370 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O_P_P,
2371 finderArgs);
2372 }
2373
2374 closeSession(session);
2375 }
2376 }
2377 else {
2378 if (result instanceof List<?>) {
2379 return null;
2380 }
2381 else {
2382 return (PortletPreferences)result;
2383 }
2384 }
2385 }
2386
2387
2393 public List<PortletPreferences> findAll() throws SystemException {
2394 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2395 }
2396
2397
2409 public List<PortletPreferences> findAll(int start, int end)
2410 throws SystemException {
2411 return findAll(start, end, null);
2412 }
2413
2414
2427 public List<PortletPreferences> findAll(int start, int end,
2428 OrderByComparator orderByComparator) throws SystemException {
2429 FinderPath finderPath = null;
2430 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2431
2432 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2433 (orderByComparator == null)) {
2434 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2435 finderArgs = FINDER_ARGS_EMPTY;
2436 }
2437 else {
2438 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2439 finderArgs = new Object[] { start, end, orderByComparator };
2440 }
2441
2442 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
2443 finderArgs, this);
2444
2445 if (list == null) {
2446 StringBundler query = null;
2447 String sql = null;
2448
2449 if (orderByComparator != null) {
2450 query = new StringBundler(2 +
2451 (orderByComparator.getOrderByFields().length * 3));
2452
2453 query.append(_SQL_SELECT_PORTLETPREFERENCES);
2454
2455 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2456 orderByComparator);
2457
2458 sql = query.toString();
2459 }
2460 else {
2461 sql = _SQL_SELECT_PORTLETPREFERENCES;
2462 }
2463
2464 Session session = null;
2465
2466 try {
2467 session = openSession();
2468
2469 Query q = session.createQuery(sql);
2470
2471 if (orderByComparator == null) {
2472 list = (List<PortletPreferences>)QueryUtil.list(q,
2473 getDialect(), start, end, false);
2474
2475 Collections.sort(list);
2476 }
2477 else {
2478 list = (List<PortletPreferences>)QueryUtil.list(q,
2479 getDialect(), start, end);
2480 }
2481 }
2482 catch (Exception e) {
2483 throw processException(e);
2484 }
2485 finally {
2486 if (list == null) {
2487 FinderCacheUtil.removeResult(finderPath, finderArgs);
2488 }
2489 else {
2490 cacheResult(list);
2491
2492 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2493 }
2494
2495 closeSession(session);
2496 }
2497 }
2498
2499 return list;
2500 }
2501
2502
2508 public void removeByPlid(long plid) throws SystemException {
2509 for (PortletPreferences portletPreferences : findByPlid(plid)) {
2510 remove(portletPreferences);
2511 }
2512 }
2513
2514
2521 public void removeByP_P(long plid, String portletId)
2522 throws SystemException {
2523 for (PortletPreferences portletPreferences : findByP_P(plid, portletId)) {
2524 remove(portletPreferences);
2525 }
2526 }
2527
2528
2536 public void removeByO_O_P(long ownerId, int ownerType, long plid)
2537 throws SystemException {
2538 for (PortletPreferences portletPreferences : findByO_O_P(ownerId,
2539 ownerType, plid)) {
2540 remove(portletPreferences);
2541 }
2542 }
2543
2544
2552 public void removeByO_P_P(int ownerType, long plid, String portletId)
2553 throws SystemException {
2554 for (PortletPreferences portletPreferences : findByO_P_P(ownerType,
2555 plid, portletId)) {
2556 remove(portletPreferences);
2557 }
2558 }
2559
2560
2569 public void removeByO_O_P_P(long ownerId, int ownerType, long plid,
2570 String portletId)
2571 throws NoSuchPortletPreferencesException, SystemException {
2572 PortletPreferences portletPreferences = findByO_O_P_P(ownerId,
2573 ownerType, plid, portletId);
2574
2575 remove(portletPreferences);
2576 }
2577
2578
2583 public void removeAll() throws SystemException {
2584 for (PortletPreferences portletPreferences : findAll()) {
2585 remove(portletPreferences);
2586 }
2587 }
2588
2589
2596 public int countByPlid(long plid) throws SystemException {
2597 Object[] finderArgs = new Object[] { plid };
2598
2599 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PLID,
2600 finderArgs, this);
2601
2602 if (count == null) {
2603 StringBundler query = new StringBundler(2);
2604
2605 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2606
2607 query.append(_FINDER_COLUMN_PLID_PLID_2);
2608
2609 String sql = query.toString();
2610
2611 Session session = null;
2612
2613 try {
2614 session = openSession();
2615
2616 Query q = session.createQuery(sql);
2617
2618 QueryPos qPos = QueryPos.getInstance(q);
2619
2620 qPos.add(plid);
2621
2622 count = (Long)q.uniqueResult();
2623 }
2624 catch (Exception e) {
2625 throw processException(e);
2626 }
2627 finally {
2628 if (count == null) {
2629 count = Long.valueOf(0);
2630 }
2631
2632 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_PLID,
2633 finderArgs, count);
2634
2635 closeSession(session);
2636 }
2637 }
2638
2639 return count.intValue();
2640 }
2641
2642
2650 public int countByP_P(long plid, String portletId)
2651 throws SystemException {
2652 Object[] finderArgs = new Object[] { plid, portletId };
2653
2654 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_P,
2655 finderArgs, this);
2656
2657 if (count == null) {
2658 StringBundler query = new StringBundler(3);
2659
2660 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2661
2662 query.append(_FINDER_COLUMN_P_P_PLID_2);
2663
2664 if (portletId == null) {
2665 query.append(_FINDER_COLUMN_P_P_PORTLETID_1);
2666 }
2667 else {
2668 if (portletId.equals(StringPool.BLANK)) {
2669 query.append(_FINDER_COLUMN_P_P_PORTLETID_3);
2670 }
2671 else {
2672 query.append(_FINDER_COLUMN_P_P_PORTLETID_2);
2673 }
2674 }
2675
2676 String sql = query.toString();
2677
2678 Session session = null;
2679
2680 try {
2681 session = openSession();
2682
2683 Query q = session.createQuery(sql);
2684
2685 QueryPos qPos = QueryPos.getInstance(q);
2686
2687 qPos.add(plid);
2688
2689 if (portletId != null) {
2690 qPos.add(portletId);
2691 }
2692
2693 count = (Long)q.uniqueResult();
2694 }
2695 catch (Exception e) {
2696 throw processException(e);
2697 }
2698 finally {
2699 if (count == null) {
2700 count = Long.valueOf(0);
2701 }
2702
2703 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_P, finderArgs,
2704 count);
2705
2706 closeSession(session);
2707 }
2708 }
2709
2710 return count.intValue();
2711 }
2712
2713
2722 public int countByO_O_P(long ownerId, int ownerType, long plid)
2723 throws SystemException {
2724 Object[] finderArgs = new Object[] { ownerId, ownerType, plid };
2725
2726 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_O_O_P,
2727 finderArgs, this);
2728
2729 if (count == null) {
2730 StringBundler query = new StringBundler(4);
2731
2732 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2733
2734 query.append(_FINDER_COLUMN_O_O_P_OWNERID_2);
2735
2736 query.append(_FINDER_COLUMN_O_O_P_OWNERTYPE_2);
2737
2738 query.append(_FINDER_COLUMN_O_O_P_PLID_2);
2739
2740 String sql = query.toString();
2741
2742 Session session = null;
2743
2744 try {
2745 session = openSession();
2746
2747 Query q = session.createQuery(sql);
2748
2749 QueryPos qPos = QueryPos.getInstance(q);
2750
2751 qPos.add(ownerId);
2752
2753 qPos.add(ownerType);
2754
2755 qPos.add(plid);
2756
2757 count = (Long)q.uniqueResult();
2758 }
2759 catch (Exception e) {
2760 throw processException(e);
2761 }
2762 finally {
2763 if (count == null) {
2764 count = Long.valueOf(0);
2765 }
2766
2767 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_O_O_P,
2768 finderArgs, count);
2769
2770 closeSession(session);
2771 }
2772 }
2773
2774 return count.intValue();
2775 }
2776
2777
2786 public int countByO_P_P(int ownerType, long plid, String portletId)
2787 throws SystemException {
2788 Object[] finderArgs = new Object[] { ownerType, plid, portletId };
2789
2790 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_O_P_P,
2791 finderArgs, this);
2792
2793 if (count == null) {
2794 StringBundler query = new StringBundler(4);
2795
2796 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2797
2798 query.append(_FINDER_COLUMN_O_P_P_OWNERTYPE_2);
2799
2800 query.append(_FINDER_COLUMN_O_P_P_PLID_2);
2801
2802 if (portletId == null) {
2803 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_1);
2804 }
2805 else {
2806 if (portletId.equals(StringPool.BLANK)) {
2807 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_3);
2808 }
2809 else {
2810 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_2);
2811 }
2812 }
2813
2814 String sql = query.toString();
2815
2816 Session session = null;
2817
2818 try {
2819 session = openSession();
2820
2821 Query q = session.createQuery(sql);
2822
2823 QueryPos qPos = QueryPos.getInstance(q);
2824
2825 qPos.add(ownerType);
2826
2827 qPos.add(plid);
2828
2829 if (portletId != null) {
2830 qPos.add(portletId);
2831 }
2832
2833 count = (Long)q.uniqueResult();
2834 }
2835 catch (Exception e) {
2836 throw processException(e);
2837 }
2838 finally {
2839 if (count == null) {
2840 count = Long.valueOf(0);
2841 }
2842
2843 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_O_P_P,
2844 finderArgs, count);
2845
2846 closeSession(session);
2847 }
2848 }
2849
2850 return count.intValue();
2851 }
2852
2853
2863 public int countByO_O_P_P(long ownerId, int ownerType, long plid,
2864 String portletId) throws SystemException {
2865 Object[] finderArgs = new Object[] { ownerId, ownerType, plid, portletId };
2866
2867 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_O_O_P_P,
2868 finderArgs, this);
2869
2870 if (count == null) {
2871 StringBundler query = new StringBundler(5);
2872
2873 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2874
2875 query.append(_FINDER_COLUMN_O_O_P_P_OWNERID_2);
2876
2877 query.append(_FINDER_COLUMN_O_O_P_P_OWNERTYPE_2);
2878
2879 query.append(_FINDER_COLUMN_O_O_P_P_PLID_2);
2880
2881 if (portletId == null) {
2882 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_1);
2883 }
2884 else {
2885 if (portletId.equals(StringPool.BLANK)) {
2886 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_3);
2887 }
2888 else {
2889 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_2);
2890 }
2891 }
2892
2893 String sql = query.toString();
2894
2895 Session session = null;
2896
2897 try {
2898 session = openSession();
2899
2900 Query q = session.createQuery(sql);
2901
2902 QueryPos qPos = QueryPos.getInstance(q);
2903
2904 qPos.add(ownerId);
2905
2906 qPos.add(ownerType);
2907
2908 qPos.add(plid);
2909
2910 if (portletId != null) {
2911 qPos.add(portletId);
2912 }
2913
2914 count = (Long)q.uniqueResult();
2915 }
2916 catch (Exception e) {
2917 throw processException(e);
2918 }
2919 finally {
2920 if (count == null) {
2921 count = Long.valueOf(0);
2922 }
2923
2924 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_O_O_P_P,
2925 finderArgs, count);
2926
2927 closeSession(session);
2928 }
2929 }
2930
2931 return count.intValue();
2932 }
2933
2934
2940 public int countAll() throws SystemException {
2941 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2942 FINDER_ARGS_EMPTY, this);
2943
2944 if (count == null) {
2945 Session session = null;
2946
2947 try {
2948 session = openSession();
2949
2950 Query q = session.createQuery(_SQL_COUNT_PORTLETPREFERENCES);
2951
2952 count = (Long)q.uniqueResult();
2953 }
2954 catch (Exception e) {
2955 throw processException(e);
2956 }
2957 finally {
2958 if (count == null) {
2959 count = Long.valueOf(0);
2960 }
2961
2962 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2963 FINDER_ARGS_EMPTY, count);
2964
2965 closeSession(session);
2966 }
2967 }
2968
2969 return count.intValue();
2970 }
2971
2972
2975 public void afterPropertiesSet() {
2976 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2977 com.liferay.portal.util.PropsUtil.get(
2978 "value.object.listener.com.liferay.portal.model.PortletPreferences")));
2979
2980 if (listenerClassNames.length > 0) {
2981 try {
2982 List<ModelListener<PortletPreferences>> listenersList = new ArrayList<ModelListener<PortletPreferences>>();
2983
2984 for (String listenerClassName : listenerClassNames) {
2985 listenersList.add((ModelListener<PortletPreferences>)InstanceFactory.newInstance(
2986 listenerClassName));
2987 }
2988
2989 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2990 }
2991 catch (Exception e) {
2992 _log.error(e);
2993 }
2994 }
2995 }
2996
2997 public void destroy() {
2998 EntityCacheUtil.removeCache(PortletPreferencesImpl.class.getName());
2999 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3000 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3001 }
3002
3003 @BeanReference(type = AccountPersistence.class)
3004 protected AccountPersistence accountPersistence;
3005 @BeanReference(type = AddressPersistence.class)
3006 protected AddressPersistence addressPersistence;
3007 @BeanReference(type = BrowserTrackerPersistence.class)
3008 protected BrowserTrackerPersistence browserTrackerPersistence;
3009 @BeanReference(type = ClassNamePersistence.class)
3010 protected ClassNamePersistence classNamePersistence;
3011 @BeanReference(type = ClusterGroupPersistence.class)
3012 protected ClusterGroupPersistence clusterGroupPersistence;
3013 @BeanReference(type = CompanyPersistence.class)
3014 protected CompanyPersistence companyPersistence;
3015 @BeanReference(type = ContactPersistence.class)
3016 protected ContactPersistence contactPersistence;
3017 @BeanReference(type = CountryPersistence.class)
3018 protected CountryPersistence countryPersistence;
3019 @BeanReference(type = EmailAddressPersistence.class)
3020 protected EmailAddressPersistence emailAddressPersistence;
3021 @BeanReference(type = GroupPersistence.class)
3022 protected GroupPersistence groupPersistence;
3023 @BeanReference(type = ImagePersistence.class)
3024 protected ImagePersistence imagePersistence;
3025 @BeanReference(type = LayoutPersistence.class)
3026 protected LayoutPersistence layoutPersistence;
3027 @BeanReference(type = LayoutBranchPersistence.class)
3028 protected LayoutBranchPersistence layoutBranchPersistence;
3029 @BeanReference(type = LayoutPrototypePersistence.class)
3030 protected LayoutPrototypePersistence layoutPrototypePersistence;
3031 @BeanReference(type = LayoutRevisionPersistence.class)
3032 protected LayoutRevisionPersistence layoutRevisionPersistence;
3033 @BeanReference(type = LayoutSetPersistence.class)
3034 protected LayoutSetPersistence layoutSetPersistence;
3035 @BeanReference(type = LayoutSetBranchPersistence.class)
3036 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
3037 @BeanReference(type = LayoutSetPrototypePersistence.class)
3038 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
3039 @BeanReference(type = ListTypePersistence.class)
3040 protected ListTypePersistence listTypePersistence;
3041 @BeanReference(type = LockPersistence.class)
3042 protected LockPersistence lockPersistence;
3043 @BeanReference(type = MembershipRequestPersistence.class)
3044 protected MembershipRequestPersistence membershipRequestPersistence;
3045 @BeanReference(type = OrganizationPersistence.class)
3046 protected OrganizationPersistence organizationPersistence;
3047 @BeanReference(type = OrgGroupPermissionPersistence.class)
3048 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
3049 @BeanReference(type = OrgGroupRolePersistence.class)
3050 protected OrgGroupRolePersistence orgGroupRolePersistence;
3051 @BeanReference(type = OrgLaborPersistence.class)
3052 protected OrgLaborPersistence orgLaborPersistence;
3053 @BeanReference(type = PasswordPolicyPersistence.class)
3054 protected PasswordPolicyPersistence passwordPolicyPersistence;
3055 @BeanReference(type = PasswordPolicyRelPersistence.class)
3056 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
3057 @BeanReference(type = PasswordTrackerPersistence.class)
3058 protected PasswordTrackerPersistence passwordTrackerPersistence;
3059 @BeanReference(type = PermissionPersistence.class)
3060 protected PermissionPersistence permissionPersistence;
3061 @BeanReference(type = PhonePersistence.class)
3062 protected PhonePersistence phonePersistence;
3063 @BeanReference(type = PluginSettingPersistence.class)
3064 protected PluginSettingPersistence pluginSettingPersistence;
3065 @BeanReference(type = PortalPreferencesPersistence.class)
3066 protected PortalPreferencesPersistence portalPreferencesPersistence;
3067 @BeanReference(type = PortletPersistence.class)
3068 protected PortletPersistence portletPersistence;
3069 @BeanReference(type = PortletItemPersistence.class)
3070 protected PortletItemPersistence portletItemPersistence;
3071 @BeanReference(type = PortletPreferencesPersistence.class)
3072 protected PortletPreferencesPersistence portletPreferencesPersistence;
3073 @BeanReference(type = RegionPersistence.class)
3074 protected RegionPersistence regionPersistence;
3075 @BeanReference(type = ReleasePersistence.class)
3076 protected ReleasePersistence releasePersistence;
3077 @BeanReference(type = RepositoryPersistence.class)
3078 protected RepositoryPersistence repositoryPersistence;
3079 @BeanReference(type = RepositoryEntryPersistence.class)
3080 protected RepositoryEntryPersistence repositoryEntryPersistence;
3081 @BeanReference(type = ResourcePersistence.class)
3082 protected ResourcePersistence resourcePersistence;
3083 @BeanReference(type = ResourceActionPersistence.class)
3084 protected ResourceActionPersistence resourceActionPersistence;
3085 @BeanReference(type = ResourceBlockPersistence.class)
3086 protected ResourceBlockPersistence resourceBlockPersistence;
3087 @BeanReference(type = ResourceBlockPermissionPersistence.class)
3088 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
3089 @BeanReference(type = ResourceCodePersistence.class)
3090 protected ResourceCodePersistence resourceCodePersistence;
3091 @BeanReference(type = ResourcePermissionPersistence.class)
3092 protected ResourcePermissionPersistence resourcePermissionPersistence;
3093 @BeanReference(type = ResourceTypePermissionPersistence.class)
3094 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
3095 @BeanReference(type = RolePersistence.class)
3096 protected RolePersistence rolePersistence;
3097 @BeanReference(type = ServiceComponentPersistence.class)
3098 protected ServiceComponentPersistence serviceComponentPersistence;
3099 @BeanReference(type = ShardPersistence.class)
3100 protected ShardPersistence shardPersistence;
3101 @BeanReference(type = SubscriptionPersistence.class)
3102 protected SubscriptionPersistence subscriptionPersistence;
3103 @BeanReference(type = TeamPersistence.class)
3104 protected TeamPersistence teamPersistence;
3105 @BeanReference(type = TicketPersistence.class)
3106 protected TicketPersistence ticketPersistence;
3107 @BeanReference(type = UserPersistence.class)
3108 protected UserPersistence userPersistence;
3109 @BeanReference(type = UserGroupPersistence.class)
3110 protected UserGroupPersistence userGroupPersistence;
3111 @BeanReference(type = UserGroupGroupRolePersistence.class)
3112 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
3113 @BeanReference(type = UserGroupRolePersistence.class)
3114 protected UserGroupRolePersistence userGroupRolePersistence;
3115 @BeanReference(type = UserIdMapperPersistence.class)
3116 protected UserIdMapperPersistence userIdMapperPersistence;
3117 @BeanReference(type = UserNotificationEventPersistence.class)
3118 protected UserNotificationEventPersistence userNotificationEventPersistence;
3119 @BeanReference(type = UserTrackerPersistence.class)
3120 protected UserTrackerPersistence userTrackerPersistence;
3121 @BeanReference(type = UserTrackerPathPersistence.class)
3122 protected UserTrackerPathPersistence userTrackerPathPersistence;
3123 @BeanReference(type = VirtualHostPersistence.class)
3124 protected VirtualHostPersistence virtualHostPersistence;
3125 @BeanReference(type = WebDAVPropsPersistence.class)
3126 protected WebDAVPropsPersistence webDAVPropsPersistence;
3127 @BeanReference(type = WebsitePersistence.class)
3128 protected WebsitePersistence websitePersistence;
3129 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
3130 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
3131 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
3132 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
3133 private static final String _SQL_SELECT_PORTLETPREFERENCES = "SELECT portletPreferences FROM PortletPreferences portletPreferences";
3134 private static final String _SQL_SELECT_PORTLETPREFERENCES_WHERE = "SELECT portletPreferences FROM PortletPreferences portletPreferences WHERE ";
3135 private static final String _SQL_COUNT_PORTLETPREFERENCES = "SELECT COUNT(portletPreferences) FROM PortletPreferences portletPreferences";
3136 private static final String _SQL_COUNT_PORTLETPREFERENCES_WHERE = "SELECT COUNT(portletPreferences) FROM PortletPreferences portletPreferences WHERE ";
3137 private static final String _FINDER_COLUMN_PLID_PLID_2 = "portletPreferences.plid = ?";
3138 private static final String _FINDER_COLUMN_P_P_PLID_2 = "portletPreferences.plid = ? AND ";
3139 private static final String _FINDER_COLUMN_P_P_PORTLETID_1 = "portletPreferences.portletId IS NULL";
3140 private static final String _FINDER_COLUMN_P_P_PORTLETID_2 = "portletPreferences.portletId = ?";
3141 private static final String _FINDER_COLUMN_P_P_PORTLETID_3 = "(portletPreferences.portletId IS NULL OR portletPreferences.portletId = ?)";
3142 private static final String _FINDER_COLUMN_O_O_P_OWNERID_2 = "portletPreferences.ownerId = ? AND ";
3143 private static final String _FINDER_COLUMN_O_O_P_OWNERTYPE_2 = "portletPreferences.ownerType = ? AND ";
3144 private static final String _FINDER_COLUMN_O_O_P_PLID_2 = "portletPreferences.plid = ?";
3145 private static final String _FINDER_COLUMN_O_P_P_OWNERTYPE_2 = "portletPreferences.ownerType = ? AND ";
3146 private static final String _FINDER_COLUMN_O_P_P_PLID_2 = "portletPreferences.plid = ? AND ";
3147 private static final String _FINDER_COLUMN_O_P_P_PORTLETID_1 = "portletPreferences.portletId IS NULL";
3148 private static final String _FINDER_COLUMN_O_P_P_PORTLETID_2 = "portletPreferences.portletId = ?";
3149 private static final String _FINDER_COLUMN_O_P_P_PORTLETID_3 = "(portletPreferences.portletId IS NULL OR portletPreferences.portletId = ?)";
3150 private static final String _FINDER_COLUMN_O_O_P_P_OWNERID_2 = "portletPreferences.ownerId = ? AND ";
3151 private static final String _FINDER_COLUMN_O_O_P_P_OWNERTYPE_2 = "portletPreferences.ownerType = ? AND ";
3152 private static final String _FINDER_COLUMN_O_O_P_P_PLID_2 = "portletPreferences.plid = ? AND ";
3153 private static final String _FINDER_COLUMN_O_O_P_P_PORTLETID_1 = "portletPreferences.portletId IS NULL";
3154 private static final String _FINDER_COLUMN_O_O_P_P_PORTLETID_2 = "portletPreferences.portletId = ?";
3155 private static final String _FINDER_COLUMN_O_O_P_P_PORTLETID_3 = "(portletPreferences.portletId IS NULL OR portletPreferences.portletId = ?)";
3156 private static final String _ORDER_BY_ENTITY_ALIAS = "portletPreferences.";
3157 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PortletPreferences exists with the primary key ";
3158 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PortletPreferences exists with the key {";
3159 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3160 private static Log _log = LogFactoryUtil.getLog(PortletPreferencesPersistenceImpl.class);
3161 private static PortletPreferences _nullPortletPreferences = new PortletPreferencesImpl() {
3162 @Override
3163 public Object clone() {
3164 return this;
3165 }
3166
3167 @Override
3168 public CacheModel<PortletPreferences> toCacheModel() {
3169 return _nullPortletPreferencesCacheModel;
3170 }
3171 };
3172
3173 private static CacheModel<PortletPreferences> _nullPortletPreferencesCacheModel =
3174 new CacheModel<PortletPreferences>() {
3175 public PortletPreferences toEntityModel() {
3176 return _nullPortletPreferences;
3177 }
3178 };
3179 }