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 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O, args);
340
341 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O,
342 new Object[] {
343 Long.valueOf(portalPreferences.getOwnerId()),
344 Integer.valueOf(portalPreferences.getOwnerType())
345 }, portalPreferences);
346 }
347 }
348
349 return portalPreferences;
350 }
351
352 protected PortalPreferences toUnwrappedModel(
353 PortalPreferences portalPreferences) {
354 if (portalPreferences instanceof PortalPreferencesImpl) {
355 return portalPreferences;
356 }
357
358 PortalPreferencesImpl portalPreferencesImpl = new PortalPreferencesImpl();
359
360 portalPreferencesImpl.setNew(portalPreferences.isNew());
361 portalPreferencesImpl.setPrimaryKey(portalPreferences.getPrimaryKey());
362
363 portalPreferencesImpl.setPortalPreferencesId(portalPreferences.getPortalPreferencesId());
364 portalPreferencesImpl.setOwnerId(portalPreferences.getOwnerId());
365 portalPreferencesImpl.setOwnerType(portalPreferences.getOwnerType());
366 portalPreferencesImpl.setPreferences(portalPreferences.getPreferences());
367
368 return portalPreferencesImpl;
369 }
370
371
379 @Override
380 public PortalPreferences findByPrimaryKey(Serializable primaryKey)
381 throws NoSuchModelException, SystemException {
382 return findByPrimaryKey(((Long)primaryKey).longValue());
383 }
384
385
393 public PortalPreferences findByPrimaryKey(long portalPreferencesId)
394 throws NoSuchPreferencesException, SystemException {
395 PortalPreferences portalPreferences = fetchByPrimaryKey(portalPreferencesId);
396
397 if (portalPreferences == null) {
398 if (_log.isWarnEnabled()) {
399 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
400 portalPreferencesId);
401 }
402
403 throw new NoSuchPreferencesException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
404 portalPreferencesId);
405 }
406
407 return portalPreferences;
408 }
409
410
417 @Override
418 public PortalPreferences fetchByPrimaryKey(Serializable primaryKey)
419 throws SystemException {
420 return fetchByPrimaryKey(((Long)primaryKey).longValue());
421 }
422
423
430 public PortalPreferences fetchByPrimaryKey(long portalPreferencesId)
431 throws SystemException {
432 PortalPreferences portalPreferences = (PortalPreferences)EntityCacheUtil.getResult(PortalPreferencesModelImpl.ENTITY_CACHE_ENABLED,
433 PortalPreferencesImpl.class, portalPreferencesId);
434
435 if (portalPreferences == _nullPortalPreferences) {
436 return null;
437 }
438
439 if (portalPreferences == null) {
440 Session session = null;
441
442 boolean hasException = false;
443
444 try {
445 session = openSession();
446
447 portalPreferences = (PortalPreferences)session.get(PortalPreferencesImpl.class,
448 Long.valueOf(portalPreferencesId));
449 }
450 catch (Exception e) {
451 hasException = true;
452
453 throw processException(e);
454 }
455 finally {
456 if (portalPreferences != null) {
457 cacheResult(portalPreferences);
458 }
459 else if (!hasException) {
460 EntityCacheUtil.putResult(PortalPreferencesModelImpl.ENTITY_CACHE_ENABLED,
461 PortalPreferencesImpl.class, portalPreferencesId,
462 _nullPortalPreferences);
463 }
464
465 closeSession(session);
466 }
467 }
468
469 return portalPreferences;
470 }
471
472
481 public PortalPreferences findByO_O(long ownerId, int ownerType)
482 throws NoSuchPreferencesException, SystemException {
483 PortalPreferences portalPreferences = fetchByO_O(ownerId, ownerType);
484
485 if (portalPreferences == null) {
486 StringBundler msg = new StringBundler(6);
487
488 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
489
490 msg.append("ownerId=");
491 msg.append(ownerId);
492
493 msg.append(", ownerType=");
494 msg.append(ownerType);
495
496 msg.append(StringPool.CLOSE_CURLY_BRACE);
497
498 if (_log.isWarnEnabled()) {
499 _log.warn(msg.toString());
500 }
501
502 throw new NoSuchPreferencesException(msg.toString());
503 }
504
505 return portalPreferences;
506 }
507
508
516 public PortalPreferences fetchByO_O(long ownerId, int ownerType)
517 throws SystemException {
518 return fetchByO_O(ownerId, ownerType, true);
519 }
520
521
530 public PortalPreferences fetchByO_O(long ownerId, int ownerType,
531 boolean retrieveFromCache) throws SystemException {
532 Object[] finderArgs = new Object[] { ownerId, ownerType };
533
534 Object result = null;
535
536 if (retrieveFromCache) {
537 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_O_O,
538 finderArgs, this);
539 }
540
541 if (result instanceof PortalPreferences) {
542 PortalPreferences portalPreferences = (PortalPreferences)result;
543
544 if ((ownerId != portalPreferences.getOwnerId()) ||
545 (ownerType != portalPreferences.getOwnerType())) {
546 result = null;
547 }
548 }
549
550 if (result == null) {
551 StringBundler query = new StringBundler(3);
552
553 query.append(_SQL_SELECT_PORTALPREFERENCES_WHERE);
554
555 query.append(_FINDER_COLUMN_O_O_OWNERID_2);
556
557 query.append(_FINDER_COLUMN_O_O_OWNERTYPE_2);
558
559 String sql = query.toString();
560
561 Session session = null;
562
563 try {
564 session = openSession();
565
566 Query q = session.createQuery(sql);
567
568 QueryPos qPos = QueryPos.getInstance(q);
569
570 qPos.add(ownerId);
571
572 qPos.add(ownerType);
573
574 List<PortalPreferences> list = q.list();
575
576 result = list;
577
578 PortalPreferences portalPreferences = null;
579
580 if (list.isEmpty()) {
581 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O,
582 finderArgs, list);
583 }
584 else {
585 portalPreferences = list.get(0);
586
587 cacheResult(portalPreferences);
588
589 if ((portalPreferences.getOwnerId() != ownerId) ||
590 (portalPreferences.getOwnerType() != ownerType)) {
591 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_O_O,
592 finderArgs, portalPreferences);
593 }
594 }
595
596 return portalPreferences;
597 }
598 catch (Exception e) {
599 throw processException(e);
600 }
601 finally {
602 if (result == null) {
603 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O,
604 finderArgs);
605 }
606
607 closeSession(session);
608 }
609 }
610 else {
611 if (result instanceof List<?>) {
612 return null;
613 }
614 else {
615 return (PortalPreferences)result;
616 }
617 }
618 }
619
620
626 public List<PortalPreferences> findAll() throws SystemException {
627 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
628 }
629
630
642 public List<PortalPreferences> findAll(int start, int end)
643 throws SystemException {
644 return findAll(start, end, null);
645 }
646
647
660 public List<PortalPreferences> findAll(int start, int end,
661 OrderByComparator orderByComparator) throws SystemException {
662 FinderPath finderPath = null;
663 Object[] finderArgs = new Object[] { start, end, orderByComparator };
664
665 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
666 (orderByComparator == null)) {
667 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
668 finderArgs = FINDER_ARGS_EMPTY;
669 }
670 else {
671 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
672 finderArgs = new Object[] { start, end, orderByComparator };
673 }
674
675 List<PortalPreferences> list = (List<PortalPreferences>)FinderCacheUtil.getResult(finderPath,
676 finderArgs, this);
677
678 if (list == null) {
679 StringBundler query = null;
680 String sql = null;
681
682 if (orderByComparator != null) {
683 query = new StringBundler(2 +
684 (orderByComparator.getOrderByFields().length * 3));
685
686 query.append(_SQL_SELECT_PORTALPREFERENCES);
687
688 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
689 orderByComparator);
690
691 sql = query.toString();
692 }
693 else {
694 sql = _SQL_SELECT_PORTALPREFERENCES;
695 }
696
697 Session session = null;
698
699 try {
700 session = openSession();
701
702 Query q = session.createQuery(sql);
703
704 if (orderByComparator == null) {
705 list = (List<PortalPreferences>)QueryUtil.list(q,
706 getDialect(), start, end, false);
707
708 Collections.sort(list);
709 }
710 else {
711 list = (List<PortalPreferences>)QueryUtil.list(q,
712 getDialect(), start, end);
713 }
714 }
715 catch (Exception e) {
716 throw processException(e);
717 }
718 finally {
719 if (list == null) {
720 FinderCacheUtil.removeResult(finderPath, finderArgs);
721 }
722 else {
723 cacheResult(list);
724
725 FinderCacheUtil.putResult(finderPath, finderArgs, list);
726 }
727
728 closeSession(session);
729 }
730 }
731
732 return list;
733 }
734
735
742 public void removeByO_O(long ownerId, int ownerType)
743 throws NoSuchPreferencesException, SystemException {
744 PortalPreferences portalPreferences = findByO_O(ownerId, ownerType);
745
746 remove(portalPreferences);
747 }
748
749
754 public void removeAll() throws SystemException {
755 for (PortalPreferences portalPreferences : findAll()) {
756 remove(portalPreferences);
757 }
758 }
759
760
768 public int countByO_O(long ownerId, int ownerType)
769 throws SystemException {
770 Object[] finderArgs = new Object[] { ownerId, ownerType };
771
772 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_O_O,
773 finderArgs, this);
774
775 if (count == null) {
776 StringBundler query = new StringBundler(3);
777
778 query.append(_SQL_COUNT_PORTALPREFERENCES_WHERE);
779
780 query.append(_FINDER_COLUMN_O_O_OWNERID_2);
781
782 query.append(_FINDER_COLUMN_O_O_OWNERTYPE_2);
783
784 String sql = query.toString();
785
786 Session session = null;
787
788 try {
789 session = openSession();
790
791 Query q = session.createQuery(sql);
792
793 QueryPos qPos = QueryPos.getInstance(q);
794
795 qPos.add(ownerId);
796
797 qPos.add(ownerType);
798
799 count = (Long)q.uniqueResult();
800 }
801 catch (Exception e) {
802 throw processException(e);
803 }
804 finally {
805 if (count == null) {
806 count = Long.valueOf(0);
807 }
808
809 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_O_O, finderArgs,
810 count);
811
812 closeSession(session);
813 }
814 }
815
816 return count.intValue();
817 }
818
819
825 public int countAll() throws SystemException {
826 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
827 FINDER_ARGS_EMPTY, this);
828
829 if (count == null) {
830 Session session = null;
831
832 try {
833 session = openSession();
834
835 Query q = session.createQuery(_SQL_COUNT_PORTALPREFERENCES);
836
837 count = (Long)q.uniqueResult();
838 }
839 catch (Exception e) {
840 throw processException(e);
841 }
842 finally {
843 if (count == null) {
844 count = Long.valueOf(0);
845 }
846
847 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
848 FINDER_ARGS_EMPTY, count);
849
850 closeSession(session);
851 }
852 }
853
854 return count.intValue();
855 }
856
857
860 public void afterPropertiesSet() {
861 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
862 com.liferay.portal.util.PropsUtil.get(
863 "value.object.listener.com.liferay.portal.model.PortalPreferences")));
864
865 if (listenerClassNames.length > 0) {
866 try {
867 List<ModelListener<PortalPreferences>> listenersList = new ArrayList<ModelListener<PortalPreferences>>();
868
869 for (String listenerClassName : listenerClassNames) {
870 listenersList.add((ModelListener<PortalPreferences>)InstanceFactory.newInstance(
871 listenerClassName));
872 }
873
874 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
875 }
876 catch (Exception e) {
877 _log.error(e);
878 }
879 }
880 }
881
882 public void destroy() {
883 EntityCacheUtil.removeCache(PortalPreferencesImpl.class.getName());
884 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
885 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
886 }
887
888 @BeanReference(type = AccountPersistence.class)
889 protected AccountPersistence accountPersistence;
890 @BeanReference(type = AddressPersistence.class)
891 protected AddressPersistence addressPersistence;
892 @BeanReference(type = BrowserTrackerPersistence.class)
893 protected BrowserTrackerPersistence browserTrackerPersistence;
894 @BeanReference(type = ClassNamePersistence.class)
895 protected ClassNamePersistence classNamePersistence;
896 @BeanReference(type = ClusterGroupPersistence.class)
897 protected ClusterGroupPersistence clusterGroupPersistence;
898 @BeanReference(type = CompanyPersistence.class)
899 protected CompanyPersistence companyPersistence;
900 @BeanReference(type = ContactPersistence.class)
901 protected ContactPersistence contactPersistence;
902 @BeanReference(type = CountryPersistence.class)
903 protected CountryPersistence countryPersistence;
904 @BeanReference(type = EmailAddressPersistence.class)
905 protected EmailAddressPersistence emailAddressPersistence;
906 @BeanReference(type = GroupPersistence.class)
907 protected GroupPersistence groupPersistence;
908 @BeanReference(type = ImagePersistence.class)
909 protected ImagePersistence imagePersistence;
910 @BeanReference(type = LayoutPersistence.class)
911 protected LayoutPersistence layoutPersistence;
912 @BeanReference(type = LayoutBranchPersistence.class)
913 protected LayoutBranchPersistence layoutBranchPersistence;
914 @BeanReference(type = LayoutPrototypePersistence.class)
915 protected LayoutPrototypePersistence layoutPrototypePersistence;
916 @BeanReference(type = LayoutRevisionPersistence.class)
917 protected LayoutRevisionPersistence layoutRevisionPersistence;
918 @BeanReference(type = LayoutSetPersistence.class)
919 protected LayoutSetPersistence layoutSetPersistence;
920 @BeanReference(type = LayoutSetBranchPersistence.class)
921 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
922 @BeanReference(type = LayoutSetPrototypePersistence.class)
923 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
924 @BeanReference(type = ListTypePersistence.class)
925 protected ListTypePersistence listTypePersistence;
926 @BeanReference(type = LockPersistence.class)
927 protected LockPersistence lockPersistence;
928 @BeanReference(type = MembershipRequestPersistence.class)
929 protected MembershipRequestPersistence membershipRequestPersistence;
930 @BeanReference(type = OrganizationPersistence.class)
931 protected OrganizationPersistence organizationPersistence;
932 @BeanReference(type = OrgGroupPermissionPersistence.class)
933 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
934 @BeanReference(type = OrgGroupRolePersistence.class)
935 protected OrgGroupRolePersistence orgGroupRolePersistence;
936 @BeanReference(type = OrgLaborPersistence.class)
937 protected OrgLaborPersistence orgLaborPersistence;
938 @BeanReference(type = PasswordPolicyPersistence.class)
939 protected PasswordPolicyPersistence passwordPolicyPersistence;
940 @BeanReference(type = PasswordPolicyRelPersistence.class)
941 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
942 @BeanReference(type = PasswordTrackerPersistence.class)
943 protected PasswordTrackerPersistence passwordTrackerPersistence;
944 @BeanReference(type = PermissionPersistence.class)
945 protected PermissionPersistence permissionPersistence;
946 @BeanReference(type = PhonePersistence.class)
947 protected PhonePersistence phonePersistence;
948 @BeanReference(type = PluginSettingPersistence.class)
949 protected PluginSettingPersistence pluginSettingPersistence;
950 @BeanReference(type = PortalPreferencesPersistence.class)
951 protected PortalPreferencesPersistence portalPreferencesPersistence;
952 @BeanReference(type = PortletPersistence.class)
953 protected PortletPersistence portletPersistence;
954 @BeanReference(type = PortletItemPersistence.class)
955 protected PortletItemPersistence portletItemPersistence;
956 @BeanReference(type = PortletPreferencesPersistence.class)
957 protected PortletPreferencesPersistence portletPreferencesPersistence;
958 @BeanReference(type = RegionPersistence.class)
959 protected RegionPersistence regionPersistence;
960 @BeanReference(type = ReleasePersistence.class)
961 protected ReleasePersistence releasePersistence;
962 @BeanReference(type = RepositoryPersistence.class)
963 protected RepositoryPersistence repositoryPersistence;
964 @BeanReference(type = RepositoryEntryPersistence.class)
965 protected RepositoryEntryPersistence repositoryEntryPersistence;
966 @BeanReference(type = ResourcePersistence.class)
967 protected ResourcePersistence resourcePersistence;
968 @BeanReference(type = ResourceActionPersistence.class)
969 protected ResourceActionPersistence resourceActionPersistence;
970 @BeanReference(type = ResourceBlockPersistence.class)
971 protected ResourceBlockPersistence resourceBlockPersistence;
972 @BeanReference(type = ResourceBlockPermissionPersistence.class)
973 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
974 @BeanReference(type = ResourceCodePersistence.class)
975 protected ResourceCodePersistence resourceCodePersistence;
976 @BeanReference(type = ResourcePermissionPersistence.class)
977 protected ResourcePermissionPersistence resourcePermissionPersistence;
978 @BeanReference(type = ResourceTypePermissionPersistence.class)
979 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
980 @BeanReference(type = RolePersistence.class)
981 protected RolePersistence rolePersistence;
982 @BeanReference(type = ServiceComponentPersistence.class)
983 protected ServiceComponentPersistence serviceComponentPersistence;
984 @BeanReference(type = ShardPersistence.class)
985 protected ShardPersistence shardPersistence;
986 @BeanReference(type = SubscriptionPersistence.class)
987 protected SubscriptionPersistence subscriptionPersistence;
988 @BeanReference(type = TeamPersistence.class)
989 protected TeamPersistence teamPersistence;
990 @BeanReference(type = TicketPersistence.class)
991 protected TicketPersistence ticketPersistence;
992 @BeanReference(type = UserPersistence.class)
993 protected UserPersistence userPersistence;
994 @BeanReference(type = UserGroupPersistence.class)
995 protected UserGroupPersistence userGroupPersistence;
996 @BeanReference(type = UserGroupGroupRolePersistence.class)
997 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
998 @BeanReference(type = UserGroupRolePersistence.class)
999 protected UserGroupRolePersistence userGroupRolePersistence;
1000 @BeanReference(type = UserIdMapperPersistence.class)
1001 protected UserIdMapperPersistence userIdMapperPersistence;
1002 @BeanReference(type = UserNotificationEventPersistence.class)
1003 protected UserNotificationEventPersistence userNotificationEventPersistence;
1004 @BeanReference(type = UserTrackerPersistence.class)
1005 protected UserTrackerPersistence userTrackerPersistence;
1006 @BeanReference(type = UserTrackerPathPersistence.class)
1007 protected UserTrackerPathPersistence userTrackerPathPersistence;
1008 @BeanReference(type = VirtualHostPersistence.class)
1009 protected VirtualHostPersistence virtualHostPersistence;
1010 @BeanReference(type = WebDAVPropsPersistence.class)
1011 protected WebDAVPropsPersistence webDAVPropsPersistence;
1012 @BeanReference(type = WebsitePersistence.class)
1013 protected WebsitePersistence websitePersistence;
1014 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1015 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1016 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1017 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1018 private static final String _SQL_SELECT_PORTALPREFERENCES = "SELECT portalPreferences FROM PortalPreferences portalPreferences";
1019 private static final String _SQL_SELECT_PORTALPREFERENCES_WHERE = "SELECT portalPreferences FROM PortalPreferences portalPreferences WHERE ";
1020 private static final String _SQL_COUNT_PORTALPREFERENCES = "SELECT COUNT(portalPreferences) FROM PortalPreferences portalPreferences";
1021 private static final String _SQL_COUNT_PORTALPREFERENCES_WHERE = "SELECT COUNT(portalPreferences) FROM PortalPreferences portalPreferences WHERE ";
1022 private static final String _FINDER_COLUMN_O_O_OWNERID_2 = "portalPreferences.ownerId = ? AND ";
1023 private static final String _FINDER_COLUMN_O_O_OWNERTYPE_2 = "portalPreferences.ownerType = ?";
1024 private static final String _ORDER_BY_ENTITY_ALIAS = "portalPreferences.";
1025 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PortalPreferences exists with the primary key ";
1026 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PortalPreferences exists with the key {";
1027 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1028 private static Log _log = LogFactoryUtil.getLog(PortalPreferencesPersistenceImpl.class);
1029 private static PortalPreferences _nullPortalPreferences = new PortalPreferencesImpl() {
1030 @Override
1031 public Object clone() {
1032 return this;
1033 }
1034
1035 @Override
1036 public CacheModel<PortalPreferences> toCacheModel() {
1037 return _nullPortalPreferencesCacheModel;
1038 }
1039 };
1040
1041 private static CacheModel<PortalPreferences> _nullPortalPreferencesCacheModel =
1042 new CacheModel<PortalPreferences>() {
1043 public PortalPreferences toEntityModel() {
1044 return _nullPortalPreferences;
1045 }
1046 };
1047 }