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.annotation.BeanReference;
020 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
021 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
022 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
023 import com.liferay.portal.kernel.exception.PortalException;
024 import com.liferay.portal.kernel.exception.SystemException;
025 import com.liferay.portal.kernel.util.OrderByComparator;
026 import com.liferay.portal.service.ResourceLocalService;
027 import com.liferay.portal.service.ResourceService;
028 import com.liferay.portal.service.UserLocalService;
029 import com.liferay.portal.service.UserService;
030 import com.liferay.portal.service.persistence.ResourceFinder;
031 import com.liferay.portal.service.persistence.ResourcePersistence;
032 import com.liferay.portal.service.persistence.UserFinder;
033 import com.liferay.portal.service.persistence.UserPersistence;
034
035 import com.liferay.portlet.ratings.model.RatingsStats;
036 import com.liferay.portlet.ratings.service.RatingsEntryLocalService;
037 import com.liferay.portlet.ratings.service.RatingsEntryService;
038 import com.liferay.portlet.ratings.service.RatingsStatsLocalService;
039 import com.liferay.portlet.ratings.service.persistence.RatingsEntryFinder;
040 import com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence;
041 import com.liferay.portlet.ratings.service.persistence.RatingsStatsFinder;
042 import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
043
044 import java.util.List;
045
046 import javax.sql.DataSource;
047
048
051 public abstract class RatingsStatsLocalServiceBaseImpl
052 implements RatingsStatsLocalService {
053 public RatingsStats addRatingsStats(RatingsStats ratingsStats)
054 throws SystemException {
055 ratingsStats.setNew(true);
056
057 return ratingsStatsPersistence.update(ratingsStats, false);
058 }
059
060 public RatingsStats createRatingsStats(long statsId) {
061 return ratingsStatsPersistence.create(statsId);
062 }
063
064 public void deleteRatingsStats(long statsId)
065 throws PortalException, SystemException {
066 ratingsStatsPersistence.remove(statsId);
067 }
068
069 public void deleteRatingsStats(RatingsStats ratingsStats)
070 throws SystemException {
071 ratingsStatsPersistence.remove(ratingsStats);
072 }
073
074 @SuppressWarnings("unchecked")
075 public List dynamicQuery(DynamicQuery dynamicQuery)
076 throws SystemException {
077 return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery);
078 }
079
080 @SuppressWarnings("unchecked")
081 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
082 throws SystemException {
083 return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery,
084 start, end);
085 }
086
087 @SuppressWarnings("unchecked")
088 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
089 OrderByComparator orderByComparator) throws SystemException {
090 return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery,
091 start, end, orderByComparator);
092 }
093
094 public long dynamicQueryCount(DynamicQuery dynamicQuery)
095 throws SystemException {
096 return ratingsStatsPersistence.countWithDynamicQuery(dynamicQuery);
097 }
098
099 public RatingsStats getRatingsStats(long statsId)
100 throws PortalException, SystemException {
101 return ratingsStatsPersistence.findByPrimaryKey(statsId);
102 }
103
104 public List<RatingsStats> getRatingsStatses(int start, int end)
105 throws SystemException {
106 return ratingsStatsPersistence.findAll(start, end);
107 }
108
109 public int getRatingsStatsesCount() throws SystemException {
110 return ratingsStatsPersistence.countAll();
111 }
112
113 public RatingsStats updateRatingsStats(RatingsStats ratingsStats)
114 throws SystemException {
115 ratingsStats.setNew(false);
116
117 return ratingsStatsPersistence.update(ratingsStats, true);
118 }
119
120 public RatingsStats updateRatingsStats(RatingsStats ratingsStats,
121 boolean merge) throws SystemException {
122 ratingsStats.setNew(false);
123
124 return ratingsStatsPersistence.update(ratingsStats, merge);
125 }
126
127 public RatingsEntryLocalService getRatingsEntryLocalService() {
128 return ratingsEntryLocalService;
129 }
130
131 public void setRatingsEntryLocalService(
132 RatingsEntryLocalService ratingsEntryLocalService) {
133 this.ratingsEntryLocalService = ratingsEntryLocalService;
134 }
135
136 public RatingsEntryService getRatingsEntryService() {
137 return ratingsEntryService;
138 }
139
140 public void setRatingsEntryService(RatingsEntryService ratingsEntryService) {
141 this.ratingsEntryService = ratingsEntryService;
142 }
143
144 public RatingsEntryPersistence getRatingsEntryPersistence() {
145 return ratingsEntryPersistence;
146 }
147
148 public void setRatingsEntryPersistence(
149 RatingsEntryPersistence ratingsEntryPersistence) {
150 this.ratingsEntryPersistence = ratingsEntryPersistence;
151 }
152
153 public RatingsEntryFinder getRatingsEntryFinder() {
154 return ratingsEntryFinder;
155 }
156
157 public void setRatingsEntryFinder(RatingsEntryFinder ratingsEntryFinder) {
158 this.ratingsEntryFinder = ratingsEntryFinder;
159 }
160
161 public RatingsStatsLocalService getRatingsStatsLocalService() {
162 return ratingsStatsLocalService;
163 }
164
165 public void setRatingsStatsLocalService(
166 RatingsStatsLocalService ratingsStatsLocalService) {
167 this.ratingsStatsLocalService = ratingsStatsLocalService;
168 }
169
170 public RatingsStatsPersistence getRatingsStatsPersistence() {
171 return ratingsStatsPersistence;
172 }
173
174 public void setRatingsStatsPersistence(
175 RatingsStatsPersistence ratingsStatsPersistence) {
176 this.ratingsStatsPersistence = ratingsStatsPersistence;
177 }
178
179 public RatingsStatsFinder getRatingsStatsFinder() {
180 return ratingsStatsFinder;
181 }
182
183 public void setRatingsStatsFinder(RatingsStatsFinder ratingsStatsFinder) {
184 this.ratingsStatsFinder = ratingsStatsFinder;
185 }
186
187 public CounterLocalService getCounterLocalService() {
188 return counterLocalService;
189 }
190
191 public void setCounterLocalService(CounterLocalService counterLocalService) {
192 this.counterLocalService = counterLocalService;
193 }
194
195 public ResourceLocalService getResourceLocalService() {
196 return resourceLocalService;
197 }
198
199 public void setResourceLocalService(
200 ResourceLocalService resourceLocalService) {
201 this.resourceLocalService = resourceLocalService;
202 }
203
204 public ResourceService getResourceService() {
205 return resourceService;
206 }
207
208 public void setResourceService(ResourceService resourceService) {
209 this.resourceService = resourceService;
210 }
211
212 public ResourcePersistence getResourcePersistence() {
213 return resourcePersistence;
214 }
215
216 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
217 this.resourcePersistence = resourcePersistence;
218 }
219
220 public ResourceFinder getResourceFinder() {
221 return resourceFinder;
222 }
223
224 public void setResourceFinder(ResourceFinder resourceFinder) {
225 this.resourceFinder = resourceFinder;
226 }
227
228 public UserLocalService getUserLocalService() {
229 return userLocalService;
230 }
231
232 public void setUserLocalService(UserLocalService userLocalService) {
233 this.userLocalService = userLocalService;
234 }
235
236 public UserService getUserService() {
237 return userService;
238 }
239
240 public void setUserService(UserService userService) {
241 this.userService = userService;
242 }
243
244 public UserPersistence getUserPersistence() {
245 return userPersistence;
246 }
247
248 public void setUserPersistence(UserPersistence userPersistence) {
249 this.userPersistence = userPersistence;
250 }
251
252 public UserFinder getUserFinder() {
253 return userFinder;
254 }
255
256 public void setUserFinder(UserFinder userFinder) {
257 this.userFinder = userFinder;
258 }
259
260 protected void runSQL(String sql) throws SystemException {
261 try {
262 DataSource dataSource = ratingsStatsPersistence.getDataSource();
263
264 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
265 sql, new int[0]);
266
267 sqlUpdate.update();
268 }
269 catch (Exception e) {
270 throw new SystemException(e);
271 }
272 }
273
274 @BeanReference(type = RatingsEntryLocalService.class)
275 protected RatingsEntryLocalService ratingsEntryLocalService;
276 @BeanReference(type = RatingsEntryService.class)
277 protected RatingsEntryService ratingsEntryService;
278 @BeanReference(type = RatingsEntryPersistence.class)
279 protected RatingsEntryPersistence ratingsEntryPersistence;
280 @BeanReference(type = RatingsEntryFinder.class)
281 protected RatingsEntryFinder ratingsEntryFinder;
282 @BeanReference(type = RatingsStatsLocalService.class)
283 protected RatingsStatsLocalService ratingsStatsLocalService;
284 @BeanReference(type = RatingsStatsPersistence.class)
285 protected RatingsStatsPersistence ratingsStatsPersistence;
286 @BeanReference(type = RatingsStatsFinder.class)
287 protected RatingsStatsFinder ratingsStatsFinder;
288 @BeanReference(type = CounterLocalService.class)
289 protected CounterLocalService counterLocalService;
290 @BeanReference(type = ResourceLocalService.class)
291 protected ResourceLocalService resourceLocalService;
292 @BeanReference(type = ResourceService.class)
293 protected ResourceService resourceService;
294 @BeanReference(type = ResourcePersistence.class)
295 protected ResourcePersistence resourcePersistence;
296 @BeanReference(type = ResourceFinder.class)
297 protected ResourceFinder resourceFinder;
298 @BeanReference(type = UserLocalService.class)
299 protected UserLocalService userLocalService;
300 @BeanReference(type = UserService.class)
301 protected UserService userService;
302 @BeanReference(type = UserPersistence.class)
303 protected UserPersistence userPersistence;
304 @BeanReference(type = UserFinder.class)
305 protected UserFinder userFinder;
306 }