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