1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.polls.service.base;
24  
25  import com.liferay.counter.service.CounterLocalService;
26  import com.liferay.counter.service.CounterService;
27  
28  import com.liferay.portal.PortalException;
29  import com.liferay.portal.SystemException;
30  import com.liferay.portal.kernel.annotation.BeanReference;
31  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
32  import com.liferay.portal.util.PortalUtil;
33  
34  import com.liferay.portlet.polls.model.PollsVote;
35  import com.liferay.portlet.polls.service.PollsChoiceLocalService;
36  import com.liferay.portlet.polls.service.PollsQuestionLocalService;
37  import com.liferay.portlet.polls.service.PollsQuestionService;
38  import com.liferay.portlet.polls.service.PollsVoteLocalService;
39  import com.liferay.portlet.polls.service.PollsVoteService;
40  import com.liferay.portlet.polls.service.persistence.PollsChoiceFinder;
41  import com.liferay.portlet.polls.service.persistence.PollsChoicePersistence;
42  import com.liferay.portlet.polls.service.persistence.PollsQuestionPersistence;
43  import com.liferay.portlet.polls.service.persistence.PollsVotePersistence;
44  
45  import java.util.List;
46  
47  /**
48   * <a href="PollsVoteLocalServiceBaseImpl.java.html"><b><i>View Source</i></b></a>
49   *
50   * @author Brian Wing Shun Chan
51   *
52   */
53  public abstract class PollsVoteLocalServiceBaseImpl
54      implements PollsVoteLocalService {
55      public PollsVote addPollsVote(PollsVote pollsVote)
56          throws SystemException {
57          pollsVote.setNew(true);
58  
59          return pollsVotePersistence.update(pollsVote, false);
60      }
61  
62      public PollsVote createPollsVote(long voteId) {
63          return pollsVotePersistence.create(voteId);
64      }
65  
66      public void deletePollsVote(long voteId)
67          throws PortalException, SystemException {
68          pollsVotePersistence.remove(voteId);
69      }
70  
71      public void deletePollsVote(PollsVote pollsVote) throws SystemException {
72          pollsVotePersistence.remove(pollsVote);
73      }
74  
75      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
76          throws SystemException {
77          return pollsVotePersistence.findWithDynamicQuery(dynamicQuery);
78      }
79  
80      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
81          int end) throws SystemException {
82          return pollsVotePersistence.findWithDynamicQuery(dynamicQuery, start,
83              end);
84      }
85  
86      public PollsVote getPollsVote(long voteId)
87          throws PortalException, SystemException {
88          return pollsVotePersistence.findByPrimaryKey(voteId);
89      }
90  
91      public List<PollsVote> getPollsVotes(int start, int end)
92          throws SystemException {
93          return pollsVotePersistence.findAll(start, end);
94      }
95  
96      public int getPollsVotesCount() throws SystemException {
97          return pollsVotePersistence.countAll();
98      }
99  
100     public PollsVote updatePollsVote(PollsVote pollsVote)
101         throws SystemException {
102         pollsVote.setNew(false);
103 
104         return pollsVotePersistence.update(pollsVote, true);
105     }
106 
107     public PollsVote updatePollsVote(PollsVote pollsVote, boolean merge)
108         throws SystemException {
109         pollsVote.setNew(false);
110 
111         return pollsVotePersistence.update(pollsVote, merge);
112     }
113 
114     public PollsChoiceLocalService getPollsChoiceLocalService() {
115         return pollsChoiceLocalService;
116     }
117 
118     public void setPollsChoiceLocalService(
119         PollsChoiceLocalService pollsChoiceLocalService) {
120         this.pollsChoiceLocalService = pollsChoiceLocalService;
121     }
122 
123     public PollsChoicePersistence getPollsChoicePersistence() {
124         return pollsChoicePersistence;
125     }
126 
127     public void setPollsChoicePersistence(
128         PollsChoicePersistence pollsChoicePersistence) {
129         this.pollsChoicePersistence = pollsChoicePersistence;
130     }
131 
132     public PollsChoiceFinder getPollsChoiceFinder() {
133         return pollsChoiceFinder;
134     }
135 
136     public void setPollsChoiceFinder(PollsChoiceFinder pollsChoiceFinder) {
137         this.pollsChoiceFinder = pollsChoiceFinder;
138     }
139 
140     public PollsQuestionLocalService getPollsQuestionLocalService() {
141         return pollsQuestionLocalService;
142     }
143 
144     public void setPollsQuestionLocalService(
145         PollsQuestionLocalService pollsQuestionLocalService) {
146         this.pollsQuestionLocalService = pollsQuestionLocalService;
147     }
148 
149     public PollsQuestionService getPollsQuestionService() {
150         return pollsQuestionService;
151     }
152 
153     public void setPollsQuestionService(
154         PollsQuestionService pollsQuestionService) {
155         this.pollsQuestionService = pollsQuestionService;
156     }
157 
158     public PollsQuestionPersistence getPollsQuestionPersistence() {
159         return pollsQuestionPersistence;
160     }
161 
162     public void setPollsQuestionPersistence(
163         PollsQuestionPersistence pollsQuestionPersistence) {
164         this.pollsQuestionPersistence = pollsQuestionPersistence;
165     }
166 
167     public PollsVoteLocalService getPollsVoteLocalService() {
168         return pollsVoteLocalService;
169     }
170 
171     public void setPollsVoteLocalService(
172         PollsVoteLocalService pollsVoteLocalService) {
173         this.pollsVoteLocalService = pollsVoteLocalService;
174     }
175 
176     public PollsVoteService getPollsVoteService() {
177         return pollsVoteService;
178     }
179 
180     public void setPollsVoteService(PollsVoteService pollsVoteService) {
181         this.pollsVoteService = pollsVoteService;
182     }
183 
184     public PollsVotePersistence getPollsVotePersistence() {
185         return pollsVotePersistence;
186     }
187 
188     public void setPollsVotePersistence(
189         PollsVotePersistence pollsVotePersistence) {
190         this.pollsVotePersistence = pollsVotePersistence;
191     }
192 
193     public CounterLocalService getCounterLocalService() {
194         return counterLocalService;
195     }
196 
197     public void setCounterLocalService(CounterLocalService counterLocalService) {
198         this.counterLocalService = counterLocalService;
199     }
200 
201     public CounterService getCounterService() {
202         return counterService;
203     }
204 
205     public void setCounterService(CounterService counterService) {
206         this.counterService = counterService;
207     }
208 
209     protected void runSQL(String sql) throws SystemException {
210         try {
211             PortalUtil.runSQL(sql);
212         }
213         catch (Exception e) {
214             throw new SystemException(e);
215         }
216     }
217 
218     @BeanReference(name = "com.liferay.portlet.polls.service.PollsChoiceLocalService.impl")
219     protected PollsChoiceLocalService pollsChoiceLocalService;
220     @BeanReference(name = "com.liferay.portlet.polls.service.persistence.PollsChoicePersistence.impl")
221     protected PollsChoicePersistence pollsChoicePersistence;
222     @BeanReference(name = "com.liferay.portlet.polls.service.persistence.PollsChoiceFinder.impl")
223     protected PollsChoiceFinder pollsChoiceFinder;
224     @BeanReference(name = "com.liferay.portlet.polls.service.PollsQuestionLocalService.impl")
225     protected PollsQuestionLocalService pollsQuestionLocalService;
226     @BeanReference(name = "com.liferay.portlet.polls.service.PollsQuestionService.impl")
227     protected PollsQuestionService pollsQuestionService;
228     @BeanReference(name = "com.liferay.portlet.polls.service.persistence.PollsQuestionPersistence.impl")
229     protected PollsQuestionPersistence pollsQuestionPersistence;
230     @BeanReference(name = "com.liferay.portlet.polls.service.PollsVoteLocalService.impl")
231     protected PollsVoteLocalService pollsVoteLocalService;
232     @BeanReference(name = "com.liferay.portlet.polls.service.PollsVoteService.impl")
233     protected PollsVoteService pollsVoteService;
234     @BeanReference(name = "com.liferay.portlet.polls.service.persistence.PollsVotePersistence.impl")
235     protected PollsVotePersistence pollsVotePersistence;
236     @BeanReference(name = "com.liferay.counter.service.CounterLocalService.impl")
237     protected CounterLocalService counterLocalService;
238     @BeanReference(name = "com.liferay.counter.service.CounterService.impl")
239     protected CounterService counterService;
240 }