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  
34  import com.liferay.portlet.polls.model.PollsChoice;
35  import com.liferay.portlet.polls.service.PollsChoiceLocalService;
36  import com.liferay.portlet.polls.service.PollsQuestionLocalService;
37  import com.liferay.portlet.polls.service.PollsQuestionService;
38  import com.liferay.portlet.polls.service.PollsVoteLocalService;
39  import com.liferay.portlet.polls.service.PollsVoteService;
40  import com.liferay.portlet.polls.service.persistence.PollsChoiceFinder;
41  import com.liferay.portlet.polls.service.persistence.PollsChoicePersistence;
42  import com.liferay.portlet.polls.service.persistence.PollsQuestionPersistence;
43  import com.liferay.portlet.polls.service.persistence.PollsVotePersistence;
44  
45  import java.util.List;
46  
47  /**
48   * <a href="PollsChoiceLocalServiceBaseImpl.java.html"><b><i>View Source</i></b></a>
49   *
50   * @author Brian Wing Shun Chan
51   *
52   */
53  public abstract class PollsChoiceLocalServiceBaseImpl
54      implements PollsChoiceLocalService, InitializingBean {
55      public PollsChoice addPollsChoice(PollsChoice pollsChoice)
56          throws SystemException {
57          pollsChoice.setNew(true);
58  
59          return pollsChoicePersistence.update(pollsChoice, false);
60      }
61  
62      public void deletePollsChoice(long choiceId)
63          throws PortalException, SystemException {
64          pollsChoicePersistence.remove(choiceId);
65      }
66  
67      public void deletePollsChoice(PollsChoice pollsChoice)
68          throws SystemException {
69          pollsChoicePersistence.remove(pollsChoice);
70      }
71  
72      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
73          throws SystemException {
74          return pollsChoicePersistence.findWithDynamicQuery(dynamicQuery);
75      }
76  
77      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
78          int end) throws SystemException {
79          return pollsChoicePersistence.findWithDynamicQuery(dynamicQuery, start,
80              end);
81      }
82  
83      public PollsChoice getPollsChoice(long choiceId)
84          throws PortalException, SystemException {
85          return pollsChoicePersistence.findByPrimaryKey(choiceId);
86      }
87  
88      public List<PollsChoice> getPollsChoices(int start, int end)
89          throws SystemException {
90          return pollsChoicePersistence.findAll(start, end);
91      }
92  
93      public int getPollsChoicesCount() throws SystemException {
94          return pollsChoicePersistence.countAll();
95      }
96  
97      public PollsChoice updatePollsChoice(PollsChoice pollsChoice)
98          throws SystemException {
99          pollsChoice.setNew(false);
100 
101         return pollsChoicePersistence.update(pollsChoice, true);
102     }
103 
104     public PollsChoicePersistence getPollsChoicePersistence() {
105         return pollsChoicePersistence;
106     }
107 
108     public void setPollsChoicePersistence(
109         PollsChoicePersistence pollsChoicePersistence) {
110         this.pollsChoicePersistence = pollsChoicePersistence;
111     }
112 
113     public PollsChoiceFinder getPollsChoiceFinder() {
114         return pollsChoiceFinder;
115     }
116 
117     public void setPollsChoiceFinder(PollsChoiceFinder pollsChoiceFinder) {
118         this.pollsChoiceFinder = pollsChoiceFinder;
119     }
120 
121     public PollsQuestionLocalService getPollsQuestionLocalService() {
122         return pollsQuestionLocalService;
123     }
124 
125     public void setPollsQuestionLocalService(
126         PollsQuestionLocalService pollsQuestionLocalService) {
127         this.pollsQuestionLocalService = pollsQuestionLocalService;
128     }
129 
130     public PollsQuestionService getPollsQuestionService() {
131         return pollsQuestionService;
132     }
133 
134     public void setPollsQuestionService(
135         PollsQuestionService pollsQuestionService) {
136         this.pollsQuestionService = pollsQuestionService;
137     }
138 
139     public PollsQuestionPersistence getPollsQuestionPersistence() {
140         return pollsQuestionPersistence;
141     }
142 
143     public void setPollsQuestionPersistence(
144         PollsQuestionPersistence pollsQuestionPersistence) {
145         this.pollsQuestionPersistence = pollsQuestionPersistence;
146     }
147 
148     public PollsVoteLocalService getPollsVoteLocalService() {
149         return pollsVoteLocalService;
150     }
151 
152     public void setPollsVoteLocalService(
153         PollsVoteLocalService pollsVoteLocalService) {
154         this.pollsVoteLocalService = pollsVoteLocalService;
155     }
156 
157     public PollsVoteService getPollsVoteService() {
158         return pollsVoteService;
159     }
160 
161     public void setPollsVoteService(PollsVoteService pollsVoteService) {
162         this.pollsVoteService = pollsVoteService;
163     }
164 
165     public PollsVotePersistence getPollsVotePersistence() {
166         return pollsVotePersistence;
167     }
168 
169     public void setPollsVotePersistence(
170         PollsVotePersistence pollsVotePersistence) {
171         this.pollsVotePersistence = pollsVotePersistence;
172     }
173 
174     public CounterLocalService getCounterLocalService() {
175         return counterLocalService;
176     }
177 
178     public void setCounterLocalService(CounterLocalService counterLocalService) {
179         this.counterLocalService = counterLocalService;
180     }
181 
182     public CounterService getCounterService() {
183         return counterService;
184     }
185 
186     public void setCounterService(CounterService counterService) {
187         this.counterService = counterService;
188     }
189 
190     public void afterPropertiesSet() {
191         if (pollsChoicePersistence == null) {
192             pollsChoicePersistence = (PollsChoicePersistence)PortalBeanLocatorUtil.locate(PollsChoicePersistence.class.getName() +
193                     ".impl");
194         }
195 
196         if (pollsChoiceFinder == null) {
197             pollsChoiceFinder = (PollsChoiceFinder)PortalBeanLocatorUtil.locate(PollsChoiceFinder.class.getName() +
198                     ".impl");
199         }
200 
201         if (pollsQuestionLocalService == null) {
202             pollsQuestionLocalService = (PollsQuestionLocalService)PortalBeanLocatorUtil.locate(PollsQuestionLocalService.class.getName() +
203                     ".impl");
204         }
205 
206         if (pollsQuestionService == null) {
207             pollsQuestionService = (PollsQuestionService)PortalBeanLocatorUtil.locate(PollsQuestionService.class.getName() +
208                     ".impl");
209         }
210 
211         if (pollsQuestionPersistence == null) {
212             pollsQuestionPersistence = (PollsQuestionPersistence)PortalBeanLocatorUtil.locate(PollsQuestionPersistence.class.getName() +
213                     ".impl");
214         }
215 
216         if (pollsVoteLocalService == null) {
217             pollsVoteLocalService = (PollsVoteLocalService)PortalBeanLocatorUtil.locate(PollsVoteLocalService.class.getName() +
218                     ".impl");
219         }
220 
221         if (pollsVoteService == null) {
222             pollsVoteService = (PollsVoteService)PortalBeanLocatorUtil.locate(PollsVoteService.class.getName() +
223                     ".impl");
224         }
225 
226         if (pollsVotePersistence == null) {
227             pollsVotePersistence = (PollsVotePersistence)PortalBeanLocatorUtil.locate(PollsVotePersistence.class.getName() +
228                     ".impl");
229         }
230 
231         if (counterLocalService == null) {
232             counterLocalService = (CounterLocalService)PortalBeanLocatorUtil.locate(CounterLocalService.class.getName() +
233                     ".impl");
234         }
235 
236         if (counterService == null) {
237             counterService = (CounterService)PortalBeanLocatorUtil.locate(CounterService.class.getName() +
238                     ".impl");
239         }
240     }
241 
242     protected PollsChoicePersistence pollsChoicePersistence;
243     protected PollsChoiceFinder pollsChoiceFinder;
244     protected PollsQuestionLocalService pollsQuestionLocalService;
245     protected PollsQuestionService pollsQuestionService;
246     protected PollsQuestionPersistence pollsQuestionPersistence;
247     protected PollsVoteLocalService pollsVoteLocalService;
248     protected PollsVoteService pollsVoteService;
249     protected PollsVotePersistence pollsVotePersistence;
250     protected CounterLocalService counterLocalService;
251     protected CounterService counterService;
252 }