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