1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet.polls.service.base;
16  
17  import com.liferay.counter.service.CounterLocalService;
18  import com.liferay.counter.service.CounterService;
19  
20  import com.liferay.portal.PortalException;
21  import com.liferay.portal.SystemException;
22  import com.liferay.portal.kernel.annotation.BeanReference;
23  import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
24  import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
25  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
26  import com.liferay.portal.kernel.util.OrderByComparator;
27  import com.liferay.portal.service.ResourceLocalService;
28  import com.liferay.portal.service.ResourceService;
29  import com.liferay.portal.service.UserLocalService;
30  import com.liferay.portal.service.UserService;
31  import com.liferay.portal.service.persistence.ResourceFinder;
32  import com.liferay.portal.service.persistence.ResourcePersistence;
33  import com.liferay.portal.service.persistence.UserFinder;
34  import com.liferay.portal.service.persistence.UserPersistence;
35  
36  import com.liferay.portlet.polls.model.PollsVote;
37  import com.liferay.portlet.polls.service.PollsChoiceLocalService;
38  import com.liferay.portlet.polls.service.PollsQuestionLocalService;
39  import com.liferay.portlet.polls.service.PollsQuestionService;
40  import com.liferay.portlet.polls.service.PollsVoteLocalService;
41  import com.liferay.portlet.polls.service.PollsVoteService;
42  import com.liferay.portlet.polls.service.persistence.PollsChoiceFinder;
43  import com.liferay.portlet.polls.service.persistence.PollsChoicePersistence;
44  import com.liferay.portlet.polls.service.persistence.PollsQuestionPersistence;
45  import com.liferay.portlet.polls.service.persistence.PollsVotePersistence;
46  
47  import java.util.List;
48  
49  import javax.sql.DataSource;
50  
51  /**
52   * <a href="PollsVoteLocalServiceBaseImpl.java.html"><b><i>View Source</i></b>
53   * </a>
54   *
55   * @author Brian Wing Shun Chan
56   */
57  public abstract class PollsVoteLocalServiceBaseImpl
58      implements PollsVoteLocalService {
59      public PollsVote addPollsVote(PollsVote pollsVote)
60          throws SystemException {
61          pollsVote.setNew(true);
62  
63          return pollsVotePersistence.update(pollsVote, false);
64      }
65  
66      public PollsVote createPollsVote(long voteId) {
67          return pollsVotePersistence.create(voteId);
68      }
69  
70      public void deletePollsVote(long voteId)
71          throws PortalException, SystemException {
72          pollsVotePersistence.remove(voteId);
73      }
74  
75      public void deletePollsVote(PollsVote pollsVote) throws SystemException {
76          pollsVotePersistence.remove(pollsVote);
77      }
78  
79      @SuppressWarnings("rawtypes")
80      public List dynamicQuery(DynamicQuery dynamicQuery)
81          throws SystemException {
82          return pollsVotePersistence.findWithDynamicQuery(dynamicQuery);
83      }
84  
85      @SuppressWarnings("rawtypes")
86      public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
87          throws SystemException {
88          return pollsVotePersistence.findWithDynamicQuery(dynamicQuery, start,
89              end);
90      }
91  
92      @SuppressWarnings("rawtypes")
93      public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
94          OrderByComparator orderByComparator) throws SystemException {
95          return pollsVotePersistence.findWithDynamicQuery(dynamicQuery, start,
96              end, orderByComparator);
97      }
98  
99      public int dynamicQueryCount(DynamicQuery dynamicQuery)
100         throws SystemException {
101         return pollsVotePersistence.countWithDynamicQuery(dynamicQuery);
102     }
103 
104     public PollsVote getPollsVote(long voteId)
105         throws PortalException, SystemException {
106         return pollsVotePersistence.findByPrimaryKey(voteId);
107     }
108 
109     public List<PollsVote> getPollsVotes(int start, int end)
110         throws SystemException {
111         return pollsVotePersistence.findAll(start, end);
112     }
113 
114     public int getPollsVotesCount() throws SystemException {
115         return pollsVotePersistence.countAll();
116     }
117 
118     public PollsVote updatePollsVote(PollsVote pollsVote)
119         throws SystemException {
120         pollsVote.setNew(false);
121 
122         return pollsVotePersistence.update(pollsVote, true);
123     }
124 
125     public PollsVote updatePollsVote(PollsVote pollsVote, boolean merge)
126         throws SystemException {
127         pollsVote.setNew(false);
128 
129         return pollsVotePersistence.update(pollsVote, merge);
130     }
131 
132     public PollsChoiceLocalService getPollsChoiceLocalService() {
133         return pollsChoiceLocalService;
134     }
135 
136     public void setPollsChoiceLocalService(
137         PollsChoiceLocalService pollsChoiceLocalService) {
138         this.pollsChoiceLocalService = pollsChoiceLocalService;
139     }
140 
141     public PollsChoicePersistence getPollsChoicePersistence() {
142         return pollsChoicePersistence;
143     }
144 
145     public void setPollsChoicePersistence(
146         PollsChoicePersistence pollsChoicePersistence) {
147         this.pollsChoicePersistence = pollsChoicePersistence;
148     }
149 
150     public PollsChoiceFinder getPollsChoiceFinder() {
151         return pollsChoiceFinder;
152     }
153 
154     public void setPollsChoiceFinder(PollsChoiceFinder pollsChoiceFinder) {
155         this.pollsChoiceFinder = pollsChoiceFinder;
156     }
157 
158     public PollsQuestionLocalService getPollsQuestionLocalService() {
159         return pollsQuestionLocalService;
160     }
161 
162     public void setPollsQuestionLocalService(
163         PollsQuestionLocalService pollsQuestionLocalService) {
164         this.pollsQuestionLocalService = pollsQuestionLocalService;
165     }
166 
167     public PollsQuestionService getPollsQuestionService() {
168         return pollsQuestionService;
169     }
170 
171     public void setPollsQuestionService(
172         PollsQuestionService pollsQuestionService) {
173         this.pollsQuestionService = pollsQuestionService;
174     }
175 
176     public PollsQuestionPersistence getPollsQuestionPersistence() {
177         return pollsQuestionPersistence;
178     }
179 
180     public void setPollsQuestionPersistence(
181         PollsQuestionPersistence pollsQuestionPersistence) {
182         this.pollsQuestionPersistence = pollsQuestionPersistence;
183     }
184 
185     public PollsVoteLocalService getPollsVoteLocalService() {
186         return pollsVoteLocalService;
187     }
188 
189     public void setPollsVoteLocalService(
190         PollsVoteLocalService pollsVoteLocalService) {
191         this.pollsVoteLocalService = pollsVoteLocalService;
192     }
193 
194     public PollsVoteService getPollsVoteService() {
195         return pollsVoteService;
196     }
197 
198     public void setPollsVoteService(PollsVoteService pollsVoteService) {
199         this.pollsVoteService = pollsVoteService;
200     }
201 
202     public PollsVotePersistence getPollsVotePersistence() {
203         return pollsVotePersistence;
204     }
205 
206     public void setPollsVotePersistence(
207         PollsVotePersistence pollsVotePersistence) {
208         this.pollsVotePersistence = pollsVotePersistence;
209     }
210 
211     public CounterLocalService getCounterLocalService() {
212         return counterLocalService;
213     }
214 
215     public void setCounterLocalService(CounterLocalService counterLocalService) {
216         this.counterLocalService = counterLocalService;
217     }
218 
219     public CounterService getCounterService() {
220         return counterService;
221     }
222 
223     public void setCounterService(CounterService counterService) {
224         this.counterService = counterService;
225     }
226 
227     public ResourceLocalService getResourceLocalService() {
228         return resourceLocalService;
229     }
230 
231     public void setResourceLocalService(
232         ResourceLocalService resourceLocalService) {
233         this.resourceLocalService = resourceLocalService;
234     }
235 
236     public ResourceService getResourceService() {
237         return resourceService;
238     }
239 
240     public void setResourceService(ResourceService resourceService) {
241         this.resourceService = resourceService;
242     }
243 
244     public ResourcePersistence getResourcePersistence() {
245         return resourcePersistence;
246     }
247 
248     public void setResourcePersistence(ResourcePersistence resourcePersistence) {
249         this.resourcePersistence = resourcePersistence;
250     }
251 
252     public ResourceFinder getResourceFinder() {
253         return resourceFinder;
254     }
255 
256     public void setResourceFinder(ResourceFinder resourceFinder) {
257         this.resourceFinder = resourceFinder;
258     }
259 
260     public UserLocalService getUserLocalService() {
261         return userLocalService;
262     }
263 
264     public void setUserLocalService(UserLocalService userLocalService) {
265         this.userLocalService = userLocalService;
266     }
267 
268     public UserService getUserService() {
269         return userService;
270     }
271 
272     public void setUserService(UserService userService) {
273         this.userService = userService;
274     }
275 
276     public UserPersistence getUserPersistence() {
277         return userPersistence;
278     }
279 
280     public void setUserPersistence(UserPersistence userPersistence) {
281         this.userPersistence = userPersistence;
282     }
283 
284     public UserFinder getUserFinder() {
285         return userFinder;
286     }
287 
288     public void setUserFinder(UserFinder userFinder) {
289         this.userFinder = userFinder;
290     }
291 
292     protected void runSQL(String sql) throws SystemException {
293         try {
294             DataSource dataSource = pollsVotePersistence.getDataSource();
295 
296             SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
297                     sql, new int[0]);
298 
299             sqlUpdate.update(new Object[0]);
300         }
301         catch (Exception e) {
302             throw new SystemException(e);
303         }
304     }
305 
306     @BeanReference(type = PollsChoiceLocalService.class)
307     protected PollsChoiceLocalService pollsChoiceLocalService;
308     @BeanReference(type = PollsChoicePersistence.class)
309     protected PollsChoicePersistence pollsChoicePersistence;
310     @BeanReference(type = PollsChoiceFinder.class)
311     protected PollsChoiceFinder pollsChoiceFinder;
312     @BeanReference(type = PollsQuestionLocalService.class)
313     protected PollsQuestionLocalService pollsQuestionLocalService;
314     @BeanReference(type = PollsQuestionService.class)
315     protected PollsQuestionService pollsQuestionService;
316     @BeanReference(type = PollsQuestionPersistence.class)
317     protected PollsQuestionPersistence pollsQuestionPersistence;
318     @BeanReference(type = PollsVoteLocalService.class)
319     protected PollsVoteLocalService pollsVoteLocalService;
320     @BeanReference(type = PollsVoteService.class)
321     protected PollsVoteService pollsVoteService;
322     @BeanReference(type = PollsVotePersistence.class)
323     protected PollsVotePersistence pollsVotePersistence;
324     @BeanReference(type = CounterLocalService.class)
325     protected CounterLocalService counterLocalService;
326     @BeanReference(type = CounterService.class)
327     protected CounterService counterService;
328     @BeanReference(type = ResourceLocalService.class)
329     protected ResourceLocalService resourceLocalService;
330     @BeanReference(type = ResourceService.class)
331     protected ResourceService resourceService;
332     @BeanReference(type = ResourcePersistence.class)
333     protected ResourcePersistence resourcePersistence;
334     @BeanReference(type = ResourceFinder.class)
335     protected ResourceFinder resourceFinder;
336     @BeanReference(type = UserLocalService.class)
337     protected UserLocalService userLocalService;
338     @BeanReference(type = UserService.class)
339     protected UserService userService;
340     @BeanReference(type = UserPersistence.class)
341     protected UserPersistence userPersistence;
342     @BeanReference(type = UserFinder.class)
343     protected UserFinder userFinder;
344 }