001
014
015 package com.liferay.portlet.social.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.social.model.SocialRelation;
044 import com.liferay.portlet.social.service.SocialActivityAchievementLocalService;
045 import com.liferay.portlet.social.service.SocialActivityCounterLocalService;
046 import com.liferay.portlet.social.service.SocialActivityInterpreterLocalService;
047 import com.liferay.portlet.social.service.SocialActivityLimitLocalService;
048 import com.liferay.portlet.social.service.SocialActivityLocalService;
049 import com.liferay.portlet.social.service.SocialActivitySettingLocalService;
050 import com.liferay.portlet.social.service.SocialActivitySettingService;
051 import com.liferay.portlet.social.service.SocialRelationLocalService;
052 import com.liferay.portlet.social.service.SocialRequestInterpreterLocalService;
053 import com.liferay.portlet.social.service.SocialRequestLocalService;
054 import com.liferay.portlet.social.service.persistence.SocialActivityAchievementPersistence;
055 import com.liferay.portlet.social.service.persistence.SocialActivityCounterFinder;
056 import com.liferay.portlet.social.service.persistence.SocialActivityCounterPersistence;
057 import com.liferay.portlet.social.service.persistence.SocialActivityFinder;
058 import com.liferay.portlet.social.service.persistence.SocialActivityLimitPersistence;
059 import com.liferay.portlet.social.service.persistence.SocialActivityPersistence;
060 import com.liferay.portlet.social.service.persistence.SocialActivitySettingPersistence;
061 import com.liferay.portlet.social.service.persistence.SocialRelationPersistence;
062 import com.liferay.portlet.social.service.persistence.SocialRequestPersistence;
063
064 import java.io.Serializable;
065
066 import java.util.List;
067
068 import javax.sql.DataSource;
069
070
082 public abstract class SocialRelationLocalServiceBaseImpl
083 implements SocialRelationLocalService, IdentifiableBean {
084
089
090
097 public SocialRelation addSocialRelation(SocialRelation socialRelation)
098 throws SystemException {
099 socialRelation.setNew(true);
100
101 socialRelation = socialRelationPersistence.update(socialRelation, false);
102
103 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
104
105 if (indexer != null) {
106 try {
107 indexer.reindex(socialRelation);
108 }
109 catch (SearchException se) {
110 if (_log.isWarnEnabled()) {
111 _log.warn(se, se);
112 }
113 }
114 }
115
116 return socialRelation;
117 }
118
119
125 public SocialRelation createSocialRelation(long relationId) {
126 return socialRelationPersistence.create(relationId);
127 }
128
129
136 public void deleteSocialRelation(long relationId)
137 throws PortalException, SystemException {
138 SocialRelation socialRelation = socialRelationPersistence.remove(relationId);
139
140 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
141
142 if (indexer != null) {
143 try {
144 indexer.delete(socialRelation);
145 }
146 catch (SearchException se) {
147 if (_log.isWarnEnabled()) {
148 _log.warn(se, se);
149 }
150 }
151 }
152 }
153
154
160 public void deleteSocialRelation(SocialRelation socialRelation)
161 throws SystemException {
162 socialRelationPersistence.remove(socialRelation);
163
164 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
165
166 if (indexer != null) {
167 try {
168 indexer.delete(socialRelation);
169 }
170 catch (SearchException se) {
171 if (_log.isWarnEnabled()) {
172 _log.warn(se, se);
173 }
174 }
175 }
176 }
177
178
185 @SuppressWarnings("rawtypes")
186 public List dynamicQuery(DynamicQuery dynamicQuery)
187 throws SystemException {
188 return socialRelationPersistence.findWithDynamicQuery(dynamicQuery);
189 }
190
191
204 @SuppressWarnings("rawtypes")
205 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
206 throws SystemException {
207 return socialRelationPersistence.findWithDynamicQuery(dynamicQuery,
208 start, end);
209 }
210
211
225 @SuppressWarnings("rawtypes")
226 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
227 OrderByComparator orderByComparator) throws SystemException {
228 return socialRelationPersistence.findWithDynamicQuery(dynamicQuery,
229 start, end, orderByComparator);
230 }
231
232
239 public long dynamicQueryCount(DynamicQuery dynamicQuery)
240 throws SystemException {
241 return socialRelationPersistence.countWithDynamicQuery(dynamicQuery);
242 }
243
244 public SocialRelation fetchSocialRelation(long relationId)
245 throws SystemException {
246 return socialRelationPersistence.fetchByPrimaryKey(relationId);
247 }
248
249
257 public SocialRelation getSocialRelation(long relationId)
258 throws PortalException, SystemException {
259 return socialRelationPersistence.findByPrimaryKey(relationId);
260 }
261
262 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
263 throws PortalException, SystemException {
264 return socialRelationPersistence.findByPrimaryKey(primaryKeyObj);
265 }
266
267
279 public List<SocialRelation> getSocialRelations(int start, int end)
280 throws SystemException {
281 return socialRelationPersistence.findAll(start, end);
282 }
283
284
290 public int getSocialRelationsCount() throws SystemException {
291 return socialRelationPersistence.countAll();
292 }
293
294
301 public SocialRelation updateSocialRelation(SocialRelation socialRelation)
302 throws SystemException {
303 return updateSocialRelation(socialRelation, true);
304 }
305
306
314 public SocialRelation updateSocialRelation(SocialRelation socialRelation,
315 boolean merge) throws SystemException {
316 socialRelation.setNew(false);
317
318 socialRelation = socialRelationPersistence.update(socialRelation, merge);
319
320 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
321
322 if (indexer != null) {
323 try {
324 indexer.reindex(socialRelation);
325 }
326 catch (SearchException se) {
327 if (_log.isWarnEnabled()) {
328 _log.warn(se, se);
329 }
330 }
331 }
332
333 return socialRelation;
334 }
335
336
341 public SocialActivityLocalService getSocialActivityLocalService() {
342 return socialActivityLocalService;
343 }
344
345
350 public void setSocialActivityLocalService(
351 SocialActivityLocalService socialActivityLocalService) {
352 this.socialActivityLocalService = socialActivityLocalService;
353 }
354
355
360 public SocialActivityPersistence getSocialActivityPersistence() {
361 return socialActivityPersistence;
362 }
363
364
369 public void setSocialActivityPersistence(
370 SocialActivityPersistence socialActivityPersistence) {
371 this.socialActivityPersistence = socialActivityPersistence;
372 }
373
374
379 public SocialActivityFinder getSocialActivityFinder() {
380 return socialActivityFinder;
381 }
382
383
388 public void setSocialActivityFinder(
389 SocialActivityFinder socialActivityFinder) {
390 this.socialActivityFinder = socialActivityFinder;
391 }
392
393
398 public SocialActivityAchievementLocalService getSocialActivityAchievementLocalService() {
399 return socialActivityAchievementLocalService;
400 }
401
402
407 public void setSocialActivityAchievementLocalService(
408 SocialActivityAchievementLocalService socialActivityAchievementLocalService) {
409 this.socialActivityAchievementLocalService = socialActivityAchievementLocalService;
410 }
411
412
417 public SocialActivityAchievementPersistence getSocialActivityAchievementPersistence() {
418 return socialActivityAchievementPersistence;
419 }
420
421
426 public void setSocialActivityAchievementPersistence(
427 SocialActivityAchievementPersistence socialActivityAchievementPersistence) {
428 this.socialActivityAchievementPersistence = socialActivityAchievementPersistence;
429 }
430
431
436 public SocialActivityCounterLocalService getSocialActivityCounterLocalService() {
437 return socialActivityCounterLocalService;
438 }
439
440
445 public void setSocialActivityCounterLocalService(
446 SocialActivityCounterLocalService socialActivityCounterLocalService) {
447 this.socialActivityCounterLocalService = socialActivityCounterLocalService;
448 }
449
450
455 public SocialActivityCounterPersistence getSocialActivityCounterPersistence() {
456 return socialActivityCounterPersistence;
457 }
458
459
464 public void setSocialActivityCounterPersistence(
465 SocialActivityCounterPersistence socialActivityCounterPersistence) {
466 this.socialActivityCounterPersistence = socialActivityCounterPersistence;
467 }
468
469
474 public SocialActivityCounterFinder getSocialActivityCounterFinder() {
475 return socialActivityCounterFinder;
476 }
477
478
483 public void setSocialActivityCounterFinder(
484 SocialActivityCounterFinder socialActivityCounterFinder) {
485 this.socialActivityCounterFinder = socialActivityCounterFinder;
486 }
487
488
493 public SocialActivityInterpreterLocalService getSocialActivityInterpreterLocalService() {
494 return socialActivityInterpreterLocalService;
495 }
496
497
502 public void setSocialActivityInterpreterLocalService(
503 SocialActivityInterpreterLocalService socialActivityInterpreterLocalService) {
504 this.socialActivityInterpreterLocalService = socialActivityInterpreterLocalService;
505 }
506
507
512 public SocialActivityLimitLocalService getSocialActivityLimitLocalService() {
513 return socialActivityLimitLocalService;
514 }
515
516
521 public void setSocialActivityLimitLocalService(
522 SocialActivityLimitLocalService socialActivityLimitLocalService) {
523 this.socialActivityLimitLocalService = socialActivityLimitLocalService;
524 }
525
526
531 public SocialActivityLimitPersistence getSocialActivityLimitPersistence() {
532 return socialActivityLimitPersistence;
533 }
534
535
540 public void setSocialActivityLimitPersistence(
541 SocialActivityLimitPersistence socialActivityLimitPersistence) {
542 this.socialActivityLimitPersistence = socialActivityLimitPersistence;
543 }
544
545
550 public SocialActivitySettingLocalService getSocialActivitySettingLocalService() {
551 return socialActivitySettingLocalService;
552 }
553
554
559 public void setSocialActivitySettingLocalService(
560 SocialActivitySettingLocalService socialActivitySettingLocalService) {
561 this.socialActivitySettingLocalService = socialActivitySettingLocalService;
562 }
563
564
569 public SocialActivitySettingService getSocialActivitySettingService() {
570 return socialActivitySettingService;
571 }
572
573
578 public void setSocialActivitySettingService(
579 SocialActivitySettingService socialActivitySettingService) {
580 this.socialActivitySettingService = socialActivitySettingService;
581 }
582
583
588 public SocialActivitySettingPersistence getSocialActivitySettingPersistence() {
589 return socialActivitySettingPersistence;
590 }
591
592
597 public void setSocialActivitySettingPersistence(
598 SocialActivitySettingPersistence socialActivitySettingPersistence) {
599 this.socialActivitySettingPersistence = socialActivitySettingPersistence;
600 }
601
602
607 public SocialRelationLocalService getSocialRelationLocalService() {
608 return socialRelationLocalService;
609 }
610
611
616 public void setSocialRelationLocalService(
617 SocialRelationLocalService socialRelationLocalService) {
618 this.socialRelationLocalService = socialRelationLocalService;
619 }
620
621
626 public SocialRelationPersistence getSocialRelationPersistence() {
627 return socialRelationPersistence;
628 }
629
630
635 public void setSocialRelationPersistence(
636 SocialRelationPersistence socialRelationPersistence) {
637 this.socialRelationPersistence = socialRelationPersistence;
638 }
639
640
645 public SocialRequestLocalService getSocialRequestLocalService() {
646 return socialRequestLocalService;
647 }
648
649
654 public void setSocialRequestLocalService(
655 SocialRequestLocalService socialRequestLocalService) {
656 this.socialRequestLocalService = socialRequestLocalService;
657 }
658
659
664 public SocialRequestPersistence getSocialRequestPersistence() {
665 return socialRequestPersistence;
666 }
667
668
673 public void setSocialRequestPersistence(
674 SocialRequestPersistence socialRequestPersistence) {
675 this.socialRequestPersistence = socialRequestPersistence;
676 }
677
678
683 public SocialRequestInterpreterLocalService getSocialRequestInterpreterLocalService() {
684 return socialRequestInterpreterLocalService;
685 }
686
687
692 public void setSocialRequestInterpreterLocalService(
693 SocialRequestInterpreterLocalService socialRequestInterpreterLocalService) {
694 this.socialRequestInterpreterLocalService = socialRequestInterpreterLocalService;
695 }
696
697
702 public CounterLocalService getCounterLocalService() {
703 return counterLocalService;
704 }
705
706
711 public void setCounterLocalService(CounterLocalService counterLocalService) {
712 this.counterLocalService = counterLocalService;
713 }
714
715
720 public ResourceLocalService getResourceLocalService() {
721 return resourceLocalService;
722 }
723
724
729 public void setResourceLocalService(
730 ResourceLocalService resourceLocalService) {
731 this.resourceLocalService = resourceLocalService;
732 }
733
734
739 public ResourceService getResourceService() {
740 return resourceService;
741 }
742
743
748 public void setResourceService(ResourceService resourceService) {
749 this.resourceService = resourceService;
750 }
751
752
757 public ResourcePersistence getResourcePersistence() {
758 return resourcePersistence;
759 }
760
761
766 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
767 this.resourcePersistence = resourcePersistence;
768 }
769
770
775 public ResourceFinder getResourceFinder() {
776 return resourceFinder;
777 }
778
779
784 public void setResourceFinder(ResourceFinder resourceFinder) {
785 this.resourceFinder = resourceFinder;
786 }
787
788
793 public UserLocalService getUserLocalService() {
794 return userLocalService;
795 }
796
797
802 public void setUserLocalService(UserLocalService userLocalService) {
803 this.userLocalService = userLocalService;
804 }
805
806
811 public UserService getUserService() {
812 return userService;
813 }
814
815
820 public void setUserService(UserService userService) {
821 this.userService = userService;
822 }
823
824
829 public UserPersistence getUserPersistence() {
830 return userPersistence;
831 }
832
833
838 public void setUserPersistence(UserPersistence userPersistence) {
839 this.userPersistence = userPersistence;
840 }
841
842
847 public UserFinder getUserFinder() {
848 return userFinder;
849 }
850
851
856 public void setUserFinder(UserFinder userFinder) {
857 this.userFinder = userFinder;
858 }
859
860 public void afterPropertiesSet() {
861 persistedModelLocalServiceRegistry.register("com.liferay.portlet.social.model.SocialRelation",
862 socialRelationLocalService);
863 }
864
865 public void destroy() {
866 persistedModelLocalServiceRegistry.unregister(
867 "com.liferay.portlet.social.model.SocialRelation");
868 }
869
870
875 public String getBeanIdentifier() {
876 return _beanIdentifier;
877 }
878
879
884 public void setBeanIdentifier(String beanIdentifier) {
885 _beanIdentifier = beanIdentifier;
886 }
887
888 protected ClassLoader getClassLoader() {
889 Class<?> clazz = getClass();
890
891 return clazz.getClassLoader();
892 }
893
894 protected Class<?> getModelClass() {
895 return SocialRelation.class;
896 }
897
898 protected String getModelClassName() {
899 return SocialRelation.class.getName();
900 }
901
902
907 protected void runSQL(String sql) throws SystemException {
908 try {
909 DataSource dataSource = socialRelationPersistence.getDataSource();
910
911 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
912 sql, new int[0]);
913
914 sqlUpdate.update();
915 }
916 catch (Exception e) {
917 throw new SystemException(e);
918 }
919 }
920
921 @BeanReference(type = SocialActivityLocalService.class)
922 protected SocialActivityLocalService socialActivityLocalService;
923 @BeanReference(type = SocialActivityPersistence.class)
924 protected SocialActivityPersistence socialActivityPersistence;
925 @BeanReference(type = SocialActivityFinder.class)
926 protected SocialActivityFinder socialActivityFinder;
927 @BeanReference(type = SocialActivityAchievementLocalService.class)
928 protected SocialActivityAchievementLocalService socialActivityAchievementLocalService;
929 @BeanReference(type = SocialActivityAchievementPersistence.class)
930 protected SocialActivityAchievementPersistence socialActivityAchievementPersistence;
931 @BeanReference(type = SocialActivityCounterLocalService.class)
932 protected SocialActivityCounterLocalService socialActivityCounterLocalService;
933 @BeanReference(type = SocialActivityCounterPersistence.class)
934 protected SocialActivityCounterPersistence socialActivityCounterPersistence;
935 @BeanReference(type = SocialActivityCounterFinder.class)
936 protected SocialActivityCounterFinder socialActivityCounterFinder;
937 @BeanReference(type = SocialActivityInterpreterLocalService.class)
938 protected SocialActivityInterpreterLocalService socialActivityInterpreterLocalService;
939 @BeanReference(type = SocialActivityLimitLocalService.class)
940 protected SocialActivityLimitLocalService socialActivityLimitLocalService;
941 @BeanReference(type = SocialActivityLimitPersistence.class)
942 protected SocialActivityLimitPersistence socialActivityLimitPersistence;
943 @BeanReference(type = SocialActivitySettingLocalService.class)
944 protected SocialActivitySettingLocalService socialActivitySettingLocalService;
945 @BeanReference(type = SocialActivitySettingService.class)
946 protected SocialActivitySettingService socialActivitySettingService;
947 @BeanReference(type = SocialActivitySettingPersistence.class)
948 protected SocialActivitySettingPersistence socialActivitySettingPersistence;
949 @BeanReference(type = SocialRelationLocalService.class)
950 protected SocialRelationLocalService socialRelationLocalService;
951 @BeanReference(type = SocialRelationPersistence.class)
952 protected SocialRelationPersistence socialRelationPersistence;
953 @BeanReference(type = SocialRequestLocalService.class)
954 protected SocialRequestLocalService socialRequestLocalService;
955 @BeanReference(type = SocialRequestPersistence.class)
956 protected SocialRequestPersistence socialRequestPersistence;
957 @BeanReference(type = SocialRequestInterpreterLocalService.class)
958 protected SocialRequestInterpreterLocalService socialRequestInterpreterLocalService;
959 @BeanReference(type = CounterLocalService.class)
960 protected CounterLocalService counterLocalService;
961 @BeanReference(type = ResourceLocalService.class)
962 protected ResourceLocalService resourceLocalService;
963 @BeanReference(type = ResourceService.class)
964 protected ResourceService resourceService;
965 @BeanReference(type = ResourcePersistence.class)
966 protected ResourcePersistence resourcePersistence;
967 @BeanReference(type = ResourceFinder.class)
968 protected ResourceFinder resourceFinder;
969 @BeanReference(type = UserLocalService.class)
970 protected UserLocalService userLocalService;
971 @BeanReference(type = UserService.class)
972 protected UserService userService;
973 @BeanReference(type = UserPersistence.class)
974 protected UserPersistence userPersistence;
975 @BeanReference(type = UserFinder.class)
976 protected UserFinder userFinder;
977 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
978 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
979 private static Log _log = LogFactoryUtil.getLog(SocialRelationLocalServiceBaseImpl.class);
980 private String _beanIdentifier;
981 }