001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.NoSuchWebDAVPropsException;
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.WebDAVProps;
040 import com.liferay.portal.model.impl.WebDAVPropsImpl;
041 import com.liferay.portal.model.impl.WebDAVPropsModelImpl;
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 WebDAVPropsPersistenceImpl extends BasePersistenceImpl<WebDAVProps>
063 implements WebDAVPropsPersistence {
064
069 public static final String FINDER_CLASS_NAME_ENTITY = WebDAVPropsImpl.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_C_C = new FinderPath(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
075 WebDAVPropsModelImpl.FINDER_CACHE_ENABLED, WebDAVPropsImpl.class,
076 FINDER_CLASS_NAME_ENTITY, "fetchByC_C",
077 new String[] { Long.class.getName(), Long.class.getName() },
078 WebDAVPropsModelImpl.CLASSNAMEID_COLUMN_BITMASK |
079 WebDAVPropsModelImpl.CLASSPK_COLUMN_BITMASK);
080 public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
081 WebDAVPropsModelImpl.FINDER_CACHE_ENABLED, Long.class,
082 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C",
083 new String[] { Long.class.getName(), Long.class.getName() });
084 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
085 WebDAVPropsModelImpl.FINDER_CACHE_ENABLED, WebDAVPropsImpl.class,
086 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
087 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
088 WebDAVPropsModelImpl.FINDER_CACHE_ENABLED, WebDAVPropsImpl.class,
089 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
090 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
091 WebDAVPropsModelImpl.FINDER_CACHE_ENABLED, Long.class,
092 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
093
094
099 public void cacheResult(WebDAVProps webDAVProps) {
100 EntityCacheUtil.putResult(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
101 WebDAVPropsImpl.class, webDAVProps.getPrimaryKey(), webDAVProps);
102
103 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
104 new Object[] {
105 Long.valueOf(webDAVProps.getClassNameId()),
106 Long.valueOf(webDAVProps.getClassPK())
107 }, webDAVProps);
108
109 webDAVProps.resetOriginalValues();
110 }
111
112
117 public void cacheResult(List<WebDAVProps> webDAVPropses) {
118 for (WebDAVProps webDAVProps : webDAVPropses) {
119 if (EntityCacheUtil.getResult(
120 WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
121 WebDAVPropsImpl.class, webDAVProps.getPrimaryKey()) == null) {
122 cacheResult(webDAVProps);
123 }
124 else {
125 webDAVProps.resetOriginalValues();
126 }
127 }
128 }
129
130
137 @Override
138 public void clearCache() {
139 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
140 CacheRegistryUtil.clear(WebDAVPropsImpl.class.getName());
141 }
142
143 EntityCacheUtil.clearCache(WebDAVPropsImpl.class.getName());
144
145 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
146 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
147 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
148 }
149
150
157 @Override
158 public void clearCache(WebDAVProps webDAVProps) {
159 EntityCacheUtil.removeResult(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
160 WebDAVPropsImpl.class, webDAVProps.getPrimaryKey());
161
162 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
163 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
164
165 clearUniqueFindersCache(webDAVProps);
166 }
167
168 @Override
169 public void clearCache(List<WebDAVProps> webDAVPropses) {
170 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
171 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
172
173 for (WebDAVProps webDAVProps : webDAVPropses) {
174 EntityCacheUtil.removeResult(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
175 WebDAVPropsImpl.class, webDAVProps.getPrimaryKey());
176
177 clearUniqueFindersCache(webDAVProps);
178 }
179 }
180
181 protected void cacheUniqueFindersCache(WebDAVProps webDAVProps) {
182 if (webDAVProps.isNew()) {
183 Object[] args = new Object[] {
184 Long.valueOf(webDAVProps.getClassNameId()),
185 Long.valueOf(webDAVProps.getClassPK())
186 };
187
188 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, args,
189 Long.valueOf(1));
190 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C, args,
191 webDAVProps);
192 }
193 else {
194 WebDAVPropsModelImpl webDAVPropsModelImpl = (WebDAVPropsModelImpl)webDAVProps;
195
196 if ((webDAVPropsModelImpl.getColumnBitmask() &
197 FINDER_PATH_FETCH_BY_C_C.getColumnBitmask()) != 0) {
198 Object[] args = new Object[] {
199 Long.valueOf(webDAVProps.getClassNameId()),
200 Long.valueOf(webDAVProps.getClassPK())
201 };
202
203 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, args,
204 Long.valueOf(1));
205 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C, args,
206 webDAVProps);
207 }
208 }
209 }
210
211 protected void clearUniqueFindersCache(WebDAVProps webDAVProps) {
212 WebDAVPropsModelImpl webDAVPropsModelImpl = (WebDAVPropsModelImpl)webDAVProps;
213
214 Object[] args = new Object[] {
215 Long.valueOf(webDAVProps.getClassNameId()),
216 Long.valueOf(webDAVProps.getClassPK())
217 };
218
219 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
220 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C, args);
221
222 if ((webDAVPropsModelImpl.getColumnBitmask() &
223 FINDER_PATH_FETCH_BY_C_C.getColumnBitmask()) != 0) {
224 args = new Object[] {
225 Long.valueOf(webDAVPropsModelImpl.getOriginalClassNameId()),
226 Long.valueOf(webDAVPropsModelImpl.getOriginalClassPK())
227 };
228
229 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
230 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C, args);
231 }
232 }
233
234
240 public WebDAVProps create(long webDavPropsId) {
241 WebDAVProps webDAVProps = new WebDAVPropsImpl();
242
243 webDAVProps.setNew(true);
244 webDAVProps.setPrimaryKey(webDavPropsId);
245
246 return webDAVProps;
247 }
248
249
257 public WebDAVProps remove(long webDavPropsId)
258 throws NoSuchWebDAVPropsException, SystemException {
259 return remove(Long.valueOf(webDavPropsId));
260 }
261
262
270 @Override
271 public WebDAVProps remove(Serializable primaryKey)
272 throws NoSuchWebDAVPropsException, SystemException {
273 Session session = null;
274
275 try {
276 session = openSession();
277
278 WebDAVProps webDAVProps = (WebDAVProps)session.get(WebDAVPropsImpl.class,
279 primaryKey);
280
281 if (webDAVProps == null) {
282 if (_log.isWarnEnabled()) {
283 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
284 }
285
286 throw new NoSuchWebDAVPropsException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
287 primaryKey);
288 }
289
290 return remove(webDAVProps);
291 }
292 catch (NoSuchWebDAVPropsException nsee) {
293 throw nsee;
294 }
295 catch (Exception e) {
296 throw processException(e);
297 }
298 finally {
299 closeSession(session);
300 }
301 }
302
303 @Override
304 protected WebDAVProps removeImpl(WebDAVProps webDAVProps)
305 throws SystemException {
306 webDAVProps = toUnwrappedModel(webDAVProps);
307
308 Session session = null;
309
310 try {
311 session = openSession();
312
313 BatchSessionUtil.delete(session, webDAVProps);
314 }
315 catch (Exception e) {
316 throw processException(e);
317 }
318 finally {
319 closeSession(session);
320 }
321
322 clearCache(webDAVProps);
323
324 return webDAVProps;
325 }
326
327 @Override
328 public WebDAVProps updateImpl(
329 com.liferay.portal.model.WebDAVProps webDAVProps, boolean merge)
330 throws SystemException {
331 webDAVProps = toUnwrappedModel(webDAVProps);
332
333 boolean isNew = webDAVProps.isNew();
334
335 Session session = null;
336
337 try {
338 session = openSession();
339
340 BatchSessionUtil.update(session, webDAVProps, merge);
341
342 webDAVProps.setNew(false);
343 }
344 catch (Exception e) {
345 throw processException(e);
346 }
347 finally {
348 closeSession(session);
349 }
350
351 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
352
353 if (isNew || !WebDAVPropsModelImpl.COLUMN_BITMASK_ENABLED) {
354 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
355 }
356
357 EntityCacheUtil.putResult(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
358 WebDAVPropsImpl.class, webDAVProps.getPrimaryKey(), webDAVProps);
359
360 clearUniqueFindersCache(webDAVProps);
361 cacheUniqueFindersCache(webDAVProps);
362
363 return webDAVProps;
364 }
365
366 protected WebDAVProps toUnwrappedModel(WebDAVProps webDAVProps) {
367 if (webDAVProps instanceof WebDAVPropsImpl) {
368 return webDAVProps;
369 }
370
371 WebDAVPropsImpl webDAVPropsImpl = new WebDAVPropsImpl();
372
373 webDAVPropsImpl.setNew(webDAVProps.isNew());
374 webDAVPropsImpl.setPrimaryKey(webDAVProps.getPrimaryKey());
375
376 webDAVPropsImpl.setWebDavPropsId(webDAVProps.getWebDavPropsId());
377 webDAVPropsImpl.setCompanyId(webDAVProps.getCompanyId());
378 webDAVPropsImpl.setCreateDate(webDAVProps.getCreateDate());
379 webDAVPropsImpl.setModifiedDate(webDAVProps.getModifiedDate());
380 webDAVPropsImpl.setClassNameId(webDAVProps.getClassNameId());
381 webDAVPropsImpl.setClassPK(webDAVProps.getClassPK());
382 webDAVPropsImpl.setProps(webDAVProps.getProps());
383
384 return webDAVPropsImpl;
385 }
386
387
395 @Override
396 public WebDAVProps findByPrimaryKey(Serializable primaryKey)
397 throws NoSuchModelException, SystemException {
398 return findByPrimaryKey(((Long)primaryKey).longValue());
399 }
400
401
409 public WebDAVProps findByPrimaryKey(long webDavPropsId)
410 throws NoSuchWebDAVPropsException, SystemException {
411 WebDAVProps webDAVProps = fetchByPrimaryKey(webDavPropsId);
412
413 if (webDAVProps == null) {
414 if (_log.isWarnEnabled()) {
415 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + webDavPropsId);
416 }
417
418 throw new NoSuchWebDAVPropsException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
419 webDavPropsId);
420 }
421
422 return webDAVProps;
423 }
424
425
432 @Override
433 public WebDAVProps fetchByPrimaryKey(Serializable primaryKey)
434 throws SystemException {
435 return fetchByPrimaryKey(((Long)primaryKey).longValue());
436 }
437
438
445 public WebDAVProps fetchByPrimaryKey(long webDavPropsId)
446 throws SystemException {
447 WebDAVProps webDAVProps = (WebDAVProps)EntityCacheUtil.getResult(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
448 WebDAVPropsImpl.class, webDavPropsId);
449
450 if (webDAVProps == _nullWebDAVProps) {
451 return null;
452 }
453
454 if (webDAVProps == null) {
455 Session session = null;
456
457 boolean hasException = false;
458
459 try {
460 session = openSession();
461
462 webDAVProps = (WebDAVProps)session.get(WebDAVPropsImpl.class,
463 Long.valueOf(webDavPropsId));
464 }
465 catch (Exception e) {
466 hasException = true;
467
468 throw processException(e);
469 }
470 finally {
471 if (webDAVProps != null) {
472 cacheResult(webDAVProps);
473 }
474 else if (!hasException) {
475 EntityCacheUtil.putResult(WebDAVPropsModelImpl.ENTITY_CACHE_ENABLED,
476 WebDAVPropsImpl.class, webDavPropsId, _nullWebDAVProps);
477 }
478
479 closeSession(session);
480 }
481 }
482
483 return webDAVProps;
484 }
485
486
495 public WebDAVProps findByC_C(long classNameId, long classPK)
496 throws NoSuchWebDAVPropsException, SystemException {
497 WebDAVProps webDAVProps = fetchByC_C(classNameId, classPK);
498
499 if (webDAVProps == null) {
500 StringBundler msg = new StringBundler(6);
501
502 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
503
504 msg.append("classNameId=");
505 msg.append(classNameId);
506
507 msg.append(", classPK=");
508 msg.append(classPK);
509
510 msg.append(StringPool.CLOSE_CURLY_BRACE);
511
512 if (_log.isWarnEnabled()) {
513 _log.warn(msg.toString());
514 }
515
516 throw new NoSuchWebDAVPropsException(msg.toString());
517 }
518
519 return webDAVProps;
520 }
521
522
530 public WebDAVProps fetchByC_C(long classNameId, long classPK)
531 throws SystemException {
532 return fetchByC_C(classNameId, classPK, true);
533 }
534
535
544 public WebDAVProps fetchByC_C(long classNameId, long classPK,
545 boolean retrieveFromCache) throws SystemException {
546 Object[] finderArgs = new Object[] { classNameId, classPK };
547
548 Object result = null;
549
550 if (retrieveFromCache) {
551 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C,
552 finderArgs, this);
553 }
554
555 if (result instanceof WebDAVProps) {
556 WebDAVProps webDAVProps = (WebDAVProps)result;
557
558 if ((classNameId != webDAVProps.getClassNameId()) ||
559 (classPK != webDAVProps.getClassPK())) {
560 result = null;
561 }
562 }
563
564 if (result == null) {
565 StringBundler query = new StringBundler(3);
566
567 query.append(_SQL_SELECT_WEBDAVPROPS_WHERE);
568
569 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
570
571 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
572
573 String sql = query.toString();
574
575 Session session = null;
576
577 try {
578 session = openSession();
579
580 Query q = session.createQuery(sql);
581
582 QueryPos qPos = QueryPos.getInstance(q);
583
584 qPos.add(classNameId);
585
586 qPos.add(classPK);
587
588 List<WebDAVProps> list = q.list();
589
590 result = list;
591
592 WebDAVProps webDAVProps = null;
593
594 if (list.isEmpty()) {
595 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
596 finderArgs, list);
597 }
598 else {
599 webDAVProps = list.get(0);
600
601 cacheResult(webDAVProps);
602
603 if ((webDAVProps.getClassNameId() != classNameId) ||
604 (webDAVProps.getClassPK() != classPK)) {
605 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
606 finderArgs, webDAVProps);
607 }
608 }
609
610 return webDAVProps;
611 }
612 catch (Exception e) {
613 throw processException(e);
614 }
615 finally {
616 if (result == null) {
617 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
618 finderArgs);
619 }
620
621 closeSession(session);
622 }
623 }
624 else {
625 if (result instanceof List<?>) {
626 return null;
627 }
628 else {
629 return (WebDAVProps)result;
630 }
631 }
632 }
633
634
640 public List<WebDAVProps> findAll() throws SystemException {
641 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
642 }
643
644
656 public List<WebDAVProps> findAll(int start, int end)
657 throws SystemException {
658 return findAll(start, end, null);
659 }
660
661
674 public List<WebDAVProps> findAll(int start, int end,
675 OrderByComparator orderByComparator) throws SystemException {
676 FinderPath finderPath = null;
677 Object[] finderArgs = new Object[] { start, end, orderByComparator };
678
679 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
680 (orderByComparator == null)) {
681 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
682 finderArgs = FINDER_ARGS_EMPTY;
683 }
684 else {
685 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
686 finderArgs = new Object[] { start, end, orderByComparator };
687 }
688
689 List<WebDAVProps> list = (List<WebDAVProps>)FinderCacheUtil.getResult(finderPath,
690 finderArgs, this);
691
692 if (list == null) {
693 StringBundler query = null;
694 String sql = null;
695
696 if (orderByComparator != null) {
697 query = new StringBundler(2 +
698 (orderByComparator.getOrderByFields().length * 3));
699
700 query.append(_SQL_SELECT_WEBDAVPROPS);
701
702 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
703 orderByComparator);
704
705 sql = query.toString();
706 }
707 else {
708 sql = _SQL_SELECT_WEBDAVPROPS;
709 }
710
711 Session session = null;
712
713 try {
714 session = openSession();
715
716 Query q = session.createQuery(sql);
717
718 if (orderByComparator == null) {
719 list = (List<WebDAVProps>)QueryUtil.list(q, getDialect(),
720 start, end, false);
721
722 Collections.sort(list);
723 }
724 else {
725 list = (List<WebDAVProps>)QueryUtil.list(q, getDialect(),
726 start, end);
727 }
728 }
729 catch (Exception e) {
730 throw processException(e);
731 }
732 finally {
733 if (list == null) {
734 FinderCacheUtil.removeResult(finderPath, finderArgs);
735 }
736 else {
737 cacheResult(list);
738
739 FinderCacheUtil.putResult(finderPath, finderArgs, list);
740 }
741
742 closeSession(session);
743 }
744 }
745
746 return list;
747 }
748
749
757 public WebDAVProps removeByC_C(long classNameId, long classPK)
758 throws NoSuchWebDAVPropsException, SystemException {
759 WebDAVProps webDAVProps = findByC_C(classNameId, classPK);
760
761 return remove(webDAVProps);
762 }
763
764
769 public void removeAll() throws SystemException {
770 for (WebDAVProps webDAVProps : findAll()) {
771 remove(webDAVProps);
772 }
773 }
774
775
783 public int countByC_C(long classNameId, long classPK)
784 throws SystemException {
785 Object[] finderArgs = new Object[] { classNameId, classPK };
786
787 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
788 finderArgs, this);
789
790 if (count == null) {
791 StringBundler query = new StringBundler(3);
792
793 query.append(_SQL_COUNT_WEBDAVPROPS_WHERE);
794
795 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
796
797 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
798
799 String sql = query.toString();
800
801 Session session = null;
802
803 try {
804 session = openSession();
805
806 Query q = session.createQuery(sql);
807
808 QueryPos qPos = QueryPos.getInstance(q);
809
810 qPos.add(classNameId);
811
812 qPos.add(classPK);
813
814 count = (Long)q.uniqueResult();
815 }
816 catch (Exception e) {
817 throw processException(e);
818 }
819 finally {
820 if (count == null) {
821 count = Long.valueOf(0);
822 }
823
824 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
825 count);
826
827 closeSession(session);
828 }
829 }
830
831 return count.intValue();
832 }
833
834
840 public int countAll() throws SystemException {
841 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
842 FINDER_ARGS_EMPTY, this);
843
844 if (count == null) {
845 Session session = null;
846
847 try {
848 session = openSession();
849
850 Query q = session.createQuery(_SQL_COUNT_WEBDAVPROPS);
851
852 count = (Long)q.uniqueResult();
853 }
854 catch (Exception e) {
855 throw processException(e);
856 }
857 finally {
858 if (count == null) {
859 count = Long.valueOf(0);
860 }
861
862 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
863 FINDER_ARGS_EMPTY, count);
864
865 closeSession(session);
866 }
867 }
868
869 return count.intValue();
870 }
871
872
875 public void afterPropertiesSet() {
876 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
877 com.liferay.portal.util.PropsUtil.get(
878 "value.object.listener.com.liferay.portal.model.WebDAVProps")));
879
880 if (listenerClassNames.length > 0) {
881 try {
882 List<ModelListener<WebDAVProps>> listenersList = new ArrayList<ModelListener<WebDAVProps>>();
883
884 for (String listenerClassName : listenerClassNames) {
885 Class<?> clazz = getClass();
886
887 listenersList.add((ModelListener<WebDAVProps>)InstanceFactory.newInstance(
888 clazz.getClassLoader(), listenerClassName));
889 }
890
891 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
892 }
893 catch (Exception e) {
894 _log.error(e);
895 }
896 }
897 }
898
899 public void destroy() {
900 EntityCacheUtil.removeCache(WebDAVPropsImpl.class.getName());
901 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
902 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
903 }
904
905 @BeanReference(type = AccountPersistence.class)
906 protected AccountPersistence accountPersistence;
907 @BeanReference(type = AddressPersistence.class)
908 protected AddressPersistence addressPersistence;
909 @BeanReference(type = BrowserTrackerPersistence.class)
910 protected BrowserTrackerPersistence browserTrackerPersistence;
911 @BeanReference(type = ClassNamePersistence.class)
912 protected ClassNamePersistence classNamePersistence;
913 @BeanReference(type = ClusterGroupPersistence.class)
914 protected ClusterGroupPersistence clusterGroupPersistence;
915 @BeanReference(type = CompanyPersistence.class)
916 protected CompanyPersistence companyPersistence;
917 @BeanReference(type = ContactPersistence.class)
918 protected ContactPersistence contactPersistence;
919 @BeanReference(type = CountryPersistence.class)
920 protected CountryPersistence countryPersistence;
921 @BeanReference(type = EmailAddressPersistence.class)
922 protected EmailAddressPersistence emailAddressPersistence;
923 @BeanReference(type = GroupPersistence.class)
924 protected GroupPersistence groupPersistence;
925 @BeanReference(type = ImagePersistence.class)
926 protected ImagePersistence imagePersistence;
927 @BeanReference(type = LayoutPersistence.class)
928 protected LayoutPersistence layoutPersistence;
929 @BeanReference(type = LayoutBranchPersistence.class)
930 protected LayoutBranchPersistence layoutBranchPersistence;
931 @BeanReference(type = LayoutPrototypePersistence.class)
932 protected LayoutPrototypePersistence layoutPrototypePersistence;
933 @BeanReference(type = LayoutRevisionPersistence.class)
934 protected LayoutRevisionPersistence layoutRevisionPersistence;
935 @BeanReference(type = LayoutSetPersistence.class)
936 protected LayoutSetPersistence layoutSetPersistence;
937 @BeanReference(type = LayoutSetBranchPersistence.class)
938 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
939 @BeanReference(type = LayoutSetPrototypePersistence.class)
940 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
941 @BeanReference(type = ListTypePersistence.class)
942 protected ListTypePersistence listTypePersistence;
943 @BeanReference(type = LockPersistence.class)
944 protected LockPersistence lockPersistence;
945 @BeanReference(type = MembershipRequestPersistence.class)
946 protected MembershipRequestPersistence membershipRequestPersistence;
947 @BeanReference(type = OrganizationPersistence.class)
948 protected OrganizationPersistence organizationPersistence;
949 @BeanReference(type = OrgGroupPermissionPersistence.class)
950 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
951 @BeanReference(type = OrgGroupRolePersistence.class)
952 protected OrgGroupRolePersistence orgGroupRolePersistence;
953 @BeanReference(type = OrgLaborPersistence.class)
954 protected OrgLaborPersistence orgLaborPersistence;
955 @BeanReference(type = PasswordPolicyPersistence.class)
956 protected PasswordPolicyPersistence passwordPolicyPersistence;
957 @BeanReference(type = PasswordPolicyRelPersistence.class)
958 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
959 @BeanReference(type = PasswordTrackerPersistence.class)
960 protected PasswordTrackerPersistence passwordTrackerPersistence;
961 @BeanReference(type = PermissionPersistence.class)
962 protected PermissionPersistence permissionPersistence;
963 @BeanReference(type = PhonePersistence.class)
964 protected PhonePersistence phonePersistence;
965 @BeanReference(type = PluginSettingPersistence.class)
966 protected PluginSettingPersistence pluginSettingPersistence;
967 @BeanReference(type = PortalPreferencesPersistence.class)
968 protected PortalPreferencesPersistence portalPreferencesPersistence;
969 @BeanReference(type = PortletPersistence.class)
970 protected PortletPersistence portletPersistence;
971 @BeanReference(type = PortletItemPersistence.class)
972 protected PortletItemPersistence portletItemPersistence;
973 @BeanReference(type = PortletPreferencesPersistence.class)
974 protected PortletPreferencesPersistence portletPreferencesPersistence;
975 @BeanReference(type = RegionPersistence.class)
976 protected RegionPersistence regionPersistence;
977 @BeanReference(type = ReleasePersistence.class)
978 protected ReleasePersistence releasePersistence;
979 @BeanReference(type = RepositoryPersistence.class)
980 protected RepositoryPersistence repositoryPersistence;
981 @BeanReference(type = RepositoryEntryPersistence.class)
982 protected RepositoryEntryPersistence repositoryEntryPersistence;
983 @BeanReference(type = ResourcePersistence.class)
984 protected ResourcePersistence resourcePersistence;
985 @BeanReference(type = ResourceActionPersistence.class)
986 protected ResourceActionPersistence resourceActionPersistence;
987 @BeanReference(type = ResourceBlockPersistence.class)
988 protected ResourceBlockPersistence resourceBlockPersistence;
989 @BeanReference(type = ResourceBlockPermissionPersistence.class)
990 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
991 @BeanReference(type = ResourceCodePersistence.class)
992 protected ResourceCodePersistence resourceCodePersistence;
993 @BeanReference(type = ResourcePermissionPersistence.class)
994 protected ResourcePermissionPersistence resourcePermissionPersistence;
995 @BeanReference(type = ResourceTypePermissionPersistence.class)
996 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
997 @BeanReference(type = RolePersistence.class)
998 protected RolePersistence rolePersistence;
999 @BeanReference(type = ServiceComponentPersistence.class)
1000 protected ServiceComponentPersistence serviceComponentPersistence;
1001 @BeanReference(type = ShardPersistence.class)
1002 protected ShardPersistence shardPersistence;
1003 @BeanReference(type = SubscriptionPersistence.class)
1004 protected SubscriptionPersistence subscriptionPersistence;
1005 @BeanReference(type = TeamPersistence.class)
1006 protected TeamPersistence teamPersistence;
1007 @BeanReference(type = TicketPersistence.class)
1008 protected TicketPersistence ticketPersistence;
1009 @BeanReference(type = UserPersistence.class)
1010 protected UserPersistence userPersistence;
1011 @BeanReference(type = UserGroupPersistence.class)
1012 protected UserGroupPersistence userGroupPersistence;
1013 @BeanReference(type = UserGroupGroupRolePersistence.class)
1014 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1015 @BeanReference(type = UserGroupRolePersistence.class)
1016 protected UserGroupRolePersistence userGroupRolePersistence;
1017 @BeanReference(type = UserIdMapperPersistence.class)
1018 protected UserIdMapperPersistence userIdMapperPersistence;
1019 @BeanReference(type = UserNotificationEventPersistence.class)
1020 protected UserNotificationEventPersistence userNotificationEventPersistence;
1021 @BeanReference(type = UserTrackerPersistence.class)
1022 protected UserTrackerPersistence userTrackerPersistence;
1023 @BeanReference(type = UserTrackerPathPersistence.class)
1024 protected UserTrackerPathPersistence userTrackerPathPersistence;
1025 @BeanReference(type = VirtualHostPersistence.class)
1026 protected VirtualHostPersistence virtualHostPersistence;
1027 @BeanReference(type = WebDAVPropsPersistence.class)
1028 protected WebDAVPropsPersistence webDAVPropsPersistence;
1029 @BeanReference(type = WebsitePersistence.class)
1030 protected WebsitePersistence websitePersistence;
1031 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1032 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1033 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1034 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1035 private static final String _SQL_SELECT_WEBDAVPROPS = "SELECT webDAVProps FROM WebDAVProps webDAVProps";
1036 private static final String _SQL_SELECT_WEBDAVPROPS_WHERE = "SELECT webDAVProps FROM WebDAVProps webDAVProps WHERE ";
1037 private static final String _SQL_COUNT_WEBDAVPROPS = "SELECT COUNT(webDAVProps) FROM WebDAVProps webDAVProps";
1038 private static final String _SQL_COUNT_WEBDAVPROPS_WHERE = "SELECT COUNT(webDAVProps) FROM WebDAVProps webDAVProps WHERE ";
1039 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "webDAVProps.classNameId = ? AND ";
1040 private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "webDAVProps.classPK = ?";
1041 private static final String _ORDER_BY_ENTITY_ALIAS = "webDAVProps.";
1042 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No WebDAVProps exists with the primary key ";
1043 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No WebDAVProps exists with the key {";
1044 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1045 private static Log _log = LogFactoryUtil.getLog(WebDAVPropsPersistenceImpl.class);
1046 private static WebDAVProps _nullWebDAVProps = new WebDAVPropsImpl() {
1047 @Override
1048 public Object clone() {
1049 return this;
1050 }
1051
1052 @Override
1053 public CacheModel<WebDAVProps> toCacheModel() {
1054 return _nullWebDAVPropsCacheModel;
1055 }
1056 };
1057
1058 private static CacheModel<WebDAVProps> _nullWebDAVPropsCacheModel = new CacheModel<WebDAVProps>() {
1059 public WebDAVProps toEntityModel() {
1060 return _nullWebDAVProps;
1061 }
1062 };
1063 }