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.persistence;
24  
25  /**
26   * <a href="PollsVoteUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class PollsVoteUtil {
32      public static com.liferay.portlet.polls.model.PollsVote create(long voteId) {
33          return getPersistence().create(voteId);
34      }
35  
36      public static com.liferay.portlet.polls.model.PollsVote remove(long voteId)
37          throws com.liferay.portal.SystemException,
38              com.liferay.portlet.polls.NoSuchVoteException {
39          return getPersistence().remove(voteId);
40      }
41  
42      public static com.liferay.portlet.polls.model.PollsVote remove(
43          com.liferay.portlet.polls.model.PollsVote pollsVote)
44          throws com.liferay.portal.SystemException {
45          return getPersistence().remove(pollsVote);
46      }
47  
48      /**
49       * @deprecated Use <code>update(PollsVote pollsVote, boolean merge)</code>.
50       */
51      public static com.liferay.portlet.polls.model.PollsVote update(
52          com.liferay.portlet.polls.model.PollsVote pollsVote)
53          throws com.liferay.portal.SystemException {
54          return getPersistence().update(pollsVote);
55      }
56  
57      /**
58       * Add, update, or merge, the entity. This method also calls the model
59       * listeners to trigger the proper events associated with adding, deleting,
60       * or updating an entity.
61       *
62       * @param        pollsVote the entity to add, update, or merge
63       * @param        merge boolean value for whether to merge the entity. The
64       *                default value is false. Setting merge to true is more
65       *                expensive and should only be true when pollsVote is
66       *                transient. See LEP-5473 for a detailed discussion of this
67       *                method.
68       * @return        true if the portlet can be displayed via Ajax
69       */
70      public static com.liferay.portlet.polls.model.PollsVote update(
71          com.liferay.portlet.polls.model.PollsVote pollsVote, boolean merge)
72          throws com.liferay.portal.SystemException {
73          return getPersistence().update(pollsVote, merge);
74      }
75  
76      public static com.liferay.portlet.polls.model.PollsVote updateImpl(
77          com.liferay.portlet.polls.model.PollsVote pollsVote, boolean merge)
78          throws com.liferay.portal.SystemException {
79          return getPersistence().updateImpl(pollsVote, merge);
80      }
81  
82      public static com.liferay.portlet.polls.model.PollsVote findByPrimaryKey(
83          long voteId)
84          throws com.liferay.portal.SystemException,
85              com.liferay.portlet.polls.NoSuchVoteException {
86          return getPersistence().findByPrimaryKey(voteId);
87      }
88  
89      public static com.liferay.portlet.polls.model.PollsVote fetchByPrimaryKey(
90          long voteId) throws com.liferay.portal.SystemException {
91          return getPersistence().fetchByPrimaryKey(voteId);
92      }
93  
94      public static java.util.List<com.liferay.portlet.polls.model.PollsVote> findByQuestionId(
95          long questionId) throws com.liferay.portal.SystemException {
96          return getPersistence().findByQuestionId(questionId);
97      }
98  
99      public static java.util.List<com.liferay.portlet.polls.model.PollsVote> findByQuestionId(
100         long questionId, int begin, int end)
101         throws com.liferay.portal.SystemException {
102         return getPersistence().findByQuestionId(questionId, begin, end);
103     }
104 
105     public static java.util.List<com.liferay.portlet.polls.model.PollsVote> findByQuestionId(
106         long questionId, int begin, int end,
107         com.liferay.portal.kernel.util.OrderByComparator obc)
108         throws com.liferay.portal.SystemException {
109         return getPersistence().findByQuestionId(questionId, begin, end, obc);
110     }
111 
112     public static com.liferay.portlet.polls.model.PollsVote findByQuestionId_First(
113         long questionId, com.liferay.portal.kernel.util.OrderByComparator obc)
114         throws com.liferay.portal.SystemException,
115             com.liferay.portlet.polls.NoSuchVoteException {
116         return getPersistence().findByQuestionId_First(questionId, obc);
117     }
118 
119     public static com.liferay.portlet.polls.model.PollsVote findByQuestionId_Last(
120         long questionId, com.liferay.portal.kernel.util.OrderByComparator obc)
121         throws com.liferay.portal.SystemException,
122             com.liferay.portlet.polls.NoSuchVoteException {
123         return getPersistence().findByQuestionId_Last(questionId, obc);
124     }
125 
126     public static com.liferay.portlet.polls.model.PollsVote[] findByQuestionId_PrevAndNext(
127         long voteId, long questionId,
128         com.liferay.portal.kernel.util.OrderByComparator obc)
129         throws com.liferay.portal.SystemException,
130             com.liferay.portlet.polls.NoSuchVoteException {
131         return getPersistence()
132                    .findByQuestionId_PrevAndNext(voteId, questionId, obc);
133     }
134 
135     public static java.util.List<com.liferay.portlet.polls.model.PollsVote> findByChoiceId(
136         long choiceId) throws com.liferay.portal.SystemException {
137         return getPersistence().findByChoiceId(choiceId);
138     }
139 
140     public static java.util.List<com.liferay.portlet.polls.model.PollsVote> findByChoiceId(
141         long choiceId, int begin, int end)
142         throws com.liferay.portal.SystemException {
143         return getPersistence().findByChoiceId(choiceId, begin, end);
144     }
145 
146     public static java.util.List<com.liferay.portlet.polls.model.PollsVote> findByChoiceId(
147         long choiceId, int begin, int end,
148         com.liferay.portal.kernel.util.OrderByComparator obc)
149         throws com.liferay.portal.SystemException {
150         return getPersistence().findByChoiceId(choiceId, begin, end, obc);
151     }
152 
153     public static com.liferay.portlet.polls.model.PollsVote findByChoiceId_First(
154         long choiceId, com.liferay.portal.kernel.util.OrderByComparator obc)
155         throws com.liferay.portal.SystemException,
156             com.liferay.portlet.polls.NoSuchVoteException {
157         return getPersistence().findByChoiceId_First(choiceId, obc);
158     }
159 
160     public static com.liferay.portlet.polls.model.PollsVote findByChoiceId_Last(
161         long choiceId, com.liferay.portal.kernel.util.OrderByComparator obc)
162         throws com.liferay.portal.SystemException,
163             com.liferay.portlet.polls.NoSuchVoteException {
164         return getPersistence().findByChoiceId_Last(choiceId, obc);
165     }
166 
167     public static com.liferay.portlet.polls.model.PollsVote[] findByChoiceId_PrevAndNext(
168         long voteId, long choiceId,
169         com.liferay.portal.kernel.util.OrderByComparator obc)
170         throws com.liferay.portal.SystemException,
171             com.liferay.portlet.polls.NoSuchVoteException {
172         return getPersistence().findByChoiceId_PrevAndNext(voteId, choiceId, obc);
173     }
174 
175     public static com.liferay.portlet.polls.model.PollsVote findByQ_U(
176         long questionId, long userId)
177         throws com.liferay.portal.SystemException,
178             com.liferay.portlet.polls.NoSuchVoteException {
179         return getPersistence().findByQ_U(questionId, userId);
180     }
181 
182     public static com.liferay.portlet.polls.model.PollsVote fetchByQ_U(
183         long questionId, long userId) throws com.liferay.portal.SystemException {
184         return getPersistence().fetchByQ_U(questionId, userId);
185     }
186 
187     public static java.util.List<com.liferay.portlet.polls.model.PollsVote> findWithDynamicQuery(
188         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
189         throws com.liferay.portal.SystemException {
190         return getPersistence().findWithDynamicQuery(queryInitializer);
191     }
192 
193     public static java.util.List<com.liferay.portlet.polls.model.PollsVote> findWithDynamicQuery(
194         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
195         int begin, int end) throws com.liferay.portal.SystemException {
196         return getPersistence()
197                    .findWithDynamicQuery(queryInitializer, begin, end);
198     }
199 
200     public static java.util.List<com.liferay.portlet.polls.model.PollsVote> findAll()
201         throws com.liferay.portal.SystemException {
202         return getPersistence().findAll();
203     }
204 
205     public static java.util.List<com.liferay.portlet.polls.model.PollsVote> findAll(
206         int begin, int end) throws com.liferay.portal.SystemException {
207         return getPersistence().findAll(begin, end);
208     }
209 
210     public static java.util.List<com.liferay.portlet.polls.model.PollsVote> findAll(
211         int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
212         throws com.liferay.portal.SystemException {
213         return getPersistence().findAll(begin, end, obc);
214     }
215 
216     public static void removeByQuestionId(long questionId)
217         throws com.liferay.portal.SystemException {
218         getPersistence().removeByQuestionId(questionId);
219     }
220 
221     public static void removeByChoiceId(long choiceId)
222         throws com.liferay.portal.SystemException {
223         getPersistence().removeByChoiceId(choiceId);
224     }
225 
226     public static void removeByQ_U(long questionId, long userId)
227         throws com.liferay.portal.SystemException,
228             com.liferay.portlet.polls.NoSuchVoteException {
229         getPersistence().removeByQ_U(questionId, userId);
230     }
231 
232     public static void removeAll() throws com.liferay.portal.SystemException {
233         getPersistence().removeAll();
234     }
235 
236     public static int countByQuestionId(long questionId)
237         throws com.liferay.portal.SystemException {
238         return getPersistence().countByQuestionId(questionId);
239     }
240 
241     public static int countByChoiceId(long choiceId)
242         throws com.liferay.portal.SystemException {
243         return getPersistence().countByChoiceId(choiceId);
244     }
245 
246     public static int countByQ_U(long questionId, long userId)
247         throws com.liferay.portal.SystemException {
248         return getPersistence().countByQ_U(questionId, userId);
249     }
250 
251     public static int countAll() throws com.liferay.portal.SystemException {
252         return getPersistence().countAll();
253     }
254 
255     public static PollsVotePersistence getPersistence() {
256         return _getUtil()._persistence;
257     }
258 
259     public void setPersistence(PollsVotePersistence persistence) {
260         _persistence = persistence;
261     }
262 
263     private static PollsVoteUtil _getUtil() {
264         if (_util == null) {
265             _util = (PollsVoteUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
266         }
267 
268         return _util;
269     }
270 
271     private static final String _UTIL = PollsVoteUtil.class.getName();
272     private static PollsVoteUtil _util;
273     private PollsVotePersistence _persistence;
274 }