001
014
015 package com.liferay.portlet.polls.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.polls.model.PollsVote;
043 import com.liferay.portlet.polls.service.PollsChoiceLocalService;
044 import com.liferay.portlet.polls.service.PollsChoiceService;
045 import com.liferay.portlet.polls.service.PollsQuestionLocalService;
046 import com.liferay.portlet.polls.service.PollsQuestionService;
047 import com.liferay.portlet.polls.service.PollsVoteLocalService;
048 import com.liferay.portlet.polls.service.PollsVoteService;
049 import com.liferay.portlet.polls.service.persistence.PollsChoiceFinder;
050 import com.liferay.portlet.polls.service.persistence.PollsChoicePersistence;
051 import com.liferay.portlet.polls.service.persistence.PollsQuestionPersistence;
052 import com.liferay.portlet.polls.service.persistence.PollsVotePersistence;
053
054 import java.io.Serializable;
055
056 import java.util.List;
057
058 import javax.sql.DataSource;
059
060
072 public abstract class PollsVoteLocalServiceBaseImpl extends BaseLocalServiceImpl
073 implements PollsVoteLocalService, IdentifiableBean {
074
079
080
087 @Indexable(type = IndexableType.REINDEX)
088 public PollsVote addPollsVote(PollsVote pollsVote)
089 throws SystemException {
090 pollsVote.setNew(true);
091
092 return pollsVotePersistence.update(pollsVote, false);
093 }
094
095
101 public PollsVote createPollsVote(long voteId) {
102 return pollsVotePersistence.create(voteId);
103 }
104
105
113 @Indexable(type = IndexableType.DELETE)
114 public PollsVote deletePollsVote(long voteId)
115 throws PortalException, SystemException {
116 return pollsVotePersistence.remove(voteId);
117 }
118
119
126 @Indexable(type = IndexableType.DELETE)
127 public PollsVote deletePollsVote(PollsVote pollsVote)
128 throws SystemException {
129 return pollsVotePersistence.remove(pollsVote);
130 }
131
132 public DynamicQuery dynamicQuery() {
133 Class<?> clazz = getClass();
134
135 return DynamicQueryFactoryUtil.forClass(PollsVote.class,
136 clazz.getClassLoader());
137 }
138
139
146 @SuppressWarnings("rawtypes")
147 public List dynamicQuery(DynamicQuery dynamicQuery)
148 throws SystemException {
149 return pollsVotePersistence.findWithDynamicQuery(dynamicQuery);
150 }
151
152
165 @SuppressWarnings("rawtypes")
166 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
167 throws SystemException {
168 return pollsVotePersistence.findWithDynamicQuery(dynamicQuery, start,
169 end);
170 }
171
172
186 @SuppressWarnings("rawtypes")
187 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
188 OrderByComparator orderByComparator) throws SystemException {
189 return pollsVotePersistence.findWithDynamicQuery(dynamicQuery, start,
190 end, orderByComparator);
191 }
192
193
200 public long dynamicQueryCount(DynamicQuery dynamicQuery)
201 throws SystemException {
202 return pollsVotePersistence.countWithDynamicQuery(dynamicQuery);
203 }
204
205 public PollsVote fetchPollsVote(long voteId) throws SystemException {
206 return pollsVotePersistence.fetchByPrimaryKey(voteId);
207 }
208
209
217 public PollsVote getPollsVote(long voteId)
218 throws PortalException, SystemException {
219 return pollsVotePersistence.findByPrimaryKey(voteId);
220 }
221
222 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
223 throws PortalException, SystemException {
224 return pollsVotePersistence.findByPrimaryKey(primaryKeyObj);
225 }
226
227
239 public List<PollsVote> getPollsVotes(int start, int end)
240 throws SystemException {
241 return pollsVotePersistence.findAll(start, end);
242 }
243
244
250 public int getPollsVotesCount() throws SystemException {
251 return pollsVotePersistence.countAll();
252 }
253
254
261 @Indexable(type = IndexableType.REINDEX)
262 public PollsVote updatePollsVote(PollsVote pollsVote)
263 throws SystemException {
264 return updatePollsVote(pollsVote, true);
265 }
266
267
275 @Indexable(type = IndexableType.REINDEX)
276 public PollsVote updatePollsVote(PollsVote pollsVote, boolean merge)
277 throws SystemException {
278 pollsVote.setNew(false);
279
280 return pollsVotePersistence.update(pollsVote, merge);
281 }
282
283
288 public PollsChoiceLocalService getPollsChoiceLocalService() {
289 return pollsChoiceLocalService;
290 }
291
292
297 public void setPollsChoiceLocalService(
298 PollsChoiceLocalService pollsChoiceLocalService) {
299 this.pollsChoiceLocalService = pollsChoiceLocalService;
300 }
301
302
307 public PollsChoiceService getPollsChoiceService() {
308 return pollsChoiceService;
309 }
310
311
316 public void setPollsChoiceService(PollsChoiceService pollsChoiceService) {
317 this.pollsChoiceService = pollsChoiceService;
318 }
319
320
325 public PollsChoicePersistence getPollsChoicePersistence() {
326 return pollsChoicePersistence;
327 }
328
329
334 public void setPollsChoicePersistence(
335 PollsChoicePersistence pollsChoicePersistence) {
336 this.pollsChoicePersistence = pollsChoicePersistence;
337 }
338
339
344 public PollsChoiceFinder getPollsChoiceFinder() {
345 return pollsChoiceFinder;
346 }
347
348
353 public void setPollsChoiceFinder(PollsChoiceFinder pollsChoiceFinder) {
354 this.pollsChoiceFinder = pollsChoiceFinder;
355 }
356
357
362 public PollsQuestionLocalService getPollsQuestionLocalService() {
363 return pollsQuestionLocalService;
364 }
365
366
371 public void setPollsQuestionLocalService(
372 PollsQuestionLocalService pollsQuestionLocalService) {
373 this.pollsQuestionLocalService = pollsQuestionLocalService;
374 }
375
376
381 public PollsQuestionService getPollsQuestionService() {
382 return pollsQuestionService;
383 }
384
385
390 public void setPollsQuestionService(
391 PollsQuestionService pollsQuestionService) {
392 this.pollsQuestionService = pollsQuestionService;
393 }
394
395
400 public PollsQuestionPersistence getPollsQuestionPersistence() {
401 return pollsQuestionPersistence;
402 }
403
404
409 public void setPollsQuestionPersistence(
410 PollsQuestionPersistence pollsQuestionPersistence) {
411 this.pollsQuestionPersistence = pollsQuestionPersistence;
412 }
413
414
419 public PollsVoteLocalService getPollsVoteLocalService() {
420 return pollsVoteLocalService;
421 }
422
423
428 public void setPollsVoteLocalService(
429 PollsVoteLocalService pollsVoteLocalService) {
430 this.pollsVoteLocalService = pollsVoteLocalService;
431 }
432
433
438 public PollsVoteService getPollsVoteService() {
439 return pollsVoteService;
440 }
441
442
447 public void setPollsVoteService(PollsVoteService pollsVoteService) {
448 this.pollsVoteService = pollsVoteService;
449 }
450
451
456 public PollsVotePersistence getPollsVotePersistence() {
457 return pollsVotePersistence;
458 }
459
460
465 public void setPollsVotePersistence(
466 PollsVotePersistence pollsVotePersistence) {
467 this.pollsVotePersistence = pollsVotePersistence;
468 }
469
470
475 public CounterLocalService getCounterLocalService() {
476 return counterLocalService;
477 }
478
479
484 public void setCounterLocalService(CounterLocalService counterLocalService) {
485 this.counterLocalService = counterLocalService;
486 }
487
488
493 public ResourceLocalService getResourceLocalService() {
494 return resourceLocalService;
495 }
496
497
502 public void setResourceLocalService(
503 ResourceLocalService resourceLocalService) {
504 this.resourceLocalService = resourceLocalService;
505 }
506
507
512 public ResourceService getResourceService() {
513 return resourceService;
514 }
515
516
521 public void setResourceService(ResourceService resourceService) {
522 this.resourceService = resourceService;
523 }
524
525
530 public ResourcePersistence getResourcePersistence() {
531 return resourcePersistence;
532 }
533
534
539 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
540 this.resourcePersistence = resourcePersistence;
541 }
542
543
548 public ResourceFinder getResourceFinder() {
549 return resourceFinder;
550 }
551
552
557 public void setResourceFinder(ResourceFinder resourceFinder) {
558 this.resourceFinder = resourceFinder;
559 }
560
561
566 public UserLocalService getUserLocalService() {
567 return userLocalService;
568 }
569
570
575 public void setUserLocalService(UserLocalService userLocalService) {
576 this.userLocalService = userLocalService;
577 }
578
579
584 public UserService getUserService() {
585 return userService;
586 }
587
588
593 public void setUserService(UserService userService) {
594 this.userService = userService;
595 }
596
597
602 public UserPersistence getUserPersistence() {
603 return userPersistence;
604 }
605
606
611 public void setUserPersistence(UserPersistence userPersistence) {
612 this.userPersistence = userPersistence;
613 }
614
615
620 public UserFinder getUserFinder() {
621 return userFinder;
622 }
623
624
629 public void setUserFinder(UserFinder userFinder) {
630 this.userFinder = userFinder;
631 }
632
633 public void afterPropertiesSet() {
634 persistedModelLocalServiceRegistry.register("com.liferay.portlet.polls.model.PollsVote",
635 pollsVoteLocalService);
636 }
637
638 public void destroy() {
639 persistedModelLocalServiceRegistry.unregister(
640 "com.liferay.portlet.polls.model.PollsVote");
641 }
642
643
648 public String getBeanIdentifier() {
649 return _beanIdentifier;
650 }
651
652
657 public void setBeanIdentifier(String beanIdentifier) {
658 _beanIdentifier = beanIdentifier;
659 }
660
661 protected Class<?> getModelClass() {
662 return PollsVote.class;
663 }
664
665 protected String getModelClassName() {
666 return PollsVote.class.getName();
667 }
668
669
674 protected void runSQL(String sql) throws SystemException {
675 try {
676 DataSource dataSource = pollsVotePersistence.getDataSource();
677
678 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
679 sql, new int[0]);
680
681 sqlUpdate.update();
682 }
683 catch (Exception e) {
684 throw new SystemException(e);
685 }
686 }
687
688 @BeanReference(type = PollsChoiceLocalService.class)
689 protected PollsChoiceLocalService pollsChoiceLocalService;
690 @BeanReference(type = PollsChoiceService.class)
691 protected PollsChoiceService pollsChoiceService;
692 @BeanReference(type = PollsChoicePersistence.class)
693 protected PollsChoicePersistence pollsChoicePersistence;
694 @BeanReference(type = PollsChoiceFinder.class)
695 protected PollsChoiceFinder pollsChoiceFinder;
696 @BeanReference(type = PollsQuestionLocalService.class)
697 protected PollsQuestionLocalService pollsQuestionLocalService;
698 @BeanReference(type = PollsQuestionService.class)
699 protected PollsQuestionService pollsQuestionService;
700 @BeanReference(type = PollsQuestionPersistence.class)
701 protected PollsQuestionPersistence pollsQuestionPersistence;
702 @BeanReference(type = PollsVoteLocalService.class)
703 protected PollsVoteLocalService pollsVoteLocalService;
704 @BeanReference(type = PollsVoteService.class)
705 protected PollsVoteService pollsVoteService;
706 @BeanReference(type = PollsVotePersistence.class)
707 protected PollsVotePersistence pollsVotePersistence;
708 @BeanReference(type = CounterLocalService.class)
709 protected CounterLocalService counterLocalService;
710 @BeanReference(type = ResourceLocalService.class)
711 protected ResourceLocalService resourceLocalService;
712 @BeanReference(type = ResourceService.class)
713 protected ResourceService resourceService;
714 @BeanReference(type = ResourcePersistence.class)
715 protected ResourcePersistence resourcePersistence;
716 @BeanReference(type = ResourceFinder.class)
717 protected ResourceFinder resourceFinder;
718 @BeanReference(type = UserLocalService.class)
719 protected UserLocalService userLocalService;
720 @BeanReference(type = UserService.class)
721 protected UserService userService;
722 @BeanReference(type = UserPersistence.class)
723 protected UserPersistence userPersistence;
724 @BeanReference(type = UserFinder.class)
725 protected UserFinder userFinder;
726 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
727 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
728 private String _beanIdentifier;
729 }