001
014
015 package com.liferay.portlet.ratings.service.base;
016
017 import com.liferay.counter.service.CounterLocalService;
018
019 import com.liferay.portal.kernel.bean.BeanReference;
020 import com.liferay.portal.kernel.bean.IdentifiableBean;
021 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
022 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
023 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
024 import com.liferay.portal.kernel.exception.PortalException;
025 import com.liferay.portal.kernel.exception.SystemException;
026 import com.liferay.portal.kernel.log.Log;
027 import com.liferay.portal.kernel.log.LogFactoryUtil;
028 import com.liferay.portal.kernel.search.Indexer;
029 import com.liferay.portal.kernel.search.IndexerRegistryUtil;
030 import com.liferay.portal.kernel.search.SearchException;
031 import com.liferay.portal.kernel.util.OrderByComparator;
032 import com.liferay.portal.model.PersistedModel;
033 import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
034 import com.liferay.portal.service.ResourceLocalService;
035 import com.liferay.portal.service.ResourceService;
036 import com.liferay.portal.service.UserLocalService;
037 import com.liferay.portal.service.UserService;
038 import com.liferay.portal.service.persistence.ResourceFinder;
039 import com.liferay.portal.service.persistence.ResourcePersistence;
040 import com.liferay.portal.service.persistence.UserFinder;
041 import com.liferay.portal.service.persistence.UserPersistence;
042
043 import com.liferay.portlet.asset.service.AssetEntryLocalService;
044 import com.liferay.portlet.asset.service.AssetEntryService;
045 import com.liferay.portlet.asset.service.persistence.AssetEntryFinder;
046 import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
047 import com.liferay.portlet.blogs.service.BlogsEntryLocalService;
048 import com.liferay.portlet.blogs.service.BlogsEntryService;
049 import com.liferay.portlet.blogs.service.BlogsStatsUserLocalService;
050 import com.liferay.portlet.blogs.service.persistence.BlogsEntryFinder;
051 import com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence;
052 import com.liferay.portlet.blogs.service.persistence.BlogsStatsUserFinder;
053 import com.liferay.portlet.blogs.service.persistence.BlogsStatsUserPersistence;
054 import com.liferay.portlet.ratings.model.RatingsEntry;
055 import com.liferay.portlet.ratings.service.RatingsEntryLocalService;
056 import com.liferay.portlet.ratings.service.RatingsEntryService;
057 import com.liferay.portlet.ratings.service.RatingsStatsLocalService;
058 import com.liferay.portlet.ratings.service.persistence.RatingsEntryFinder;
059 import com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence;
060 import com.liferay.portlet.ratings.service.persistence.RatingsStatsFinder;
061 import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
062 import com.liferay.portlet.social.service.SocialActivityLocalService;
063 import com.liferay.portlet.social.service.persistence.SocialActivityFinder;
064 import com.liferay.portlet.social.service.persistence.SocialActivityPersistence;
065
066 import java.io.Serializable;
067
068 import java.util.List;
069
070 import javax.sql.DataSource;
071
072
084 public abstract class RatingsEntryLocalServiceBaseImpl
085 implements RatingsEntryLocalService, IdentifiableBean {
086
091
092
099 public RatingsEntry addRatingsEntry(RatingsEntry ratingsEntry)
100 throws SystemException {
101 ratingsEntry.setNew(true);
102
103 ratingsEntry = ratingsEntryPersistence.update(ratingsEntry, false);
104
105 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
106
107 if (indexer != null) {
108 try {
109 indexer.reindex(ratingsEntry);
110 }
111 catch (SearchException se) {
112 if (_log.isWarnEnabled()) {
113 _log.warn(se, se);
114 }
115 }
116 }
117
118 return ratingsEntry;
119 }
120
121
127 public RatingsEntry createRatingsEntry(long entryId) {
128 return ratingsEntryPersistence.create(entryId);
129 }
130
131
138 public void deleteRatingsEntry(long entryId)
139 throws PortalException, SystemException {
140 RatingsEntry ratingsEntry = ratingsEntryPersistence.remove(entryId);
141
142 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
143
144 if (indexer != null) {
145 try {
146 indexer.delete(ratingsEntry);
147 }
148 catch (SearchException se) {
149 if (_log.isWarnEnabled()) {
150 _log.warn(se, se);
151 }
152 }
153 }
154 }
155
156
162 public void deleteRatingsEntry(RatingsEntry ratingsEntry)
163 throws SystemException {
164 ratingsEntryPersistence.remove(ratingsEntry);
165
166 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
167
168 if (indexer != null) {
169 try {
170 indexer.delete(ratingsEntry);
171 }
172 catch (SearchException se) {
173 if (_log.isWarnEnabled()) {
174 _log.warn(se, se);
175 }
176 }
177 }
178 }
179
180
187 @SuppressWarnings("rawtypes")
188 public List dynamicQuery(DynamicQuery dynamicQuery)
189 throws SystemException {
190 return ratingsEntryPersistence.findWithDynamicQuery(dynamicQuery);
191 }
192
193
206 @SuppressWarnings("rawtypes")
207 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
208 throws SystemException {
209 return ratingsEntryPersistence.findWithDynamicQuery(dynamicQuery,
210 start, end);
211 }
212
213
227 @SuppressWarnings("rawtypes")
228 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
229 OrderByComparator orderByComparator) throws SystemException {
230 return ratingsEntryPersistence.findWithDynamicQuery(dynamicQuery,
231 start, end, orderByComparator);
232 }
233
234
241 public long dynamicQueryCount(DynamicQuery dynamicQuery)
242 throws SystemException {
243 return ratingsEntryPersistence.countWithDynamicQuery(dynamicQuery);
244 }
245
246 public RatingsEntry fetchRatingsEntry(long entryId)
247 throws SystemException {
248 return ratingsEntryPersistence.fetchByPrimaryKey(entryId);
249 }
250
251
259 public RatingsEntry getRatingsEntry(long entryId)
260 throws PortalException, SystemException {
261 return ratingsEntryPersistence.findByPrimaryKey(entryId);
262 }
263
264 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
265 throws PortalException, SystemException {
266 return ratingsEntryPersistence.findByPrimaryKey(primaryKeyObj);
267 }
268
269
281 public List<RatingsEntry> getRatingsEntries(int start, int end)
282 throws SystemException {
283 return ratingsEntryPersistence.findAll(start, end);
284 }
285
286
292 public int getRatingsEntriesCount() throws SystemException {
293 return ratingsEntryPersistence.countAll();
294 }
295
296
303 public RatingsEntry updateRatingsEntry(RatingsEntry ratingsEntry)
304 throws SystemException {
305 return updateRatingsEntry(ratingsEntry, true);
306 }
307
308
316 public RatingsEntry updateRatingsEntry(RatingsEntry ratingsEntry,
317 boolean merge) throws SystemException {
318 ratingsEntry.setNew(false);
319
320 ratingsEntry = ratingsEntryPersistence.update(ratingsEntry, merge);
321
322 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
323
324 if (indexer != null) {
325 try {
326 indexer.reindex(ratingsEntry);
327 }
328 catch (SearchException se) {
329 if (_log.isWarnEnabled()) {
330 _log.warn(se, se);
331 }
332 }
333 }
334
335 return ratingsEntry;
336 }
337
338
343 public RatingsEntryLocalService getRatingsEntryLocalService() {
344 return ratingsEntryLocalService;
345 }
346
347
352 public void setRatingsEntryLocalService(
353 RatingsEntryLocalService ratingsEntryLocalService) {
354 this.ratingsEntryLocalService = ratingsEntryLocalService;
355 }
356
357
362 public RatingsEntryService getRatingsEntryService() {
363 return ratingsEntryService;
364 }
365
366
371 public void setRatingsEntryService(RatingsEntryService ratingsEntryService) {
372 this.ratingsEntryService = ratingsEntryService;
373 }
374
375
380 public RatingsEntryPersistence getRatingsEntryPersistence() {
381 return ratingsEntryPersistence;
382 }
383
384
389 public void setRatingsEntryPersistence(
390 RatingsEntryPersistence ratingsEntryPersistence) {
391 this.ratingsEntryPersistence = ratingsEntryPersistence;
392 }
393
394
399 public RatingsEntryFinder getRatingsEntryFinder() {
400 return ratingsEntryFinder;
401 }
402
403
408 public void setRatingsEntryFinder(RatingsEntryFinder ratingsEntryFinder) {
409 this.ratingsEntryFinder = ratingsEntryFinder;
410 }
411
412
417 public RatingsStatsLocalService getRatingsStatsLocalService() {
418 return ratingsStatsLocalService;
419 }
420
421
426 public void setRatingsStatsLocalService(
427 RatingsStatsLocalService ratingsStatsLocalService) {
428 this.ratingsStatsLocalService = ratingsStatsLocalService;
429 }
430
431
436 public RatingsStatsPersistence getRatingsStatsPersistence() {
437 return ratingsStatsPersistence;
438 }
439
440
445 public void setRatingsStatsPersistence(
446 RatingsStatsPersistence ratingsStatsPersistence) {
447 this.ratingsStatsPersistence = ratingsStatsPersistence;
448 }
449
450
455 public RatingsStatsFinder getRatingsStatsFinder() {
456 return ratingsStatsFinder;
457 }
458
459
464 public void setRatingsStatsFinder(RatingsStatsFinder ratingsStatsFinder) {
465 this.ratingsStatsFinder = ratingsStatsFinder;
466 }
467
468
473 public CounterLocalService getCounterLocalService() {
474 return counterLocalService;
475 }
476
477
482 public void setCounterLocalService(CounterLocalService counterLocalService) {
483 this.counterLocalService = counterLocalService;
484 }
485
486
491 public ResourceLocalService getResourceLocalService() {
492 return resourceLocalService;
493 }
494
495
500 public void setResourceLocalService(
501 ResourceLocalService resourceLocalService) {
502 this.resourceLocalService = resourceLocalService;
503 }
504
505
510 public ResourceService getResourceService() {
511 return resourceService;
512 }
513
514
519 public void setResourceService(ResourceService resourceService) {
520 this.resourceService = resourceService;
521 }
522
523
528 public ResourcePersistence getResourcePersistence() {
529 return resourcePersistence;
530 }
531
532
537 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
538 this.resourcePersistence = resourcePersistence;
539 }
540
541
546 public ResourceFinder getResourceFinder() {
547 return resourceFinder;
548 }
549
550
555 public void setResourceFinder(ResourceFinder resourceFinder) {
556 this.resourceFinder = resourceFinder;
557 }
558
559
564 public UserLocalService getUserLocalService() {
565 return userLocalService;
566 }
567
568
573 public void setUserLocalService(UserLocalService userLocalService) {
574 this.userLocalService = userLocalService;
575 }
576
577
582 public UserService getUserService() {
583 return userService;
584 }
585
586
591 public void setUserService(UserService userService) {
592 this.userService = userService;
593 }
594
595
600 public UserPersistence getUserPersistence() {
601 return userPersistence;
602 }
603
604
609 public void setUserPersistence(UserPersistence userPersistence) {
610 this.userPersistence = userPersistence;
611 }
612
613
618 public UserFinder getUserFinder() {
619 return userFinder;
620 }
621
622
627 public void setUserFinder(UserFinder userFinder) {
628 this.userFinder = userFinder;
629 }
630
631
636 public AssetEntryLocalService getAssetEntryLocalService() {
637 return assetEntryLocalService;
638 }
639
640
645 public void setAssetEntryLocalService(
646 AssetEntryLocalService assetEntryLocalService) {
647 this.assetEntryLocalService = assetEntryLocalService;
648 }
649
650
655 public AssetEntryService getAssetEntryService() {
656 return assetEntryService;
657 }
658
659
664 public void setAssetEntryService(AssetEntryService assetEntryService) {
665 this.assetEntryService = assetEntryService;
666 }
667
668
673 public AssetEntryPersistence getAssetEntryPersistence() {
674 return assetEntryPersistence;
675 }
676
677
682 public void setAssetEntryPersistence(
683 AssetEntryPersistence assetEntryPersistence) {
684 this.assetEntryPersistence = assetEntryPersistence;
685 }
686
687
692 public AssetEntryFinder getAssetEntryFinder() {
693 return assetEntryFinder;
694 }
695
696
701 public void setAssetEntryFinder(AssetEntryFinder assetEntryFinder) {
702 this.assetEntryFinder = assetEntryFinder;
703 }
704
705
710 public BlogsEntryLocalService getBlogsEntryLocalService() {
711 return blogsEntryLocalService;
712 }
713
714
719 public void setBlogsEntryLocalService(
720 BlogsEntryLocalService blogsEntryLocalService) {
721 this.blogsEntryLocalService = blogsEntryLocalService;
722 }
723
724
729 public BlogsEntryService getBlogsEntryService() {
730 return blogsEntryService;
731 }
732
733
738 public void setBlogsEntryService(BlogsEntryService blogsEntryService) {
739 this.blogsEntryService = blogsEntryService;
740 }
741
742
747 public BlogsEntryPersistence getBlogsEntryPersistence() {
748 return blogsEntryPersistence;
749 }
750
751
756 public void setBlogsEntryPersistence(
757 BlogsEntryPersistence blogsEntryPersistence) {
758 this.blogsEntryPersistence = blogsEntryPersistence;
759 }
760
761
766 public BlogsEntryFinder getBlogsEntryFinder() {
767 return blogsEntryFinder;
768 }
769
770
775 public void setBlogsEntryFinder(BlogsEntryFinder blogsEntryFinder) {
776 this.blogsEntryFinder = blogsEntryFinder;
777 }
778
779
784 public BlogsStatsUserLocalService getBlogsStatsUserLocalService() {
785 return blogsStatsUserLocalService;
786 }
787
788
793 public void setBlogsStatsUserLocalService(
794 BlogsStatsUserLocalService blogsStatsUserLocalService) {
795 this.blogsStatsUserLocalService = blogsStatsUserLocalService;
796 }
797
798
803 public BlogsStatsUserPersistence getBlogsStatsUserPersistence() {
804 return blogsStatsUserPersistence;
805 }
806
807
812 public void setBlogsStatsUserPersistence(
813 BlogsStatsUserPersistence blogsStatsUserPersistence) {
814 this.blogsStatsUserPersistence = blogsStatsUserPersistence;
815 }
816
817
822 public BlogsStatsUserFinder getBlogsStatsUserFinder() {
823 return blogsStatsUserFinder;
824 }
825
826
831 public void setBlogsStatsUserFinder(
832 BlogsStatsUserFinder blogsStatsUserFinder) {
833 this.blogsStatsUserFinder = blogsStatsUserFinder;
834 }
835
836
841 public SocialActivityLocalService getSocialActivityLocalService() {
842 return socialActivityLocalService;
843 }
844
845
850 public void setSocialActivityLocalService(
851 SocialActivityLocalService socialActivityLocalService) {
852 this.socialActivityLocalService = socialActivityLocalService;
853 }
854
855
860 public SocialActivityPersistence getSocialActivityPersistence() {
861 return socialActivityPersistence;
862 }
863
864
869 public void setSocialActivityPersistence(
870 SocialActivityPersistence socialActivityPersistence) {
871 this.socialActivityPersistence = socialActivityPersistence;
872 }
873
874
879 public SocialActivityFinder getSocialActivityFinder() {
880 return socialActivityFinder;
881 }
882
883
888 public void setSocialActivityFinder(
889 SocialActivityFinder socialActivityFinder) {
890 this.socialActivityFinder = socialActivityFinder;
891 }
892
893 public void afterPropertiesSet() {
894 persistedModelLocalServiceRegistry.register("com.liferay.portlet.ratings.model.RatingsEntry",
895 ratingsEntryLocalService);
896 }
897
898 public void destroy() {
899 persistedModelLocalServiceRegistry.unregister(
900 "com.liferay.portlet.ratings.model.RatingsEntry");
901 }
902
903
908 public String getBeanIdentifier() {
909 return _beanIdentifier;
910 }
911
912
917 public void setBeanIdentifier(String beanIdentifier) {
918 _beanIdentifier = beanIdentifier;
919 }
920
921 protected ClassLoader getClassLoader() {
922 Class<?> clazz = getClass();
923
924 return clazz.getClassLoader();
925 }
926
927 protected Class<?> getModelClass() {
928 return RatingsEntry.class;
929 }
930
931 protected String getModelClassName() {
932 return RatingsEntry.class.getName();
933 }
934
935
940 protected void runSQL(String sql) throws SystemException {
941 try {
942 DataSource dataSource = ratingsEntryPersistence.getDataSource();
943
944 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
945 sql, new int[0]);
946
947 sqlUpdate.update();
948 }
949 catch (Exception e) {
950 throw new SystemException(e);
951 }
952 }
953
954 @BeanReference(type = RatingsEntryLocalService.class)
955 protected RatingsEntryLocalService ratingsEntryLocalService;
956 @BeanReference(type = RatingsEntryService.class)
957 protected RatingsEntryService ratingsEntryService;
958 @BeanReference(type = RatingsEntryPersistence.class)
959 protected RatingsEntryPersistence ratingsEntryPersistence;
960 @BeanReference(type = RatingsEntryFinder.class)
961 protected RatingsEntryFinder ratingsEntryFinder;
962 @BeanReference(type = RatingsStatsLocalService.class)
963 protected RatingsStatsLocalService ratingsStatsLocalService;
964 @BeanReference(type = RatingsStatsPersistence.class)
965 protected RatingsStatsPersistence ratingsStatsPersistence;
966 @BeanReference(type = RatingsStatsFinder.class)
967 protected RatingsStatsFinder ratingsStatsFinder;
968 @BeanReference(type = CounterLocalService.class)
969 protected CounterLocalService counterLocalService;
970 @BeanReference(type = ResourceLocalService.class)
971 protected ResourceLocalService resourceLocalService;
972 @BeanReference(type = ResourceService.class)
973 protected ResourceService resourceService;
974 @BeanReference(type = ResourcePersistence.class)
975 protected ResourcePersistence resourcePersistence;
976 @BeanReference(type = ResourceFinder.class)
977 protected ResourceFinder resourceFinder;
978 @BeanReference(type = UserLocalService.class)
979 protected UserLocalService userLocalService;
980 @BeanReference(type = UserService.class)
981 protected UserService userService;
982 @BeanReference(type = UserPersistence.class)
983 protected UserPersistence userPersistence;
984 @BeanReference(type = UserFinder.class)
985 protected UserFinder userFinder;
986 @BeanReference(type = AssetEntryLocalService.class)
987 protected AssetEntryLocalService assetEntryLocalService;
988 @BeanReference(type = AssetEntryService.class)
989 protected AssetEntryService assetEntryService;
990 @BeanReference(type = AssetEntryPersistence.class)
991 protected AssetEntryPersistence assetEntryPersistence;
992 @BeanReference(type = AssetEntryFinder.class)
993 protected AssetEntryFinder assetEntryFinder;
994 @BeanReference(type = BlogsEntryLocalService.class)
995 protected BlogsEntryLocalService blogsEntryLocalService;
996 @BeanReference(type = BlogsEntryService.class)
997 protected BlogsEntryService blogsEntryService;
998 @BeanReference(type = BlogsEntryPersistence.class)
999 protected BlogsEntryPersistence blogsEntryPersistence;
1000 @BeanReference(type = BlogsEntryFinder.class)
1001 protected BlogsEntryFinder blogsEntryFinder;
1002 @BeanReference(type = BlogsStatsUserLocalService.class)
1003 protected BlogsStatsUserLocalService blogsStatsUserLocalService;
1004 @BeanReference(type = BlogsStatsUserPersistence.class)
1005 protected BlogsStatsUserPersistence blogsStatsUserPersistence;
1006 @BeanReference(type = BlogsStatsUserFinder.class)
1007 protected BlogsStatsUserFinder blogsStatsUserFinder;
1008 @BeanReference(type = SocialActivityLocalService.class)
1009 protected SocialActivityLocalService socialActivityLocalService;
1010 @BeanReference(type = SocialActivityPersistence.class)
1011 protected SocialActivityPersistence socialActivityPersistence;
1012 @BeanReference(type = SocialActivityFinder.class)
1013 protected SocialActivityFinder socialActivityFinder;
1014 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
1015 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
1016 private static Log _log = LogFactoryUtil.getLog(RatingsEntryLocalServiceBaseImpl.class);
1017 private String _beanIdentifier;
1018 }