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