001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
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.PollsVote;
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    /**
058     * The base implementation of the polls vote local service.
059     *
060     * <p>
061     * This implementation exists only as a container for the default service methods generated by ServiceBuilder. All custom service methods should be put in {@link com.liferay.portlet.polls.service.impl.PollsVoteLocalServiceImpl}.
062     * </p>
063     *
064     * @author Brian Wing Shun Chan
065     * @see com.liferay.portlet.polls.service.impl.PollsVoteLocalServiceImpl
066     * @see com.liferay.portlet.polls.service.PollsVoteLocalServiceUtil
067     * @generated
068     */
069    public abstract class PollsVoteLocalServiceBaseImpl extends BaseLocalServiceImpl
070            implements PollsVoteLocalService, IdentifiableBean {
071            /*
072             * NOTE FOR DEVELOPERS:
073             *
074             * Never modify or reference this class directly. Always use {@link com.liferay.portlet.polls.service.PollsVoteLocalServiceUtil} to access the polls vote local service.
075             */
076    
077            /**
078             * Adds the polls vote to the database. Also notifies the appropriate model listeners.
079             *
080             * @param pollsVote the polls vote
081             * @return the polls vote that was added
082             * @throws SystemException if a system exception occurred
083             */
084            @Indexable(type = IndexableType.REINDEX)
085            public PollsVote addPollsVote(PollsVote pollsVote)
086                    throws SystemException {
087                    pollsVote.setNew(true);
088    
089                    return pollsVotePersistence.update(pollsVote);
090            }
091    
092            /**
093             * Creates a new polls vote with the primary key. Does not add the polls vote to the database.
094             *
095             * @param voteId the primary key for the new polls vote
096             * @return the new polls vote
097             */
098            public PollsVote createPollsVote(long voteId) {
099                    return pollsVotePersistence.create(voteId);
100            }
101    
102            /**
103             * Deletes the polls vote with the primary key from the database. Also notifies the appropriate model listeners.
104             *
105             * @param voteId the primary key of the polls vote
106             * @return the polls vote that was removed
107             * @throws PortalException if a polls vote with the primary key could not be found
108             * @throws SystemException if a system exception occurred
109             */
110            @Indexable(type = IndexableType.DELETE)
111            public PollsVote deletePollsVote(long voteId)
112                    throws PortalException, SystemException {
113                    return pollsVotePersistence.remove(voteId);
114            }
115    
116            /**
117             * Deletes the polls vote from the database. Also notifies the appropriate model listeners.
118             *
119             * @param pollsVote the polls vote
120             * @return the polls vote that was removed
121             * @throws SystemException if a system exception occurred
122             */
123            @Indexable(type = IndexableType.DELETE)
124            public PollsVote deletePollsVote(PollsVote pollsVote)
125                    throws SystemException {
126                    return pollsVotePersistence.remove(pollsVote);
127            }
128    
129            public DynamicQuery dynamicQuery() {
130                    Class<?> clazz = getClass();
131    
132                    return DynamicQueryFactoryUtil.forClass(PollsVote.class,
133                            clazz.getClassLoader());
134            }
135    
136            /**
137             * Performs a dynamic query on the database and returns the matching rows.
138             *
139             * @param dynamicQuery the dynamic query
140             * @return the matching rows
141             * @throws SystemException if a system exception occurred
142             */
143            @SuppressWarnings("rawtypes")
144            public List dynamicQuery(DynamicQuery dynamicQuery)
145                    throws SystemException {
146                    return pollsVotePersistence.findWithDynamicQuery(dynamicQuery);
147            }
148    
149            /**
150             * Performs a dynamic query on the database and returns a range of the matching rows.
151             *
152             * <p>
153             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.polls.model.impl.PollsVoteModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
154             * </p>
155             *
156             * @param dynamicQuery the dynamic query
157             * @param start the lower bound of the range of model instances
158             * @param end the upper bound of the range of model instances (not inclusive)
159             * @return the range of matching rows
160             * @throws SystemException if a system exception occurred
161             */
162            @SuppressWarnings("rawtypes")
163            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
164                    throws SystemException {
165                    return pollsVotePersistence.findWithDynamicQuery(dynamicQuery, start,
166                            end);
167            }
168    
169            /**
170             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
171             *
172             * <p>
173             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.polls.model.impl.PollsVoteModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
174             * </p>
175             *
176             * @param dynamicQuery the dynamic query
177             * @param start the lower bound of the range of model instances
178             * @param end the upper bound of the range of model instances (not inclusive)
179             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
180             * @return the ordered range of matching rows
181             * @throws SystemException if a system exception occurred
182             */
183            @SuppressWarnings("rawtypes")
184            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
185                    OrderByComparator orderByComparator) throws SystemException {
186                    return pollsVotePersistence.findWithDynamicQuery(dynamicQuery, start,
187                            end, orderByComparator);
188            }
189    
190            /**
191             * Returns the number of rows that match the dynamic query.
192             *
193             * @param dynamicQuery the dynamic query
194             * @return the number of rows that match the dynamic query
195             * @throws SystemException if a system exception occurred
196             */
197            public long dynamicQueryCount(DynamicQuery dynamicQuery)
198                    throws SystemException {
199                    return pollsVotePersistence.countWithDynamicQuery(dynamicQuery);
200            }
201    
202            public PollsVote fetchPollsVote(long voteId) throws SystemException {
203                    return pollsVotePersistence.fetchByPrimaryKey(voteId);
204            }
205    
206            /**
207             * Returns the polls vote with the primary key.
208             *
209             * @param voteId the primary key of the polls vote
210             * @return the polls vote
211             * @throws PortalException if a polls vote with the primary key could not be found
212             * @throws SystemException if a system exception occurred
213             */
214            public PollsVote getPollsVote(long voteId)
215                    throws PortalException, SystemException {
216                    return pollsVotePersistence.findByPrimaryKey(voteId);
217            }
218    
219            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
220                    throws PortalException, SystemException {
221                    return pollsVotePersistence.findByPrimaryKey(primaryKeyObj);
222            }
223    
224            /**
225             * Returns the polls vote matching the UUID and group.
226             *
227             * @param uuid the polls vote's UUID
228             * @param groupId the primary key of the group
229             * @return the matching polls vote
230             * @throws PortalException if a matching polls vote could not be found
231             * @throws SystemException if a system exception occurred
232             */
233            public PollsVote getPollsVoteByUuidAndGroupId(String uuid, long groupId)
234                    throws PortalException, SystemException {
235                    return pollsVotePersistence.findByUUID_G(uuid, groupId);
236            }
237    
238            /**
239             * Returns a range of all the polls votes.
240             *
241             * <p>
242             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.polls.model.impl.PollsVoteModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
243             * </p>
244             *
245             * @param start the lower bound of the range of polls votes
246             * @param end the upper bound of the range of polls votes (not inclusive)
247             * @return the range of polls votes
248             * @throws SystemException if a system exception occurred
249             */
250            public List<PollsVote> getPollsVotes(int start, int end)
251                    throws SystemException {
252                    return pollsVotePersistence.findAll(start, end);
253            }
254    
255            /**
256             * Returns the number of polls votes.
257             *
258             * @return the number of polls votes
259             * @throws SystemException if a system exception occurred
260             */
261            public int getPollsVotesCount() throws SystemException {
262                    return pollsVotePersistence.countAll();
263            }
264    
265            /**
266             * Updates the polls vote in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
267             *
268             * @param pollsVote the polls vote
269             * @return the polls vote that was updated
270             * @throws SystemException if a system exception occurred
271             */
272            @Indexable(type = IndexableType.REINDEX)
273            public PollsVote updatePollsVote(PollsVote pollsVote)
274                    throws SystemException {
275                    return pollsVotePersistence.update(pollsVote);
276            }
277    
278            /**
279             * Returns the polls choice local service.
280             *
281             * @return the polls choice local service
282             */
283            public PollsChoiceLocalService getPollsChoiceLocalService() {
284                    return pollsChoiceLocalService;
285            }
286    
287            /**
288             * Sets the polls choice local service.
289             *
290             * @param pollsChoiceLocalService the polls choice local service
291             */
292            public void setPollsChoiceLocalService(
293                    PollsChoiceLocalService pollsChoiceLocalService) {
294                    this.pollsChoiceLocalService = pollsChoiceLocalService;
295            }
296    
297            /**
298             * Returns the polls choice remote service.
299             *
300             * @return the polls choice remote service
301             */
302            public PollsChoiceService getPollsChoiceService() {
303                    return pollsChoiceService;
304            }
305    
306            /**
307             * Sets the polls choice remote service.
308             *
309             * @param pollsChoiceService the polls choice remote service
310             */
311            public void setPollsChoiceService(PollsChoiceService pollsChoiceService) {
312                    this.pollsChoiceService = pollsChoiceService;
313            }
314    
315            /**
316             * Returns the polls choice persistence.
317             *
318             * @return the polls choice persistence
319             */
320            public PollsChoicePersistence getPollsChoicePersistence() {
321                    return pollsChoicePersistence;
322            }
323    
324            /**
325             * Sets the polls choice persistence.
326             *
327             * @param pollsChoicePersistence the polls choice persistence
328             */
329            public void setPollsChoicePersistence(
330                    PollsChoicePersistence pollsChoicePersistence) {
331                    this.pollsChoicePersistence = pollsChoicePersistence;
332            }
333    
334            /**
335             * Returns the polls choice finder.
336             *
337             * @return the polls choice finder
338             */
339            public PollsChoiceFinder getPollsChoiceFinder() {
340                    return pollsChoiceFinder;
341            }
342    
343            /**
344             * Sets the polls choice finder.
345             *
346             * @param pollsChoiceFinder the polls choice finder
347             */
348            public void setPollsChoiceFinder(PollsChoiceFinder pollsChoiceFinder) {
349                    this.pollsChoiceFinder = pollsChoiceFinder;
350            }
351    
352            /**
353             * Returns the polls question local service.
354             *
355             * @return the polls question local service
356             */
357            public PollsQuestionLocalService getPollsQuestionLocalService() {
358                    return pollsQuestionLocalService;
359            }
360    
361            /**
362             * Sets the polls question local service.
363             *
364             * @param pollsQuestionLocalService the polls question local service
365             */
366            public void setPollsQuestionLocalService(
367                    PollsQuestionLocalService pollsQuestionLocalService) {
368                    this.pollsQuestionLocalService = pollsQuestionLocalService;
369            }
370    
371            /**
372             * Returns the polls question remote service.
373             *
374             * @return the polls question remote service
375             */
376            public PollsQuestionService getPollsQuestionService() {
377                    return pollsQuestionService;
378            }
379    
380            /**
381             * Sets the polls question remote service.
382             *
383             * @param pollsQuestionService the polls question remote service
384             */
385            public void setPollsQuestionService(
386                    PollsQuestionService pollsQuestionService) {
387                    this.pollsQuestionService = pollsQuestionService;
388            }
389    
390            /**
391             * Returns the polls question persistence.
392             *
393             * @return the polls question persistence
394             */
395            public PollsQuestionPersistence getPollsQuestionPersistence() {
396                    return pollsQuestionPersistence;
397            }
398    
399            /**
400             * Sets the polls question persistence.
401             *
402             * @param pollsQuestionPersistence the polls question persistence
403             */
404            public void setPollsQuestionPersistence(
405                    PollsQuestionPersistence pollsQuestionPersistence) {
406                    this.pollsQuestionPersistence = pollsQuestionPersistence;
407            }
408    
409            /**
410             * Returns the polls vote local service.
411             *
412             * @return the polls vote local service
413             */
414            public PollsVoteLocalService getPollsVoteLocalService() {
415                    return pollsVoteLocalService;
416            }
417    
418            /**
419             * Sets the polls vote local service.
420             *
421             * @param pollsVoteLocalService the polls vote local service
422             */
423            public void setPollsVoteLocalService(
424                    PollsVoteLocalService pollsVoteLocalService) {
425                    this.pollsVoteLocalService = pollsVoteLocalService;
426            }
427    
428            /**
429             * Returns the polls vote remote service.
430             *
431             * @return the polls vote remote service
432             */
433            public PollsVoteService getPollsVoteService() {
434                    return pollsVoteService;
435            }
436    
437            /**
438             * Sets the polls vote remote service.
439             *
440             * @param pollsVoteService the polls vote remote service
441             */
442            public void setPollsVoteService(PollsVoteService pollsVoteService) {
443                    this.pollsVoteService = pollsVoteService;
444            }
445    
446            /**
447             * Returns the polls vote persistence.
448             *
449             * @return the polls vote persistence
450             */
451            public PollsVotePersistence getPollsVotePersistence() {
452                    return pollsVotePersistence;
453            }
454    
455            /**
456             * Sets the polls vote persistence.
457             *
458             * @param pollsVotePersistence the polls vote persistence
459             */
460            public void setPollsVotePersistence(
461                    PollsVotePersistence pollsVotePersistence) {
462                    this.pollsVotePersistence = pollsVotePersistence;
463            }
464    
465            /**
466             * Returns the counter local service.
467             *
468             * @return the counter local service
469             */
470            public CounterLocalService getCounterLocalService() {
471                    return counterLocalService;
472            }
473    
474            /**
475             * Sets the counter local service.
476             *
477             * @param counterLocalService the counter local service
478             */
479            public void setCounterLocalService(CounterLocalService counterLocalService) {
480                    this.counterLocalService = counterLocalService;
481            }
482    
483            /**
484             * Returns the resource local service.
485             *
486             * @return the resource local service
487             */
488            public ResourceLocalService getResourceLocalService() {
489                    return resourceLocalService;
490            }
491    
492            /**
493             * Sets the resource local service.
494             *
495             * @param resourceLocalService the resource local service
496             */
497            public void setResourceLocalService(
498                    ResourceLocalService resourceLocalService) {
499                    this.resourceLocalService = resourceLocalService;
500            }
501    
502            /**
503             * Returns the user local service.
504             *
505             * @return the user local service
506             */
507            public UserLocalService getUserLocalService() {
508                    return userLocalService;
509            }
510    
511            /**
512             * Sets the user local service.
513             *
514             * @param userLocalService the user local service
515             */
516            public void setUserLocalService(UserLocalService userLocalService) {
517                    this.userLocalService = userLocalService;
518            }
519    
520            /**
521             * Returns the user remote service.
522             *
523             * @return the user remote service
524             */
525            public UserService getUserService() {
526                    return userService;
527            }
528    
529            /**
530             * Sets the user remote service.
531             *
532             * @param userService the user remote service
533             */
534            public void setUserService(UserService userService) {
535                    this.userService = userService;
536            }
537    
538            /**
539             * Returns the user persistence.
540             *
541             * @return the user persistence
542             */
543            public UserPersistence getUserPersistence() {
544                    return userPersistence;
545            }
546    
547            /**
548             * Sets the user persistence.
549             *
550             * @param userPersistence the user persistence
551             */
552            public void setUserPersistence(UserPersistence userPersistence) {
553                    this.userPersistence = userPersistence;
554            }
555    
556            /**
557             * Returns the user finder.
558             *
559             * @return the user finder
560             */
561            public UserFinder getUserFinder() {
562                    return userFinder;
563            }
564    
565            /**
566             * Sets the user finder.
567             *
568             * @param userFinder the user finder
569             */
570            public void setUserFinder(UserFinder userFinder) {
571                    this.userFinder = userFinder;
572            }
573    
574            public void afterPropertiesSet() {
575                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.polls.model.PollsVote",
576                            pollsVoteLocalService);
577            }
578    
579            public void destroy() {
580                    persistedModelLocalServiceRegistry.unregister(
581                            "com.liferay.portlet.polls.model.PollsVote");
582            }
583    
584            /**
585             * Returns the Spring bean ID for this bean.
586             *
587             * @return the Spring bean ID for this bean
588             */
589            public String getBeanIdentifier() {
590                    return _beanIdentifier;
591            }
592    
593            /**
594             * Sets the Spring bean ID for this bean.
595             *
596             * @param beanIdentifier the Spring bean ID for this bean
597             */
598            public void setBeanIdentifier(String beanIdentifier) {
599                    _beanIdentifier = beanIdentifier;
600            }
601    
602            protected Class<?> getModelClass() {
603                    return PollsVote.class;
604            }
605    
606            protected String getModelClassName() {
607                    return PollsVote.class.getName();
608            }
609    
610            /**
611             * Performs an SQL query.
612             *
613             * @param sql the sql query
614             */
615            protected void runSQL(String sql) throws SystemException {
616                    try {
617                            DataSource dataSource = pollsVotePersistence.getDataSource();
618    
619                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
620                                            sql, new int[0]);
621    
622                            sqlUpdate.update();
623                    }
624                    catch (Exception e) {
625                            throw new SystemException(e);
626                    }
627            }
628    
629            @BeanReference(type = PollsChoiceLocalService.class)
630            protected PollsChoiceLocalService pollsChoiceLocalService;
631            @BeanReference(type = PollsChoiceService.class)
632            protected PollsChoiceService pollsChoiceService;
633            @BeanReference(type = PollsChoicePersistence.class)
634            protected PollsChoicePersistence pollsChoicePersistence;
635            @BeanReference(type = PollsChoiceFinder.class)
636            protected PollsChoiceFinder pollsChoiceFinder;
637            @BeanReference(type = PollsQuestionLocalService.class)
638            protected PollsQuestionLocalService pollsQuestionLocalService;
639            @BeanReference(type = PollsQuestionService.class)
640            protected PollsQuestionService pollsQuestionService;
641            @BeanReference(type = PollsQuestionPersistence.class)
642            protected PollsQuestionPersistence pollsQuestionPersistence;
643            @BeanReference(type = PollsVoteLocalService.class)
644            protected PollsVoteLocalService pollsVoteLocalService;
645            @BeanReference(type = PollsVoteService.class)
646            protected PollsVoteService pollsVoteService;
647            @BeanReference(type = PollsVotePersistence.class)
648            protected PollsVotePersistence pollsVotePersistence;
649            @BeanReference(type = CounterLocalService.class)
650            protected CounterLocalService counterLocalService;
651            @BeanReference(type = ResourceLocalService.class)
652            protected ResourceLocalService resourceLocalService;
653            @BeanReference(type = UserLocalService.class)
654            protected UserLocalService userLocalService;
655            @BeanReference(type = UserService.class)
656            protected UserService userService;
657            @BeanReference(type = UserPersistence.class)
658            protected UserPersistence userPersistence;
659            @BeanReference(type = UserFinder.class)
660            protected UserFinder userFinder;
661            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
662            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
663            private String _beanIdentifier;
664    }