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