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