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.CounterLocalServiceFactory;
27  import com.liferay.counter.service.CounterService;
28  import com.liferay.counter.service.CounterServiceFactory;
29  
30  import com.liferay.portal.PortalException;
31  import com.liferay.portal.SystemException;
32  import com.liferay.portal.kernel.bean.InitializingBean;
33  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
34  
35  import com.liferay.portlet.polls.model.PollsChoice;
36  import com.liferay.portlet.polls.service.PollsChoiceLocalService;
37  import com.liferay.portlet.polls.service.PollsQuestionLocalService;
38  import com.liferay.portlet.polls.service.PollsQuestionLocalServiceFactory;
39  import com.liferay.portlet.polls.service.PollsQuestionService;
40  import com.liferay.portlet.polls.service.PollsQuestionServiceFactory;
41  import com.liferay.portlet.polls.service.PollsVoteLocalService;
42  import com.liferay.portlet.polls.service.PollsVoteLocalServiceFactory;
43  import com.liferay.portlet.polls.service.PollsVoteService;
44  import com.liferay.portlet.polls.service.PollsVoteServiceFactory;
45  import com.liferay.portlet.polls.service.persistence.PollsChoiceFinder;
46  import com.liferay.portlet.polls.service.persistence.PollsChoiceFinderUtil;
47  import com.liferay.portlet.polls.service.persistence.PollsChoicePersistence;
48  import com.liferay.portlet.polls.service.persistence.PollsChoiceUtil;
49  import com.liferay.portlet.polls.service.persistence.PollsQuestionPersistence;
50  import com.liferay.portlet.polls.service.persistence.PollsQuestionUtil;
51  import com.liferay.portlet.polls.service.persistence.PollsVotePersistence;
52  import com.liferay.portlet.polls.service.persistence.PollsVoteUtil;
53  
54  import java.util.List;
55  
56  /**
57   * <a href="PollsChoiceLocalServiceBaseImpl.java.html"><b><i>View Source</i></b></a>
58   *
59   * @author Brian Wing Shun Chan
60   *
61   */
62  public abstract class PollsChoiceLocalServiceBaseImpl
63      implements PollsChoiceLocalService, InitializingBean {
64      public PollsChoice addPollsChoice(PollsChoice pollsChoice)
65          throws SystemException {
66          pollsChoice.setNew(true);
67  
68          return pollsChoicePersistence.update(pollsChoice, false);
69      }
70  
71      public void deletePollsChoice(long choiceId)
72          throws PortalException, SystemException {
73          pollsChoicePersistence.remove(choiceId);
74      }
75  
76      public void deletePollsChoice(PollsChoice pollsChoice)
77          throws SystemException {
78          pollsChoicePersistence.remove(pollsChoice);
79      }
80  
81      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
82          throws SystemException {
83          return pollsChoicePersistence.findWithDynamicQuery(dynamicQuery);
84      }
85  
86      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
87          int end) throws SystemException {
88          return pollsChoicePersistence.findWithDynamicQuery(dynamicQuery, start,
89              end);
90      }
91  
92      public PollsChoice getPollsChoice(long choiceId)
93          throws PortalException, SystemException {
94          return pollsChoicePersistence.findByPrimaryKey(choiceId);
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 = PollsChoiceUtil.getPersistence();
193         }
194 
195         if (pollsChoiceFinder == null) {
196             pollsChoiceFinder = PollsChoiceFinderUtil.getFinder();
197         }
198 
199         if (pollsQuestionLocalService == null) {
200             pollsQuestionLocalService = PollsQuestionLocalServiceFactory.getImpl();
201         }
202 
203         if (pollsQuestionService == null) {
204             pollsQuestionService = PollsQuestionServiceFactory.getImpl();
205         }
206 
207         if (pollsQuestionPersistence == null) {
208             pollsQuestionPersistence = PollsQuestionUtil.getPersistence();
209         }
210 
211         if (pollsVoteLocalService == null) {
212             pollsVoteLocalService = PollsVoteLocalServiceFactory.getImpl();
213         }
214 
215         if (pollsVoteService == null) {
216             pollsVoteService = PollsVoteServiceFactory.getImpl();
217         }
218 
219         if (pollsVotePersistence == null) {
220             pollsVotePersistence = PollsVoteUtil.getPersistence();
221         }
222 
223         if (counterLocalService == null) {
224             counterLocalService = CounterLocalServiceFactory.getImpl();
225         }
226 
227         if (counterService == null) {
228             counterService = CounterServiceFactory.getImpl();
229         }
230     }
231 
232     protected PollsChoicePersistence pollsChoicePersistence;
233     protected PollsChoiceFinder pollsChoiceFinder;
234     protected PollsQuestionLocalService pollsQuestionLocalService;
235     protected PollsQuestionService pollsQuestionService;
236     protected PollsQuestionPersistence pollsQuestionPersistence;
237     protected PollsVoteLocalService pollsVoteLocalService;
238     protected PollsVoteService pollsVoteService;
239     protected PollsVotePersistence pollsVotePersistence;
240     protected CounterLocalService counterLocalService;
241     protected CounterService counterService;
242 }