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