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