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.db.DB;
21  import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
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  /**
49   * <a href="PollsVoteLocalServiceBaseImpl.java.html"><b><i>View Source</i></b>
50   * </a>
51   *
52   * @author Brian Wing Shun Chan
53   */
54  public abstract class PollsVoteLocalServiceBaseImpl
55      implements PollsVoteLocalService {
56      public PollsVote addPollsVote(PollsVote pollsVote)
57          throws SystemException {
58          pollsVote.setNew(true);
59  
60          return pollsVotePersistence.update(pollsVote, false);
61      }
62  
63      public PollsVote createPollsVote(long voteId) {
64          return pollsVotePersistence.create(voteId);
65      }
66  
67      public void deletePollsVote(long voteId)
68          throws PortalException, SystemException {
69          pollsVotePersistence.remove(voteId);
70      }
71  
72      public void deletePollsVote(PollsVote pollsVote) throws SystemException {
73          pollsVotePersistence.remove(pollsVote);
74      }
75  
76      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
77          throws SystemException {
78          return pollsVotePersistence.findWithDynamicQuery(dynamicQuery);
79      }
80  
81      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
82          int end) throws SystemException {
83          return pollsVotePersistence.findWithDynamicQuery(dynamicQuery, start,
84              end);
85      }
86  
87      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
88          int end, OrderByComparator orderByComparator) throws SystemException {
89          return pollsVotePersistence.findWithDynamicQuery(dynamicQuery, start,
90              end, orderByComparator);
91      }
92  
93      public int dynamicQueryCount(DynamicQuery dynamicQuery)
94          throws SystemException {
95          return pollsVotePersistence.countWithDynamicQuery(dynamicQuery);
96      }
97  
98      public PollsVote getPollsVote(long voteId)
99          throws PortalException, SystemException {
100         return pollsVotePersistence.findByPrimaryKey(voteId);
101     }
102 
103     public List<PollsVote> getPollsVotes(int start, int end)
104         throws SystemException {
105         return pollsVotePersistence.findAll(start, end);
106     }
107 
108     public int getPollsVotesCount() throws SystemException {
109         return pollsVotePersistence.countAll();
110     }
111 
112     public PollsVote updatePollsVote(PollsVote pollsVote)
113         throws SystemException {
114         pollsVote.setNew(false);
115 
116         return pollsVotePersistence.update(pollsVote, true);
117     }
118 
119     public PollsVote updatePollsVote(PollsVote pollsVote, boolean merge)
120         throws SystemException {
121         pollsVote.setNew(false);
122 
123         return pollsVotePersistence.update(pollsVote, merge);
124     }
125 
126     public PollsChoiceLocalService getPollsChoiceLocalService() {
127         return pollsChoiceLocalService;
128     }
129 
130     public void setPollsChoiceLocalService(
131         PollsChoiceLocalService pollsChoiceLocalService) {
132         this.pollsChoiceLocalService = pollsChoiceLocalService;
133     }
134 
135     public PollsChoicePersistence getPollsChoicePersistence() {
136         return pollsChoicePersistence;
137     }
138 
139     public void setPollsChoicePersistence(
140         PollsChoicePersistence pollsChoicePersistence) {
141         this.pollsChoicePersistence = pollsChoicePersistence;
142     }
143 
144     public PollsChoiceFinder getPollsChoiceFinder() {
145         return pollsChoiceFinder;
146     }
147 
148     public void setPollsChoiceFinder(PollsChoiceFinder pollsChoiceFinder) {
149         this.pollsChoiceFinder = pollsChoiceFinder;
150     }
151 
152     public PollsQuestionLocalService getPollsQuestionLocalService() {
153         return pollsQuestionLocalService;
154     }
155 
156     public void setPollsQuestionLocalService(
157         PollsQuestionLocalService pollsQuestionLocalService) {
158         this.pollsQuestionLocalService = pollsQuestionLocalService;
159     }
160 
161     public PollsQuestionService getPollsQuestionService() {
162         return pollsQuestionService;
163     }
164 
165     public void setPollsQuestionService(
166         PollsQuestionService pollsQuestionService) {
167         this.pollsQuestionService = pollsQuestionService;
168     }
169 
170     public PollsQuestionPersistence getPollsQuestionPersistence() {
171         return pollsQuestionPersistence;
172     }
173 
174     public void setPollsQuestionPersistence(
175         PollsQuestionPersistence pollsQuestionPersistence) {
176         this.pollsQuestionPersistence = pollsQuestionPersistence;
177     }
178 
179     public PollsVoteLocalService getPollsVoteLocalService() {
180         return pollsVoteLocalService;
181     }
182 
183     public void setPollsVoteLocalService(
184         PollsVoteLocalService pollsVoteLocalService) {
185         this.pollsVoteLocalService = pollsVoteLocalService;
186     }
187 
188     public PollsVoteService getPollsVoteService() {
189         return pollsVoteService;
190     }
191 
192     public void setPollsVoteService(PollsVoteService pollsVoteService) {
193         this.pollsVoteService = pollsVoteService;
194     }
195 
196     public PollsVotePersistence getPollsVotePersistence() {
197         return pollsVotePersistence;
198     }
199 
200     public void setPollsVotePersistence(
201         PollsVotePersistence pollsVotePersistence) {
202         this.pollsVotePersistence = pollsVotePersistence;
203     }
204 
205     public CounterLocalService getCounterLocalService() {
206         return counterLocalService;
207     }
208 
209     public void setCounterLocalService(CounterLocalService counterLocalService) {
210         this.counterLocalService = counterLocalService;
211     }
212 
213     public ResourceLocalService getResourceLocalService() {
214         return resourceLocalService;
215     }
216 
217     public void setResourceLocalService(
218         ResourceLocalService resourceLocalService) {
219         this.resourceLocalService = resourceLocalService;
220     }
221 
222     public ResourceService getResourceService() {
223         return resourceService;
224     }
225 
226     public void setResourceService(ResourceService resourceService) {
227         this.resourceService = resourceService;
228     }
229 
230     public ResourcePersistence getResourcePersistence() {
231         return resourcePersistence;
232     }
233 
234     public void setResourcePersistence(ResourcePersistence resourcePersistence) {
235         this.resourcePersistence = resourcePersistence;
236     }
237 
238     public ResourceFinder getResourceFinder() {
239         return resourceFinder;
240     }
241 
242     public void setResourceFinder(ResourceFinder resourceFinder) {
243         this.resourceFinder = resourceFinder;
244     }
245 
246     public UserLocalService getUserLocalService() {
247         return userLocalService;
248     }
249 
250     public void setUserLocalService(UserLocalService userLocalService) {
251         this.userLocalService = userLocalService;
252     }
253 
254     public UserService getUserService() {
255         return userService;
256     }
257 
258     public void setUserService(UserService userService) {
259         this.userService = userService;
260     }
261 
262     public UserPersistence getUserPersistence() {
263         return userPersistence;
264     }
265 
266     public void setUserPersistence(UserPersistence userPersistence) {
267         this.userPersistence = userPersistence;
268     }
269 
270     public UserFinder getUserFinder() {
271         return userFinder;
272     }
273 
274     public void setUserFinder(UserFinder userFinder) {
275         this.userFinder = userFinder;
276     }
277 
278     protected void runSQL(String sql) throws SystemException {
279         try {
280             DB db = DBFactoryUtil.getDB();
281 
282             db.runSQL(sql);
283         }
284         catch (Exception e) {
285             throw new SystemException(e);
286         }
287     }
288 
289     @BeanReference(type = PollsChoiceLocalService.class)
290     protected PollsChoiceLocalService pollsChoiceLocalService;
291     @BeanReference(type = PollsChoicePersistence.class)
292     protected PollsChoicePersistence pollsChoicePersistence;
293     @BeanReference(type = PollsChoiceFinder.class)
294     protected PollsChoiceFinder pollsChoiceFinder;
295     @BeanReference(type = PollsQuestionLocalService.class)
296     protected PollsQuestionLocalService pollsQuestionLocalService;
297     @BeanReference(type = PollsQuestionService.class)
298     protected PollsQuestionService pollsQuestionService;
299     @BeanReference(type = PollsQuestionPersistence.class)
300     protected PollsQuestionPersistence pollsQuestionPersistence;
301     @BeanReference(type = PollsVoteLocalService.class)
302     protected PollsVoteLocalService pollsVoteLocalService;
303     @BeanReference(type = PollsVoteService.class)
304     protected PollsVoteService pollsVoteService;
305     @BeanReference(type = PollsVotePersistence.class)
306     protected PollsVotePersistence pollsVotePersistence;
307     @BeanReference(type = CounterLocalService.class)
308     protected CounterLocalService counterLocalService;
309     @BeanReference(type = ResourceLocalService.class)
310     protected ResourceLocalService resourceLocalService;
311     @BeanReference(type = ResourceService.class)
312     protected ResourceService resourceService;
313     @BeanReference(type = ResourcePersistence.class)
314     protected ResourcePersistence resourcePersistence;
315     @BeanReference(type = ResourceFinder.class)
316     protected ResourceFinder resourceFinder;
317     @BeanReference(type = UserLocalService.class)
318     protected UserLocalService userLocalService;
319     @BeanReference(type = UserService.class)
320     protected UserService userService;
321     @BeanReference(type = UserPersistence.class)
322     protected UserPersistence userPersistence;
323     @BeanReference(type = UserFinder.class)
324     protected UserFinder userFinder;
325 }