001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.counter.service.persistence;
016    
017    import com.liferay.counter.model.Counter;
018    
019    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
020    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
021    import com.liferay.portal.kernel.exception.SystemException;
022    import com.liferay.portal.kernel.util.OrderByComparator;
023    import com.liferay.portal.service.ServiceContext;
024    
025    import java.util.List;
026    
027    /**
028     * The persistence utility for the counter service. This utility wraps {@link CounterPersistenceImpl} and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class.
029     *
030     * <p>
031     * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
032     * </p>
033     *
034     * <p>
035     * Caching information and settings can be found in <code>portal.properties</code>
036     * </p>
037     *
038     * @author Brian Wing Shun Chan
039     * @see CounterPersistence
040     * @see CounterPersistenceImpl
041     * @generated
042     */
043    public class CounterUtil {
044            /**
045             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
046             */
047            public static void clearCache() {
048                    getPersistence().clearCache();
049            }
050    
051            /**
052             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
053             */
054            public static void clearCache(Counter counter) {
055                    getPersistence().clearCache(counter);
056            }
057    
058            /**
059             * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
060             */
061            public long countWithDynamicQuery(DynamicQuery dynamicQuery)
062                    throws SystemException {
063                    return getPersistence().countWithDynamicQuery(dynamicQuery);
064            }
065    
066            /**
067             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
068             */
069            public static List<Counter> findWithDynamicQuery(DynamicQuery dynamicQuery)
070                    throws SystemException {
071                    return getPersistence().findWithDynamicQuery(dynamicQuery);
072            }
073    
074            /**
075             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
076             */
077            public static List<Counter> findWithDynamicQuery(
078                    DynamicQuery dynamicQuery, int start, int end)
079                    throws SystemException {
080                    return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
081            }
082    
083            /**
084             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
085             */
086            public static List<Counter> findWithDynamicQuery(
087                    DynamicQuery dynamicQuery, int start, int end,
088                    OrderByComparator orderByComparator) throws SystemException {
089                    return getPersistence()
090                                       .findWithDynamicQuery(dynamicQuery, start, end,
091                            orderByComparator);
092            }
093    
094            /**
095             * @see com.liferay.portal.service.persistence.BasePersistence#remove(com.liferay.portal.model.BaseModel)
096             */
097            public static Counter remove(Counter counter) throws SystemException {
098                    return getPersistence().remove(counter);
099            }
100    
101            /**
102             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)
103             */
104            public static Counter update(Counter counter, boolean merge)
105                    throws SystemException {
106                    return getPersistence().update(counter, merge);
107            }
108    
109            /**
110             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
111             */
112            public static Counter update(Counter counter, boolean merge,
113                    ServiceContext serviceContext) throws SystemException {
114                    return getPersistence().update(counter, merge, serviceContext);
115            }
116    
117            /**
118            * Caches the counter in the entity cache if it is enabled.
119            *
120            * @param counter the counter to cache
121            */
122            public static void cacheResult(com.liferay.counter.model.Counter counter) {
123                    getPersistence().cacheResult(counter);
124            }
125    
126            /**
127            * Caches the counters in the entity cache if it is enabled.
128            *
129            * @param counters the counters to cache
130            */
131            public static void cacheResult(
132                    java.util.List<com.liferay.counter.model.Counter> counters) {
133                    getPersistence().cacheResult(counters);
134            }
135    
136            /**
137            * Creates a new counter with the primary key. Does not add the counter to the database.
138            *
139            * @param name the primary key for the new counter
140            * @return the new counter
141            */
142            public static com.liferay.counter.model.Counter create(
143                    java.lang.String name) {
144                    return getPersistence().create(name);
145            }
146    
147            /**
148            * Removes the counter with the primary key from the database. Also notifies the appropriate model listeners.
149            *
150            * @param name the primary key of the counter to remove
151            * @return the counter that was removed
152            * @throws com.liferay.counter.NoSuchCounterException if a counter with the primary key could not be found
153            * @throws SystemException if a system exception occurred
154            */
155            public static com.liferay.counter.model.Counter remove(
156                    java.lang.String name)
157                    throws com.liferay.counter.NoSuchCounterException,
158                            com.liferay.portal.kernel.exception.SystemException {
159                    return getPersistence().remove(name);
160            }
161    
162            public static com.liferay.counter.model.Counter updateImpl(
163                    com.liferay.counter.model.Counter counter, boolean merge)
164                    throws com.liferay.portal.kernel.exception.SystemException {
165                    return getPersistence().updateImpl(counter, merge);
166            }
167    
168            /**
169            * Finds the counter with the primary key or throws a {@link com.liferay.counter.NoSuchCounterException} if it could not be found.
170            *
171            * @param name the primary key of the counter to find
172            * @return the counter
173            * @throws com.liferay.counter.NoSuchCounterException if a counter with the primary key could not be found
174            * @throws SystemException if a system exception occurred
175            */
176            public static com.liferay.counter.model.Counter findByPrimaryKey(
177                    java.lang.String name)
178                    throws com.liferay.counter.NoSuchCounterException,
179                            com.liferay.portal.kernel.exception.SystemException {
180                    return getPersistence().findByPrimaryKey(name);
181            }
182    
183            /**
184            * Finds the counter with the primary key or returns <code>null</code> if it could not be found.
185            *
186            * @param name the primary key of the counter to find
187            * @return the counter, or <code>null</code> if a counter with the primary key could not be found
188            * @throws SystemException if a system exception occurred
189            */
190            public static com.liferay.counter.model.Counter fetchByPrimaryKey(
191                    java.lang.String name)
192                    throws com.liferay.portal.kernel.exception.SystemException {
193                    return getPersistence().fetchByPrimaryKey(name);
194            }
195    
196            /**
197            * Finds all the counters.
198            *
199            * @return the counters
200            * @throws SystemException if a system exception occurred
201            */
202            public static java.util.List<com.liferay.counter.model.Counter> findAll()
203                    throws com.liferay.portal.kernel.exception.SystemException {
204                    return getPersistence().findAll();
205            }
206    
207            /**
208            * Finds a range of all the counters.
209            *
210            * <p>
211            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
212            * </p>
213            *
214            * @param start the lower bound of the range of counters to return
215            * @param end the upper bound of the range of counters to return (not inclusive)
216            * @return the range of counters
217            * @throws SystemException if a system exception occurred
218            */
219            public static java.util.List<com.liferay.counter.model.Counter> findAll(
220                    int start, int end)
221                    throws com.liferay.portal.kernel.exception.SystemException {
222                    return getPersistence().findAll(start, end);
223            }
224    
225            /**
226            * Finds an ordered range of all the counters.
227            *
228            * <p>
229            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
230            * </p>
231            *
232            * @param start the lower bound of the range of counters to return
233            * @param end the upper bound of the range of counters to return (not inclusive)
234            * @param orderByComparator the comparator to order the results by
235            * @return the ordered range of counters
236            * @throws SystemException if a system exception occurred
237            */
238            public static java.util.List<com.liferay.counter.model.Counter> findAll(
239                    int start, int end,
240                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
241                    throws com.liferay.portal.kernel.exception.SystemException {
242                    return getPersistence().findAll(start, end, orderByComparator);
243            }
244    
245            /**
246            * Removes all the counters from the database.
247            *
248            * @throws SystemException if a system exception occurred
249            */
250            public static void removeAll()
251                    throws com.liferay.portal.kernel.exception.SystemException {
252                    getPersistence().removeAll();
253            }
254    
255            /**
256            * Counts all the counters.
257            *
258            * @return the number of counters
259            * @throws SystemException if a system exception occurred
260            */
261            public static int countAll()
262                    throws com.liferay.portal.kernel.exception.SystemException {
263                    return getPersistence().countAll();
264            }
265    
266            public static CounterPersistence getPersistence() {
267                    if (_persistence == null) {
268                            _persistence = (CounterPersistence)PortalBeanLocatorUtil.locate(CounterPersistence.class.getName());
269                    }
270    
271                    return _persistence;
272            }
273    
274            public void setPersistence(CounterPersistence persistence) {
275                    _persistence = persistence;
276            }
277    
278            private static CounterPersistence _persistence;
279    }