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.ResourceService;
035 import com.liferay.portal.service.UserLocalService;
036 import com.liferay.portal.service.UserService;
037 import com.liferay.portal.service.persistence.ResourceFinder;
038 import com.liferay.portal.service.persistence.ResourcePersistence;
039 import com.liferay.portal.service.persistence.UserFinder;
040 import com.liferay.portal.service.persistence.UserPersistence;
041
042 import com.liferay.portlet.ratings.model.RatingsStats;
043 import com.liferay.portlet.ratings.service.RatingsEntryLocalService;
044 import com.liferay.portlet.ratings.service.RatingsEntryService;
045 import com.liferay.portlet.ratings.service.RatingsStatsLocalService;
046 import com.liferay.portlet.ratings.service.persistence.RatingsEntryFinder;
047 import com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence;
048 import com.liferay.portlet.ratings.service.persistence.RatingsStatsFinder;
049 import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
050
051 import java.io.Serializable;
052
053 import java.util.List;
054
055 import javax.sql.DataSource;
056
057
069 public abstract class RatingsStatsLocalServiceBaseImpl
070 extends BaseLocalServiceImpl implements RatingsStatsLocalService,
071 IdentifiableBean {
072
077
078
085 @Indexable(type = IndexableType.REINDEX)
086 public RatingsStats addRatingsStats(RatingsStats ratingsStats)
087 throws SystemException {
088 ratingsStats.setNew(true);
089
090 return ratingsStatsPersistence.update(ratingsStats, false);
091 }
092
093
099 public RatingsStats createRatingsStats(long statsId) {
100 return ratingsStatsPersistence.create(statsId);
101 }
102
103
111 @Indexable(type = IndexableType.DELETE)
112 public RatingsStats deleteRatingsStats(long statsId)
113 throws PortalException, SystemException {
114 return ratingsStatsPersistence.remove(statsId);
115 }
116
117
124 @Indexable(type = IndexableType.DELETE)
125 public RatingsStats deleteRatingsStats(RatingsStats ratingsStats)
126 throws SystemException {
127 return ratingsStatsPersistence.remove(ratingsStats);
128 }
129
130 public DynamicQuery dynamicQuery() {
131 Class<?> clazz = getClass();
132
133 return DynamicQueryFactoryUtil.forClass(RatingsStats.class,
134 clazz.getClassLoader());
135 }
136
137
144 @SuppressWarnings("rawtypes")
145 public List dynamicQuery(DynamicQuery dynamicQuery)
146 throws SystemException {
147 return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery);
148 }
149
150
163 @SuppressWarnings("rawtypes")
164 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
165 throws SystemException {
166 return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery,
167 start, end);
168 }
169
170
184 @SuppressWarnings("rawtypes")
185 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
186 OrderByComparator orderByComparator) throws SystemException {
187 return ratingsStatsPersistence.findWithDynamicQuery(dynamicQuery,
188 start, end, orderByComparator);
189 }
190
191
198 public long dynamicQueryCount(DynamicQuery dynamicQuery)
199 throws SystemException {
200 return ratingsStatsPersistence.countWithDynamicQuery(dynamicQuery);
201 }
202
203 public RatingsStats fetchRatingsStats(long statsId)
204 throws SystemException {
205 return ratingsStatsPersistence.fetchByPrimaryKey(statsId);
206 }
207
208
216 public RatingsStats getRatingsStats(long statsId)
217 throws PortalException, SystemException {
218 return ratingsStatsPersistence.findByPrimaryKey(statsId);
219 }
220
221 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
222 throws PortalException, SystemException {
223 return ratingsStatsPersistence.findByPrimaryKey(primaryKeyObj);
224 }
225
226
238 public List<RatingsStats> getRatingsStatses(int start, int end)
239 throws SystemException {
240 return ratingsStatsPersistence.findAll(start, end);
241 }
242
243
249 public int getRatingsStatsesCount() throws SystemException {
250 return ratingsStatsPersistence.countAll();
251 }
252
253
260 @Indexable(type = IndexableType.REINDEX)
261 public RatingsStats updateRatingsStats(RatingsStats ratingsStats)
262 throws SystemException {
263 return updateRatingsStats(ratingsStats, true);
264 }
265
266
274 @Indexable(type = IndexableType.REINDEX)
275 public RatingsStats updateRatingsStats(RatingsStats ratingsStats,
276 boolean merge) throws SystemException {
277 ratingsStats.setNew(false);
278
279 return ratingsStatsPersistence.update(ratingsStats, merge);
280 }
281
282
287 public RatingsEntryLocalService getRatingsEntryLocalService() {
288 return ratingsEntryLocalService;
289 }
290
291
296 public void setRatingsEntryLocalService(
297 RatingsEntryLocalService ratingsEntryLocalService) {
298 this.ratingsEntryLocalService = ratingsEntryLocalService;
299 }
300
301
306 public RatingsEntryService getRatingsEntryService() {
307 return ratingsEntryService;
308 }
309
310
315 public void setRatingsEntryService(RatingsEntryService ratingsEntryService) {
316 this.ratingsEntryService = ratingsEntryService;
317 }
318
319
324 public RatingsEntryPersistence getRatingsEntryPersistence() {
325 return ratingsEntryPersistence;
326 }
327
328
333 public void setRatingsEntryPersistence(
334 RatingsEntryPersistence ratingsEntryPersistence) {
335 this.ratingsEntryPersistence = ratingsEntryPersistence;
336 }
337
338
343 public RatingsEntryFinder getRatingsEntryFinder() {
344 return ratingsEntryFinder;
345 }
346
347
352 public void setRatingsEntryFinder(RatingsEntryFinder ratingsEntryFinder) {
353 this.ratingsEntryFinder = ratingsEntryFinder;
354 }
355
356
361 public RatingsStatsLocalService getRatingsStatsLocalService() {
362 return ratingsStatsLocalService;
363 }
364
365
370 public void setRatingsStatsLocalService(
371 RatingsStatsLocalService ratingsStatsLocalService) {
372 this.ratingsStatsLocalService = ratingsStatsLocalService;
373 }
374
375
380 public RatingsStatsPersistence getRatingsStatsPersistence() {
381 return ratingsStatsPersistence;
382 }
383
384
389 public void setRatingsStatsPersistence(
390 RatingsStatsPersistence ratingsStatsPersistence) {
391 this.ratingsStatsPersistence = ratingsStatsPersistence;
392 }
393
394
399 public RatingsStatsFinder getRatingsStatsFinder() {
400 return ratingsStatsFinder;
401 }
402
403
408 public void setRatingsStatsFinder(RatingsStatsFinder ratingsStatsFinder) {
409 this.ratingsStatsFinder = ratingsStatsFinder;
410 }
411
412
417 public CounterLocalService getCounterLocalService() {
418 return counterLocalService;
419 }
420
421
426 public void setCounterLocalService(CounterLocalService counterLocalService) {
427 this.counterLocalService = counterLocalService;
428 }
429
430
435 public ResourceLocalService getResourceLocalService() {
436 return resourceLocalService;
437 }
438
439
444 public void setResourceLocalService(
445 ResourceLocalService resourceLocalService) {
446 this.resourceLocalService = resourceLocalService;
447 }
448
449
454 public ResourceService getResourceService() {
455 return resourceService;
456 }
457
458
463 public void setResourceService(ResourceService resourceService) {
464 this.resourceService = resourceService;
465 }
466
467
472 public ResourcePersistence getResourcePersistence() {
473 return resourcePersistence;
474 }
475
476
481 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
482 this.resourcePersistence = resourcePersistence;
483 }
484
485
490 public ResourceFinder getResourceFinder() {
491 return resourceFinder;
492 }
493
494
499 public void setResourceFinder(ResourceFinder resourceFinder) {
500 this.resourceFinder = resourceFinder;
501 }
502
503
508 public UserLocalService getUserLocalService() {
509 return userLocalService;
510 }
511
512
517 public void setUserLocalService(UserLocalService userLocalService) {
518 this.userLocalService = userLocalService;
519 }
520
521
526 public UserService getUserService() {
527 return userService;
528 }
529
530
535 public void setUserService(UserService userService) {
536 this.userService = userService;
537 }
538
539
544 public UserPersistence getUserPersistence() {
545 return userPersistence;
546 }
547
548
553 public void setUserPersistence(UserPersistence userPersistence) {
554 this.userPersistence = userPersistence;
555 }
556
557
562 public UserFinder getUserFinder() {
563 return userFinder;
564 }
565
566
571 public void setUserFinder(UserFinder userFinder) {
572 this.userFinder = userFinder;
573 }
574
575 public void afterPropertiesSet() {
576 persistedModelLocalServiceRegistry.register("com.liferay.portlet.ratings.model.RatingsStats",
577 ratingsStatsLocalService);
578 }
579
580 public void destroy() {
581 persistedModelLocalServiceRegistry.unregister(
582 "com.liferay.portlet.ratings.model.RatingsStats");
583 }
584
585
590 public String getBeanIdentifier() {
591 return _beanIdentifier;
592 }
593
594
599 public void setBeanIdentifier(String beanIdentifier) {
600 _beanIdentifier = beanIdentifier;
601 }
602
603 protected Class<?> getModelClass() {
604 return RatingsStats.class;
605 }
606
607 protected String getModelClassName() {
608 return RatingsStats.class.getName();
609 }
610
611
616 protected void runSQL(String sql) throws SystemException {
617 try {
618 DataSource dataSource = ratingsStatsPersistence.getDataSource();
619
620 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
621 sql, new int[0]);
622
623 sqlUpdate.update();
624 }
625 catch (Exception e) {
626 throw new SystemException(e);
627 }
628 }
629
630 @BeanReference(type = RatingsEntryLocalService.class)
631 protected RatingsEntryLocalService ratingsEntryLocalService;
632 @BeanReference(type = RatingsEntryService.class)
633 protected RatingsEntryService ratingsEntryService;
634 @BeanReference(type = RatingsEntryPersistence.class)
635 protected RatingsEntryPersistence ratingsEntryPersistence;
636 @BeanReference(type = RatingsEntryFinder.class)
637 protected RatingsEntryFinder ratingsEntryFinder;
638 @BeanReference(type = RatingsStatsLocalService.class)
639 protected RatingsStatsLocalService ratingsStatsLocalService;
640 @BeanReference(type = RatingsStatsPersistence.class)
641 protected RatingsStatsPersistence ratingsStatsPersistence;
642 @BeanReference(type = RatingsStatsFinder.class)
643 protected RatingsStatsFinder ratingsStatsFinder;
644 @BeanReference(type = CounterLocalService.class)
645 protected CounterLocalService counterLocalService;
646 @BeanReference(type = ResourceLocalService.class)
647 protected ResourceLocalService resourceLocalService;
648 @BeanReference(type = ResourceService.class)
649 protected ResourceService resourceService;
650 @BeanReference(type = ResourcePersistence.class)
651 protected ResourcePersistence resourcePersistence;
652 @BeanReference(type = ResourceFinder.class)
653 protected ResourceFinder resourceFinder;
654 @BeanReference(type = UserLocalService.class)
655 protected UserLocalService userLocalService;
656 @BeanReference(type = UserService.class)
657 protected UserService userService;
658 @BeanReference(type = UserPersistence.class)
659 protected UserPersistence userPersistence;
660 @BeanReference(type = UserFinder.class)
661 protected UserFinder userFinder;
662 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
663 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
664 private String _beanIdentifier;
665 }