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.PollsQuestion;
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 PollsQuestionLocalServiceBaseImpl
073 extends BaseLocalServiceImpl implements PollsQuestionLocalService,
074 IdentifiableBean {
075
080
081
088 @Indexable(type = IndexableType.REINDEX)
089 public PollsQuestion addPollsQuestion(PollsQuestion pollsQuestion)
090 throws SystemException {
091 pollsQuestion.setNew(true);
092
093 return pollsQuestionPersistence.update(pollsQuestion, false);
094 }
095
096
102 public PollsQuestion createPollsQuestion(long questionId) {
103 return pollsQuestionPersistence.create(questionId);
104 }
105
106
114 @Indexable(type = IndexableType.DELETE)
115 public PollsQuestion deletePollsQuestion(long questionId)
116 throws PortalException, SystemException {
117 return pollsQuestionPersistence.remove(questionId);
118 }
119
120
127 @Indexable(type = IndexableType.DELETE)
128 public PollsQuestion deletePollsQuestion(PollsQuestion pollsQuestion)
129 throws SystemException {
130 return pollsQuestionPersistence.remove(pollsQuestion);
131 }
132
133 public DynamicQuery dynamicQuery() {
134 Class<?> clazz = getClass();
135
136 return DynamicQueryFactoryUtil.forClass(PollsQuestion.class,
137 clazz.getClassLoader());
138 }
139
140
147 @SuppressWarnings("rawtypes")
148 public List dynamicQuery(DynamicQuery dynamicQuery)
149 throws SystemException {
150 return pollsQuestionPersistence.findWithDynamicQuery(dynamicQuery);
151 }
152
153
166 @SuppressWarnings("rawtypes")
167 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
168 throws SystemException {
169 return pollsQuestionPersistence.findWithDynamicQuery(dynamicQuery,
170 start, end);
171 }
172
173
187 @SuppressWarnings("rawtypes")
188 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
189 OrderByComparator orderByComparator) throws SystemException {
190 return pollsQuestionPersistence.findWithDynamicQuery(dynamicQuery,
191 start, end, orderByComparator);
192 }
193
194
201 public long dynamicQueryCount(DynamicQuery dynamicQuery)
202 throws SystemException {
203 return pollsQuestionPersistence.countWithDynamicQuery(dynamicQuery);
204 }
205
206 public PollsQuestion fetchPollsQuestion(long questionId)
207 throws SystemException {
208 return pollsQuestionPersistence.fetchByPrimaryKey(questionId);
209 }
210
211
219 public PollsQuestion getPollsQuestion(long questionId)
220 throws PortalException, SystemException {
221 return pollsQuestionPersistence.findByPrimaryKey(questionId);
222 }
223
224 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
225 throws PortalException, SystemException {
226 return pollsQuestionPersistence.findByPrimaryKey(primaryKeyObj);
227 }
228
229
238 public PollsQuestion getPollsQuestionByUuidAndGroupId(String uuid,
239 long groupId) throws PortalException, SystemException {
240 return pollsQuestionPersistence.findByUUID_G(uuid, groupId);
241 }
242
243
255 public List<PollsQuestion> getPollsQuestions(int start, int end)
256 throws SystemException {
257 return pollsQuestionPersistence.findAll(start, end);
258 }
259
260
266 public int getPollsQuestionsCount() throws SystemException {
267 return pollsQuestionPersistence.countAll();
268 }
269
270
277 @Indexable(type = IndexableType.REINDEX)
278 public PollsQuestion updatePollsQuestion(PollsQuestion pollsQuestion)
279 throws SystemException {
280 return updatePollsQuestion(pollsQuestion, true);
281 }
282
283
291 @Indexable(type = IndexableType.REINDEX)
292 public PollsQuestion updatePollsQuestion(PollsQuestion pollsQuestion,
293 boolean merge) throws SystemException {
294 pollsQuestion.setNew(false);
295
296 return pollsQuestionPersistence.update(pollsQuestion, merge);
297 }
298
299
304 public PollsChoiceLocalService getPollsChoiceLocalService() {
305 return pollsChoiceLocalService;
306 }
307
308
313 public void setPollsChoiceLocalService(
314 PollsChoiceLocalService pollsChoiceLocalService) {
315 this.pollsChoiceLocalService = pollsChoiceLocalService;
316 }
317
318
323 public PollsChoiceService getPollsChoiceService() {
324 return pollsChoiceService;
325 }
326
327
332 public void setPollsChoiceService(PollsChoiceService pollsChoiceService) {
333 this.pollsChoiceService = pollsChoiceService;
334 }
335
336
341 public PollsChoicePersistence getPollsChoicePersistence() {
342 return pollsChoicePersistence;
343 }
344
345
350 public void setPollsChoicePersistence(
351 PollsChoicePersistence pollsChoicePersistence) {
352 this.pollsChoicePersistence = pollsChoicePersistence;
353 }
354
355
360 public PollsChoiceFinder getPollsChoiceFinder() {
361 return pollsChoiceFinder;
362 }
363
364
369 public void setPollsChoiceFinder(PollsChoiceFinder pollsChoiceFinder) {
370 this.pollsChoiceFinder = pollsChoiceFinder;
371 }
372
373
378 public PollsQuestionLocalService getPollsQuestionLocalService() {
379 return pollsQuestionLocalService;
380 }
381
382
387 public void setPollsQuestionLocalService(
388 PollsQuestionLocalService pollsQuestionLocalService) {
389 this.pollsQuestionLocalService = pollsQuestionLocalService;
390 }
391
392
397 public PollsQuestionService getPollsQuestionService() {
398 return pollsQuestionService;
399 }
400
401
406 public void setPollsQuestionService(
407 PollsQuestionService pollsQuestionService) {
408 this.pollsQuestionService = pollsQuestionService;
409 }
410
411
416 public PollsQuestionPersistence getPollsQuestionPersistence() {
417 return pollsQuestionPersistence;
418 }
419
420
425 public void setPollsQuestionPersistence(
426 PollsQuestionPersistence pollsQuestionPersistence) {
427 this.pollsQuestionPersistence = pollsQuestionPersistence;
428 }
429
430
435 public PollsVoteLocalService getPollsVoteLocalService() {
436 return pollsVoteLocalService;
437 }
438
439
444 public void setPollsVoteLocalService(
445 PollsVoteLocalService pollsVoteLocalService) {
446 this.pollsVoteLocalService = pollsVoteLocalService;
447 }
448
449
454 public PollsVoteService getPollsVoteService() {
455 return pollsVoteService;
456 }
457
458
463 public void setPollsVoteService(PollsVoteService pollsVoteService) {
464 this.pollsVoteService = pollsVoteService;
465 }
466
467
472 public PollsVotePersistence getPollsVotePersistence() {
473 return pollsVotePersistence;
474 }
475
476
481 public void setPollsVotePersistence(
482 PollsVotePersistence pollsVotePersistence) {
483 this.pollsVotePersistence = pollsVotePersistence;
484 }
485
486
491 public CounterLocalService getCounterLocalService() {
492 return counterLocalService;
493 }
494
495
500 public void setCounterLocalService(CounterLocalService counterLocalService) {
501 this.counterLocalService = counterLocalService;
502 }
503
504
509 public ResourceLocalService getResourceLocalService() {
510 return resourceLocalService;
511 }
512
513
518 public void setResourceLocalService(
519 ResourceLocalService resourceLocalService) {
520 this.resourceLocalService = resourceLocalService;
521 }
522
523
528 public ResourceService getResourceService() {
529 return resourceService;
530 }
531
532
537 public void setResourceService(ResourceService resourceService) {
538 this.resourceService = resourceService;
539 }
540
541
546 public ResourcePersistence getResourcePersistence() {
547 return resourcePersistence;
548 }
549
550
555 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
556 this.resourcePersistence = resourcePersistence;
557 }
558
559
564 public ResourceFinder getResourceFinder() {
565 return resourceFinder;
566 }
567
568
573 public void setResourceFinder(ResourceFinder resourceFinder) {
574 this.resourceFinder = resourceFinder;
575 }
576
577
582 public UserLocalService getUserLocalService() {
583 return userLocalService;
584 }
585
586
591 public void setUserLocalService(UserLocalService userLocalService) {
592 this.userLocalService = userLocalService;
593 }
594
595
600 public UserService getUserService() {
601 return userService;
602 }
603
604
609 public void setUserService(UserService userService) {
610 this.userService = userService;
611 }
612
613
618 public UserPersistence getUserPersistence() {
619 return userPersistence;
620 }
621
622
627 public void setUserPersistence(UserPersistence userPersistence) {
628 this.userPersistence = userPersistence;
629 }
630
631
636 public UserFinder getUserFinder() {
637 return userFinder;
638 }
639
640
645 public void setUserFinder(UserFinder userFinder) {
646 this.userFinder = userFinder;
647 }
648
649 public void afterPropertiesSet() {
650 persistedModelLocalServiceRegistry.register("com.liferay.portlet.polls.model.PollsQuestion",
651 pollsQuestionLocalService);
652 }
653
654 public void destroy() {
655 persistedModelLocalServiceRegistry.unregister(
656 "com.liferay.portlet.polls.model.PollsQuestion");
657 }
658
659
664 public String getBeanIdentifier() {
665 return _beanIdentifier;
666 }
667
668
673 public void setBeanIdentifier(String beanIdentifier) {
674 _beanIdentifier = beanIdentifier;
675 }
676
677 protected Class<?> getModelClass() {
678 return PollsQuestion.class;
679 }
680
681 protected String getModelClassName() {
682 return PollsQuestion.class.getName();
683 }
684
685
690 protected void runSQL(String sql) throws SystemException {
691 try {
692 DataSource dataSource = pollsQuestionPersistence.getDataSource();
693
694 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
695 sql, new int[0]);
696
697 sqlUpdate.update();
698 }
699 catch (Exception e) {
700 throw new SystemException(e);
701 }
702 }
703
704 @BeanReference(type = PollsChoiceLocalService.class)
705 protected PollsChoiceLocalService pollsChoiceLocalService;
706 @BeanReference(type = PollsChoiceService.class)
707 protected PollsChoiceService pollsChoiceService;
708 @BeanReference(type = PollsChoicePersistence.class)
709 protected PollsChoicePersistence pollsChoicePersistence;
710 @BeanReference(type = PollsChoiceFinder.class)
711 protected PollsChoiceFinder pollsChoiceFinder;
712 @BeanReference(type = PollsQuestionLocalService.class)
713 protected PollsQuestionLocalService pollsQuestionLocalService;
714 @BeanReference(type = PollsQuestionService.class)
715 protected PollsQuestionService pollsQuestionService;
716 @BeanReference(type = PollsQuestionPersistence.class)
717 protected PollsQuestionPersistence pollsQuestionPersistence;
718 @BeanReference(type = PollsVoteLocalService.class)
719 protected PollsVoteLocalService pollsVoteLocalService;
720 @BeanReference(type = PollsVoteService.class)
721 protected PollsVoteService pollsVoteService;
722 @BeanReference(type = PollsVotePersistence.class)
723 protected PollsVotePersistence pollsVotePersistence;
724 @BeanReference(type = CounterLocalService.class)
725 protected CounterLocalService counterLocalService;
726 @BeanReference(type = ResourceLocalService.class)
727 protected ResourceLocalService resourceLocalService;
728 @BeanReference(type = ResourceService.class)
729 protected ResourceService resourceService;
730 @BeanReference(type = ResourcePersistence.class)
731 protected ResourcePersistence resourcePersistence;
732 @BeanReference(type = ResourceFinder.class)
733 protected ResourceFinder resourceFinder;
734 @BeanReference(type = UserLocalService.class)
735 protected UserLocalService userLocalService;
736 @BeanReference(type = UserService.class)
737 protected UserService userService;
738 @BeanReference(type = UserPersistence.class)
739 protected UserPersistence userPersistence;
740 @BeanReference(type = UserFinder.class)
741 protected UserFinder userFinder;
742 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
743 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
744 private String _beanIdentifier;
745 }