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.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.polls.model.PollsChoice;
040 import com.liferay.portlet.polls.service.PollsChoiceLocalService;
041 import com.liferay.portlet.polls.service.PollsChoiceService;
042 import com.liferay.portlet.polls.service.PollsQuestionLocalService;
043 import com.liferay.portlet.polls.service.PollsQuestionService;
044 import com.liferay.portlet.polls.service.PollsVoteLocalService;
045 import com.liferay.portlet.polls.service.PollsVoteService;
046 import com.liferay.portlet.polls.service.persistence.PollsChoiceFinder;
047 import com.liferay.portlet.polls.service.persistence.PollsChoicePersistence;
048 import com.liferay.portlet.polls.service.persistence.PollsQuestionPersistence;
049 import com.liferay.portlet.polls.service.persistence.PollsVotePersistence;
050
051 import java.io.Serializable;
052
053 import java.util.List;
054
055 import javax.sql.DataSource;
056
057
069 public abstract class PollsChoiceLocalServiceBaseImpl
070 extends BaseLocalServiceImpl implements PollsChoiceLocalService,
071 IdentifiableBean {
072
077
078
085 @Indexable(type = IndexableType.REINDEX)
086 public PollsChoice addPollsChoice(PollsChoice pollsChoice)
087 throws SystemException {
088 pollsChoice.setNew(true);
089
090 return pollsChoicePersistence.update(pollsChoice);
091 }
092
093
099 public PollsChoice createPollsChoice(long choiceId) {
100 return pollsChoicePersistence.create(choiceId);
101 }
102
103
111 @Indexable(type = IndexableType.DELETE)
112 public PollsChoice deletePollsChoice(long choiceId)
113 throws PortalException, SystemException {
114 return pollsChoicePersistence.remove(choiceId);
115 }
116
117
124 @Indexable(type = IndexableType.DELETE)
125 public PollsChoice deletePollsChoice(PollsChoice pollsChoice)
126 throws SystemException {
127 return pollsChoicePersistence.remove(pollsChoice);
128 }
129
130 public DynamicQuery dynamicQuery() {
131 Class<?> clazz = getClass();
132
133 return DynamicQueryFactoryUtil.forClass(PollsChoice.class,
134 clazz.getClassLoader());
135 }
136
137
144 @SuppressWarnings("rawtypes")
145 public List dynamicQuery(DynamicQuery dynamicQuery)
146 throws SystemException {
147 return pollsChoicePersistence.findWithDynamicQuery(dynamicQuery);
148 }
149
150
163 @SuppressWarnings("rawtypes")
164 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
165 throws SystemException {
166 return pollsChoicePersistence.findWithDynamicQuery(dynamicQuery, start,
167 end);
168 }
169
170
184 @SuppressWarnings("rawtypes")
185 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
186 OrderByComparator orderByComparator) throws SystemException {
187 return pollsChoicePersistence.findWithDynamicQuery(dynamicQuery, start,
188 end, orderByComparator);
189 }
190
191
198 public long dynamicQueryCount(DynamicQuery dynamicQuery)
199 throws SystemException {
200 return pollsChoicePersistence.countWithDynamicQuery(dynamicQuery);
201 }
202
203 public PollsChoice fetchPollsChoice(long choiceId)
204 throws SystemException {
205 return pollsChoicePersistence.fetchByPrimaryKey(choiceId);
206 }
207
208
216 public PollsChoice getPollsChoice(long choiceId)
217 throws PortalException, SystemException {
218 return pollsChoicePersistence.findByPrimaryKey(choiceId);
219 }
220
221 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
222 throws PortalException, SystemException {
223 return pollsChoicePersistence.findByPrimaryKey(primaryKeyObj);
224 }
225
226
238 public List<PollsChoice> getPollsChoices(int start, int end)
239 throws SystemException {
240 return pollsChoicePersistence.findAll(start, end);
241 }
242
243
249 public int getPollsChoicesCount() throws SystemException {
250 return pollsChoicePersistence.countAll();
251 }
252
253
260 @Indexable(type = IndexableType.REINDEX)
261 public PollsChoice updatePollsChoice(PollsChoice pollsChoice)
262 throws SystemException {
263 return pollsChoicePersistence.update(pollsChoice);
264 }
265
266
271 public PollsChoiceLocalService getPollsChoiceLocalService() {
272 return pollsChoiceLocalService;
273 }
274
275
280 public void setPollsChoiceLocalService(
281 PollsChoiceLocalService pollsChoiceLocalService) {
282 this.pollsChoiceLocalService = pollsChoiceLocalService;
283 }
284
285
290 public PollsChoiceService getPollsChoiceService() {
291 return pollsChoiceService;
292 }
293
294
299 public void setPollsChoiceService(PollsChoiceService pollsChoiceService) {
300 this.pollsChoiceService = pollsChoiceService;
301 }
302
303
308 public PollsChoicePersistence getPollsChoicePersistence() {
309 return pollsChoicePersistence;
310 }
311
312
317 public void setPollsChoicePersistence(
318 PollsChoicePersistence pollsChoicePersistence) {
319 this.pollsChoicePersistence = pollsChoicePersistence;
320 }
321
322
327 public PollsChoiceFinder getPollsChoiceFinder() {
328 return pollsChoiceFinder;
329 }
330
331
336 public void setPollsChoiceFinder(PollsChoiceFinder pollsChoiceFinder) {
337 this.pollsChoiceFinder = pollsChoiceFinder;
338 }
339
340
345 public PollsQuestionLocalService getPollsQuestionLocalService() {
346 return pollsQuestionLocalService;
347 }
348
349
354 public void setPollsQuestionLocalService(
355 PollsQuestionLocalService pollsQuestionLocalService) {
356 this.pollsQuestionLocalService = pollsQuestionLocalService;
357 }
358
359
364 public PollsQuestionService getPollsQuestionService() {
365 return pollsQuestionService;
366 }
367
368
373 public void setPollsQuestionService(
374 PollsQuestionService pollsQuestionService) {
375 this.pollsQuestionService = pollsQuestionService;
376 }
377
378
383 public PollsQuestionPersistence getPollsQuestionPersistence() {
384 return pollsQuestionPersistence;
385 }
386
387
392 public void setPollsQuestionPersistence(
393 PollsQuestionPersistence pollsQuestionPersistence) {
394 this.pollsQuestionPersistence = pollsQuestionPersistence;
395 }
396
397
402 public PollsVoteLocalService getPollsVoteLocalService() {
403 return pollsVoteLocalService;
404 }
405
406
411 public void setPollsVoteLocalService(
412 PollsVoteLocalService pollsVoteLocalService) {
413 this.pollsVoteLocalService = pollsVoteLocalService;
414 }
415
416
421 public PollsVoteService getPollsVoteService() {
422 return pollsVoteService;
423 }
424
425
430 public void setPollsVoteService(PollsVoteService pollsVoteService) {
431 this.pollsVoteService = pollsVoteService;
432 }
433
434
439 public PollsVotePersistence getPollsVotePersistence() {
440 return pollsVotePersistence;
441 }
442
443
448 public void setPollsVotePersistence(
449 PollsVotePersistence pollsVotePersistence) {
450 this.pollsVotePersistence = pollsVotePersistence;
451 }
452
453
458 public CounterLocalService getCounterLocalService() {
459 return counterLocalService;
460 }
461
462
467 public void setCounterLocalService(CounterLocalService counterLocalService) {
468 this.counterLocalService = counterLocalService;
469 }
470
471
476 public ResourceLocalService getResourceLocalService() {
477 return resourceLocalService;
478 }
479
480
485 public void setResourceLocalService(
486 ResourceLocalService resourceLocalService) {
487 this.resourceLocalService = resourceLocalService;
488 }
489
490
495 public UserLocalService getUserLocalService() {
496 return userLocalService;
497 }
498
499
504 public void setUserLocalService(UserLocalService userLocalService) {
505 this.userLocalService = userLocalService;
506 }
507
508
513 public UserService getUserService() {
514 return userService;
515 }
516
517
522 public void setUserService(UserService userService) {
523 this.userService = userService;
524 }
525
526
531 public UserPersistence getUserPersistence() {
532 return userPersistence;
533 }
534
535
540 public void setUserPersistence(UserPersistence userPersistence) {
541 this.userPersistence = userPersistence;
542 }
543
544
549 public UserFinder getUserFinder() {
550 return userFinder;
551 }
552
553
558 public void setUserFinder(UserFinder userFinder) {
559 this.userFinder = userFinder;
560 }
561
562 public void afterPropertiesSet() {
563 persistedModelLocalServiceRegistry.register("com.liferay.portlet.polls.model.PollsChoice",
564 pollsChoiceLocalService);
565 }
566
567 public void destroy() {
568 persistedModelLocalServiceRegistry.unregister(
569 "com.liferay.portlet.polls.model.PollsChoice");
570 }
571
572
577 public String getBeanIdentifier() {
578 return _beanIdentifier;
579 }
580
581
586 public void setBeanIdentifier(String beanIdentifier) {
587 _beanIdentifier = beanIdentifier;
588 }
589
590 protected Class<?> getModelClass() {
591 return PollsChoice.class;
592 }
593
594 protected String getModelClassName() {
595 return PollsChoice.class.getName();
596 }
597
598
603 protected void runSQL(String sql) throws SystemException {
604 try {
605 DataSource dataSource = pollsChoicePersistence.getDataSource();
606
607 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
608 sql, new int[0]);
609
610 sqlUpdate.update();
611 }
612 catch (Exception e) {
613 throw new SystemException(e);
614 }
615 }
616
617 @BeanReference(type = PollsChoiceLocalService.class)
618 protected PollsChoiceLocalService pollsChoiceLocalService;
619 @BeanReference(type = PollsChoiceService.class)
620 protected PollsChoiceService pollsChoiceService;
621 @BeanReference(type = PollsChoicePersistence.class)
622 protected PollsChoicePersistence pollsChoicePersistence;
623 @BeanReference(type = PollsChoiceFinder.class)
624 protected PollsChoiceFinder pollsChoiceFinder;
625 @BeanReference(type = PollsQuestionLocalService.class)
626 protected PollsQuestionLocalService pollsQuestionLocalService;
627 @BeanReference(type = PollsQuestionService.class)
628 protected PollsQuestionService pollsQuestionService;
629 @BeanReference(type = PollsQuestionPersistence.class)
630 protected PollsQuestionPersistence pollsQuestionPersistence;
631 @BeanReference(type = PollsVoteLocalService.class)
632 protected PollsVoteLocalService pollsVoteLocalService;
633 @BeanReference(type = PollsVoteService.class)
634 protected PollsVoteService pollsVoteService;
635 @BeanReference(type = PollsVotePersistence.class)
636 protected PollsVotePersistence pollsVotePersistence;
637 @BeanReference(type = CounterLocalService.class)
638 protected CounterLocalService counterLocalService;
639 @BeanReference(type = ResourceLocalService.class)
640 protected ResourceLocalService resourceLocalService;
641 @BeanReference(type = UserLocalService.class)
642 protected UserLocalService userLocalService;
643 @BeanReference(type = UserService.class)
644 protected UserService userService;
645 @BeanReference(type = UserPersistence.class)
646 protected UserPersistence userPersistence;
647 @BeanReference(type = UserFinder.class)
648 protected UserFinder userFinder;
649 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
650 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
651 private String _beanIdentifier;
652 }