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.dao.orm.DynamicQueryFactoryUtil;
025 import com.liferay.portal.kernel.exception.PortalException;
026 import com.liferay.portal.kernel.exception.SystemException;
027 import com.liferay.portal.kernel.search.Indexable;
028 import com.liferay.portal.kernel.search.IndexableType;
029 import com.liferay.portal.kernel.util.OrderByComparator;
030 import com.liferay.portal.model.PersistedModel;
031 import com.liferay.portal.service.BaseLocalServiceImpl;
032 import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
033 import com.liferay.portal.service.ResourceLocalService;
034 import com.liferay.portal.service.UserLocalService;
035 import com.liferay.portal.service.UserService;
036 import com.liferay.portal.service.persistence.UserFinder;
037 import com.liferay.portal.service.persistence.UserPersistence;
038
039 import com.liferay.portlet.ratings.model.RatingsStats;
040 import com.liferay.portlet.ratings.service.RatingsEntryLocalService;
041 import com.liferay.portlet.ratings.service.RatingsEntryService;
042 import com.liferay.portlet.ratings.service.RatingsStatsLocalService;
043 import com.liferay.portlet.ratings.service.persistence.RatingsEntryFinder;
044 import com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence;
045 import com.liferay.portlet.ratings.service.persistence.RatingsStatsFinder;
046 import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
047
048 import java.io.Serializable;
049
050 import java.util.List;
051
052 import javax.sql.DataSource;
053
054
066 public abstract class RatingsStatsLocalServiceBaseImpl
067 extends BaseLocalServiceImpl implements RatingsStatsLocalService,
068 IdentifiableBean {
069
074
075
082 @Indexable(type = IndexableType.REINDEX)
083 public RatingsStats addRatingsStats(RatingsStats ratingsStats)
084 throws SystemException {
085 ratingsStats.setNew(true);
086
087 return ratingsStatsPersistence.update(ratingsStats);
088 }
089
090
096 public RatingsStats createRatingsStats(long statsId) {
097 return ratingsStatsPersistence.create(statsId);
098 }
099
100
108 @Indexable(type = IndexableType.DELETE)
109 public RatingsStats deleteRatingsStats(long statsId)
110 throws PortalException, SystemException {
111 return ratingsStatsPersistence.remove(statsId);
112 }
113
114
121 @Indexable(type = IndexableType.DELETE)
122 public RatingsStats deleteRatingsStats(RatingsStats ratingsStats)
123 throws SystemException {
124 return ratingsStatsPersistence.remove(ratingsStats);
125 }
126
127 public DynamicQuery dynamicQuery() {
128 Class<?> clazz = getClass();
129
130 return DynamicQueryFactoryUtil.forClass(RatingsStats.class,
131 clazz.getClassLoader());
132 }
133
134
141 @SuppressWarnings("rawtypes")
142 public List dynamicQuery(DynamicQuery dynamicQuery)
143 throws SystemException {
144 return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery);
145 }
146
147
160 @SuppressWarnings("rawtypes")
161 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
162 throws SystemException {
163 return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery,
164 start, end);
165 }
166
167
181 @SuppressWarnings("rawtypes")
182 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
183 OrderByComparator orderByComparator) throws SystemException {
184 return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery,
185 start, end, orderByComparator);
186 }
187
188
195 public long dynamicQueryCount(DynamicQuery dynamicQuery)
196 throws SystemException {
197 return ratingsStatsPersistence.countWithDynamicQuery(dynamicQuery);
198 }
199
200 public RatingsStats fetchRatingsStats(long statsId)
201 throws SystemException {
202 return ratingsStatsPersistence.fetchByPrimaryKey(statsId);
203 }
204
205
213 public RatingsStats getRatingsStats(long statsId)
214 throws PortalException, SystemException {
215 return ratingsStatsPersistence.findByPrimaryKey(statsId);
216 }
217
218 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
219 throws PortalException, SystemException {
220 return ratingsStatsPersistence.findByPrimaryKey(primaryKeyObj);
221 }
222
223
235 public List<RatingsStats> getRatingsStatses(int start, int end)
236 throws SystemException {
237 return ratingsStatsPersistence.findAll(start, end);
238 }
239
240
246 public int getRatingsStatsesCount() throws SystemException {
247 return ratingsStatsPersistence.countAll();
248 }
249
250
257 @Indexable(type = IndexableType.REINDEX)
258 public RatingsStats updateRatingsStats(RatingsStats ratingsStats)
259 throws SystemException {
260 return ratingsStatsPersistence.update(ratingsStats);
261 }
262
263
268 public RatingsEntryLocalService getRatingsEntryLocalService() {
269 return ratingsEntryLocalService;
270 }
271
272
277 public void setRatingsEntryLocalService(
278 RatingsEntryLocalService ratingsEntryLocalService) {
279 this.ratingsEntryLocalService = ratingsEntryLocalService;
280 }
281
282
287 public RatingsEntryService getRatingsEntryService() {
288 return ratingsEntryService;
289 }
290
291
296 public void setRatingsEntryService(RatingsEntryService ratingsEntryService) {
297 this.ratingsEntryService = ratingsEntryService;
298 }
299
300
305 public RatingsEntryPersistence getRatingsEntryPersistence() {
306 return ratingsEntryPersistence;
307 }
308
309
314 public void setRatingsEntryPersistence(
315 RatingsEntryPersistence ratingsEntryPersistence) {
316 this.ratingsEntryPersistence = ratingsEntryPersistence;
317 }
318
319
324 public RatingsEntryFinder getRatingsEntryFinder() {
325 return ratingsEntryFinder;
326 }
327
328
333 public void setRatingsEntryFinder(RatingsEntryFinder ratingsEntryFinder) {
334 this.ratingsEntryFinder = ratingsEntryFinder;
335 }
336
337
342 public RatingsStatsLocalService getRatingsStatsLocalService() {
343 return ratingsStatsLocalService;
344 }
345
346
351 public void setRatingsStatsLocalService(
352 RatingsStatsLocalService ratingsStatsLocalService) {
353 this.ratingsStatsLocalService = ratingsStatsLocalService;
354 }
355
356
361 public RatingsStatsPersistence getRatingsStatsPersistence() {
362 return ratingsStatsPersistence;
363 }
364
365
370 public void setRatingsStatsPersistence(
371 RatingsStatsPersistence ratingsStatsPersistence) {
372 this.ratingsStatsPersistence = ratingsStatsPersistence;
373 }
374
375
380 public RatingsStatsFinder getRatingsStatsFinder() {
381 return ratingsStatsFinder;
382 }
383
384
389 public void setRatingsStatsFinder(RatingsStatsFinder ratingsStatsFinder) {
390 this.ratingsStatsFinder = ratingsStatsFinder;
391 }
392
393
398 public CounterLocalService getCounterLocalService() {
399 return counterLocalService;
400 }
401
402
407 public void setCounterLocalService(CounterLocalService counterLocalService) {
408 this.counterLocalService = counterLocalService;
409 }
410
411
416 public ResourceLocalService getResourceLocalService() {
417 return resourceLocalService;
418 }
419
420
425 public void setResourceLocalService(
426 ResourceLocalService resourceLocalService) {
427 this.resourceLocalService = resourceLocalService;
428 }
429
430
435 public UserLocalService getUserLocalService() {
436 return userLocalService;
437 }
438
439
444 public void setUserLocalService(UserLocalService userLocalService) {
445 this.userLocalService = userLocalService;
446 }
447
448
453 public UserService getUserService() {
454 return userService;
455 }
456
457
462 public void setUserService(UserService userService) {
463 this.userService = userService;
464 }
465
466
471 public UserPersistence getUserPersistence() {
472 return userPersistence;
473 }
474
475
480 public void setUserPersistence(UserPersistence userPersistence) {
481 this.userPersistence = userPersistence;
482 }
483
484
489 public UserFinder getUserFinder() {
490 return userFinder;
491 }
492
493
498 public void setUserFinder(UserFinder userFinder) {
499 this.userFinder = userFinder;
500 }
501
502 public void afterPropertiesSet() {
503 persistedModelLocalServiceRegistry.register("com.liferay.portlet.ratings.model.RatingsStats",
504 ratingsStatsLocalService);
505 }
506
507 public void destroy() {
508 persistedModelLocalServiceRegistry.unregister(
509 "com.liferay.portlet.ratings.model.RatingsStats");
510 }
511
512
517 public String getBeanIdentifier() {
518 return _beanIdentifier;
519 }
520
521
526 public void setBeanIdentifier(String beanIdentifier) {
527 _beanIdentifier = beanIdentifier;
528 }
529
530 protected Class<?> getModelClass() {
531 return RatingsStats.class;
532 }
533
534 protected String getModelClassName() {
535 return RatingsStats.class.getName();
536 }
537
538
543 protected void runSQL(String sql) throws SystemException {
544 try {
545 DataSource dataSource = ratingsStatsPersistence.getDataSource();
546
547 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
548 sql, new int[0]);
549
550 sqlUpdate.update();
551 }
552 catch (Exception e) {
553 throw new SystemException(e);
554 }
555 }
556
557 @BeanReference(type = RatingsEntryLocalService.class)
558 protected RatingsEntryLocalService ratingsEntryLocalService;
559 @BeanReference(type = RatingsEntryService.class)
560 protected RatingsEntryService ratingsEntryService;
561 @BeanReference(type = RatingsEntryPersistence.class)
562 protected RatingsEntryPersistence ratingsEntryPersistence;
563 @BeanReference(type = RatingsEntryFinder.class)
564 protected RatingsEntryFinder ratingsEntryFinder;
565 @BeanReference(type = RatingsStatsLocalService.class)
566 protected RatingsStatsLocalService ratingsStatsLocalService;
567 @BeanReference(type = RatingsStatsPersistence.class)
568 protected RatingsStatsPersistence ratingsStatsPersistence;
569 @BeanReference(type = RatingsStatsFinder.class)
570 protected RatingsStatsFinder ratingsStatsFinder;
571 @BeanReference(type = CounterLocalService.class)
572 protected CounterLocalService counterLocalService;
573 @BeanReference(type = ResourceLocalService.class)
574 protected ResourceLocalService resourceLocalService;
575 @BeanReference(type = UserLocalService.class)
576 protected UserLocalService userLocalService;
577 @BeanReference(type = UserService.class)
578 protected UserService userService;
579 @BeanReference(type = UserPersistence.class)
580 protected UserPersistence userPersistence;
581 @BeanReference(type = UserFinder.class)
582 protected UserFinder userFinder;
583 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
584 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
585 private String _beanIdentifier;
586 }