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.kernel.util.Validator;
038 import com.liferay.portal.model.CacheModel;
039 import com.liferay.portal.model.ModelListener;
040 import com.liferay.portal.model.PortletPreferences;
041 import com.liferay.portal.model.impl.PortletPreferencesImpl;
042 import com.liferay.portal.model.impl.PortletPreferencesModelImpl;
043 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
044
045 import java.io.Serializable;
046
047 import java.util.ArrayList;
048 import java.util.Collections;
049 import java.util.List;
050
051
063 public class PortletPreferencesPersistenceImpl extends BasePersistenceImpl<PortletPreferences>
064 implements PortletPreferencesPersistence {
065
070 public static final String FINDER_CLASS_NAME_ENTITY = PortletPreferencesImpl.class.getName();
071 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
072 ".List1";
073 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
074 ".List2";
075 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_PLID = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
076 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
077 PortletPreferencesImpl.class,
078 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByPlid",
079 new String[] {
080 Long.class.getName(),
081
082 "java.lang.Integer", "java.lang.Integer",
083 "com.liferay.portal.kernel.util.OrderByComparator"
084 });
085 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
086 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
087 PortletPreferencesImpl.class,
088 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByPlid",
089 new String[] { Long.class.getName() },
090 PortletPreferencesModelImpl.PLID_COLUMN_BITMASK);
091 public static final FinderPath FINDER_PATH_COUNT_BY_PLID = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
092 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
093 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByPlid",
094 new String[] { Long.class.getName() });
095 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
096 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
097 PortletPreferencesImpl.class,
098 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByP_P",
099 new String[] {
100 Long.class.getName(), String.class.getName(),
101
102 "java.lang.Integer", "java.lang.Integer",
103 "com.liferay.portal.kernel.util.OrderByComparator"
104 });
105 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
106 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
107 PortletPreferencesImpl.class,
108 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByP_P",
109 new String[] { Long.class.getName(), String.class.getName() },
110 PortletPreferencesModelImpl.PLID_COLUMN_BITMASK |
111 PortletPreferencesModelImpl.PORTLETID_COLUMN_BITMASK);
112 public static final FinderPath FINDER_PATH_COUNT_BY_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
113 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
114 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByP_P",
115 new String[] { Long.class.getName(), String.class.getName() });
116 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_O_O_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
117 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
118 PortletPreferencesImpl.class,
119 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByO_O_P",
120 new String[] {
121 Long.class.getName(), Integer.class.getName(),
122 Long.class.getName(),
123
124 "java.lang.Integer", "java.lang.Integer",
125 "com.liferay.portal.kernel.util.OrderByComparator"
126 });
127 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
128 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
129 PortletPreferencesImpl.class,
130 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByO_O_P",
131 new String[] {
132 Long.class.getName(), Integer.class.getName(),
133 Long.class.getName()
134 },
135 PortletPreferencesModelImpl.OWNERID_COLUMN_BITMASK |
136 PortletPreferencesModelImpl.OWNERTYPE_COLUMN_BITMASK |
137 PortletPreferencesModelImpl.PLID_COLUMN_BITMASK);
138 public static final FinderPath FINDER_PATH_COUNT_BY_O_O_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
139 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
140 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByO_O_P",
141 new String[] {
142 Long.class.getName(), Integer.class.getName(),
143 Long.class.getName()
144 });
145 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_O_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
146 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
147 PortletPreferencesImpl.class,
148 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByO_P_P",
149 new String[] {
150 Integer.class.getName(), Long.class.getName(),
151 String.class.getName(),
152
153 "java.lang.Integer", "java.lang.Integer",
154 "com.liferay.portal.kernel.util.OrderByComparator"
155 });
156 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
157 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
158 PortletPreferencesImpl.class,
159 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByO_P_P",
160 new String[] {
161 Integer.class.getName(), Long.class.getName(),
162 String.class.getName()
163 },
164 PortletPreferencesModelImpl.OWNERTYPE_COLUMN_BITMASK |
165 PortletPreferencesModelImpl.PLID_COLUMN_BITMASK |
166 PortletPreferencesModelImpl.PORTLETID_COLUMN_BITMASK);
167 public static final FinderPath FINDER_PATH_COUNT_BY_O_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
168 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
169 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByO_P_P",
170 new String[] {
171 Integer.class.getName(), Long.class.getName(),
172 String.class.getName()
173 });
174 public static final FinderPath FINDER_PATH_FETCH_BY_O_O_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
175 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
176 PortletPreferencesImpl.class, FINDER_CLASS_NAME_ENTITY,
177 "fetchByO_O_P_P",
178 new String[] {
179 Long.class.getName(), Integer.class.getName(),
180 Long.class.getName(), String.class.getName()
181 },
182 PortletPreferencesModelImpl.OWNERID_COLUMN_BITMASK |
183 PortletPreferencesModelImpl.OWNERTYPE_COLUMN_BITMASK |
184 PortletPreferencesModelImpl.PLID_COLUMN_BITMASK |
185 PortletPreferencesModelImpl.PORTLETID_COLUMN_BITMASK);
186 public static final FinderPath FINDER_PATH_COUNT_BY_O_O_P_P = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
187 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
188 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByO_O_P_P",
189 new String[] {
190 Long.class.getName(), Integer.class.getName(),
191 Long.class.getName(), String.class.getName()
192 });
193 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
194 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
195 PortletPreferencesImpl.class,
196 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
197 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
198 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED,
199 PortletPreferencesImpl.class,
200 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
201 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
202 PortletPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
203 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
204
205
210 public void cacheResult(PortletPreferences portletPreferences) {
211 EntityCacheUtil.putResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
212 PortletPreferencesImpl.class, portletPreferences.getPrimaryKey(),
213 portletPreferences);
214
215 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
216 new Object[] {
217 Long.valueOf(portletPreferences.getOwnerId()),
218 Integer.valueOf(portletPreferences.getOwnerType()),
219 Long.valueOf(portletPreferences.getPlid()),
220
221 portletPreferences.getPortletId()
222 }, portletPreferences);
223
224 portletPreferences.resetOriginalValues();
225 }
226
227
232 public void cacheResult(List<PortletPreferences> portletPreferenceses) {
233 for (PortletPreferences portletPreferences : portletPreferenceses) {
234 if (EntityCacheUtil.getResult(
235 PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
236 PortletPreferencesImpl.class,
237 portletPreferences.getPrimaryKey()) == null) {
238 cacheResult(portletPreferences);
239 }
240 else {
241 portletPreferences.resetOriginalValues();
242 }
243 }
244 }
245
246
253 @Override
254 public void clearCache() {
255 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
256 CacheRegistryUtil.clear(PortletPreferencesImpl.class.getName());
257 }
258
259 EntityCacheUtil.clearCache(PortletPreferencesImpl.class.getName());
260
261 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
262 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
263 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
264 }
265
266
273 @Override
274 public void clearCache(PortletPreferences portletPreferences) {
275 EntityCacheUtil.removeResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
276 PortletPreferencesImpl.class, portletPreferences.getPrimaryKey());
277
278 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
279 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
280
281 clearUniqueFindersCache(portletPreferences);
282 }
283
284 @Override
285 public void clearCache(List<PortletPreferences> portletPreferenceses) {
286 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
287 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
288
289 for (PortletPreferences portletPreferences : portletPreferenceses) {
290 EntityCacheUtil.removeResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
291 PortletPreferencesImpl.class, portletPreferences.getPrimaryKey());
292
293 clearUniqueFindersCache(portletPreferences);
294 }
295 }
296
297 protected void clearUniqueFindersCache(
298 PortletPreferences portletPreferences) {
299 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O_P_P,
300 new Object[] {
301 Long.valueOf(portletPreferences.getOwnerId()),
302 Integer.valueOf(portletPreferences.getOwnerType()),
303 Long.valueOf(portletPreferences.getPlid()),
304
305 portletPreferences.getPortletId()
306 });
307 }
308
309
315 public PortletPreferences create(long portletPreferencesId) {
316 PortletPreferences portletPreferences = new PortletPreferencesImpl();
317
318 portletPreferences.setNew(true);
319 portletPreferences.setPrimaryKey(portletPreferencesId);
320
321 return portletPreferences;
322 }
323
324
332 public PortletPreferences remove(long portletPreferencesId)
333 throws NoSuchPortletPreferencesException, SystemException {
334 return remove(Long.valueOf(portletPreferencesId));
335 }
336
337
345 @Override
346 public PortletPreferences remove(Serializable primaryKey)
347 throws NoSuchPortletPreferencesException, SystemException {
348 Session session = null;
349
350 try {
351 session = openSession();
352
353 PortletPreferences portletPreferences = (PortletPreferences)session.get(PortletPreferencesImpl.class,
354 primaryKey);
355
356 if (portletPreferences == null) {
357 if (_log.isWarnEnabled()) {
358 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
359 }
360
361 throw new NoSuchPortletPreferencesException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
362 primaryKey);
363 }
364
365 return remove(portletPreferences);
366 }
367 catch (NoSuchPortletPreferencesException nsee) {
368 throw nsee;
369 }
370 catch (Exception e) {
371 throw processException(e);
372 }
373 finally {
374 closeSession(session);
375 }
376 }
377
378 @Override
379 protected PortletPreferences removeImpl(
380 PortletPreferences portletPreferences) throws SystemException {
381 portletPreferences = toUnwrappedModel(portletPreferences);
382
383 Session session = null;
384
385 try {
386 session = openSession();
387
388 BatchSessionUtil.delete(session, portletPreferences);
389 }
390 catch (Exception e) {
391 throw processException(e);
392 }
393 finally {
394 closeSession(session);
395 }
396
397 clearCache(portletPreferences);
398
399 return portletPreferences;
400 }
401
402 @Override
403 public PortletPreferences updateImpl(
404 com.liferay.portal.model.PortletPreferences portletPreferences,
405 boolean merge) throws SystemException {
406 portletPreferences = toUnwrappedModel(portletPreferences);
407
408 boolean isNew = portletPreferences.isNew();
409
410 PortletPreferencesModelImpl portletPreferencesModelImpl = (PortletPreferencesModelImpl)portletPreferences;
411
412 Session session = null;
413
414 try {
415 session = openSession();
416
417 BatchSessionUtil.update(session, portletPreferences, merge);
418
419 portletPreferences.setNew(false);
420 }
421 catch (Exception e) {
422 throw processException(e);
423 }
424 finally {
425 closeSession(session);
426 }
427
428 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
429
430 if (isNew || !PortletPreferencesModelImpl.COLUMN_BITMASK_ENABLED) {
431 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
432 }
433
434 else {
435 if ((portletPreferencesModelImpl.getColumnBitmask() &
436 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID.getColumnBitmask()) != 0) {
437 Object[] args = new Object[] {
438 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid())
439 };
440
441 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PLID, args);
442 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID,
443 args);
444
445 args = new Object[] {
446 Long.valueOf(portletPreferencesModelImpl.getPlid())
447 };
448
449 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PLID, args);
450 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID,
451 args);
452 }
453
454 if ((portletPreferencesModelImpl.getColumnBitmask() &
455 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P.getColumnBitmask()) != 0) {
456 Object[] args = new Object[] {
457 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid()),
458
459 portletPreferencesModelImpl.getOriginalPortletId()
460 };
461
462 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_P_P, args);
463 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P,
464 args);
465
466 args = new Object[] {
467 Long.valueOf(portletPreferencesModelImpl.getPlid()),
468
469 portletPreferencesModelImpl.getPortletId()
470 };
471
472 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_P_P, args);
473 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P,
474 args);
475 }
476
477 if ((portletPreferencesModelImpl.getColumnBitmask() &
478 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P.getColumnBitmask()) != 0) {
479 Object[] args = new Object[] {
480 Long.valueOf(portletPreferencesModelImpl.getOriginalOwnerId()),
481 Integer.valueOf(portletPreferencesModelImpl.getOriginalOwnerType()),
482 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid())
483 };
484
485 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_O_P, args);
486 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P,
487 args);
488
489 args = new Object[] {
490 Long.valueOf(portletPreferencesModelImpl.getOwnerId()),
491 Integer.valueOf(portletPreferencesModelImpl.getOwnerType()),
492 Long.valueOf(portletPreferencesModelImpl.getPlid())
493 };
494
495 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_O_P, args);
496 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P,
497 args);
498 }
499
500 if ((portletPreferencesModelImpl.getColumnBitmask() &
501 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_P_P.getColumnBitmask()) != 0) {
502 Object[] args = new Object[] {
503 Integer.valueOf(portletPreferencesModelImpl.getOriginalOwnerType()),
504 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid()),
505
506 portletPreferencesModelImpl.getOriginalPortletId()
507 };
508
509 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_P_P, args);
510 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_P_P,
511 args);
512
513 args = new Object[] {
514 Integer.valueOf(portletPreferencesModelImpl.getOwnerType()),
515 Long.valueOf(portletPreferencesModelImpl.getPlid()),
516
517 portletPreferencesModelImpl.getPortletId()
518 };
519
520 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_P_P, args);
521 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_P_P,
522 args);
523 }
524 }
525
526 EntityCacheUtil.putResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
527 PortletPreferencesImpl.class, portletPreferences.getPrimaryKey(),
528 portletPreferences);
529
530 if (isNew) {
531 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
532 new Object[] {
533 Long.valueOf(portletPreferences.getOwnerId()),
534 Integer.valueOf(portletPreferences.getOwnerType()),
535 Long.valueOf(portletPreferences.getPlid()),
536
537 portletPreferences.getPortletId()
538 }, portletPreferences);
539 }
540 else {
541 if ((portletPreferencesModelImpl.getColumnBitmask() &
542 FINDER_PATH_FETCH_BY_O_O_P_P.getColumnBitmask()) != 0) {
543 Object[] args = new Object[] {
544 Long.valueOf(portletPreferencesModelImpl.getOriginalOwnerId()),
545 Integer.valueOf(portletPreferencesModelImpl.getOriginalOwnerType()),
546 Long.valueOf(portletPreferencesModelImpl.getOriginalPlid()),
547
548 portletPreferencesModelImpl.getOriginalPortletId()
549 };
550
551 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_O_P_P, args);
552
553 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O_P_P, args);
554
555 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
556 new Object[] {
557 Long.valueOf(portletPreferences.getOwnerId()),
558 Integer.valueOf(portletPreferences.getOwnerType()),
559 Long.valueOf(portletPreferences.getPlid()),
560
561 portletPreferences.getPortletId()
562 }, portletPreferences);
563 }
564 }
565
566 return portletPreferences;
567 }
568
569 protected PortletPreferences toUnwrappedModel(
570 PortletPreferences portletPreferences) {
571 if (portletPreferences instanceof PortletPreferencesImpl) {
572 return portletPreferences;
573 }
574
575 PortletPreferencesImpl portletPreferencesImpl = new PortletPreferencesImpl();
576
577 portletPreferencesImpl.setNew(portletPreferences.isNew());
578 portletPreferencesImpl.setPrimaryKey(portletPreferences.getPrimaryKey());
579
580 portletPreferencesImpl.setPortletPreferencesId(portletPreferences.getPortletPreferencesId());
581 portletPreferencesImpl.setOwnerId(portletPreferences.getOwnerId());
582 portletPreferencesImpl.setOwnerType(portletPreferences.getOwnerType());
583 portletPreferencesImpl.setPlid(portletPreferences.getPlid());
584 portletPreferencesImpl.setPortletId(portletPreferences.getPortletId());
585 portletPreferencesImpl.setPreferences(portletPreferences.getPreferences());
586
587 return portletPreferencesImpl;
588 }
589
590
598 @Override
599 public PortletPreferences findByPrimaryKey(Serializable primaryKey)
600 throws NoSuchModelException, SystemException {
601 return findByPrimaryKey(((Long)primaryKey).longValue());
602 }
603
604
612 public PortletPreferences findByPrimaryKey(long portletPreferencesId)
613 throws NoSuchPortletPreferencesException, SystemException {
614 PortletPreferences portletPreferences = fetchByPrimaryKey(portletPreferencesId);
615
616 if (portletPreferences == null) {
617 if (_log.isWarnEnabled()) {
618 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
619 portletPreferencesId);
620 }
621
622 throw new NoSuchPortletPreferencesException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
623 portletPreferencesId);
624 }
625
626 return portletPreferences;
627 }
628
629
636 @Override
637 public PortletPreferences fetchByPrimaryKey(Serializable primaryKey)
638 throws SystemException {
639 return fetchByPrimaryKey(((Long)primaryKey).longValue());
640 }
641
642
649 public PortletPreferences fetchByPrimaryKey(long portletPreferencesId)
650 throws SystemException {
651 PortletPreferences portletPreferences = (PortletPreferences)EntityCacheUtil.getResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
652 PortletPreferencesImpl.class, portletPreferencesId);
653
654 if (portletPreferences == _nullPortletPreferences) {
655 return null;
656 }
657
658 if (portletPreferences == null) {
659 Session session = null;
660
661 boolean hasException = false;
662
663 try {
664 session = openSession();
665
666 portletPreferences = (PortletPreferences)session.get(PortletPreferencesImpl.class,
667 Long.valueOf(portletPreferencesId));
668 }
669 catch (Exception e) {
670 hasException = true;
671
672 throw processException(e);
673 }
674 finally {
675 if (portletPreferences != null) {
676 cacheResult(portletPreferences);
677 }
678 else if (!hasException) {
679 EntityCacheUtil.putResult(PortletPreferencesModelImpl.ENTITY_CACHE_ENABLED,
680 PortletPreferencesImpl.class, portletPreferencesId,
681 _nullPortletPreferences);
682 }
683
684 closeSession(session);
685 }
686 }
687
688 return portletPreferences;
689 }
690
691
698 public List<PortletPreferences> findByPlid(long plid)
699 throws SystemException {
700 return findByPlid(plid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
701 }
702
703
716 public List<PortletPreferences> findByPlid(long plid, int start, int end)
717 throws SystemException {
718 return findByPlid(plid, start, end, null);
719 }
720
721
735 public List<PortletPreferences> findByPlid(long plid, int start, int end,
736 OrderByComparator orderByComparator) throws SystemException {
737 FinderPath finderPath = null;
738 Object[] finderArgs = null;
739
740 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
741 (orderByComparator == null)) {
742 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PLID;
743 finderArgs = new Object[] { plid };
744 }
745 else {
746 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_PLID;
747 finderArgs = new Object[] { plid, start, end, orderByComparator };
748 }
749
750 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
751 finderArgs, this);
752
753 if ((list != null) && !list.isEmpty()) {
754 for (PortletPreferences portletPreferences : list) {
755 if ((plid != portletPreferences.getPlid())) {
756 list = null;
757
758 break;
759 }
760 }
761 }
762
763 if (list == null) {
764 StringBundler query = null;
765
766 if (orderByComparator != null) {
767 query = new StringBundler(3 +
768 (orderByComparator.getOrderByFields().length * 3));
769 }
770 else {
771 query = new StringBundler(2);
772 }
773
774 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
775
776 query.append(_FINDER_COLUMN_PLID_PLID_2);
777
778 if (orderByComparator != null) {
779 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
780 orderByComparator);
781 }
782
783 String sql = query.toString();
784
785 Session session = null;
786
787 try {
788 session = openSession();
789
790 Query q = session.createQuery(sql);
791
792 QueryPos qPos = QueryPos.getInstance(q);
793
794 qPos.add(plid);
795
796 list = (List<PortletPreferences>)QueryUtil.list(q,
797 getDialect(), start, end);
798 }
799 catch (Exception e) {
800 throw processException(e);
801 }
802 finally {
803 if (list == null) {
804 FinderCacheUtil.removeResult(finderPath, finderArgs);
805 }
806 else {
807 cacheResult(list);
808
809 FinderCacheUtil.putResult(finderPath, finderArgs, list);
810 }
811
812 closeSession(session);
813 }
814 }
815
816 return list;
817 }
818
819
828 public PortletPreferences findByPlid_First(long plid,
829 OrderByComparator orderByComparator)
830 throws NoSuchPortletPreferencesException, SystemException {
831 PortletPreferences portletPreferences = fetchByPlid_First(plid,
832 orderByComparator);
833
834 if (portletPreferences != null) {
835 return portletPreferences;
836 }
837
838 StringBundler msg = new StringBundler(4);
839
840 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
841
842 msg.append("plid=");
843 msg.append(plid);
844
845 msg.append(StringPool.CLOSE_CURLY_BRACE);
846
847 throw new NoSuchPortletPreferencesException(msg.toString());
848 }
849
850
858 public PortletPreferences fetchByPlid_First(long plid,
859 OrderByComparator orderByComparator) throws SystemException {
860 List<PortletPreferences> list = findByPlid(plid, 0, 1, orderByComparator);
861
862 if (!list.isEmpty()) {
863 return list.get(0);
864 }
865
866 return null;
867 }
868
869
878 public PortletPreferences findByPlid_Last(long plid,
879 OrderByComparator orderByComparator)
880 throws NoSuchPortletPreferencesException, SystemException {
881 PortletPreferences portletPreferences = fetchByPlid_Last(plid,
882 orderByComparator);
883
884 if (portletPreferences != null) {
885 return portletPreferences;
886 }
887
888 StringBundler msg = new StringBundler(4);
889
890 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
891
892 msg.append("plid=");
893 msg.append(plid);
894
895 msg.append(StringPool.CLOSE_CURLY_BRACE);
896
897 throw new NoSuchPortletPreferencesException(msg.toString());
898 }
899
900
908 public PortletPreferences fetchByPlid_Last(long plid,
909 OrderByComparator orderByComparator) throws SystemException {
910 int count = countByPlid(plid);
911
912 List<PortletPreferences> list = findByPlid(plid, count - 1, count,
913 orderByComparator);
914
915 if (!list.isEmpty()) {
916 return list.get(0);
917 }
918
919 return null;
920 }
921
922
932 public PortletPreferences[] findByPlid_PrevAndNext(
933 long portletPreferencesId, long plid,
934 OrderByComparator orderByComparator)
935 throws NoSuchPortletPreferencesException, SystemException {
936 PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesId);
937
938 Session session = null;
939
940 try {
941 session = openSession();
942
943 PortletPreferences[] array = new PortletPreferencesImpl[3];
944
945 array[0] = getByPlid_PrevAndNext(session, portletPreferences, plid,
946 orderByComparator, true);
947
948 array[1] = portletPreferences;
949
950 array[2] = getByPlid_PrevAndNext(session, portletPreferences, plid,
951 orderByComparator, false);
952
953 return array;
954 }
955 catch (Exception e) {
956 throw processException(e);
957 }
958 finally {
959 closeSession(session);
960 }
961 }
962
963 protected PortletPreferences getByPlid_PrevAndNext(Session session,
964 PortletPreferences portletPreferences, long plid,
965 OrderByComparator orderByComparator, boolean previous) {
966 StringBundler query = null;
967
968 if (orderByComparator != null) {
969 query = new StringBundler(6 +
970 (orderByComparator.getOrderByFields().length * 6));
971 }
972 else {
973 query = new StringBundler(3);
974 }
975
976 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
977
978 query.append(_FINDER_COLUMN_PLID_PLID_2);
979
980 if (orderByComparator != null) {
981 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
982
983 if (orderByConditionFields.length > 0) {
984 query.append(WHERE_AND);
985 }
986
987 for (int i = 0; i < orderByConditionFields.length; i++) {
988 query.append(_ORDER_BY_ENTITY_ALIAS);
989 query.append(orderByConditionFields[i]);
990
991 if ((i + 1) < orderByConditionFields.length) {
992 if (orderByComparator.isAscending() ^ previous) {
993 query.append(WHERE_GREATER_THAN_HAS_NEXT);
994 }
995 else {
996 query.append(WHERE_LESSER_THAN_HAS_NEXT);
997 }
998 }
999 else {
1000 if (orderByComparator.isAscending() ^ previous) {
1001 query.append(WHERE_GREATER_THAN);
1002 }
1003 else {
1004 query.append(WHERE_LESSER_THAN);
1005 }
1006 }
1007 }
1008
1009 query.append(ORDER_BY_CLAUSE);
1010
1011 String[] orderByFields = orderByComparator.getOrderByFields();
1012
1013 for (int i = 0; i < orderByFields.length; i++) {
1014 query.append(_ORDER_BY_ENTITY_ALIAS);
1015 query.append(orderByFields[i]);
1016
1017 if ((i + 1) < orderByFields.length) {
1018 if (orderByComparator.isAscending() ^ previous) {
1019 query.append(ORDER_BY_ASC_HAS_NEXT);
1020 }
1021 else {
1022 query.append(ORDER_BY_DESC_HAS_NEXT);
1023 }
1024 }
1025 else {
1026 if (orderByComparator.isAscending() ^ previous) {
1027 query.append(ORDER_BY_ASC);
1028 }
1029 else {
1030 query.append(ORDER_BY_DESC);
1031 }
1032 }
1033 }
1034 }
1035
1036 String sql = query.toString();
1037
1038 Query q = session.createQuery(sql);
1039
1040 q.setFirstResult(0);
1041 q.setMaxResults(2);
1042
1043 QueryPos qPos = QueryPos.getInstance(q);
1044
1045 qPos.add(plid);
1046
1047 if (orderByComparator != null) {
1048 Object[] values = orderByComparator.getOrderByConditionValues(portletPreferences);
1049
1050 for (Object value : values) {
1051 qPos.add(value);
1052 }
1053 }
1054
1055 List<PortletPreferences> list = q.list();
1056
1057 if (list.size() == 2) {
1058 return list.get(1);
1059 }
1060 else {
1061 return null;
1062 }
1063 }
1064
1065
1073 public List<PortletPreferences> findByP_P(long plid, String portletId)
1074 throws SystemException {
1075 return findByP_P(plid, portletId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1076 null);
1077 }
1078
1079
1093 public List<PortletPreferences> findByP_P(long plid, String portletId,
1094 int start, int end) throws SystemException {
1095 return findByP_P(plid, portletId, start, end, null);
1096 }
1097
1098
1113 public List<PortletPreferences> findByP_P(long plid, String portletId,
1114 int start, int end, OrderByComparator orderByComparator)
1115 throws SystemException {
1116 FinderPath finderPath = null;
1117 Object[] finderArgs = null;
1118
1119 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1120 (orderByComparator == null)) {
1121 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_P_P;
1122 finderArgs = new Object[] { plid, portletId };
1123 }
1124 else {
1125 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_P_P;
1126 finderArgs = new Object[] {
1127 plid, portletId,
1128
1129 start, end, orderByComparator
1130 };
1131 }
1132
1133 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
1134 finderArgs, this);
1135
1136 if ((list != null) && !list.isEmpty()) {
1137 for (PortletPreferences portletPreferences : list) {
1138 if ((plid != portletPreferences.getPlid()) ||
1139 !Validator.equals(portletId,
1140 portletPreferences.getPortletId())) {
1141 list = null;
1142
1143 break;
1144 }
1145 }
1146 }
1147
1148 if (list == null) {
1149 StringBundler query = null;
1150
1151 if (orderByComparator != null) {
1152 query = new StringBundler(4 +
1153 (orderByComparator.getOrderByFields().length * 3));
1154 }
1155 else {
1156 query = new StringBundler(3);
1157 }
1158
1159 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1160
1161 query.append(_FINDER_COLUMN_P_P_PLID_2);
1162
1163 if (portletId == null) {
1164 query.append(_FINDER_COLUMN_P_P_PORTLETID_1);
1165 }
1166 else {
1167 if (portletId.equals(StringPool.BLANK)) {
1168 query.append(_FINDER_COLUMN_P_P_PORTLETID_3);
1169 }
1170 else {
1171 query.append(_FINDER_COLUMN_P_P_PORTLETID_2);
1172 }
1173 }
1174
1175 if (orderByComparator != null) {
1176 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1177 orderByComparator);
1178 }
1179
1180 String sql = query.toString();
1181
1182 Session session = null;
1183
1184 try {
1185 session = openSession();
1186
1187 Query q = session.createQuery(sql);
1188
1189 QueryPos qPos = QueryPos.getInstance(q);
1190
1191 qPos.add(plid);
1192
1193 if (portletId != null) {
1194 qPos.add(portletId);
1195 }
1196
1197 list = (List<PortletPreferences>)QueryUtil.list(q,
1198 getDialect(), start, end);
1199 }
1200 catch (Exception e) {
1201 throw processException(e);
1202 }
1203 finally {
1204 if (list == null) {
1205 FinderCacheUtil.removeResult(finderPath, finderArgs);
1206 }
1207 else {
1208 cacheResult(list);
1209
1210 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1211 }
1212
1213 closeSession(session);
1214 }
1215 }
1216
1217 return list;
1218 }
1219
1220
1230 public PortletPreferences findByP_P_First(long plid, String portletId,
1231 OrderByComparator orderByComparator)
1232 throws NoSuchPortletPreferencesException, SystemException {
1233 PortletPreferences portletPreferences = fetchByP_P_First(plid,
1234 portletId, orderByComparator);
1235
1236 if (portletPreferences != null) {
1237 return portletPreferences;
1238 }
1239
1240 StringBundler msg = new StringBundler(6);
1241
1242 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1243
1244 msg.append("plid=");
1245 msg.append(plid);
1246
1247 msg.append(", portletId=");
1248 msg.append(portletId);
1249
1250 msg.append(StringPool.CLOSE_CURLY_BRACE);
1251
1252 throw new NoSuchPortletPreferencesException(msg.toString());
1253 }
1254
1255
1264 public PortletPreferences fetchByP_P_First(long plid, String portletId,
1265 OrderByComparator orderByComparator) throws SystemException {
1266 List<PortletPreferences> list = findByP_P(plid, portletId, 0, 1,
1267 orderByComparator);
1268
1269 if (!list.isEmpty()) {
1270 return list.get(0);
1271 }
1272
1273 return null;
1274 }
1275
1276
1286 public PortletPreferences findByP_P_Last(long plid, String portletId,
1287 OrderByComparator orderByComparator)
1288 throws NoSuchPortletPreferencesException, SystemException {
1289 PortletPreferences portletPreferences = fetchByP_P_Last(plid,
1290 portletId, orderByComparator);
1291
1292 if (portletPreferences != null) {
1293 return portletPreferences;
1294 }
1295
1296 StringBundler msg = new StringBundler(6);
1297
1298 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1299
1300 msg.append("plid=");
1301 msg.append(plid);
1302
1303 msg.append(", portletId=");
1304 msg.append(portletId);
1305
1306 msg.append(StringPool.CLOSE_CURLY_BRACE);
1307
1308 throw new NoSuchPortletPreferencesException(msg.toString());
1309 }
1310
1311
1320 public PortletPreferences fetchByP_P_Last(long plid, String portletId,
1321 OrderByComparator orderByComparator) throws SystemException {
1322 int count = countByP_P(plid, portletId);
1323
1324 List<PortletPreferences> list = findByP_P(plid, portletId, count - 1,
1325 count, orderByComparator);
1326
1327 if (!list.isEmpty()) {
1328 return list.get(0);
1329 }
1330
1331 return null;
1332 }
1333
1334
1345 public PortletPreferences[] findByP_P_PrevAndNext(
1346 long portletPreferencesId, long plid, String portletId,
1347 OrderByComparator orderByComparator)
1348 throws NoSuchPortletPreferencesException, SystemException {
1349 PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesId);
1350
1351 Session session = null;
1352
1353 try {
1354 session = openSession();
1355
1356 PortletPreferences[] array = new PortletPreferencesImpl[3];
1357
1358 array[0] = getByP_P_PrevAndNext(session, portletPreferences, plid,
1359 portletId, orderByComparator, true);
1360
1361 array[1] = portletPreferences;
1362
1363 array[2] = getByP_P_PrevAndNext(session, portletPreferences, plid,
1364 portletId, orderByComparator, false);
1365
1366 return array;
1367 }
1368 catch (Exception e) {
1369 throw processException(e);
1370 }
1371 finally {
1372 closeSession(session);
1373 }
1374 }
1375
1376 protected PortletPreferences getByP_P_PrevAndNext(Session session,
1377 PortletPreferences portletPreferences, long plid, String portletId,
1378 OrderByComparator orderByComparator, boolean previous) {
1379 StringBundler query = null;
1380
1381 if (orderByComparator != null) {
1382 query = new StringBundler(6 +
1383 (orderByComparator.getOrderByFields().length * 6));
1384 }
1385 else {
1386 query = new StringBundler(3);
1387 }
1388
1389 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1390
1391 query.append(_FINDER_COLUMN_P_P_PLID_2);
1392
1393 if (portletId == null) {
1394 query.append(_FINDER_COLUMN_P_P_PORTLETID_1);
1395 }
1396 else {
1397 if (portletId.equals(StringPool.BLANK)) {
1398 query.append(_FINDER_COLUMN_P_P_PORTLETID_3);
1399 }
1400 else {
1401 query.append(_FINDER_COLUMN_P_P_PORTLETID_2);
1402 }
1403 }
1404
1405 if (orderByComparator != null) {
1406 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1407
1408 if (orderByConditionFields.length > 0) {
1409 query.append(WHERE_AND);
1410 }
1411
1412 for (int i = 0; i < orderByConditionFields.length; i++) {
1413 query.append(_ORDER_BY_ENTITY_ALIAS);
1414 query.append(orderByConditionFields[i]);
1415
1416 if ((i + 1) < orderByConditionFields.length) {
1417 if (orderByComparator.isAscending() ^ previous) {
1418 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1419 }
1420 else {
1421 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1422 }
1423 }
1424 else {
1425 if (orderByComparator.isAscending() ^ previous) {
1426 query.append(WHERE_GREATER_THAN);
1427 }
1428 else {
1429 query.append(WHERE_LESSER_THAN);
1430 }
1431 }
1432 }
1433
1434 query.append(ORDER_BY_CLAUSE);
1435
1436 String[] orderByFields = orderByComparator.getOrderByFields();
1437
1438 for (int i = 0; i < orderByFields.length; i++) {
1439 query.append(_ORDER_BY_ENTITY_ALIAS);
1440 query.append(orderByFields[i]);
1441
1442 if ((i + 1) < orderByFields.length) {
1443 if (orderByComparator.isAscending() ^ previous) {
1444 query.append(ORDER_BY_ASC_HAS_NEXT);
1445 }
1446 else {
1447 query.append(ORDER_BY_DESC_HAS_NEXT);
1448 }
1449 }
1450 else {
1451 if (orderByComparator.isAscending() ^ previous) {
1452 query.append(ORDER_BY_ASC);
1453 }
1454 else {
1455 query.append(ORDER_BY_DESC);
1456 }
1457 }
1458 }
1459 }
1460
1461 String sql = query.toString();
1462
1463 Query q = session.createQuery(sql);
1464
1465 q.setFirstResult(0);
1466 q.setMaxResults(2);
1467
1468 QueryPos qPos = QueryPos.getInstance(q);
1469
1470 qPos.add(plid);
1471
1472 if (portletId != null) {
1473 qPos.add(portletId);
1474 }
1475
1476 if (orderByComparator != null) {
1477 Object[] values = orderByComparator.getOrderByConditionValues(portletPreferences);
1478
1479 for (Object value : values) {
1480 qPos.add(value);
1481 }
1482 }
1483
1484 List<PortletPreferences> list = q.list();
1485
1486 if (list.size() == 2) {
1487 return list.get(1);
1488 }
1489 else {
1490 return null;
1491 }
1492 }
1493
1494
1503 public List<PortletPreferences> findByO_O_P(long ownerId, int ownerType,
1504 long plid) throws SystemException {
1505 return findByO_O_P(ownerId, ownerType, plid, QueryUtil.ALL_POS,
1506 QueryUtil.ALL_POS, null);
1507 }
1508
1509
1524 public List<PortletPreferences> findByO_O_P(long ownerId, int ownerType,
1525 long plid, int start, int end) throws SystemException {
1526 return findByO_O_P(ownerId, ownerType, plid, start, end, null);
1527 }
1528
1529
1545 public List<PortletPreferences> findByO_O_P(long ownerId, int ownerType,
1546 long plid, int start, int end, OrderByComparator orderByComparator)
1547 throws SystemException {
1548 FinderPath finderPath = null;
1549 Object[] finderArgs = null;
1550
1551 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1552 (orderByComparator == null)) {
1553 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_O_P;
1554 finderArgs = new Object[] { ownerId, ownerType, plid };
1555 }
1556 else {
1557 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_O_O_P;
1558 finderArgs = new Object[] {
1559 ownerId, ownerType, plid,
1560
1561 start, end, orderByComparator
1562 };
1563 }
1564
1565 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
1566 finderArgs, this);
1567
1568 if ((list != null) && !list.isEmpty()) {
1569 for (PortletPreferences portletPreferences : list) {
1570 if ((ownerId != portletPreferences.getOwnerId()) ||
1571 (ownerType != portletPreferences.getOwnerType()) ||
1572 (plid != portletPreferences.getPlid())) {
1573 list = null;
1574
1575 break;
1576 }
1577 }
1578 }
1579
1580 if (list == null) {
1581 StringBundler query = null;
1582
1583 if (orderByComparator != null) {
1584 query = new StringBundler(5 +
1585 (orderByComparator.getOrderByFields().length * 3));
1586 }
1587 else {
1588 query = new StringBundler(4);
1589 }
1590
1591 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1592
1593 query.append(_FINDER_COLUMN_O_O_P_OWNERID_2);
1594
1595 query.append(_FINDER_COLUMN_O_O_P_OWNERTYPE_2);
1596
1597 query.append(_FINDER_COLUMN_O_O_P_PLID_2);
1598
1599 if (orderByComparator != null) {
1600 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1601 orderByComparator);
1602 }
1603
1604 String sql = query.toString();
1605
1606 Session session = null;
1607
1608 try {
1609 session = openSession();
1610
1611 Query q = session.createQuery(sql);
1612
1613 QueryPos qPos = QueryPos.getInstance(q);
1614
1615 qPos.add(ownerId);
1616
1617 qPos.add(ownerType);
1618
1619 qPos.add(plid);
1620
1621 list = (List<PortletPreferences>)QueryUtil.list(q,
1622 getDialect(), start, end);
1623 }
1624 catch (Exception e) {
1625 throw processException(e);
1626 }
1627 finally {
1628 if (list == null) {
1629 FinderCacheUtil.removeResult(finderPath, finderArgs);
1630 }
1631 else {
1632 cacheResult(list);
1633
1634 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1635 }
1636
1637 closeSession(session);
1638 }
1639 }
1640
1641 return list;
1642 }
1643
1644
1655 public PortletPreferences findByO_O_P_First(long ownerId, int ownerType,
1656 long plid, OrderByComparator orderByComparator)
1657 throws NoSuchPortletPreferencesException, SystemException {
1658 PortletPreferences portletPreferences = fetchByO_O_P_First(ownerId,
1659 ownerType, plid, orderByComparator);
1660
1661 if (portletPreferences != null) {
1662 return portletPreferences;
1663 }
1664
1665 StringBundler msg = new StringBundler(8);
1666
1667 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1668
1669 msg.append("ownerId=");
1670 msg.append(ownerId);
1671
1672 msg.append(", ownerType=");
1673 msg.append(ownerType);
1674
1675 msg.append(", plid=");
1676 msg.append(plid);
1677
1678 msg.append(StringPool.CLOSE_CURLY_BRACE);
1679
1680 throw new NoSuchPortletPreferencesException(msg.toString());
1681 }
1682
1683
1693 public PortletPreferences fetchByO_O_P_First(long ownerId, int ownerType,
1694 long plid, OrderByComparator orderByComparator)
1695 throws SystemException {
1696 List<PortletPreferences> list = findByO_O_P(ownerId, ownerType, plid,
1697 0, 1, orderByComparator);
1698
1699 if (!list.isEmpty()) {
1700 return list.get(0);
1701 }
1702
1703 return null;
1704 }
1705
1706
1717 public PortletPreferences findByO_O_P_Last(long ownerId, int ownerType,
1718 long plid, OrderByComparator orderByComparator)
1719 throws NoSuchPortletPreferencesException, SystemException {
1720 PortletPreferences portletPreferences = fetchByO_O_P_Last(ownerId,
1721 ownerType, plid, orderByComparator);
1722
1723 if (portletPreferences != null) {
1724 return portletPreferences;
1725 }
1726
1727 StringBundler msg = new StringBundler(8);
1728
1729 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1730
1731 msg.append("ownerId=");
1732 msg.append(ownerId);
1733
1734 msg.append(", ownerType=");
1735 msg.append(ownerType);
1736
1737 msg.append(", plid=");
1738 msg.append(plid);
1739
1740 msg.append(StringPool.CLOSE_CURLY_BRACE);
1741
1742 throw new NoSuchPortletPreferencesException(msg.toString());
1743 }
1744
1745
1755 public PortletPreferences fetchByO_O_P_Last(long ownerId, int ownerType,
1756 long plid, OrderByComparator orderByComparator)
1757 throws SystemException {
1758 int count = countByO_O_P(ownerId, ownerType, plid);
1759
1760 List<PortletPreferences> list = findByO_O_P(ownerId, ownerType, plid,
1761 count - 1, count, orderByComparator);
1762
1763 if (!list.isEmpty()) {
1764 return list.get(0);
1765 }
1766
1767 return null;
1768 }
1769
1770
1782 public PortletPreferences[] findByO_O_P_PrevAndNext(
1783 long portletPreferencesId, long ownerId, int ownerType, long plid,
1784 OrderByComparator orderByComparator)
1785 throws NoSuchPortletPreferencesException, SystemException {
1786 PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesId);
1787
1788 Session session = null;
1789
1790 try {
1791 session = openSession();
1792
1793 PortletPreferences[] array = new PortletPreferencesImpl[3];
1794
1795 array[0] = getByO_O_P_PrevAndNext(session, portletPreferences,
1796 ownerId, ownerType, plid, orderByComparator, true);
1797
1798 array[1] = portletPreferences;
1799
1800 array[2] = getByO_O_P_PrevAndNext(session, portletPreferences,
1801 ownerId, ownerType, plid, orderByComparator, false);
1802
1803 return array;
1804 }
1805 catch (Exception e) {
1806 throw processException(e);
1807 }
1808 finally {
1809 closeSession(session);
1810 }
1811 }
1812
1813 protected PortletPreferences getByO_O_P_PrevAndNext(Session session,
1814 PortletPreferences portletPreferences, long ownerId, int ownerType,
1815 long plid, OrderByComparator orderByComparator, boolean previous) {
1816 StringBundler query = null;
1817
1818 if (orderByComparator != null) {
1819 query = new StringBundler(6 +
1820 (orderByComparator.getOrderByFields().length * 6));
1821 }
1822 else {
1823 query = new StringBundler(3);
1824 }
1825
1826 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
1827
1828 query.append(_FINDER_COLUMN_O_O_P_OWNERID_2);
1829
1830 query.append(_FINDER_COLUMN_O_O_P_OWNERTYPE_2);
1831
1832 query.append(_FINDER_COLUMN_O_O_P_PLID_2);
1833
1834 if (orderByComparator != null) {
1835 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1836
1837 if (orderByConditionFields.length > 0) {
1838 query.append(WHERE_AND);
1839 }
1840
1841 for (int i = 0; i < orderByConditionFields.length; i++) {
1842 query.append(_ORDER_BY_ENTITY_ALIAS);
1843 query.append(orderByConditionFields[i]);
1844
1845 if ((i + 1) < orderByConditionFields.length) {
1846 if (orderByComparator.isAscending() ^ previous) {
1847 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1848 }
1849 else {
1850 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1851 }
1852 }
1853 else {
1854 if (orderByComparator.isAscending() ^ previous) {
1855 query.append(WHERE_GREATER_THAN);
1856 }
1857 else {
1858 query.append(WHERE_LESSER_THAN);
1859 }
1860 }
1861 }
1862
1863 query.append(ORDER_BY_CLAUSE);
1864
1865 String[] orderByFields = orderByComparator.getOrderByFields();
1866
1867 for (int i = 0; i < orderByFields.length; i++) {
1868 query.append(_ORDER_BY_ENTITY_ALIAS);
1869 query.append(orderByFields[i]);
1870
1871 if ((i + 1) < orderByFields.length) {
1872 if (orderByComparator.isAscending() ^ previous) {
1873 query.append(ORDER_BY_ASC_HAS_NEXT);
1874 }
1875 else {
1876 query.append(ORDER_BY_DESC_HAS_NEXT);
1877 }
1878 }
1879 else {
1880 if (orderByComparator.isAscending() ^ previous) {
1881 query.append(ORDER_BY_ASC);
1882 }
1883 else {
1884 query.append(ORDER_BY_DESC);
1885 }
1886 }
1887 }
1888 }
1889
1890 String sql = query.toString();
1891
1892 Query q = session.createQuery(sql);
1893
1894 q.setFirstResult(0);
1895 q.setMaxResults(2);
1896
1897 QueryPos qPos = QueryPos.getInstance(q);
1898
1899 qPos.add(ownerId);
1900
1901 qPos.add(ownerType);
1902
1903 qPos.add(plid);
1904
1905 if (orderByComparator != null) {
1906 Object[] values = orderByComparator.getOrderByConditionValues(portletPreferences);
1907
1908 for (Object value : values) {
1909 qPos.add(value);
1910 }
1911 }
1912
1913 List<PortletPreferences> list = q.list();
1914
1915 if (list.size() == 2) {
1916 return list.get(1);
1917 }
1918 else {
1919 return null;
1920 }
1921 }
1922
1923
1932 public List<PortletPreferences> findByO_P_P(int ownerType, long plid,
1933 String portletId) throws SystemException {
1934 return findByO_P_P(ownerType, plid, portletId, QueryUtil.ALL_POS,
1935 QueryUtil.ALL_POS, null);
1936 }
1937
1938
1953 public List<PortletPreferences> findByO_P_P(int ownerType, long plid,
1954 String portletId, int start, int end) throws SystemException {
1955 return findByO_P_P(ownerType, plid, portletId, start, end, null);
1956 }
1957
1958
1974 public List<PortletPreferences> findByO_P_P(int ownerType, long plid,
1975 String portletId, int start, int end,
1976 OrderByComparator orderByComparator) throws SystemException {
1977 FinderPath finderPath = null;
1978 Object[] finderArgs = null;
1979
1980 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1981 (orderByComparator == null)) {
1982 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_O_P_P;
1983 finderArgs = new Object[] { ownerType, plid, portletId };
1984 }
1985 else {
1986 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_O_P_P;
1987 finderArgs = new Object[] {
1988 ownerType, plid, portletId,
1989
1990 start, end, orderByComparator
1991 };
1992 }
1993
1994 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
1995 finderArgs, this);
1996
1997 if ((list != null) && !list.isEmpty()) {
1998 for (PortletPreferences portletPreferences : list) {
1999 if ((ownerType != portletPreferences.getOwnerType()) ||
2000 (plid != portletPreferences.getPlid()) ||
2001 !Validator.equals(portletId,
2002 portletPreferences.getPortletId())) {
2003 list = null;
2004
2005 break;
2006 }
2007 }
2008 }
2009
2010 if (list == null) {
2011 StringBundler query = null;
2012
2013 if (orderByComparator != null) {
2014 query = new StringBundler(5 +
2015 (orderByComparator.getOrderByFields().length * 3));
2016 }
2017 else {
2018 query = new StringBundler(4);
2019 }
2020
2021 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
2022
2023 query.append(_FINDER_COLUMN_O_P_P_OWNERTYPE_2);
2024
2025 query.append(_FINDER_COLUMN_O_P_P_PLID_2);
2026
2027 if (portletId == null) {
2028 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_1);
2029 }
2030 else {
2031 if (portletId.equals(StringPool.BLANK)) {
2032 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_3);
2033 }
2034 else {
2035 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_2);
2036 }
2037 }
2038
2039 if (orderByComparator != null) {
2040 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2041 orderByComparator);
2042 }
2043
2044 String sql = query.toString();
2045
2046 Session session = null;
2047
2048 try {
2049 session = openSession();
2050
2051 Query q = session.createQuery(sql);
2052
2053 QueryPos qPos = QueryPos.getInstance(q);
2054
2055 qPos.add(ownerType);
2056
2057 qPos.add(plid);
2058
2059 if (portletId != null) {
2060 qPos.add(portletId);
2061 }
2062
2063 list = (List<PortletPreferences>)QueryUtil.list(q,
2064 getDialect(), start, end);
2065 }
2066 catch (Exception e) {
2067 throw processException(e);
2068 }
2069 finally {
2070 if (list == null) {
2071 FinderCacheUtil.removeResult(finderPath, finderArgs);
2072 }
2073 else {
2074 cacheResult(list);
2075
2076 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2077 }
2078
2079 closeSession(session);
2080 }
2081 }
2082
2083 return list;
2084 }
2085
2086
2097 public PortletPreferences findByO_P_P_First(int ownerType, long plid,
2098 String portletId, OrderByComparator orderByComparator)
2099 throws NoSuchPortletPreferencesException, SystemException {
2100 PortletPreferences portletPreferences = fetchByO_P_P_First(ownerType,
2101 plid, portletId, orderByComparator);
2102
2103 if (portletPreferences != null) {
2104 return portletPreferences;
2105 }
2106
2107 StringBundler msg = new StringBundler(8);
2108
2109 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2110
2111 msg.append("ownerType=");
2112 msg.append(ownerType);
2113
2114 msg.append(", plid=");
2115 msg.append(plid);
2116
2117 msg.append(", portletId=");
2118 msg.append(portletId);
2119
2120 msg.append(StringPool.CLOSE_CURLY_BRACE);
2121
2122 throw new NoSuchPortletPreferencesException(msg.toString());
2123 }
2124
2125
2135 public PortletPreferences fetchByO_P_P_First(int ownerType, long plid,
2136 String portletId, OrderByComparator orderByComparator)
2137 throws SystemException {
2138 List<PortletPreferences> list = findByO_P_P(ownerType, plid, portletId,
2139 0, 1, orderByComparator);
2140
2141 if (!list.isEmpty()) {
2142 return list.get(0);
2143 }
2144
2145 return null;
2146 }
2147
2148
2159 public PortletPreferences findByO_P_P_Last(int ownerType, long plid,
2160 String portletId, OrderByComparator orderByComparator)
2161 throws NoSuchPortletPreferencesException, SystemException {
2162 PortletPreferences portletPreferences = fetchByO_P_P_Last(ownerType,
2163 plid, portletId, orderByComparator);
2164
2165 if (portletPreferences != null) {
2166 return portletPreferences;
2167 }
2168
2169 StringBundler msg = new StringBundler(8);
2170
2171 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2172
2173 msg.append("ownerType=");
2174 msg.append(ownerType);
2175
2176 msg.append(", plid=");
2177 msg.append(plid);
2178
2179 msg.append(", portletId=");
2180 msg.append(portletId);
2181
2182 msg.append(StringPool.CLOSE_CURLY_BRACE);
2183
2184 throw new NoSuchPortletPreferencesException(msg.toString());
2185 }
2186
2187
2197 public PortletPreferences fetchByO_P_P_Last(int ownerType, long plid,
2198 String portletId, OrderByComparator orderByComparator)
2199 throws SystemException {
2200 int count = countByO_P_P(ownerType, plid, portletId);
2201
2202 List<PortletPreferences> list = findByO_P_P(ownerType, plid, portletId,
2203 count - 1, count, orderByComparator);
2204
2205 if (!list.isEmpty()) {
2206 return list.get(0);
2207 }
2208
2209 return null;
2210 }
2211
2212
2224 public PortletPreferences[] findByO_P_P_PrevAndNext(
2225 long portletPreferencesId, int ownerType, long plid, String portletId,
2226 OrderByComparator orderByComparator)
2227 throws NoSuchPortletPreferencesException, SystemException {
2228 PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesId);
2229
2230 Session session = null;
2231
2232 try {
2233 session = openSession();
2234
2235 PortletPreferences[] array = new PortletPreferencesImpl[3];
2236
2237 array[0] = getByO_P_P_PrevAndNext(session, portletPreferences,
2238 ownerType, plid, portletId, orderByComparator, true);
2239
2240 array[1] = portletPreferences;
2241
2242 array[2] = getByO_P_P_PrevAndNext(session, portletPreferences,
2243 ownerType, plid, portletId, orderByComparator, false);
2244
2245 return array;
2246 }
2247 catch (Exception e) {
2248 throw processException(e);
2249 }
2250 finally {
2251 closeSession(session);
2252 }
2253 }
2254
2255 protected PortletPreferences getByO_P_P_PrevAndNext(Session session,
2256 PortletPreferences portletPreferences, int ownerType, long plid,
2257 String portletId, OrderByComparator orderByComparator, boolean previous) {
2258 StringBundler query = null;
2259
2260 if (orderByComparator != null) {
2261 query = new StringBundler(6 +
2262 (orderByComparator.getOrderByFields().length * 6));
2263 }
2264 else {
2265 query = new StringBundler(3);
2266 }
2267
2268 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
2269
2270 query.append(_FINDER_COLUMN_O_P_P_OWNERTYPE_2);
2271
2272 query.append(_FINDER_COLUMN_O_P_P_PLID_2);
2273
2274 if (portletId == null) {
2275 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_1);
2276 }
2277 else {
2278 if (portletId.equals(StringPool.BLANK)) {
2279 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_3);
2280 }
2281 else {
2282 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_2);
2283 }
2284 }
2285
2286 if (orderByComparator != null) {
2287 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2288
2289 if (orderByConditionFields.length > 0) {
2290 query.append(WHERE_AND);
2291 }
2292
2293 for (int i = 0; i < orderByConditionFields.length; i++) {
2294 query.append(_ORDER_BY_ENTITY_ALIAS);
2295 query.append(orderByConditionFields[i]);
2296
2297 if ((i + 1) < orderByConditionFields.length) {
2298 if (orderByComparator.isAscending() ^ previous) {
2299 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2300 }
2301 else {
2302 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2303 }
2304 }
2305 else {
2306 if (orderByComparator.isAscending() ^ previous) {
2307 query.append(WHERE_GREATER_THAN);
2308 }
2309 else {
2310 query.append(WHERE_LESSER_THAN);
2311 }
2312 }
2313 }
2314
2315 query.append(ORDER_BY_CLAUSE);
2316
2317 String[] orderByFields = orderByComparator.getOrderByFields();
2318
2319 for (int i = 0; i < orderByFields.length; i++) {
2320 query.append(_ORDER_BY_ENTITY_ALIAS);
2321 query.append(orderByFields[i]);
2322
2323 if ((i + 1) < orderByFields.length) {
2324 if (orderByComparator.isAscending() ^ previous) {
2325 query.append(ORDER_BY_ASC_HAS_NEXT);
2326 }
2327 else {
2328 query.append(ORDER_BY_DESC_HAS_NEXT);
2329 }
2330 }
2331 else {
2332 if (orderByComparator.isAscending() ^ previous) {
2333 query.append(ORDER_BY_ASC);
2334 }
2335 else {
2336 query.append(ORDER_BY_DESC);
2337 }
2338 }
2339 }
2340 }
2341
2342 String sql = query.toString();
2343
2344 Query q = session.createQuery(sql);
2345
2346 q.setFirstResult(0);
2347 q.setMaxResults(2);
2348
2349 QueryPos qPos = QueryPos.getInstance(q);
2350
2351 qPos.add(ownerType);
2352
2353 qPos.add(plid);
2354
2355 if (portletId != null) {
2356 qPos.add(portletId);
2357 }
2358
2359 if (orderByComparator != null) {
2360 Object[] values = orderByComparator.getOrderByConditionValues(portletPreferences);
2361
2362 for (Object value : values) {
2363 qPos.add(value);
2364 }
2365 }
2366
2367 List<PortletPreferences> list = q.list();
2368
2369 if (list.size() == 2) {
2370 return list.get(1);
2371 }
2372 else {
2373 return null;
2374 }
2375 }
2376
2377
2388 public PortletPreferences findByO_O_P_P(long ownerId, int ownerType,
2389 long plid, String portletId)
2390 throws NoSuchPortletPreferencesException, SystemException {
2391 PortletPreferences portletPreferences = fetchByO_O_P_P(ownerId,
2392 ownerType, plid, portletId);
2393
2394 if (portletPreferences == null) {
2395 StringBundler msg = new StringBundler(10);
2396
2397 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2398
2399 msg.append("ownerId=");
2400 msg.append(ownerId);
2401
2402 msg.append(", ownerType=");
2403 msg.append(ownerType);
2404
2405 msg.append(", plid=");
2406 msg.append(plid);
2407
2408 msg.append(", portletId=");
2409 msg.append(portletId);
2410
2411 msg.append(StringPool.CLOSE_CURLY_BRACE);
2412
2413 if (_log.isWarnEnabled()) {
2414 _log.warn(msg.toString());
2415 }
2416
2417 throw new NoSuchPortletPreferencesException(msg.toString());
2418 }
2419
2420 return portletPreferences;
2421 }
2422
2423
2433 public PortletPreferences fetchByO_O_P_P(long ownerId, int ownerType,
2434 long plid, String portletId) throws SystemException {
2435 return fetchByO_O_P_P(ownerId, ownerType, plid, portletId, true);
2436 }
2437
2438
2449 public PortletPreferences fetchByO_O_P_P(long ownerId, int ownerType,
2450 long plid, String portletId, boolean retrieveFromCache)
2451 throws SystemException {
2452 Object[] finderArgs = new Object[] { ownerId, ownerType, plid, portletId };
2453
2454 Object result = null;
2455
2456 if (retrieveFromCache) {
2457 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_O_O_P_P,
2458 finderArgs, this);
2459 }
2460
2461 if (result instanceof PortletPreferences) {
2462 PortletPreferences portletPreferences = (PortletPreferences)result;
2463
2464 if ((ownerId != portletPreferences.getOwnerId()) ||
2465 (ownerType != portletPreferences.getOwnerType()) ||
2466 (plid != portletPreferences.getPlid()) ||
2467 !Validator.equals(portletId,
2468 portletPreferences.getPortletId())) {
2469 result = null;
2470 }
2471 }
2472
2473 if (result == null) {
2474 StringBundler query = new StringBundler(5);
2475
2476 query.append(_SQL_SELECT_PORTLETPREFERENCES_WHERE);
2477
2478 query.append(_FINDER_COLUMN_O_O_P_P_OWNERID_2);
2479
2480 query.append(_FINDER_COLUMN_O_O_P_P_OWNERTYPE_2);
2481
2482 query.append(_FINDER_COLUMN_O_O_P_P_PLID_2);
2483
2484 if (portletId == null) {
2485 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_1);
2486 }
2487 else {
2488 if (portletId.equals(StringPool.BLANK)) {
2489 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_3);
2490 }
2491 else {
2492 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_2);
2493 }
2494 }
2495
2496 String sql = query.toString();
2497
2498 Session session = null;
2499
2500 try {
2501 session = openSession();
2502
2503 Query q = session.createQuery(sql);
2504
2505 QueryPos qPos = QueryPos.getInstance(q);
2506
2507 qPos.add(ownerId);
2508
2509 qPos.add(ownerType);
2510
2511 qPos.add(plid);
2512
2513 if (portletId != null) {
2514 qPos.add(portletId);
2515 }
2516
2517 List<PortletPreferences> list = q.list();
2518
2519 result = list;
2520
2521 PortletPreferences portletPreferences = null;
2522
2523 if (list.isEmpty()) {
2524 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
2525 finderArgs, list);
2526 }
2527 else {
2528 portletPreferences = list.get(0);
2529
2530 cacheResult(portletPreferences);
2531
2532 if ((portletPreferences.getOwnerId() != ownerId) ||
2533 (portletPreferences.getOwnerType() != ownerType) ||
2534 (portletPreferences.getPlid() != plid) ||
2535 (portletPreferences.getPortletId() == null) ||
2536 !portletPreferences.getPortletId().equals(portletId)) {
2537 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O_P_P,
2538 finderArgs, portletPreferences);
2539 }
2540 }
2541
2542 return portletPreferences;
2543 }
2544 catch (Exception e) {
2545 throw processException(e);
2546 }
2547 finally {
2548 if (result == null) {
2549 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O_P_P,
2550 finderArgs);
2551 }
2552
2553 closeSession(session);
2554 }
2555 }
2556 else {
2557 if (result instanceof List<?>) {
2558 return null;
2559 }
2560 else {
2561 return (PortletPreferences)result;
2562 }
2563 }
2564 }
2565
2566
2572 public List<PortletPreferences> findAll() throws SystemException {
2573 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2574 }
2575
2576
2588 public List<PortletPreferences> findAll(int start, int end)
2589 throws SystemException {
2590 return findAll(start, end, null);
2591 }
2592
2593
2606 public List<PortletPreferences> findAll(int start, int end,
2607 OrderByComparator orderByComparator) throws SystemException {
2608 FinderPath finderPath = null;
2609 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2610
2611 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2612 (orderByComparator == null)) {
2613 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2614 finderArgs = FINDER_ARGS_EMPTY;
2615 }
2616 else {
2617 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2618 finderArgs = new Object[] { start, end, orderByComparator };
2619 }
2620
2621 List<PortletPreferences> list = (List<PortletPreferences>)FinderCacheUtil.getResult(finderPath,
2622 finderArgs, this);
2623
2624 if (list == null) {
2625 StringBundler query = null;
2626 String sql = null;
2627
2628 if (orderByComparator != null) {
2629 query = new StringBundler(2 +
2630 (orderByComparator.getOrderByFields().length * 3));
2631
2632 query.append(_SQL_SELECT_PORTLETPREFERENCES);
2633
2634 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2635 orderByComparator);
2636
2637 sql = query.toString();
2638 }
2639 else {
2640 sql = _SQL_SELECT_PORTLETPREFERENCES;
2641 }
2642
2643 Session session = null;
2644
2645 try {
2646 session = openSession();
2647
2648 Query q = session.createQuery(sql);
2649
2650 if (orderByComparator == null) {
2651 list = (List<PortletPreferences>)QueryUtil.list(q,
2652 getDialect(), start, end, false);
2653
2654 Collections.sort(list);
2655 }
2656 else {
2657 list = (List<PortletPreferences>)QueryUtil.list(q,
2658 getDialect(), start, end);
2659 }
2660 }
2661 catch (Exception e) {
2662 throw processException(e);
2663 }
2664 finally {
2665 if (list == null) {
2666 FinderCacheUtil.removeResult(finderPath, finderArgs);
2667 }
2668 else {
2669 cacheResult(list);
2670
2671 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2672 }
2673
2674 closeSession(session);
2675 }
2676 }
2677
2678 return list;
2679 }
2680
2681
2687 public void removeByPlid(long plid) throws SystemException {
2688 for (PortletPreferences portletPreferences : findByPlid(plid)) {
2689 remove(portletPreferences);
2690 }
2691 }
2692
2693
2700 public void removeByP_P(long plid, String portletId)
2701 throws SystemException {
2702 for (PortletPreferences portletPreferences : findByP_P(plid, portletId)) {
2703 remove(portletPreferences);
2704 }
2705 }
2706
2707
2715 public void removeByO_O_P(long ownerId, int ownerType, long plid)
2716 throws SystemException {
2717 for (PortletPreferences portletPreferences : findByO_O_P(ownerId,
2718 ownerType, plid)) {
2719 remove(portletPreferences);
2720 }
2721 }
2722
2723
2731 public void removeByO_P_P(int ownerType, long plid, String portletId)
2732 throws SystemException {
2733 for (PortletPreferences portletPreferences : findByO_P_P(ownerType,
2734 plid, portletId)) {
2735 remove(portletPreferences);
2736 }
2737 }
2738
2739
2749 public PortletPreferences removeByO_O_P_P(long ownerId, int ownerType,
2750 long plid, String portletId)
2751 throws NoSuchPortletPreferencesException, SystemException {
2752 PortletPreferences portletPreferences = findByO_O_P_P(ownerId,
2753 ownerType, plid, portletId);
2754
2755 return remove(portletPreferences);
2756 }
2757
2758
2763 public void removeAll() throws SystemException {
2764 for (PortletPreferences portletPreferences : findAll()) {
2765 remove(portletPreferences);
2766 }
2767 }
2768
2769
2776 public int countByPlid(long plid) throws SystemException {
2777 Object[] finderArgs = new Object[] { plid };
2778
2779 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PLID,
2780 finderArgs, this);
2781
2782 if (count == null) {
2783 StringBundler query = new StringBundler(2);
2784
2785 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2786
2787 query.append(_FINDER_COLUMN_PLID_PLID_2);
2788
2789 String sql = query.toString();
2790
2791 Session session = null;
2792
2793 try {
2794 session = openSession();
2795
2796 Query q = session.createQuery(sql);
2797
2798 QueryPos qPos = QueryPos.getInstance(q);
2799
2800 qPos.add(plid);
2801
2802 count = (Long)q.uniqueResult();
2803 }
2804 catch (Exception e) {
2805 throw processException(e);
2806 }
2807 finally {
2808 if (count == null) {
2809 count = Long.valueOf(0);
2810 }
2811
2812 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_PLID,
2813 finderArgs, count);
2814
2815 closeSession(session);
2816 }
2817 }
2818
2819 return count.intValue();
2820 }
2821
2822
2830 public int countByP_P(long plid, String portletId)
2831 throws SystemException {
2832 Object[] finderArgs = new Object[] { plid, portletId };
2833
2834 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_P,
2835 finderArgs, this);
2836
2837 if (count == null) {
2838 StringBundler query = new StringBundler(3);
2839
2840 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2841
2842 query.append(_FINDER_COLUMN_P_P_PLID_2);
2843
2844 if (portletId == null) {
2845 query.append(_FINDER_COLUMN_P_P_PORTLETID_1);
2846 }
2847 else {
2848 if (portletId.equals(StringPool.BLANK)) {
2849 query.append(_FINDER_COLUMN_P_P_PORTLETID_3);
2850 }
2851 else {
2852 query.append(_FINDER_COLUMN_P_P_PORTLETID_2);
2853 }
2854 }
2855
2856 String sql = query.toString();
2857
2858 Session session = null;
2859
2860 try {
2861 session = openSession();
2862
2863 Query q = session.createQuery(sql);
2864
2865 QueryPos qPos = QueryPos.getInstance(q);
2866
2867 qPos.add(plid);
2868
2869 if (portletId != null) {
2870 qPos.add(portletId);
2871 }
2872
2873 count = (Long)q.uniqueResult();
2874 }
2875 catch (Exception e) {
2876 throw processException(e);
2877 }
2878 finally {
2879 if (count == null) {
2880 count = Long.valueOf(0);
2881 }
2882
2883 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_P, finderArgs,
2884 count);
2885
2886 closeSession(session);
2887 }
2888 }
2889
2890 return count.intValue();
2891 }
2892
2893
2902 public int countByO_O_P(long ownerId, int ownerType, long plid)
2903 throws SystemException {
2904 Object[] finderArgs = new Object[] { ownerId, ownerType, plid };
2905
2906 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_O_O_P,
2907 finderArgs, this);
2908
2909 if (count == null) {
2910 StringBundler query = new StringBundler(4);
2911
2912 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2913
2914 query.append(_FINDER_COLUMN_O_O_P_OWNERID_2);
2915
2916 query.append(_FINDER_COLUMN_O_O_P_OWNERTYPE_2);
2917
2918 query.append(_FINDER_COLUMN_O_O_P_PLID_2);
2919
2920 String sql = query.toString();
2921
2922 Session session = null;
2923
2924 try {
2925 session = openSession();
2926
2927 Query q = session.createQuery(sql);
2928
2929 QueryPos qPos = QueryPos.getInstance(q);
2930
2931 qPos.add(ownerId);
2932
2933 qPos.add(ownerType);
2934
2935 qPos.add(plid);
2936
2937 count = (Long)q.uniqueResult();
2938 }
2939 catch (Exception e) {
2940 throw processException(e);
2941 }
2942 finally {
2943 if (count == null) {
2944 count = Long.valueOf(0);
2945 }
2946
2947 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_O_O_P,
2948 finderArgs, count);
2949
2950 closeSession(session);
2951 }
2952 }
2953
2954 return count.intValue();
2955 }
2956
2957
2966 public int countByO_P_P(int ownerType, long plid, String portletId)
2967 throws SystemException {
2968 Object[] finderArgs = new Object[] { ownerType, plid, portletId };
2969
2970 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_O_P_P,
2971 finderArgs, this);
2972
2973 if (count == null) {
2974 StringBundler query = new StringBundler(4);
2975
2976 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
2977
2978 query.append(_FINDER_COLUMN_O_P_P_OWNERTYPE_2);
2979
2980 query.append(_FINDER_COLUMN_O_P_P_PLID_2);
2981
2982 if (portletId == null) {
2983 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_1);
2984 }
2985 else {
2986 if (portletId.equals(StringPool.BLANK)) {
2987 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_3);
2988 }
2989 else {
2990 query.append(_FINDER_COLUMN_O_P_P_PORTLETID_2);
2991 }
2992 }
2993
2994 String sql = query.toString();
2995
2996 Session session = null;
2997
2998 try {
2999 session = openSession();
3000
3001 Query q = session.createQuery(sql);
3002
3003 QueryPos qPos = QueryPos.getInstance(q);
3004
3005 qPos.add(ownerType);
3006
3007 qPos.add(plid);
3008
3009 if (portletId != null) {
3010 qPos.add(portletId);
3011 }
3012
3013 count = (Long)q.uniqueResult();
3014 }
3015 catch (Exception e) {
3016 throw processException(e);
3017 }
3018 finally {
3019 if (count == null) {
3020 count = Long.valueOf(0);
3021 }
3022
3023 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_O_P_P,
3024 finderArgs, count);
3025
3026 closeSession(session);
3027 }
3028 }
3029
3030 return count.intValue();
3031 }
3032
3033
3043 public int countByO_O_P_P(long ownerId, int ownerType, long plid,
3044 String portletId) throws SystemException {
3045 Object[] finderArgs = new Object[] { ownerId, ownerType, plid, portletId };
3046
3047 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_O_O_P_P,
3048 finderArgs, this);
3049
3050 if (count == null) {
3051 StringBundler query = new StringBundler(5);
3052
3053 query.append(_SQL_COUNT_PORTLETPREFERENCES_WHERE);
3054
3055 query.append(_FINDER_COLUMN_O_O_P_P_OWNERID_2);
3056
3057 query.append(_FINDER_COLUMN_O_O_P_P_OWNERTYPE_2);
3058
3059 query.append(_FINDER_COLUMN_O_O_P_P_PLID_2);
3060
3061 if (portletId == null) {
3062 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_1);
3063 }
3064 else {
3065 if (portletId.equals(StringPool.BLANK)) {
3066 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_3);
3067 }
3068 else {
3069 query.append(_FINDER_COLUMN_O_O_P_P_PORTLETID_2);
3070 }
3071 }
3072
3073 String sql = query.toString();
3074
3075 Session session = null;
3076
3077 try {
3078 session = openSession();
3079
3080 Query q = session.createQuery(sql);
3081
3082 QueryPos qPos = QueryPos.getInstance(q);
3083
3084 qPos.add(ownerId);
3085
3086 qPos.add(ownerType);
3087
3088 qPos.add(plid);
3089
3090 if (portletId != null) {
3091 qPos.add(portletId);
3092 }
3093
3094 count = (Long)q.uniqueResult();
3095 }
3096 catch (Exception e) {
3097 throw processException(e);
3098 }
3099 finally {
3100 if (count == null) {
3101 count = Long.valueOf(0);
3102 }
3103
3104 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_O_O_P_P,
3105 finderArgs, count);
3106
3107 closeSession(session);
3108 }
3109 }
3110
3111 return count.intValue();
3112 }
3113
3114
3120 public int countAll() throws SystemException {
3121 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3122 FINDER_ARGS_EMPTY, this);
3123
3124 if (count == null) {
3125 Session session = null;
3126
3127 try {
3128 session = openSession();
3129
3130 Query q = session.createQuery(_SQL_COUNT_PORTLETPREFERENCES);
3131
3132 count = (Long)q.uniqueResult();
3133 }
3134 catch (Exception e) {
3135 throw processException(e);
3136 }
3137 finally {
3138 if (count == null) {
3139 count = Long.valueOf(0);
3140 }
3141
3142 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3143 FINDER_ARGS_EMPTY, count);
3144
3145 closeSession(session);
3146 }
3147 }
3148
3149 return count.intValue();
3150 }
3151
3152
3155 public void afterPropertiesSet() {
3156 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3157 com.liferay.portal.util.PropsUtil.get(
3158 "value.object.listener.com.liferay.portal.model.PortletPreferences")));
3159
3160 if (listenerClassNames.length > 0) {
3161 try {
3162 List<ModelListener<PortletPreferences>> listenersList = new ArrayList<ModelListener<PortletPreferences>>();
3163
3164 for (String listenerClassName : listenerClassNames) {
3165 listenersList.add((ModelListener<PortletPreferences>)InstanceFactory.newInstance(
3166 listenerClassName));
3167 }
3168
3169 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3170 }
3171 catch (Exception e) {
3172 _log.error(e);
3173 }
3174 }
3175 }
3176
3177 public void destroy() {
3178 EntityCacheUtil.removeCache(PortletPreferencesImpl.class.getName());
3179 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3180 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3181 }
3182
3183 @BeanReference(type = AccountPersistence.class)
3184 protected AccountPersistence accountPersistence;
3185 @BeanReference(type = AddressPersistence.class)
3186 protected AddressPersistence addressPersistence;
3187 @BeanReference(type = BrowserTrackerPersistence.class)
3188 protected BrowserTrackerPersistence browserTrackerPersistence;
3189 @BeanReference(type = ClassNamePersistence.class)
3190 protected ClassNamePersistence classNamePersistence;
3191 @BeanReference(type = ClusterGroupPersistence.class)
3192 protected ClusterGroupPersistence clusterGroupPersistence;
3193 @BeanReference(type = CompanyPersistence.class)
3194 protected CompanyPersistence companyPersistence;
3195 @BeanReference(type = ContactPersistence.class)
3196 protected ContactPersistence contactPersistence;
3197 @BeanReference(type = CountryPersistence.class)
3198 protected CountryPersistence countryPersistence;
3199 @BeanReference(type = EmailAddressPersistence.class)
3200 protected EmailAddressPersistence emailAddressPersistence;
3201 @BeanReference(type = GroupPersistence.class)
3202 protected GroupPersistence groupPersistence;
3203 @BeanReference(type = ImagePersistence.class)
3204 protected ImagePersistence imagePersistence;
3205 @BeanReference(type = LayoutPersistence.class)
3206 protected LayoutPersistence layoutPersistence;
3207 @BeanReference(type = LayoutBranchPersistence.class)
3208 protected LayoutBranchPersistence layoutBranchPersistence;
3209 @BeanReference(type = LayoutPrototypePersistence.class)
3210 protected LayoutPrototypePersistence layoutPrototypePersistence;
3211 @BeanReference(type = LayoutRevisionPersistence.class)
3212 protected LayoutRevisionPersistence layoutRevisionPersistence;
3213 @BeanReference(type = LayoutSetPersistence.class)
3214 protected LayoutSetPersistence layoutSetPersistence;
3215 @BeanReference(type = LayoutSetBranchPersistence.class)
3216 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
3217 @BeanReference(type = LayoutSetPrototypePersistence.class)
3218 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
3219 @BeanReference(type = ListTypePersistence.class)
3220 protected ListTypePersistence listTypePersistence;
3221 @BeanReference(type = LockPersistence.class)
3222 protected LockPersistence lockPersistence;
3223 @BeanReference(type = MembershipRequestPersistence.class)
3224 protected MembershipRequestPersistence membershipRequestPersistence;
3225 @BeanReference(type = OrganizationPersistence.class)
3226 protected OrganizationPersistence organizationPersistence;
3227 @BeanReference(type = OrgGroupPermissionPersistence.class)
3228 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
3229 @BeanReference(type = OrgGroupRolePersistence.class)
3230 protected OrgGroupRolePersistence orgGroupRolePersistence;
3231 @BeanReference(type = OrgLaborPersistence.class)
3232 protected OrgLaborPersistence orgLaborPersistence;
3233 @BeanReference(type = PasswordPolicyPersistence.class)
3234 protected PasswordPolicyPersistence passwordPolicyPersistence;
3235 @BeanReference(type = PasswordPolicyRelPersistence.class)
3236 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
3237 @BeanReference(type = PasswordTrackerPersistence.class)
3238 protected PasswordTrackerPersistence passwordTrackerPersistence;
3239 @BeanReference(type = PermissionPersistence.class)
3240 protected PermissionPersistence permissionPersistence;
3241 @BeanReference(type = PhonePersistence.class)
3242 protected PhonePersistence phonePersistence;
3243 @BeanReference(type = PluginSettingPersistence.class)
3244 protected PluginSettingPersistence pluginSettingPersistence;
3245 @BeanReference(type = PortalPreferencesPersistence.class)
3246 protected PortalPreferencesPersistence portalPreferencesPersistence;
3247 @BeanReference(type = PortletPersistence.class)
3248 protected PortletPersistence portletPersistence;
3249 @BeanReference(type = PortletItemPersistence.class)
3250 protected PortletItemPersistence portletItemPersistence;
3251 @BeanReference(type = PortletPreferencesPersistence.class)
3252 protected PortletPreferencesPersistence portletPreferencesPersistence;
3253 @BeanReference(type = RegionPersistence.class)
3254 protected RegionPersistence regionPersistence;
3255 @BeanReference(type = ReleasePersistence.class)
3256 protected ReleasePersistence releasePersistence;
3257 @BeanReference(type = RepositoryPersistence.class)
3258 protected RepositoryPersistence repositoryPersistence;
3259 @BeanReference(type = RepositoryEntryPersistence.class)
3260 protected RepositoryEntryPersistence repositoryEntryPersistence;
3261 @BeanReference(type = ResourcePersistence.class)
3262 protected ResourcePersistence resourcePersistence;
3263 @BeanReference(type = ResourceActionPersistence.class)
3264 protected ResourceActionPersistence resourceActionPersistence;
3265 @BeanReference(type = ResourceBlockPersistence.class)
3266 protected ResourceBlockPersistence resourceBlockPersistence;
3267 @BeanReference(type = ResourceBlockPermissionPersistence.class)
3268 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
3269 @BeanReference(type = ResourceCodePersistence.class)
3270 protected ResourceCodePersistence resourceCodePersistence;
3271 @BeanReference(type = ResourcePermissionPersistence.class)
3272 protected ResourcePermissionPersistence resourcePermissionPersistence;
3273 @BeanReference(type = ResourceTypePermissionPersistence.class)
3274 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
3275 @BeanReference(type = RolePersistence.class)
3276 protected RolePersistence rolePersistence;
3277 @BeanReference(type = ServiceComponentPersistence.class)
3278 protected ServiceComponentPersistence serviceComponentPersistence;
3279 @BeanReference(type = ShardPersistence.class)
3280 protected ShardPersistence shardPersistence;
3281 @BeanReference(type = SubscriptionPersistence.class)
3282 protected SubscriptionPersistence subscriptionPersistence;
3283 @BeanReference(type = TeamPersistence.class)
3284 protected TeamPersistence teamPersistence;
3285 @BeanReference(type = TicketPersistence.class)
3286 protected TicketPersistence ticketPersistence;
3287 @BeanReference(type = UserPersistence.class)
3288 protected UserPersistence userPersistence;
3289 @BeanReference(type = UserGroupPersistence.class)
3290 protected UserGroupPersistence userGroupPersistence;
3291 @BeanReference(type = UserGroupGroupRolePersistence.class)
3292 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
3293 @BeanReference(type = UserGroupRolePersistence.class)
3294 protected UserGroupRolePersistence userGroupRolePersistence;
3295 @BeanReference(type = UserIdMapperPersistence.class)
3296 protected UserIdMapperPersistence userIdMapperPersistence;
3297 @BeanReference(type = UserNotificationEventPersistence.class)
3298 protected UserNotificationEventPersistence userNotificationEventPersistence;
3299 @BeanReference(type = UserTrackerPersistence.class)
3300 protected UserTrackerPersistence userTrackerPersistence;
3301 @BeanReference(type = UserTrackerPathPersistence.class)
3302 protected UserTrackerPathPersistence userTrackerPathPersistence;
3303 @BeanReference(type = VirtualHostPersistence.class)
3304 protected VirtualHostPersistence virtualHostPersistence;
3305 @BeanReference(type = WebDAVPropsPersistence.class)
3306 protected WebDAVPropsPersistence webDAVPropsPersistence;
3307 @BeanReference(type = WebsitePersistence.class)
3308 protected WebsitePersistence websitePersistence;
3309 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
3310 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
3311 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
3312 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
3313 private static final String _SQL_SELECT_PORTLETPREFERENCES = "SELECT portletPreferences FROM PortletPreferences portletPreferences";
3314 private static final String _SQL_SELECT_PORTLETPREFERENCES_WHERE = "SELECT portletPreferences FROM PortletPreferences portletPreferences WHERE ";
3315 private static final String _SQL_COUNT_PORTLETPREFERENCES = "SELECT COUNT(portletPreferences) FROM PortletPreferences portletPreferences";
3316 private static final String _SQL_COUNT_PORTLETPREFERENCES_WHERE = "SELECT COUNT(portletPreferences) FROM PortletPreferences portletPreferences WHERE ";
3317 private static final String _FINDER_COLUMN_PLID_PLID_2 = "portletPreferences.plid = ?";
3318 private static final String _FINDER_COLUMN_P_P_PLID_2 = "portletPreferences.plid = ? AND ";
3319 private static final String _FINDER_COLUMN_P_P_PORTLETID_1 = "portletPreferences.portletId IS NULL";
3320 private static final String _FINDER_COLUMN_P_P_PORTLETID_2 = "portletPreferences.portletId = ?";
3321 private static final String _FINDER_COLUMN_P_P_PORTLETID_3 = "(portletPreferences.portletId IS NULL OR portletPreferences.portletId = ?)";
3322 private static final String _FINDER_COLUMN_O_O_P_OWNERID_2 = "portletPreferences.ownerId = ? AND ";
3323 private static final String _FINDER_COLUMN_O_O_P_OWNERTYPE_2 = "portletPreferences.ownerType = ? AND ";
3324 private static final String _FINDER_COLUMN_O_O_P_PLID_2 = "portletPreferences.plid = ?";
3325 private static final String _FINDER_COLUMN_O_P_P_OWNERTYPE_2 = "portletPreferences.ownerType = ? AND ";
3326 private static final String _FINDER_COLUMN_O_P_P_PLID_2 = "portletPreferences.plid = ? AND ";
3327 private static final String _FINDER_COLUMN_O_P_P_PORTLETID_1 = "portletPreferences.portletId IS NULL";
3328 private static final String _FINDER_COLUMN_O_P_P_PORTLETID_2 = "portletPreferences.portletId = ?";
3329 private static final String _FINDER_COLUMN_O_P_P_PORTLETID_3 = "(portletPreferences.portletId IS NULL OR portletPreferences.portletId = ?)";
3330 private static final String _FINDER_COLUMN_O_O_P_P_OWNERID_2 = "portletPreferences.ownerId = ? AND ";
3331 private static final String _FINDER_COLUMN_O_O_P_P_OWNERTYPE_2 = "portletPreferences.ownerType = ? AND ";
3332 private static final String _FINDER_COLUMN_O_O_P_P_PLID_2 = "portletPreferences.plid = ? AND ";
3333 private static final String _FINDER_COLUMN_O_O_P_P_PORTLETID_1 = "portletPreferences.portletId IS NULL";
3334 private static final String _FINDER_COLUMN_O_O_P_P_PORTLETID_2 = "portletPreferences.portletId = ?";
3335 private static final String _FINDER_COLUMN_O_O_P_P_PORTLETID_3 = "(portletPreferences.portletId IS NULL OR portletPreferences.portletId = ?)";
3336 private static final String _ORDER_BY_ENTITY_ALIAS = "portletPreferences.";
3337 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PortletPreferences exists with the primary key ";
3338 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PortletPreferences exists with the key {";
3339 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3340 private static Log _log = LogFactoryUtil.getLog(PortletPreferencesPersistenceImpl.class);
3341 private static PortletPreferences _nullPortletPreferences = new PortletPreferencesImpl() {
3342 @Override
3343 public Object clone() {
3344 return this;
3345 }
3346
3347 @Override
3348 public CacheModel<PortletPreferences> toCacheModel() {
3349 return _nullPortletPreferencesCacheModel;
3350 }
3351 };
3352
3353 private static CacheModel<PortletPreferences> _nullPortletPreferencesCacheModel =
3354 new CacheModel<PortletPreferences>() {
3355 public PortletPreferences toEntityModel() {
3356 return _nullPortletPreferences;
3357 }
3358 };
3359 }