001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.NoSuchPreferencesException;
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.PortalPreferences;
040 import com.liferay.portal.model.impl.PortalPreferencesImpl;
041 import com.liferay.portal.model.impl.PortalPreferencesModelImpl;
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 PortalPreferencesPersistenceImpl extends BasePersistenceImpl<PortalPreferences>
063 implements PortalPreferencesPersistence {
064
069 public static final String FINDER_CLASS_NAME_ENTITY = PortalPreferencesImpl.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_FETCH_BY_O_O = new FinderPath(PortalPreferencesModelImpl.ENTITY_CACHE_ENABLED,
075 PortalPreferencesModelImpl.FINDER_CACHE_ENABLED,
076 PortalPreferencesImpl.class, FINDER_CLASS_NAME_ENTITY,
077 "fetchByO_O",
078 new String[] { Long.class.getName(), Integer.class.getName() },
079 PortalPreferencesModelImpl.OWNERID_COLUMN_BITMASK |
080 PortalPreferencesModelImpl.OWNERTYPE_COLUMN_BITMASK);
081 public static final FinderPath FINDER_PATH_COUNT_BY_O_O = new FinderPath(PortalPreferencesModelImpl.ENTITY_CACHE_ENABLED,
082 PortalPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
083 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByO_O",
084 new String[] { Long.class.getName(), Integer.class.getName() });
085 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(PortalPreferencesModelImpl.ENTITY_CACHE_ENABLED,
086 PortalPreferencesModelImpl.FINDER_CACHE_ENABLED,
087 PortalPreferencesImpl.class,
088 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
089 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(PortalPreferencesModelImpl.ENTITY_CACHE_ENABLED,
090 PortalPreferencesModelImpl.FINDER_CACHE_ENABLED,
091 PortalPreferencesImpl.class,
092 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
093 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PortalPreferencesModelImpl.ENTITY_CACHE_ENABLED,
094 PortalPreferencesModelImpl.FINDER_CACHE_ENABLED, Long.class,
095 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
096
097
102 public void cacheResult(PortalPreferences portalPreferences) {
103 EntityCacheUtil.putResult(PortalPreferencesModelImpl.ENTITY_CACHE_ENABLED,
104 PortalPreferencesImpl.class, portalPreferences.getPrimaryKey(),
105 portalPreferences);
106
107 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O,
108 new Object[] {
109 Long.valueOf(portalPreferences.getOwnerId()),
110 Integer.valueOf(portalPreferences.getOwnerType())
111 }, portalPreferences);
112
113 portalPreferences.resetOriginalValues();
114 }
115
116
121 public void cacheResult(List<PortalPreferences> portalPreferenceses) {
122 for (PortalPreferences portalPreferences : portalPreferenceses) {
123 if (EntityCacheUtil.getResult(
124 PortalPreferencesModelImpl.ENTITY_CACHE_ENABLED,
125 PortalPreferencesImpl.class,
126 portalPreferences.getPrimaryKey()) == null) {
127 cacheResult(portalPreferences);
128 }
129 else {
130 portalPreferences.resetOriginalValues();
131 }
132 }
133 }
134
135
142 @Override
143 public void clearCache() {
144 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
145 CacheRegistryUtil.clear(PortalPreferencesImpl.class.getName());
146 }
147
148 EntityCacheUtil.clearCache(PortalPreferencesImpl.class.getName());
149
150 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
151 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
152 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
153 }
154
155
162 @Override
163 public void clearCache(PortalPreferences portalPreferences) {
164 EntityCacheUtil.removeResult(PortalPreferencesModelImpl.ENTITY_CACHE_ENABLED,
165 PortalPreferencesImpl.class, portalPreferences.getPrimaryKey());
166
167 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
168 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
169
170 clearUniqueFindersCache(portalPreferences);
171 }
172
173 @Override
174 public void clearCache(List<PortalPreferences> portalPreferenceses) {
175 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
176 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
177
178 for (PortalPreferences portalPreferences : portalPreferenceses) {
179 EntityCacheUtil.removeResult(PortalPreferencesModelImpl.ENTITY_CACHE_ENABLED,
180 PortalPreferencesImpl.class, portalPreferences.getPrimaryKey());
181
182 clearUniqueFindersCache(portalPreferences);
183 }
184 }
185
186 protected void clearUniqueFindersCache(PortalPreferences portalPreferences) {
187 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O,
188 new Object[] {
189 Long.valueOf(portalPreferences.getOwnerId()),
190 Integer.valueOf(portalPreferences.getOwnerType())
191 });
192 }
193
194
200 public PortalPreferences create(long portalPreferencesId) {
201 PortalPreferences portalPreferences = new PortalPreferencesImpl();
202
203 portalPreferences.setNew(true);
204 portalPreferences.setPrimaryKey(portalPreferencesId);
205
206 return portalPreferences;
207 }
208
209
217 public PortalPreferences remove(long portalPreferencesId)
218 throws NoSuchPreferencesException, SystemException {
219 return remove(Long.valueOf(portalPreferencesId));
220 }
221
222
230 @Override
231 public PortalPreferences remove(Serializable primaryKey)
232 throws NoSuchPreferencesException, SystemException {
233 Session session = null;
234
235 try {
236 session = openSession();
237
238 PortalPreferences portalPreferences = (PortalPreferences)session.get(PortalPreferencesImpl.class,
239 primaryKey);
240
241 if (portalPreferences == null) {
242 if (_log.isWarnEnabled()) {
243 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
244 }
245
246 throw new NoSuchPreferencesException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
247 primaryKey);
248 }
249
250 return remove(portalPreferences);
251 }
252 catch (NoSuchPreferencesException nsee) {
253 throw nsee;
254 }
255 catch (Exception e) {
256 throw processException(e);
257 }
258 finally {
259 closeSession(session);
260 }
261 }
262
263 @Override
264 protected PortalPreferences removeImpl(PortalPreferences portalPreferences)
265 throws SystemException {
266 portalPreferences = toUnwrappedModel(portalPreferences);
267
268 Session session = null;
269
270 try {
271 session = openSession();
272
273 BatchSessionUtil.delete(session, portalPreferences);
274 }
275 catch (Exception e) {
276 throw processException(e);
277 }
278 finally {
279 closeSession(session);
280 }
281
282 clearCache(portalPreferences);
283
284 return portalPreferences;
285 }
286
287 @Override
288 public PortalPreferences updateImpl(
289 com.liferay.portal.model.PortalPreferences portalPreferences,
290 boolean merge) throws SystemException {
291 portalPreferences = toUnwrappedModel(portalPreferences);
292
293 boolean isNew = portalPreferences.isNew();
294
295 PortalPreferencesModelImpl portalPreferencesModelImpl = (PortalPreferencesModelImpl)portalPreferences;
296
297 Session session = null;
298
299 try {
300 session = openSession();
301
302 BatchSessionUtil.update(session, portalPreferences, merge);
303
304 portalPreferences.setNew(false);
305 }
306 catch (Exception e) {
307 throw processException(e);
308 }
309 finally {
310 closeSession(session);
311 }
312
313 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
314
315 if (isNew || !PortalPreferencesModelImpl.COLUMN_BITMASK_ENABLED) {
316 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
317 }
318
319 EntityCacheUtil.putResult(PortalPreferencesModelImpl.ENTITY_CACHE_ENABLED,
320 PortalPreferencesImpl.class, portalPreferences.getPrimaryKey(),
321 portalPreferences);
322
323 if (isNew) {
324 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O,
325 new Object[] {
326 Long.valueOf(portalPreferences.getOwnerId()),
327 Integer.valueOf(portalPreferences.getOwnerType())
328 }, portalPreferences);
329 }
330 else {
331 if ((portalPreferencesModelImpl.getColumnBitmask() &
332 FINDER_PATH_FETCH_BY_O_O.getColumnBitmask()) != 0) {
333 Object[] args = new Object[] {
334 Long.valueOf(portalPreferencesModelImpl.getOriginalOwnerId()),
335 Integer.valueOf(portalPreferencesModelImpl.getOriginalOwnerType())
336 };
337
338 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_O, args);
339
340 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O, args);
341
342 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O,
343 new Object[] {
344 Long.valueOf(portalPreferences.getOwnerId()),
345 Integer.valueOf(portalPreferences.getOwnerType())
346 }, portalPreferences);
347 }
348 }
349
350 return portalPreferences;
351 }
352
353 protected PortalPreferences toUnwrappedModel(
354 PortalPreferences portalPreferences) {
355 if (portalPreferences instanceof PortalPreferencesImpl) {
356 return portalPreferences;
357 }
358
359 PortalPreferencesImpl portalPreferencesImpl = new PortalPreferencesImpl();
360
361 portalPreferencesImpl.setNew(portalPreferences.isNew());
362 portalPreferencesImpl.setPrimaryKey(portalPreferences.getPrimaryKey());
363
364 portalPreferencesImpl.setPortalPreferencesId(portalPreferences.getPortalPreferencesId());
365 portalPreferencesImpl.setOwnerId(portalPreferences.getOwnerId());
366 portalPreferencesImpl.setOwnerType(portalPreferences.getOwnerType());
367 portalPreferencesImpl.setPreferences(portalPreferences.getPreferences());
368
369 return portalPreferencesImpl;
370 }
371
372
380 @Override
381 public PortalPreferences findByPrimaryKey(Serializable primaryKey)
382 throws NoSuchModelException, SystemException {
383 return findByPrimaryKey(((Long)primaryKey).longValue());
384 }
385
386
394 public PortalPreferences findByPrimaryKey(long portalPreferencesId)
395 throws NoSuchPreferencesException, SystemException {
396 PortalPreferences portalPreferences = fetchByPrimaryKey(portalPreferencesId);
397
398 if (portalPreferences == null) {
399 if (_log.isWarnEnabled()) {
400 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
401 portalPreferencesId);
402 }
403
404 throw new NoSuchPreferencesException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
405 portalPreferencesId);
406 }
407
408 return portalPreferences;
409 }
410
411
418 @Override
419 public PortalPreferences fetchByPrimaryKey(Serializable primaryKey)
420 throws SystemException {
421 return fetchByPrimaryKey(((Long)primaryKey).longValue());
422 }
423
424
431 public PortalPreferences fetchByPrimaryKey(long portalPreferencesId)
432 throws SystemException {
433 PortalPreferences portalPreferences = (PortalPreferences)EntityCacheUtil.getResult(PortalPreferencesModelImpl.ENTITY_CACHE_ENABLED,
434 PortalPreferencesImpl.class, portalPreferencesId);
435
436 if (portalPreferences == _nullPortalPreferences) {
437 return null;
438 }
439
440 if (portalPreferences == null) {
441 Session session = null;
442
443 boolean hasException = false;
444
445 try {
446 session = openSession();
447
448 portalPreferences = (PortalPreferences)session.get(PortalPreferencesImpl.class,
449 Long.valueOf(portalPreferencesId));
450 }
451 catch (Exception e) {
452 hasException = true;
453
454 throw processException(e);
455 }
456 finally {
457 if (portalPreferences != null) {
458 cacheResult(portalPreferences);
459 }
460 else if (!hasException) {
461 EntityCacheUtil.putResult(PortalPreferencesModelImpl.ENTITY_CACHE_ENABLED,
462 PortalPreferencesImpl.class, portalPreferencesId,
463 _nullPortalPreferences);
464 }
465
466 closeSession(session);
467 }
468 }
469
470 return portalPreferences;
471 }
472
473
482 public PortalPreferences findByO_O(long ownerId, int ownerType)
483 throws NoSuchPreferencesException, SystemException {
484 PortalPreferences portalPreferences = fetchByO_O(ownerId, ownerType);
485
486 if (portalPreferences == null) {
487 StringBundler msg = new StringBundler(6);
488
489 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
490
491 msg.append("ownerId=");
492 msg.append(ownerId);
493
494 msg.append(", ownerType=");
495 msg.append(ownerType);
496
497 msg.append(StringPool.CLOSE_CURLY_BRACE);
498
499 if (_log.isWarnEnabled()) {
500 _log.warn(msg.toString());
501 }
502
503 throw new NoSuchPreferencesException(msg.toString());
504 }
505
506 return portalPreferences;
507 }
508
509
517 public PortalPreferences fetchByO_O(long ownerId, int ownerType)
518 throws SystemException {
519 return fetchByO_O(ownerId, ownerType, true);
520 }
521
522
531 public PortalPreferences fetchByO_O(long ownerId, int ownerType,
532 boolean retrieveFromCache) throws SystemException {
533 Object[] finderArgs = new Object[] { ownerId, ownerType };
534
535 Object result = null;
536
537 if (retrieveFromCache) {
538 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_O_O,
539 finderArgs, this);
540 }
541
542 if (result instanceof PortalPreferences) {
543 PortalPreferences portalPreferences = (PortalPreferences)result;
544
545 if ((ownerId != portalPreferences.getOwnerId()) ||
546 (ownerType != portalPreferences.getOwnerType())) {
547 result = null;
548 }
549 }
550
551 if (result == null) {
552 StringBundler query = new StringBundler(3);
553
554 query.append(_SQL_SELECT_PORTALPREFERENCES_WHERE);
555
556 query.append(_FINDER_COLUMN_O_O_OWNERID_2);
557
558 query.append(_FINDER_COLUMN_O_O_OWNERTYPE_2);
559
560 String sql = query.toString();
561
562 Session session = null;
563
564 try {
565 session = openSession();
566
567 Query q = session.createQuery(sql);
568
569 QueryPos qPos = QueryPos.getInstance(q);
570
571 qPos.add(ownerId);
572
573 qPos.add(ownerType);
574
575 List<PortalPreferences> list = q.list();
576
577 result = list;
578
579 PortalPreferences portalPreferences = null;
580
581 if (list.isEmpty()) {
582 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O,
583 finderArgs, list);
584 }
585 else {
586 portalPreferences = list.get(0);
587
588 cacheResult(portalPreferences);
589
590 if ((portalPreferences.getOwnerId() != ownerId) ||
591 (portalPreferences.getOwnerType() != ownerType)) {
592 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O,
593 finderArgs, portalPreferences);
594 }
595 }
596
597 return portalPreferences;
598 }
599 catch (Exception e) {
600 throw processException(e);
601 }
602 finally {
603 if (result == null) {
604 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O,
605 finderArgs);
606 }
607
608 closeSession(session);
609 }
610 }
611 else {
612 if (result instanceof List<?>) {
613 return null;
614 }
615 else {
616 return (PortalPreferences)result;
617 }
618 }
619 }
620
621
627 public List<PortalPreferences> findAll() throws SystemException {
628 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
629 }
630
631
643 public List<PortalPreferences> findAll(int start, int end)
644 throws SystemException {
645 return findAll(start, end, null);
646 }
647
648
661 public List<PortalPreferences> findAll(int start, int end,
662 OrderByComparator orderByComparator) throws SystemException {
663 FinderPath finderPath = null;
664 Object[] finderArgs = new Object[] { start, end, orderByComparator };
665
666 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
667 (orderByComparator == null)) {
668 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
669 finderArgs = FINDER_ARGS_EMPTY;
670 }
671 else {
672 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
673 finderArgs = new Object[] { start, end, orderByComparator };
674 }
675
676 List<PortalPreferences> list = (List<PortalPreferences>)FinderCacheUtil.getResult(finderPath,
677 finderArgs, this);
678
679 if (list == null) {
680 StringBundler query = null;
681 String sql = null;
682
683 if (orderByComparator != null) {
684 query = new StringBundler(2 +
685 (orderByComparator.getOrderByFields().length * 3));
686
687 query.append(_SQL_SELECT_PORTALPREFERENCES);
688
689 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
690 orderByComparator);
691
692 sql = query.toString();
693 }
694 else {
695 sql = _SQL_SELECT_PORTALPREFERENCES;
696 }
697
698 Session session = null;
699
700 try {
701 session = openSession();
702
703 Query q = session.createQuery(sql);
704
705 if (orderByComparator == null) {
706 list = (List<PortalPreferences>)QueryUtil.list(q,
707 getDialect(), start, end, false);
708
709 Collections.sort(list);
710 }
711 else {
712 list = (List<PortalPreferences>)QueryUtil.list(q,
713 getDialect(), start, end);
714 }
715 }
716 catch (Exception e) {
717 throw processException(e);
718 }
719 finally {
720 if (list == null) {
721 FinderCacheUtil.removeResult(finderPath, finderArgs);
722 }
723 else {
724 cacheResult(list);
725
726 FinderCacheUtil.putResult(finderPath, finderArgs, list);
727 }
728
729 closeSession(session);
730 }
731 }
732
733 return list;
734 }
735
736
744 public PortalPreferences removeByO_O(long ownerId, int ownerType)
745 throws NoSuchPreferencesException, SystemException {
746 PortalPreferences portalPreferences = findByO_O(ownerId, ownerType);
747
748 return remove(portalPreferences);
749 }
750
751
756 public void removeAll() throws SystemException {
757 for (PortalPreferences portalPreferences : findAll()) {
758 remove(portalPreferences);
759 }
760 }
761
762
770 public int countByO_O(long ownerId, int ownerType)
771 throws SystemException {
772 Object[] finderArgs = new Object[] { ownerId, ownerType };
773
774 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_O_O,
775 finderArgs, this);
776
777 if (count == null) {
778 StringBundler query = new StringBundler(3);
779
780 query.append(_SQL_COUNT_PORTALPREFERENCES_WHERE);
781
782 query.append(_FINDER_COLUMN_O_O_OWNERID_2);
783
784 query.append(_FINDER_COLUMN_O_O_OWNERTYPE_2);
785
786 String sql = query.toString();
787
788 Session session = null;
789
790 try {
791 session = openSession();
792
793 Query q = session.createQuery(sql);
794
795 QueryPos qPos = QueryPos.getInstance(q);
796
797 qPos.add(ownerId);
798
799 qPos.add(ownerType);
800
801 count = (Long)q.uniqueResult();
802 }
803 catch (Exception e) {
804 throw processException(e);
805 }
806 finally {
807 if (count == null) {
808 count = Long.valueOf(0);
809 }
810
811 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_O_O, finderArgs,
812 count);
813
814 closeSession(session);
815 }
816 }
817
818 return count.intValue();
819 }
820
821
827 public int countAll() throws SystemException {
828 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
829 FINDER_ARGS_EMPTY, this);
830
831 if (count == null) {
832 Session session = null;
833
834 try {
835 session = openSession();
836
837 Query q = session.createQuery(_SQL_COUNT_PORTALPREFERENCES);
838
839 count = (Long)q.uniqueResult();
840 }
841 catch (Exception e) {
842 throw processException(e);
843 }
844 finally {
845 if (count == null) {
846 count = Long.valueOf(0);
847 }
848
849 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
850 FINDER_ARGS_EMPTY, count);
851
852 closeSession(session);
853 }
854 }
855
856 return count.intValue();
857 }
858
859
862 public void afterPropertiesSet() {
863 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
864 com.liferay.portal.util.PropsUtil.get(
865 "value.object.listener.com.liferay.portal.model.PortalPreferences")));
866
867 if (listenerClassNames.length > 0) {
868 try {
869 List<ModelListener<PortalPreferences>> listenersList = new ArrayList<ModelListener<PortalPreferences>>();
870
871 for (String listenerClassName : listenerClassNames) {
872 listenersList.add((ModelListener<PortalPreferences>)InstanceFactory.newInstance(
873 listenerClassName));
874 }
875
876 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
877 }
878 catch (Exception e) {
879 _log.error(e);
880 }
881 }
882 }
883
884 public void destroy() {
885 EntityCacheUtil.removeCache(PortalPreferencesImpl.class.getName());
886 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
887 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
888 }
889
890 @BeanReference(type = AccountPersistence.class)
891 protected AccountPersistence accountPersistence;
892 @BeanReference(type = AddressPersistence.class)
893 protected AddressPersistence addressPersistence;
894 @BeanReference(type = BrowserTrackerPersistence.class)
895 protected BrowserTrackerPersistence browserTrackerPersistence;
896 @BeanReference(type = ClassNamePersistence.class)
897 protected ClassNamePersistence classNamePersistence;
898 @BeanReference(type = ClusterGroupPersistence.class)
899 protected ClusterGroupPersistence clusterGroupPersistence;
900 @BeanReference(type = CompanyPersistence.class)
901 protected CompanyPersistence companyPersistence;
902 @BeanReference(type = ContactPersistence.class)
903 protected ContactPersistence contactPersistence;
904 @BeanReference(type = CountryPersistence.class)
905 protected CountryPersistence countryPersistence;
906 @BeanReference(type = EmailAddressPersistence.class)
907 protected EmailAddressPersistence emailAddressPersistence;
908 @BeanReference(type = GroupPersistence.class)
909 protected GroupPersistence groupPersistence;
910 @BeanReference(type = ImagePersistence.class)
911 protected ImagePersistence imagePersistence;
912 @BeanReference(type = LayoutPersistence.class)
913 protected LayoutPersistence layoutPersistence;
914 @BeanReference(type = LayoutBranchPersistence.class)
915 protected LayoutBranchPersistence layoutBranchPersistence;
916 @BeanReference(type = LayoutPrototypePersistence.class)
917 protected LayoutPrototypePersistence layoutPrototypePersistence;
918 @BeanReference(type = LayoutRevisionPersistence.class)
919 protected LayoutRevisionPersistence layoutRevisionPersistence;
920 @BeanReference(type = LayoutSetPersistence.class)
921 protected LayoutSetPersistence layoutSetPersistence;
922 @BeanReference(type = LayoutSetBranchPersistence.class)
923 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
924 @BeanReference(type = LayoutSetPrototypePersistence.class)
925 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
926 @BeanReference(type = ListTypePersistence.class)
927 protected ListTypePersistence listTypePersistence;
928 @BeanReference(type = LockPersistence.class)
929 protected LockPersistence lockPersistence;
930 @BeanReference(type = MembershipRequestPersistence.class)
931 protected MembershipRequestPersistence membershipRequestPersistence;
932 @BeanReference(type = OrganizationPersistence.class)
933 protected OrganizationPersistence organizationPersistence;
934 @BeanReference(type = OrgGroupPermissionPersistence.class)
935 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
936 @BeanReference(type = OrgGroupRolePersistence.class)
937 protected OrgGroupRolePersistence orgGroupRolePersistence;
938 @BeanReference(type = OrgLaborPersistence.class)
939 protected OrgLaborPersistence orgLaborPersistence;
940 @BeanReference(type = PasswordPolicyPersistence.class)
941 protected PasswordPolicyPersistence passwordPolicyPersistence;
942 @BeanReference(type = PasswordPolicyRelPersistence.class)
943 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
944 @BeanReference(type = PasswordTrackerPersistence.class)
945 protected PasswordTrackerPersistence passwordTrackerPersistence;
946 @BeanReference(type = PermissionPersistence.class)
947 protected PermissionPersistence permissionPersistence;
948 @BeanReference(type = PhonePersistence.class)
949 protected PhonePersistence phonePersistence;
950 @BeanReference(type = PluginSettingPersistence.class)
951 protected PluginSettingPersistence pluginSettingPersistence;
952 @BeanReference(type = PortalPreferencesPersistence.class)
953 protected PortalPreferencesPersistence portalPreferencesPersistence;
954 @BeanReference(type = PortletPersistence.class)
955 protected PortletPersistence portletPersistence;
956 @BeanReference(type = PortletItemPersistence.class)
957 protected PortletItemPersistence portletItemPersistence;
958 @BeanReference(type = PortletPreferencesPersistence.class)
959 protected PortletPreferencesPersistence portletPreferencesPersistence;
960 @BeanReference(type = RegionPersistence.class)
961 protected RegionPersistence regionPersistence;
962 @BeanReference(type = ReleasePersistence.class)
963 protected ReleasePersistence releasePersistence;
964 @BeanReference(type = RepositoryPersistence.class)
965 protected RepositoryPersistence repositoryPersistence;
966 @BeanReference(type = RepositoryEntryPersistence.class)
967 protected RepositoryEntryPersistence repositoryEntryPersistence;
968 @BeanReference(type = ResourcePersistence.class)
969 protected ResourcePersistence resourcePersistence;
970 @BeanReference(type = ResourceActionPersistence.class)
971 protected ResourceActionPersistence resourceActionPersistence;
972 @BeanReference(type = ResourceBlockPersistence.class)
973 protected ResourceBlockPersistence resourceBlockPersistence;
974 @BeanReference(type = ResourceBlockPermissionPersistence.class)
975 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
976 @BeanReference(type = ResourceCodePersistence.class)
977 protected ResourceCodePersistence resourceCodePersistence;
978 @BeanReference(type = ResourcePermissionPersistence.class)
979 protected ResourcePermissionPersistence resourcePermissionPersistence;
980 @BeanReference(type = ResourceTypePermissionPersistence.class)
981 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
982 @BeanReference(type = RolePersistence.class)
983 protected RolePersistence rolePersistence;
984 @BeanReference(type = ServiceComponentPersistence.class)
985 protected ServiceComponentPersistence serviceComponentPersistence;
986 @BeanReference(type = ShardPersistence.class)
987 protected ShardPersistence shardPersistence;
988 @BeanReference(type = SubscriptionPersistence.class)
989 protected SubscriptionPersistence subscriptionPersistence;
990 @BeanReference(type = TeamPersistence.class)
991 protected TeamPersistence teamPersistence;
992 @BeanReference(type = TicketPersistence.class)
993 protected TicketPersistence ticketPersistence;
994 @BeanReference(type = UserPersistence.class)
995 protected UserPersistence userPersistence;
996 @BeanReference(type = UserGroupPersistence.class)
997 protected UserGroupPersistence userGroupPersistence;
998 @BeanReference(type = UserGroupGroupRolePersistence.class)
999 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1000 @BeanReference(type = UserGroupRolePersistence.class)
1001 protected UserGroupRolePersistence userGroupRolePersistence;
1002 @BeanReference(type = UserIdMapperPersistence.class)
1003 protected UserIdMapperPersistence userIdMapperPersistence;
1004 @BeanReference(type = UserNotificationEventPersistence.class)
1005 protected UserNotificationEventPersistence userNotificationEventPersistence;
1006 @BeanReference(type = UserTrackerPersistence.class)
1007 protected UserTrackerPersistence userTrackerPersistence;
1008 @BeanReference(type = UserTrackerPathPersistence.class)
1009 protected UserTrackerPathPersistence userTrackerPathPersistence;
1010 @BeanReference(type = VirtualHostPersistence.class)
1011 protected VirtualHostPersistence virtualHostPersistence;
1012 @BeanReference(type = WebDAVPropsPersistence.class)
1013 protected WebDAVPropsPersistence webDAVPropsPersistence;
1014 @BeanReference(type = WebsitePersistence.class)
1015 protected WebsitePersistence websitePersistence;
1016 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1017 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1018 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1019 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1020 private static final String _SQL_SELECT_PORTALPREFERENCES = "SELECT portalPreferences FROM PortalPreferences portalPreferences";
1021 private static final String _SQL_SELECT_PORTALPREFERENCES_WHERE = "SELECT portalPreferences FROM PortalPreferences portalPreferences WHERE ";
1022 private static final String _SQL_COUNT_PORTALPREFERENCES = "SELECT COUNT(portalPreferences) FROM PortalPreferences portalPreferences";
1023 private static final String _SQL_COUNT_PORTALPREFERENCES_WHERE = "SELECT COUNT(portalPreferences) FROM PortalPreferences portalPreferences WHERE ";
1024 private static final String _FINDER_COLUMN_O_O_OWNERID_2 = "portalPreferences.ownerId = ? AND ";
1025 private static final String _FINDER_COLUMN_O_O_OWNERTYPE_2 = "portalPreferences.ownerType = ?";
1026 private static final String _ORDER_BY_ENTITY_ALIAS = "portalPreferences.";
1027 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PortalPreferences exists with the primary key ";
1028 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PortalPreferences exists with the key {";
1029 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1030 private static Log _log = LogFactoryUtil.getLog(PortalPreferencesPersistenceImpl.class);
1031 private static PortalPreferences _nullPortalPreferences = new PortalPreferencesImpl() {
1032 @Override
1033 public Object clone() {
1034 return this;
1035 }
1036
1037 @Override
1038 public CacheModel<PortalPreferences> toCacheModel() {
1039 return _nullPortalPreferencesCacheModel;
1040 }
1041 };
1042
1043 private static CacheModel<PortalPreferences> _nullPortalPreferencesCacheModel =
1044 new CacheModel<PortalPreferences>() {
1045 public PortalPreferences toEntityModel() {
1046 return _nullPortalPreferences;
1047 }
1048 };
1049 }