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