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