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