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.PollsChoice;
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="PollsChoiceLocalServiceBaseImpl.java.html"><b><i>View Source</i></b>
52   * </a>
53   *
54   * @author Brian Wing Shun Chan
55   */
56  public abstract class PollsChoiceLocalServiceBaseImpl
57      implements PollsChoiceLocalService {
58      public PollsChoice addPollsChoice(PollsChoice pollsChoice)
59          throws SystemException {
60          pollsChoice.setNew(true);
61  
62          return pollsChoicePersistence.update(pollsChoice, false);
63      }
64  
65      public PollsChoice createPollsChoice(long choiceId) {
66          return pollsChoicePersistence.create(choiceId);
67      }
68  
69      public void deletePollsChoice(long choiceId)
70          throws PortalException, SystemException {
71          pollsChoicePersistence.remove(choiceId);
72      }
73  
74      public void deletePollsChoice(PollsChoice pollsChoice)
75          throws SystemException {
76          pollsChoicePersistence.remove(pollsChoice);
77      }
78  
79      @SuppressWarnings("unchecked")
80      public List dynamicQuery(DynamicQuery dynamicQuery)
81          throws SystemException {
82          return pollsChoicePersistence.findWithDynamicQuery(dynamicQuery);
83      }
84  
85      @SuppressWarnings("unchecked")
86      public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
87          throws SystemException {
88          return pollsChoicePersistence.findWithDynamicQuery(dynamicQuery, start,
89              end);
90      }
91  
92      @SuppressWarnings("unchecked")
93      public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
94          OrderByComparator orderByComparator) throws SystemException {
95          return pollsChoicePersistence.findWithDynamicQuery(dynamicQuery, start,
96              end, orderByComparator);
97      }
98  
99      public long dynamicQueryCount(DynamicQuery dynamicQuery)
100         throws SystemException {
101         return pollsChoicePersistence.countWithDynamicQuery(dynamicQuery);
102     }
103 
104     public PollsChoice getPollsChoice(long choiceId)
105         throws PortalException, SystemException {
106         return pollsChoicePersistence.findByPrimaryKey(choiceId);
107     }
108 
109     public List<PollsChoice> getPollsChoices(int start, int end)
110         throws SystemException {
111         return pollsChoicePersistence.findAll(start, end);
112     }
113 
114     public int getPollsChoicesCount() throws SystemException {
115         return pollsChoicePersistence.countAll();
116     }
117 
118     public PollsChoice updatePollsChoice(PollsChoice pollsChoice)
119         throws SystemException {
120         pollsChoice.setNew(false);
121 
122         return pollsChoicePersistence.update(pollsChoice, true);
123     }
124 
125     public PollsChoice updatePollsChoice(PollsChoice pollsChoice, boolean merge)
126         throws SystemException {
127         pollsChoice.setNew(false);
128 
129         return pollsChoicePersistence.update(pollsChoice, 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 ResourceLocalService getResourceLocalService() {
220         return resourceLocalService;
221     }
222 
223     public void setResourceLocalService(
224         ResourceLocalService resourceLocalService) {
225         this.resourceLocalService = resourceLocalService;
226     }
227 
228     public ResourceService getResourceService() {
229         return resourceService;
230     }
231 
232     public void setResourceService(ResourceService resourceService) {
233         this.resourceService = resourceService;
234     }
235 
236     public ResourcePersistence getResourcePersistence() {
237         return resourcePersistence;
238     }
239 
240     public void setResourcePersistence(ResourcePersistence resourcePersistence) {
241         this.resourcePersistence = resourcePersistence;
242     }
243 
244     public ResourceFinder getResourceFinder() {
245         return resourceFinder;
246     }
247 
248     public void setResourceFinder(ResourceFinder resourceFinder) {
249         this.resourceFinder = resourceFinder;
250     }
251 
252     public UserLocalService getUserLocalService() {
253         return userLocalService;
254     }
255 
256     public void setUserLocalService(UserLocalService userLocalService) {
257         this.userLocalService = userLocalService;
258     }
259 
260     public UserService getUserService() {
261         return userService;
262     }
263 
264     public void setUserService(UserService userService) {
265         this.userService = userService;
266     }
267 
268     public UserPersistence getUserPersistence() {
269         return userPersistence;
270     }
271 
272     public void setUserPersistence(UserPersistence userPersistence) {
273         this.userPersistence = userPersistence;
274     }
275 
276     public UserFinder getUserFinder() {
277         return userFinder;
278     }
279 
280     public void setUserFinder(UserFinder userFinder) {
281         this.userFinder = userFinder;
282     }
283 
284     protected void runSQL(String sql) throws SystemException {
285         try {
286             DataSource dataSource = pollsChoicePersistence.getDataSource();
287 
288             SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
289                     sql, new int[0]);
290 
291             sqlUpdate.update();
292         }
293         catch (Exception e) {
294             throw new SystemException(e);
295         }
296     }
297 
298     @BeanReference(type = PollsChoiceLocalService.class)
299     protected PollsChoiceLocalService pollsChoiceLocalService;
300     @BeanReference(type = PollsChoicePersistence.class)
301     protected PollsChoicePersistence pollsChoicePersistence;
302     @BeanReference(type = PollsChoiceFinder.class)
303     protected PollsChoiceFinder pollsChoiceFinder;
304     @BeanReference(type = PollsQuestionLocalService.class)
305     protected PollsQuestionLocalService pollsQuestionLocalService;
306     @BeanReference(type = PollsQuestionService.class)
307     protected PollsQuestionService pollsQuestionService;
308     @BeanReference(type = PollsQuestionPersistence.class)
309     protected PollsQuestionPersistence pollsQuestionPersistence;
310     @BeanReference(type = PollsVoteLocalService.class)
311     protected PollsVoteLocalService pollsVoteLocalService;
312     @BeanReference(type = PollsVoteService.class)
313     protected PollsVoteService pollsVoteService;
314     @BeanReference(type = PollsVotePersistence.class)
315     protected PollsVotePersistence pollsVotePersistence;
316     @BeanReference(type = CounterLocalService.class)
317     protected CounterLocalService counterLocalService;
318     @BeanReference(type = ResourceLocalService.class)
319     protected ResourceLocalService resourceLocalService;
320     @BeanReference(type = ResourceService.class)
321     protected ResourceService resourceService;
322     @BeanReference(type = ResourcePersistence.class)
323     protected ResourcePersistence resourcePersistence;
324     @BeanReference(type = ResourceFinder.class)
325     protected ResourceFinder resourceFinder;
326     @BeanReference(type = UserLocalService.class)
327     protected UserLocalService userLocalService;
328     @BeanReference(type = UserService.class)
329     protected UserService userService;
330     @BeanReference(type = UserPersistence.class)
331     protected UserPersistence userPersistence;
332     @BeanReference(type = UserFinder.class)
333     protected UserFinder userFinder;
334 }