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.PollsChoice;
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 PollsChoiceLocalServiceBaseImpl
073 extends BaseLocalServiceImpl implements PollsChoiceLocalService,
074 IdentifiableBean {
075
080
081
088 @Indexable(type = IndexableType.REINDEX)
089 public PollsChoice addPollsChoice(PollsChoice pollsChoice)
090 throws SystemException {
091 pollsChoice.setNew(true);
092
093 return pollsChoicePersistence.update(pollsChoice, false);
094 }
095
096
102 public PollsChoice createPollsChoice(long choiceId) {
103 return pollsChoicePersistence.create(choiceId);
104 }
105
106
114 @Indexable(type = IndexableType.DELETE)
115 public PollsChoice deletePollsChoice(long choiceId)
116 throws PortalException, SystemException {
117 return pollsChoicePersistence.remove(choiceId);
118 }
119
120
127 @Indexable(type = IndexableType.DELETE)
128 public PollsChoice deletePollsChoice(PollsChoice pollsChoice)
129 throws SystemException {
130 return pollsChoicePersistence.remove(pollsChoice);
131 }
132
133 public DynamicQuery dynamicQuery() {
134 Class<?> clazz = getClass();
135
136 return DynamicQueryFactoryUtil.forClass(PollsChoice.class,
137 clazz.getClassLoader());
138 }
139
140
147 @SuppressWarnings("rawtypes")
148 public List dynamicQuery(DynamicQuery dynamicQuery)
149 throws SystemException {
150 return pollsChoicePersistence.findWithDynamicQuery(dynamicQuery);
151 }
152
153
166 @SuppressWarnings("rawtypes")
167 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
168 throws SystemException {
169 return pollsChoicePersistence.findWithDynamicQuery(dynamicQuery, start,
170 end);
171 }
172
173
187 @SuppressWarnings("rawtypes")
188 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
189 OrderByComparator orderByComparator) throws SystemException {
190 return pollsChoicePersistence.findWithDynamicQuery(dynamicQuery, start,
191 end, orderByComparator);
192 }
193
194
201 public long dynamicQueryCount(DynamicQuery dynamicQuery)
202 throws SystemException {
203 return pollsChoicePersistence.countWithDynamicQuery(dynamicQuery);
204 }
205
206 public PollsChoice fetchPollsChoice(long choiceId)
207 throws SystemException {
208 return pollsChoicePersistence.fetchByPrimaryKey(choiceId);
209 }
210
211
219 public PollsChoice getPollsChoice(long choiceId)
220 throws PortalException, SystemException {
221 return pollsChoicePersistence.findByPrimaryKey(choiceId);
222 }
223
224 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
225 throws PortalException, SystemException {
226 return pollsChoicePersistence.findByPrimaryKey(primaryKeyObj);
227 }
228
229
241 public List<PollsChoice> getPollsChoices(int start, int end)
242 throws SystemException {
243 return pollsChoicePersistence.findAll(start, end);
244 }
245
246
252 public int getPollsChoicesCount() throws SystemException {
253 return pollsChoicePersistence.countAll();
254 }
255
256
263 @Indexable(type = IndexableType.REINDEX)
264 public PollsChoice updatePollsChoice(PollsChoice pollsChoice)
265 throws SystemException {
266 return updatePollsChoice(pollsChoice, true);
267 }
268
269
277 @Indexable(type = IndexableType.REINDEX)
278 public PollsChoice updatePollsChoice(PollsChoice pollsChoice, boolean merge)
279 throws SystemException {
280 pollsChoice.setNew(false);
281
282 return pollsChoicePersistence.update(pollsChoice, merge);
283 }
284
285
290 public PollsChoiceLocalService getPollsChoiceLocalService() {
291 return pollsChoiceLocalService;
292 }
293
294
299 public void setPollsChoiceLocalService(
300 PollsChoiceLocalService pollsChoiceLocalService) {
301 this.pollsChoiceLocalService = pollsChoiceLocalService;
302 }
303
304
309 public PollsChoiceService getPollsChoiceService() {
310 return pollsChoiceService;
311 }
312
313
318 public void setPollsChoiceService(PollsChoiceService pollsChoiceService) {
319 this.pollsChoiceService = pollsChoiceService;
320 }
321
322
327 public PollsChoicePersistence getPollsChoicePersistence() {
328 return pollsChoicePersistence;
329 }
330
331
336 public void setPollsChoicePersistence(
337 PollsChoicePersistence pollsChoicePersistence) {
338 this.pollsChoicePersistence = pollsChoicePersistence;
339 }
340
341
346 public PollsChoiceFinder getPollsChoiceFinder() {
347 return pollsChoiceFinder;
348 }
349
350
355 public void setPollsChoiceFinder(PollsChoiceFinder pollsChoiceFinder) {
356 this.pollsChoiceFinder = pollsChoiceFinder;
357 }
358
359
364 public PollsQuestionLocalService getPollsQuestionLocalService() {
365 return pollsQuestionLocalService;
366 }
367
368
373 public void setPollsQuestionLocalService(
374 PollsQuestionLocalService pollsQuestionLocalService) {
375 this.pollsQuestionLocalService = pollsQuestionLocalService;
376 }
377
378
383 public PollsQuestionService getPollsQuestionService() {
384 return pollsQuestionService;
385 }
386
387
392 public void setPollsQuestionService(
393 PollsQuestionService pollsQuestionService) {
394 this.pollsQuestionService = pollsQuestionService;
395 }
396
397
402 public PollsQuestionPersistence getPollsQuestionPersistence() {
403 return pollsQuestionPersistence;
404 }
405
406
411 public void setPollsQuestionPersistence(
412 PollsQuestionPersistence pollsQuestionPersistence) {
413 this.pollsQuestionPersistence = pollsQuestionPersistence;
414 }
415
416
421 public PollsVoteLocalService getPollsVoteLocalService() {
422 return pollsVoteLocalService;
423 }
424
425
430 public void setPollsVoteLocalService(
431 PollsVoteLocalService pollsVoteLocalService) {
432 this.pollsVoteLocalService = pollsVoteLocalService;
433 }
434
435
440 public PollsVoteService getPollsVoteService() {
441 return pollsVoteService;
442 }
443
444
449 public void setPollsVoteService(PollsVoteService pollsVoteService) {
450 this.pollsVoteService = pollsVoteService;
451 }
452
453
458 public PollsVotePersistence getPollsVotePersistence() {
459 return pollsVotePersistence;
460 }
461
462
467 public void setPollsVotePersistence(
468 PollsVotePersistence pollsVotePersistence) {
469 this.pollsVotePersistence = pollsVotePersistence;
470 }
471
472
477 public CounterLocalService getCounterLocalService() {
478 return counterLocalService;
479 }
480
481
486 public void setCounterLocalService(CounterLocalService counterLocalService) {
487 this.counterLocalService = counterLocalService;
488 }
489
490
495 public ResourceLocalService getResourceLocalService() {
496 return resourceLocalService;
497 }
498
499
504 public void setResourceLocalService(
505 ResourceLocalService resourceLocalService) {
506 this.resourceLocalService = resourceLocalService;
507 }
508
509
514 public ResourceService getResourceService() {
515 return resourceService;
516 }
517
518
523 public void setResourceService(ResourceService resourceService) {
524 this.resourceService = resourceService;
525 }
526
527
532 public ResourcePersistence getResourcePersistence() {
533 return resourcePersistence;
534 }
535
536
541 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
542 this.resourcePersistence = resourcePersistence;
543 }
544
545
550 public ResourceFinder getResourceFinder() {
551 return resourceFinder;
552 }
553
554
559 public void setResourceFinder(ResourceFinder resourceFinder) {
560 this.resourceFinder = resourceFinder;
561 }
562
563
568 public UserLocalService getUserLocalService() {
569 return userLocalService;
570 }
571
572
577 public void setUserLocalService(UserLocalService userLocalService) {
578 this.userLocalService = userLocalService;
579 }
580
581
586 public UserService getUserService() {
587 return userService;
588 }
589
590
595 public void setUserService(UserService userService) {
596 this.userService = userService;
597 }
598
599
604 public UserPersistence getUserPersistence() {
605 return userPersistence;
606 }
607
608
613 public void setUserPersistence(UserPersistence userPersistence) {
614 this.userPersistence = userPersistence;
615 }
616
617
622 public UserFinder getUserFinder() {
623 return userFinder;
624 }
625
626
631 public void setUserFinder(UserFinder userFinder) {
632 this.userFinder = userFinder;
633 }
634
635 public void afterPropertiesSet() {
636 persistedModelLocalServiceRegistry.register("com.liferay.portlet.polls.model.PollsChoice",
637 pollsChoiceLocalService);
638 }
639
640 public void destroy() {
641 persistedModelLocalServiceRegistry.unregister(
642 "com.liferay.portlet.polls.model.PollsChoice");
643 }
644
645
650 public String getBeanIdentifier() {
651 return _beanIdentifier;
652 }
653
654
659 public void setBeanIdentifier(String beanIdentifier) {
660 _beanIdentifier = beanIdentifier;
661 }
662
663 protected Class<?> getModelClass() {
664 return PollsChoice.class;
665 }
666
667 protected String getModelClassName() {
668 return PollsChoice.class.getName();
669 }
670
671
676 protected void runSQL(String sql) throws SystemException {
677 try {
678 DataSource dataSource = pollsChoicePersistence.getDataSource();
679
680 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
681 sql, new int[0]);
682
683 sqlUpdate.update();
684 }
685 catch (Exception e) {
686 throw new SystemException(e);
687 }
688 }
689
690 @BeanReference(type = PollsChoiceLocalService.class)
691 protected PollsChoiceLocalService pollsChoiceLocalService;
692 @BeanReference(type = PollsChoiceService.class)
693 protected PollsChoiceService pollsChoiceService;
694 @BeanReference(type = PollsChoicePersistence.class)
695 protected PollsChoicePersistence pollsChoicePersistence;
696 @BeanReference(type = PollsChoiceFinder.class)
697 protected PollsChoiceFinder pollsChoiceFinder;
698 @BeanReference(type = PollsQuestionLocalService.class)
699 protected PollsQuestionLocalService pollsQuestionLocalService;
700 @BeanReference(type = PollsQuestionService.class)
701 protected PollsQuestionService pollsQuestionService;
702 @BeanReference(type = PollsQuestionPersistence.class)
703 protected PollsQuestionPersistence pollsQuestionPersistence;
704 @BeanReference(type = PollsVoteLocalService.class)
705 protected PollsVoteLocalService pollsVoteLocalService;
706 @BeanReference(type = PollsVoteService.class)
707 protected PollsVoteService pollsVoteService;
708 @BeanReference(type = PollsVotePersistence.class)
709 protected PollsVotePersistence pollsVotePersistence;
710 @BeanReference(type = CounterLocalService.class)
711 protected CounterLocalService counterLocalService;
712 @BeanReference(type = ResourceLocalService.class)
713 protected ResourceLocalService resourceLocalService;
714 @BeanReference(type = ResourceService.class)
715 protected ResourceService resourceService;
716 @BeanReference(type = ResourcePersistence.class)
717 protected ResourcePersistence resourcePersistence;
718 @BeanReference(type = ResourceFinder.class)
719 protected ResourceFinder resourceFinder;
720 @BeanReference(type = UserLocalService.class)
721 protected UserLocalService userLocalService;
722 @BeanReference(type = UserService.class)
723 protected UserService userService;
724 @BeanReference(type = UserPersistence.class)
725 protected UserPersistence userPersistence;
726 @BeanReference(type = UserFinder.class)
727 protected UserFinder userFinder;
728 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
729 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
730 private String _beanIdentifier;
731 }