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