001    /**
002     * Copyright (c) 2000-2010 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.annotation.BeanReference;
020    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
021    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
022    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
023    import com.liferay.portal.kernel.exception.PortalException;
024    import com.liferay.portal.kernel.exception.SystemException;
025    import com.liferay.portal.kernel.util.OrderByComparator;
026    import com.liferay.portal.service.ResourceLocalService;
027    import com.liferay.portal.service.ResourceService;
028    import com.liferay.portal.service.UserLocalService;
029    import com.liferay.portal.service.UserService;
030    import com.liferay.portal.service.persistence.ResourceFinder;
031    import com.liferay.portal.service.persistence.ResourcePersistence;
032    import com.liferay.portal.service.persistence.UserFinder;
033    import com.liferay.portal.service.persistence.UserPersistence;
034    
035    import com.liferay.portlet.polls.model.PollsVote;
036    import com.liferay.portlet.polls.service.PollsChoiceLocalService;
037    import com.liferay.portlet.polls.service.PollsQuestionLocalService;
038    import com.liferay.portlet.polls.service.PollsQuestionService;
039    import com.liferay.portlet.polls.service.PollsVoteLocalService;
040    import com.liferay.portlet.polls.service.PollsVoteService;
041    import com.liferay.portlet.polls.service.persistence.PollsChoiceFinder;
042    import com.liferay.portlet.polls.service.persistence.PollsChoicePersistence;
043    import com.liferay.portlet.polls.service.persistence.PollsQuestionPersistence;
044    import com.liferay.portlet.polls.service.persistence.PollsVotePersistence;
045    
046    import java.util.List;
047    
048    import javax.sql.DataSource;
049    
050    /**
051     * The base implementation of the polls vote local service.
052     *
053     * <p>
054     * 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}.
055     * </p>
056     *
057     * <p>
058     * Never modify or reference this class directly. Always use {@link com.liferay.portlet.polls.service.PollsVoteLocalServiceUtil} to access the polls vote local service.
059     * </p>
060     *
061     * @author Brian Wing Shun Chan
062     * @see com.liferay.portlet.polls.service.impl.PollsVoteLocalServiceImpl
063     * @see com.liferay.portlet.polls.service.PollsVoteLocalServiceUtil
064     * @generated
065     */
066    public abstract class PollsVoteLocalServiceBaseImpl
067            implements PollsVoteLocalService {
068            /**
069             * Adds the polls vote to the database. Also notifies the appropriate model listeners.
070             *
071             * @param pollsVote the polls vote to add
072             * @return the polls vote that was added
073             * @throws SystemException if a system exception occurred
074             */
075            public PollsVote addPollsVote(PollsVote pollsVote)
076                    throws SystemException {
077                    pollsVote.setNew(true);
078    
079                    return pollsVotePersistence.update(pollsVote, false);
080            }
081    
082            /**
083             * Creates a new polls vote with the primary key. Does not add the polls vote to the database.
084             *
085             * @param voteId the primary key for the new polls vote
086             * @return the new polls vote
087             */
088            public PollsVote createPollsVote(long voteId) {
089                    return pollsVotePersistence.create(voteId);
090            }
091    
092            /**
093             * Deletes the polls vote with the primary key from the database. Also notifies the appropriate model listeners.
094             *
095             * @param voteId the primary key of the polls vote to delete
096             * @throws PortalException if a polls vote with the primary key could not be found
097             * @throws SystemException if a system exception occurred
098             */
099            public void deletePollsVote(long voteId)
100                    throws PortalException, SystemException {
101                    pollsVotePersistence.remove(voteId);
102            }
103    
104            /**
105             * Deletes the polls vote from the database. Also notifies the appropriate model listeners.
106             *
107             * @param pollsVote the polls vote to delete
108             * @throws SystemException if a system exception occurred
109             */
110            public void deletePollsVote(PollsVote pollsVote) throws SystemException {
111                    pollsVotePersistence.remove(pollsVote);
112            }
113    
114            /**
115             * Performs a dynamic query on the database and returns the matching rows.
116             *
117             * @param dynamicQuery the dynamic query to search with
118             * @return the matching rows
119             * @throws SystemException if a system exception occurred
120             */
121            @SuppressWarnings("rawtypes")
122            public List dynamicQuery(DynamicQuery dynamicQuery)
123                    throws SystemException {
124                    return pollsVotePersistence.findWithDynamicQuery(dynamicQuery);
125            }
126    
127            /**
128             * Performs a dynamic query on the database and returns a range of the matching rows.
129             *
130             * <p>
131             * 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.
132             * </p>
133             *
134             * @param dynamicQuery the dynamic query to search with
135             * @param start the lower bound of the range of model instances to return
136             * @param end the upper bound of the range of model instances to return (not inclusive)
137             * @return the range of matching rows
138             * @throws SystemException if a system exception occurred
139             */
140            @SuppressWarnings("rawtypes")
141            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
142                    throws SystemException {
143                    return pollsVotePersistence.findWithDynamicQuery(dynamicQuery, start,
144                            end);
145            }
146    
147            /**
148             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
149             *
150             * <p>
151             * 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.
152             * </p>
153             *
154             * @param dynamicQuery the dynamic query to search with
155             * @param start the lower bound of the range of model instances to return
156             * @param end the upper bound of the range of model instances to return (not inclusive)
157             * @param orderByComparator the comparator to order the results by
158             * @return the ordered range of matching rows
159             * @throws SystemException if a system exception occurred
160             */
161            @SuppressWarnings("rawtypes")
162            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
163                    OrderByComparator orderByComparator) throws SystemException {
164                    return pollsVotePersistence.findWithDynamicQuery(dynamicQuery, start,
165                            end, orderByComparator);
166            }
167    
168            /**
169             * Counts the number of rows that match the dynamic query.
170             *
171             * @param dynamicQuery the dynamic query to search with
172             * @return the number of rows that match the dynamic query
173             * @throws SystemException if a system exception occurred
174             */
175            public long dynamicQueryCount(DynamicQuery dynamicQuery)
176                    throws SystemException {
177                    return pollsVotePersistence.countWithDynamicQuery(dynamicQuery);
178            }
179    
180            /**
181             * Gets the polls vote with the primary key.
182             *
183             * @param voteId the primary key of the polls vote to get
184             * @return the polls vote
185             * @throws PortalException if a polls vote with the primary key could not be found
186             * @throws SystemException if a system exception occurred
187             */
188            public PollsVote getPollsVote(long voteId)
189                    throws PortalException, SystemException {
190                    return pollsVotePersistence.findByPrimaryKey(voteId);
191            }
192    
193            /**
194             * Gets a range of all the polls votes.
195             *
196             * <p>
197             * 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.
198             * </p>
199             *
200             * @param start the lower bound of the range of polls votes to return
201             * @param end the upper bound of the range of polls votes to return (not inclusive)
202             * @return the range of polls votes
203             * @throws SystemException if a system exception occurred
204             */
205            public List<PollsVote> getPollsVotes(int start, int end)
206                    throws SystemException {
207                    return pollsVotePersistence.findAll(start, end);
208            }
209    
210            /**
211             * Gets the number of polls votes.
212             *
213             * @return the number of polls votes
214             * @throws SystemException if a system exception occurred
215             */
216            public int getPollsVotesCount() throws SystemException {
217                    return pollsVotePersistence.countAll();
218            }
219    
220            /**
221             * Updates the polls vote in the database. Also notifies the appropriate model listeners.
222             *
223             * @param pollsVote the polls vote to update
224             * @return the polls vote that was updated
225             * @throws SystemException if a system exception occurred
226             */
227            public PollsVote updatePollsVote(PollsVote pollsVote)
228                    throws SystemException {
229                    pollsVote.setNew(false);
230    
231                    return pollsVotePersistence.update(pollsVote, true);
232            }
233    
234            /**
235             * Updates the polls vote in the database. Also notifies the appropriate model listeners.
236             *
237             * @param pollsVote the polls vote to update
238             * @param merge whether to merge the polls vote with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
239             * @return the polls vote that was updated
240             * @throws SystemException if a system exception occurred
241             */
242            public PollsVote updatePollsVote(PollsVote pollsVote, boolean merge)
243                    throws SystemException {
244                    pollsVote.setNew(false);
245    
246                    return pollsVotePersistence.update(pollsVote, merge);
247            }
248    
249            /**
250             * Gets the polls choice local service.
251             *
252             * @return the polls choice local service
253             */
254            public PollsChoiceLocalService getPollsChoiceLocalService() {
255                    return pollsChoiceLocalService;
256            }
257    
258            /**
259             * Sets the polls choice local service.
260             *
261             * @param pollsChoiceLocalService the polls choice local service
262             */
263            public void setPollsChoiceLocalService(
264                    PollsChoiceLocalService pollsChoiceLocalService) {
265                    this.pollsChoiceLocalService = pollsChoiceLocalService;
266            }
267    
268            /**
269             * Gets the polls choice persistence.
270             *
271             * @return the polls choice persistence
272             */
273            public PollsChoicePersistence getPollsChoicePersistence() {
274                    return pollsChoicePersistence;
275            }
276    
277            /**
278             * Sets the polls choice persistence.
279             *
280             * @param pollsChoicePersistence the polls choice persistence
281             */
282            public void setPollsChoicePersistence(
283                    PollsChoicePersistence pollsChoicePersistence) {
284                    this.pollsChoicePersistence = pollsChoicePersistence;
285            }
286    
287            /**
288             * Gets the polls choice finder.
289             *
290             * @return the polls choice finder
291             */
292            public PollsChoiceFinder getPollsChoiceFinder() {
293                    return pollsChoiceFinder;
294            }
295    
296            /**
297             * Sets the polls choice finder.
298             *
299             * @param pollsChoiceFinder the polls choice finder
300             */
301            public void setPollsChoiceFinder(PollsChoiceFinder pollsChoiceFinder) {
302                    this.pollsChoiceFinder = pollsChoiceFinder;
303            }
304    
305            /**
306             * Gets the polls question local service.
307             *
308             * @return the polls question local service
309             */
310            public PollsQuestionLocalService getPollsQuestionLocalService() {
311                    return pollsQuestionLocalService;
312            }
313    
314            /**
315             * Sets the polls question local service.
316             *
317             * @param pollsQuestionLocalService the polls question local service
318             */
319            public void setPollsQuestionLocalService(
320                    PollsQuestionLocalService pollsQuestionLocalService) {
321                    this.pollsQuestionLocalService = pollsQuestionLocalService;
322            }
323    
324            /**
325             * Gets the polls question remote service.
326             *
327             * @return the polls question remote service
328             */
329            public PollsQuestionService getPollsQuestionService() {
330                    return pollsQuestionService;
331            }
332    
333            /**
334             * Sets the polls question remote service.
335             *
336             * @param pollsQuestionService the polls question remote service
337             */
338            public void setPollsQuestionService(
339                    PollsQuestionService pollsQuestionService) {
340                    this.pollsQuestionService = pollsQuestionService;
341            }
342    
343            /**
344             * Gets the polls question persistence.
345             *
346             * @return the polls question persistence
347             */
348            public PollsQuestionPersistence getPollsQuestionPersistence() {
349                    return pollsQuestionPersistence;
350            }
351    
352            /**
353             * Sets the polls question persistence.
354             *
355             * @param pollsQuestionPersistence the polls question persistence
356             */
357            public void setPollsQuestionPersistence(
358                    PollsQuestionPersistence pollsQuestionPersistence) {
359                    this.pollsQuestionPersistence = pollsQuestionPersistence;
360            }
361    
362            /**
363             * Gets the polls vote local service.
364             *
365             * @return the polls vote local service
366             */
367            public PollsVoteLocalService getPollsVoteLocalService() {
368                    return pollsVoteLocalService;
369            }
370    
371            /**
372             * Sets the polls vote local service.
373             *
374             * @param pollsVoteLocalService the polls vote local service
375             */
376            public void setPollsVoteLocalService(
377                    PollsVoteLocalService pollsVoteLocalService) {
378                    this.pollsVoteLocalService = pollsVoteLocalService;
379            }
380    
381            /**
382             * Gets the polls vote remote service.
383             *
384             * @return the polls vote remote service
385             */
386            public PollsVoteService getPollsVoteService() {
387                    return pollsVoteService;
388            }
389    
390            /**
391             * Sets the polls vote remote service.
392             *
393             * @param pollsVoteService the polls vote remote service
394             */
395            public void setPollsVoteService(PollsVoteService pollsVoteService) {
396                    this.pollsVoteService = pollsVoteService;
397            }
398    
399            /**
400             * Gets the polls vote persistence.
401             *
402             * @return the polls vote persistence
403             */
404            public PollsVotePersistence getPollsVotePersistence() {
405                    return pollsVotePersistence;
406            }
407    
408            /**
409             * Sets the polls vote persistence.
410             *
411             * @param pollsVotePersistence the polls vote persistence
412             */
413            public void setPollsVotePersistence(
414                    PollsVotePersistence pollsVotePersistence) {
415                    this.pollsVotePersistence = pollsVotePersistence;
416            }
417    
418            /**
419             * Gets the counter local service.
420             *
421             * @return the counter local service
422             */
423            public CounterLocalService getCounterLocalService() {
424                    return counterLocalService;
425            }
426    
427            /**
428             * Sets the counter local service.
429             *
430             * @param counterLocalService the counter local service
431             */
432            public void setCounterLocalService(CounterLocalService counterLocalService) {
433                    this.counterLocalService = counterLocalService;
434            }
435    
436            /**
437             * Gets the resource local service.
438             *
439             * @return the resource local service
440             */
441            public ResourceLocalService getResourceLocalService() {
442                    return resourceLocalService;
443            }
444    
445            /**
446             * Sets the resource local service.
447             *
448             * @param resourceLocalService the resource local service
449             */
450            public void setResourceLocalService(
451                    ResourceLocalService resourceLocalService) {
452                    this.resourceLocalService = resourceLocalService;
453            }
454    
455            /**
456             * Gets the resource remote service.
457             *
458             * @return the resource remote service
459             */
460            public ResourceService getResourceService() {
461                    return resourceService;
462            }
463    
464            /**
465             * Sets the resource remote service.
466             *
467             * @param resourceService the resource remote service
468             */
469            public void setResourceService(ResourceService resourceService) {
470                    this.resourceService = resourceService;
471            }
472    
473            /**
474             * Gets the resource persistence.
475             *
476             * @return the resource persistence
477             */
478            public ResourcePersistence getResourcePersistence() {
479                    return resourcePersistence;
480            }
481    
482            /**
483             * Sets the resource persistence.
484             *
485             * @param resourcePersistence the resource persistence
486             */
487            public void setResourcePersistence(ResourcePersistence resourcePersistence) {
488                    this.resourcePersistence = resourcePersistence;
489            }
490    
491            /**
492             * Gets the resource finder.
493             *
494             * @return the resource finder
495             */
496            public ResourceFinder getResourceFinder() {
497                    return resourceFinder;
498            }
499    
500            /**
501             * Sets the resource finder.
502             *
503             * @param resourceFinder the resource finder
504             */
505            public void setResourceFinder(ResourceFinder resourceFinder) {
506                    this.resourceFinder = resourceFinder;
507            }
508    
509            /**
510             * Gets the user local service.
511             *
512             * @return the user local service
513             */
514            public UserLocalService getUserLocalService() {
515                    return userLocalService;
516            }
517    
518            /**
519             * Sets the user local service.
520             *
521             * @param userLocalService the user local service
522             */
523            public void setUserLocalService(UserLocalService userLocalService) {
524                    this.userLocalService = userLocalService;
525            }
526    
527            /**
528             * Gets the user remote service.
529             *
530             * @return the user remote service
531             */
532            public UserService getUserService() {
533                    return userService;
534            }
535    
536            /**
537             * Sets the user remote service.
538             *
539             * @param userService the user remote service
540             */
541            public void setUserService(UserService userService) {
542                    this.userService = userService;
543            }
544    
545            /**
546             * Gets the user persistence.
547             *
548             * @return the user persistence
549             */
550            public UserPersistence getUserPersistence() {
551                    return userPersistence;
552            }
553    
554            /**
555             * Sets the user persistence.
556             *
557             * @param userPersistence the user persistence
558             */
559            public void setUserPersistence(UserPersistence userPersistence) {
560                    this.userPersistence = userPersistence;
561            }
562    
563            /**
564             * Gets the user finder.
565             *
566             * @return the user finder
567             */
568            public UserFinder getUserFinder() {
569                    return userFinder;
570            }
571    
572            /**
573             * Sets the user finder.
574             *
575             * @param userFinder the user finder
576             */
577            public void setUserFinder(UserFinder userFinder) {
578                    this.userFinder = userFinder;
579            }
580    
581            /**
582             * Performs an SQL query.
583             *
584             * @param sql the sql query to perform
585             */
586            protected void runSQL(String sql) throws SystemException {
587                    try {
588                            DataSource dataSource = pollsVotePersistence.getDataSource();
589    
590                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
591                                            sql, new int[0]);
592    
593                            sqlUpdate.update();
594                    }
595                    catch (Exception e) {
596                            throw new SystemException(e);
597                    }
598            }
599    
600            @BeanReference(type = PollsChoiceLocalService.class)
601            protected PollsChoiceLocalService pollsChoiceLocalService;
602            @BeanReference(type = PollsChoicePersistence.class)
603            protected PollsChoicePersistence pollsChoicePersistence;
604            @BeanReference(type = PollsChoiceFinder.class)
605            protected PollsChoiceFinder pollsChoiceFinder;
606            @BeanReference(type = PollsQuestionLocalService.class)
607            protected PollsQuestionLocalService pollsQuestionLocalService;
608            @BeanReference(type = PollsQuestionService.class)
609            protected PollsQuestionService pollsQuestionService;
610            @BeanReference(type = PollsQuestionPersistence.class)
611            protected PollsQuestionPersistence pollsQuestionPersistence;
612            @BeanReference(type = PollsVoteLocalService.class)
613            protected PollsVoteLocalService pollsVoteLocalService;
614            @BeanReference(type = PollsVoteService.class)
615            protected PollsVoteService pollsVoteService;
616            @BeanReference(type = PollsVotePersistence.class)
617            protected PollsVotePersistence pollsVotePersistence;
618            @BeanReference(type = CounterLocalService.class)
619            protected CounterLocalService counterLocalService;
620            @BeanReference(type = ResourceLocalService.class)
621            protected ResourceLocalService resourceLocalService;
622            @BeanReference(type = ResourceService.class)
623            protected ResourceService resourceService;
624            @BeanReference(type = ResourcePersistence.class)
625            protected ResourcePersistence resourcePersistence;
626            @BeanReference(type = ResourceFinder.class)
627            protected ResourceFinder resourceFinder;
628            @BeanReference(type = UserLocalService.class)
629            protected UserLocalService userLocalService;
630            @BeanReference(type = UserService.class)
631            protected UserService userService;
632            @BeanReference(type = UserPersistence.class)
633            protected UserPersistence userPersistence;
634            @BeanReference(type = UserFinder.class)
635            protected UserFinder userFinder;
636    }