1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.polls.service.base;
24  
25  import com.liferay.counter.service.CounterLocalService;
26  import com.liferay.counter.service.CounterService;
27  
28  import com.liferay.portal.PortalException;
29  import com.liferay.portal.SystemException;
30  import com.liferay.portal.kernel.bean.InitializingBean;
31  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
32  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
33  import com.liferay.portal.service.ResourceLocalService;
34  import com.liferay.portal.service.ResourceService;
35  import com.liferay.portal.service.UserLocalService;
36  import com.liferay.portal.service.UserService;
37  import com.liferay.portal.service.persistence.ResourceFinder;
38  import com.liferay.portal.service.persistence.ResourcePersistence;
39  import com.liferay.portal.service.persistence.UserFinder;
40  import com.liferay.portal.service.persistence.UserPersistence;
41  
42  import com.liferay.portlet.polls.model.PollsQuestion;
43  import com.liferay.portlet.polls.service.PollsChoiceLocalService;
44  import com.liferay.portlet.polls.service.PollsQuestionLocalService;
45  import com.liferay.portlet.polls.service.PollsVoteLocalService;
46  import com.liferay.portlet.polls.service.PollsVoteService;
47  import com.liferay.portlet.polls.service.persistence.PollsChoiceFinder;
48  import com.liferay.portlet.polls.service.persistence.PollsChoicePersistence;
49  import com.liferay.portlet.polls.service.persistence.PollsQuestionPersistence;
50  import com.liferay.portlet.polls.service.persistence.PollsVotePersistence;
51  
52  import java.util.List;
53  
54  /**
55   * <a href="PollsQuestionLocalServiceBaseImpl.java.html"><b><i>View Source</i></b></a>
56   *
57   * @author Brian Wing Shun Chan
58   *
59   */
60  public abstract class PollsQuestionLocalServiceBaseImpl
61      implements PollsQuestionLocalService, InitializingBean {
62      public PollsQuestion addPollsQuestion(PollsQuestion pollsQuestion)
63          throws SystemException {
64          pollsQuestion.setNew(true);
65  
66          return pollsQuestionPersistence.update(pollsQuestion, false);
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      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
80          throws SystemException {
81          return pollsQuestionPersistence.findWithDynamicQuery(dynamicQuery);
82      }
83  
84      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
85          int end) throws SystemException {
86          return pollsQuestionPersistence.findWithDynamicQuery(dynamicQuery,
87              start, end);
88      }
89  
90      public PollsQuestion getPollsQuestion(long questionId)
91          throws PortalException, SystemException {
92          return pollsQuestionPersistence.findByPrimaryKey(questionId);
93      }
94  
95      public List<PollsQuestion> getPollsQuestions(int start, int end)
96          throws SystemException {
97          return pollsQuestionPersistence.findAll(start, end);
98      }
99  
100     public int getPollsQuestionsCount() throws SystemException {
101         return pollsQuestionPersistence.countAll();
102     }
103 
104     public PollsQuestion updatePollsQuestion(PollsQuestion pollsQuestion)
105         throws SystemException {
106         pollsQuestion.setNew(false);
107 
108         return pollsQuestionPersistence.update(pollsQuestion, true);
109     }
110 
111     public PollsChoiceLocalService getPollsChoiceLocalService() {
112         return pollsChoiceLocalService;
113     }
114 
115     public void setPollsChoiceLocalService(
116         PollsChoiceLocalService pollsChoiceLocalService) {
117         this.pollsChoiceLocalService = pollsChoiceLocalService;
118     }
119 
120     public PollsChoicePersistence getPollsChoicePersistence() {
121         return pollsChoicePersistence;
122     }
123 
124     public void setPollsChoicePersistence(
125         PollsChoicePersistence pollsChoicePersistence) {
126         this.pollsChoicePersistence = pollsChoicePersistence;
127     }
128 
129     public PollsChoiceFinder getPollsChoiceFinder() {
130         return pollsChoiceFinder;
131     }
132 
133     public void setPollsChoiceFinder(PollsChoiceFinder pollsChoiceFinder) {
134         this.pollsChoiceFinder = pollsChoiceFinder;
135     }
136 
137     public PollsQuestionPersistence getPollsQuestionPersistence() {
138         return pollsQuestionPersistence;
139     }
140 
141     public void setPollsQuestionPersistence(
142         PollsQuestionPersistence pollsQuestionPersistence) {
143         this.pollsQuestionPersistence = pollsQuestionPersistence;
144     }
145 
146     public PollsVoteLocalService getPollsVoteLocalService() {
147         return pollsVoteLocalService;
148     }
149 
150     public void setPollsVoteLocalService(
151         PollsVoteLocalService pollsVoteLocalService) {
152         this.pollsVoteLocalService = pollsVoteLocalService;
153     }
154 
155     public PollsVoteService getPollsVoteService() {
156         return pollsVoteService;
157     }
158 
159     public void setPollsVoteService(PollsVoteService pollsVoteService) {
160         this.pollsVoteService = pollsVoteService;
161     }
162 
163     public PollsVotePersistence getPollsVotePersistence() {
164         return pollsVotePersistence;
165     }
166 
167     public void setPollsVotePersistence(
168         PollsVotePersistence pollsVotePersistence) {
169         this.pollsVotePersistence = pollsVotePersistence;
170     }
171 
172     public CounterLocalService getCounterLocalService() {
173         return counterLocalService;
174     }
175 
176     public void setCounterLocalService(CounterLocalService counterLocalService) {
177         this.counterLocalService = counterLocalService;
178     }
179 
180     public CounterService getCounterService() {
181         return counterService;
182     }
183 
184     public void setCounterService(CounterService counterService) {
185         this.counterService = counterService;
186     }
187 
188     public ResourceLocalService getResourceLocalService() {
189         return resourceLocalService;
190     }
191 
192     public void setResourceLocalService(
193         ResourceLocalService resourceLocalService) {
194         this.resourceLocalService = resourceLocalService;
195     }
196 
197     public ResourceService getResourceService() {
198         return resourceService;
199     }
200 
201     public void setResourceService(ResourceService resourceService) {
202         this.resourceService = resourceService;
203     }
204 
205     public ResourcePersistence getResourcePersistence() {
206         return resourcePersistence;
207     }
208 
209     public void setResourcePersistence(ResourcePersistence resourcePersistence) {
210         this.resourcePersistence = resourcePersistence;
211     }
212 
213     public ResourceFinder getResourceFinder() {
214         return resourceFinder;
215     }
216 
217     public void setResourceFinder(ResourceFinder resourceFinder) {
218         this.resourceFinder = resourceFinder;
219     }
220 
221     public UserLocalService getUserLocalService() {
222         return userLocalService;
223     }
224 
225     public void setUserLocalService(UserLocalService userLocalService) {
226         this.userLocalService = userLocalService;
227     }
228 
229     public UserService getUserService() {
230         return userService;
231     }
232 
233     public void setUserService(UserService userService) {
234         this.userService = userService;
235     }
236 
237     public UserPersistence getUserPersistence() {
238         return userPersistence;
239     }
240 
241     public void setUserPersistence(UserPersistence userPersistence) {
242         this.userPersistence = userPersistence;
243     }
244 
245     public UserFinder getUserFinder() {
246         return userFinder;
247     }
248 
249     public void setUserFinder(UserFinder userFinder) {
250         this.userFinder = userFinder;
251     }
252 
253     public void afterPropertiesSet() {
254         if (pollsChoiceLocalService == null) {
255             pollsChoiceLocalService = (PollsChoiceLocalService)PortalBeanLocatorUtil.locate(PollsChoiceLocalService.class.getName() +
256                     ".impl");
257         }
258 
259         if (pollsChoicePersistence == null) {
260             pollsChoicePersistence = (PollsChoicePersistence)PortalBeanLocatorUtil.locate(PollsChoicePersistence.class.getName() +
261                     ".impl");
262         }
263 
264         if (pollsChoiceFinder == null) {
265             pollsChoiceFinder = (PollsChoiceFinder)PortalBeanLocatorUtil.locate(PollsChoiceFinder.class.getName() +
266                     ".impl");
267         }
268 
269         if (pollsQuestionPersistence == null) {
270             pollsQuestionPersistence = (PollsQuestionPersistence)PortalBeanLocatorUtil.locate(PollsQuestionPersistence.class.getName() +
271                     ".impl");
272         }
273 
274         if (pollsVoteLocalService == null) {
275             pollsVoteLocalService = (PollsVoteLocalService)PortalBeanLocatorUtil.locate(PollsVoteLocalService.class.getName() +
276                     ".impl");
277         }
278 
279         if (pollsVoteService == null) {
280             pollsVoteService = (PollsVoteService)PortalBeanLocatorUtil.locate(PollsVoteService.class.getName() +
281                     ".impl");
282         }
283 
284         if (pollsVotePersistence == null) {
285             pollsVotePersistence = (PollsVotePersistence)PortalBeanLocatorUtil.locate(PollsVotePersistence.class.getName() +
286                     ".impl");
287         }
288 
289         if (counterLocalService == null) {
290             counterLocalService = (CounterLocalService)PortalBeanLocatorUtil.locate(CounterLocalService.class.getName() +
291                     ".impl");
292         }
293 
294         if (counterService == null) {
295             counterService = (CounterService)PortalBeanLocatorUtil.locate(CounterService.class.getName() +
296                     ".impl");
297         }
298 
299         if (resourceLocalService == null) {
300             resourceLocalService = (ResourceLocalService)PortalBeanLocatorUtil.locate(ResourceLocalService.class.getName() +
301                     ".impl");
302         }
303 
304         if (resourceService == null) {
305             resourceService = (ResourceService)PortalBeanLocatorUtil.locate(ResourceService.class.getName() +
306                     ".impl");
307         }
308 
309         if (resourcePersistence == null) {
310             resourcePersistence = (ResourcePersistence)PortalBeanLocatorUtil.locate(ResourcePersistence.class.getName() +
311                     ".impl");
312         }
313 
314         if (resourceFinder == null) {
315             resourceFinder = (ResourceFinder)PortalBeanLocatorUtil.locate(ResourceFinder.class.getName() +
316                     ".impl");
317         }
318 
319         if (userLocalService == null) {
320             userLocalService = (UserLocalService)PortalBeanLocatorUtil.locate(UserLocalService.class.getName() +
321                     ".impl");
322         }
323 
324         if (userService == null) {
325             userService = (UserService)PortalBeanLocatorUtil.locate(UserService.class.getName() +
326                     ".impl");
327         }
328 
329         if (userPersistence == null) {
330             userPersistence = (UserPersistence)PortalBeanLocatorUtil.locate(UserPersistence.class.getName() +
331                     ".impl");
332         }
333 
334         if (userFinder == null) {
335             userFinder = (UserFinder)PortalBeanLocatorUtil.locate(UserFinder.class.getName() +
336                     ".impl");
337         }
338     }
339 
340     protected PollsChoiceLocalService pollsChoiceLocalService;
341     protected PollsChoicePersistence pollsChoicePersistence;
342     protected PollsChoiceFinder pollsChoiceFinder;
343     protected PollsQuestionPersistence pollsQuestionPersistence;
344     protected PollsVoteLocalService pollsVoteLocalService;
345     protected PollsVoteService pollsVoteService;
346     protected PollsVotePersistence pollsVotePersistence;
347     protected CounterLocalService counterLocalService;
348     protected CounterService counterService;
349     protected ResourceLocalService resourceLocalService;
350     protected ResourceService resourceService;
351     protected ResourcePersistence resourcePersistence;
352     protected ResourceFinder resourceFinder;
353     protected UserLocalService userLocalService;
354     protected UserService userService;
355     protected UserPersistence userPersistence;
356     protected UserFinder userFinder;
357 }