1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.polls.service.base;
21  
22  import com.liferay.counter.service.CounterLocalService;
23  import com.liferay.counter.service.CounterService;
24  
25  import com.liferay.portal.PortalException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.kernel.annotation.BeanReference;
28  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
29  import com.liferay.portal.util.PortalUtil;
30  
31  import com.liferay.portlet.polls.model.PollsVote;
32  import com.liferay.portlet.polls.service.PollsChoiceLocalService;
33  import com.liferay.portlet.polls.service.PollsQuestionLocalService;
34  import com.liferay.portlet.polls.service.PollsQuestionService;
35  import com.liferay.portlet.polls.service.PollsVoteLocalService;
36  import com.liferay.portlet.polls.service.PollsVoteService;
37  import com.liferay.portlet.polls.service.persistence.PollsChoiceFinder;
38  import com.liferay.portlet.polls.service.persistence.PollsChoicePersistence;
39  import com.liferay.portlet.polls.service.persistence.PollsQuestionPersistence;
40  import com.liferay.portlet.polls.service.persistence.PollsVotePersistence;
41  
42  import java.util.List;
43  
44  /**
45   * <a href="PollsVoteLocalServiceBaseImpl.java.html"><b><i>View Source</i></b></a>
46   *
47   * @author Brian Wing Shun Chan
48   *
49   */
50  public abstract class PollsVoteLocalServiceBaseImpl
51      implements PollsVoteLocalService {
52      public PollsVote addPollsVote(PollsVote pollsVote)
53          throws SystemException {
54          pollsVote.setNew(true);
55  
56          return pollsVotePersistence.update(pollsVote, false);
57      }
58  
59      public PollsVote createPollsVote(long voteId) {
60          return pollsVotePersistence.create(voteId);
61      }
62  
63      public void deletePollsVote(long voteId)
64          throws PortalException, SystemException {
65          pollsVotePersistence.remove(voteId);
66      }
67  
68      public void deletePollsVote(PollsVote pollsVote) throws SystemException {
69          pollsVotePersistence.remove(pollsVote);
70      }
71  
72      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
73          throws SystemException {
74          return pollsVotePersistence.findWithDynamicQuery(dynamicQuery);
75      }
76  
77      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
78          int end) throws SystemException {
79          return pollsVotePersistence.findWithDynamicQuery(dynamicQuery, start,
80              end);
81      }
82  
83      public PollsVote getPollsVote(long voteId)
84          throws PortalException, SystemException {
85          return pollsVotePersistence.findByPrimaryKey(voteId);
86      }
87  
88      public List<PollsVote> getPollsVotes(int start, int end)
89          throws SystemException {
90          return pollsVotePersistence.findAll(start, end);
91      }
92  
93      public int getPollsVotesCount() throws SystemException {
94          return pollsVotePersistence.countAll();
95      }
96  
97      public PollsVote updatePollsVote(PollsVote pollsVote)
98          throws SystemException {
99          pollsVote.setNew(false);
100 
101         return pollsVotePersistence.update(pollsVote, true);
102     }
103 
104     public PollsVote updatePollsVote(PollsVote pollsVote, boolean merge)
105         throws SystemException {
106         pollsVote.setNew(false);
107 
108         return pollsVotePersistence.update(pollsVote, merge);
109     }
110 
111     public PollsChoiceLocalService getPollsChoiceLocalService() {
112         return pollsChoiceLocalService;
113     }
114 
115     public void setPollsChoiceLocalService(
116         PollsChoiceLocalService pollsChoiceLocalService) {
117         this.pollsChoiceLocalService = pollsChoiceLocalService;
118     }
119 
120     public PollsChoicePersistence getPollsChoicePersistence() {
121         return pollsChoicePersistence;
122     }
123 
124     public void setPollsChoicePersistence(
125         PollsChoicePersistence pollsChoicePersistence) {
126         this.pollsChoicePersistence = pollsChoicePersistence;
127     }
128 
129     public PollsChoiceFinder getPollsChoiceFinder() {
130         return pollsChoiceFinder;
131     }
132 
133     public void setPollsChoiceFinder(PollsChoiceFinder pollsChoiceFinder) {
134         this.pollsChoiceFinder = pollsChoiceFinder;
135     }
136 
137     public PollsQuestionLocalService getPollsQuestionLocalService() {
138         return pollsQuestionLocalService;
139     }
140 
141     public void setPollsQuestionLocalService(
142         PollsQuestionLocalService pollsQuestionLocalService) {
143         this.pollsQuestionLocalService = pollsQuestionLocalService;
144     }
145 
146     public PollsQuestionService getPollsQuestionService() {
147         return pollsQuestionService;
148     }
149 
150     public void setPollsQuestionService(
151         PollsQuestionService pollsQuestionService) {
152         this.pollsQuestionService = pollsQuestionService;
153     }
154 
155     public PollsQuestionPersistence getPollsQuestionPersistence() {
156         return pollsQuestionPersistence;
157     }
158 
159     public void setPollsQuestionPersistence(
160         PollsQuestionPersistence pollsQuestionPersistence) {
161         this.pollsQuestionPersistence = pollsQuestionPersistence;
162     }
163 
164     public PollsVoteLocalService getPollsVoteLocalService() {
165         return pollsVoteLocalService;
166     }
167 
168     public void setPollsVoteLocalService(
169         PollsVoteLocalService pollsVoteLocalService) {
170         this.pollsVoteLocalService = pollsVoteLocalService;
171     }
172 
173     public PollsVoteService getPollsVoteService() {
174         return pollsVoteService;
175     }
176 
177     public void setPollsVoteService(PollsVoteService pollsVoteService) {
178         this.pollsVoteService = pollsVoteService;
179     }
180 
181     public PollsVotePersistence getPollsVotePersistence() {
182         return pollsVotePersistence;
183     }
184 
185     public void setPollsVotePersistence(
186         PollsVotePersistence pollsVotePersistence) {
187         this.pollsVotePersistence = pollsVotePersistence;
188     }
189 
190     public CounterLocalService getCounterLocalService() {
191         return counterLocalService;
192     }
193 
194     public void setCounterLocalService(CounterLocalService counterLocalService) {
195         this.counterLocalService = counterLocalService;
196     }
197 
198     public CounterService getCounterService() {
199         return counterService;
200     }
201 
202     public void setCounterService(CounterService counterService) {
203         this.counterService = counterService;
204     }
205 
206     protected void runSQL(String sql) throws SystemException {
207         try {
208             PortalUtil.runSQL(sql);
209         }
210         catch (Exception e) {
211             throw new SystemException(e);
212         }
213     }
214 
215     @BeanReference(name = "com.liferay.portlet.polls.service.PollsChoiceLocalService.impl")
216     protected PollsChoiceLocalService pollsChoiceLocalService;
217     @BeanReference(name = "com.liferay.portlet.polls.service.persistence.PollsChoicePersistence.impl")
218     protected PollsChoicePersistence pollsChoicePersistence;
219     @BeanReference(name = "com.liferay.portlet.polls.service.persistence.PollsChoiceFinder.impl")
220     protected PollsChoiceFinder pollsChoiceFinder;
221     @BeanReference(name = "com.liferay.portlet.polls.service.PollsQuestionLocalService.impl")
222     protected PollsQuestionLocalService pollsQuestionLocalService;
223     @BeanReference(name = "com.liferay.portlet.polls.service.PollsQuestionService.impl")
224     protected PollsQuestionService pollsQuestionService;
225     @BeanReference(name = "com.liferay.portlet.polls.service.persistence.PollsQuestionPersistence.impl")
226     protected PollsQuestionPersistence pollsQuestionPersistence;
227     @BeanReference(name = "com.liferay.portlet.polls.service.PollsVoteLocalService.impl")
228     protected PollsVoteLocalService pollsVoteLocalService;
229     @BeanReference(name = "com.liferay.portlet.polls.service.PollsVoteService.impl")
230     protected PollsVoteService pollsVoteService;
231     @BeanReference(name = "com.liferay.portlet.polls.service.persistence.PollsVotePersistence.impl")
232     protected PollsVotePersistence pollsVotePersistence;
233     @BeanReference(name = "com.liferay.counter.service.CounterLocalService.impl")
234     protected CounterLocalService counterLocalService;
235     @BeanReference(name = "com.liferay.counter.service.CounterService.impl")
236     protected CounterService counterService;
237 }