1
22
23 package com.liferay.portlet.ratings.service.base;
24
25 import com.liferay.counter.service.CounterLocalService;
26 import com.liferay.counter.service.CounterLocalServiceFactory;
27 import com.liferay.counter.service.CounterService;
28 import com.liferay.counter.service.CounterServiceFactory;
29
30 import com.liferay.portal.SystemException;
31 import com.liferay.portal.kernel.dao.DynamicQueryInitializer;
32
33 import com.liferay.portlet.ratings.model.RatingsStats;
34 import com.liferay.portlet.ratings.model.impl.RatingsStatsImpl;
35 import com.liferay.portlet.ratings.service.RatingsEntryLocalService;
36 import com.liferay.portlet.ratings.service.RatingsEntryLocalServiceFactory;
37 import com.liferay.portlet.ratings.service.RatingsEntryService;
38 import com.liferay.portlet.ratings.service.RatingsEntryServiceFactory;
39 import com.liferay.portlet.ratings.service.RatingsStatsLocalService;
40 import com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence;
41 import com.liferay.portlet.ratings.service.persistence.RatingsEntryUtil;
42 import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
43 import com.liferay.portlet.ratings.service.persistence.RatingsStatsUtil;
44
45 import org.springframework.beans.factory.InitializingBean;
46
47 import java.util.List;
48
49
55 public abstract class RatingsStatsLocalServiceBaseImpl
56 implements RatingsStatsLocalService, InitializingBean {
57 public RatingsStats addRatingsStats(RatingsStats model)
58 throws SystemException {
59 RatingsStats ratingsStats = new RatingsStatsImpl();
60
61 ratingsStats.setNew(true);
62
63 ratingsStats.setStatsId(model.getStatsId());
64 ratingsStats.setClassNameId(model.getClassNameId());
65 ratingsStats.setClassPK(model.getClassPK());
66 ratingsStats.setTotalEntries(model.getTotalEntries());
67 ratingsStats.setTotalScore(model.getTotalScore());
68 ratingsStats.setAverageScore(model.getAverageScore());
69
70 return ratingsStatsPersistence.update(ratingsStats);
71 }
72
73 public List dynamicQuery(DynamicQueryInitializer queryInitializer)
74 throws SystemException {
75 return ratingsStatsPersistence.findWithDynamicQuery(queryInitializer);
76 }
77
78 public List dynamicQuery(DynamicQueryInitializer queryInitializer,
79 int begin, int end) throws SystemException {
80 return ratingsStatsPersistence.findWithDynamicQuery(queryInitializer,
81 begin, end);
82 }
83
84 public RatingsStats updateRatingsStats(RatingsStats model)
85 throws SystemException {
86 RatingsStats ratingsStats = new RatingsStatsImpl();
87
88 ratingsStats.setNew(false);
89
90 ratingsStats.setStatsId(model.getStatsId());
91 ratingsStats.setClassNameId(model.getClassNameId());
92 ratingsStats.setClassPK(model.getClassPK());
93 ratingsStats.setTotalEntries(model.getTotalEntries());
94 ratingsStats.setTotalScore(model.getTotalScore());
95 ratingsStats.setAverageScore(model.getAverageScore());
96
97 return ratingsStatsPersistence.update(ratingsStats);
98 }
99
100 public RatingsEntryLocalService getRatingsEntryLocalService() {
101 return ratingsEntryLocalService;
102 }
103
104 public void setRatingsEntryLocalService(
105 RatingsEntryLocalService ratingsEntryLocalService) {
106 this.ratingsEntryLocalService = ratingsEntryLocalService;
107 }
108
109 public RatingsEntryService getRatingsEntryService() {
110 return ratingsEntryService;
111 }
112
113 public void setRatingsEntryService(RatingsEntryService ratingsEntryService) {
114 this.ratingsEntryService = ratingsEntryService;
115 }
116
117 public RatingsEntryPersistence getRatingsEntryPersistence() {
118 return ratingsEntryPersistence;
119 }
120
121 public void setRatingsEntryPersistence(
122 RatingsEntryPersistence ratingsEntryPersistence) {
123 this.ratingsEntryPersistence = ratingsEntryPersistence;
124 }
125
126 public RatingsStatsPersistence getRatingsStatsPersistence() {
127 return ratingsStatsPersistence;
128 }
129
130 public void setRatingsStatsPersistence(
131 RatingsStatsPersistence ratingsStatsPersistence) {
132 this.ratingsStatsPersistence = ratingsStatsPersistence;
133 }
134
135 public CounterLocalService getCounterLocalService() {
136 return counterLocalService;
137 }
138
139 public void setCounterLocalService(CounterLocalService counterLocalService) {
140 this.counterLocalService = counterLocalService;
141 }
142
143 public CounterService getCounterService() {
144 return counterService;
145 }
146
147 public void setCounterService(CounterService counterService) {
148 this.counterService = counterService;
149 }
150
151 public void afterPropertiesSet() {
152 if (ratingsEntryLocalService == null) {
153 ratingsEntryLocalService = RatingsEntryLocalServiceFactory.getImpl();
154 }
155
156 if (ratingsEntryService == null) {
157 ratingsEntryService = RatingsEntryServiceFactory.getImpl();
158 }
159
160 if (ratingsEntryPersistence == null) {
161 ratingsEntryPersistence = RatingsEntryUtil.getPersistence();
162 }
163
164 if (ratingsStatsPersistence == null) {
165 ratingsStatsPersistence = RatingsStatsUtil.getPersistence();
166 }
167
168 if (counterLocalService == null) {
169 counterLocalService = CounterLocalServiceFactory.getImpl();
170 }
171
172 if (counterService == null) {
173 counterService = CounterServiceFactory.getImpl();
174 }
175 }
176
177 protected RatingsEntryLocalService ratingsEntryLocalService;
178 protected RatingsEntryService ratingsEntryService;
179 protected RatingsEntryPersistence ratingsEntryPersistence;
180 protected RatingsStatsPersistence ratingsStatsPersistence;
181 protected CounterLocalService counterLocalService;
182 protected CounterService counterService;
183 }