001    /**
002     * Copyright (c) 2000-2013 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.kernel.util.ReferenceRegistry;
024    import com.liferay.portal.service.ServiceContext;
025    
026    import java.util.List;
027    
028    /**
029     * 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.
030     *
031     * <p>
032     * Caching information and settings can be found in <code>portal.properties</code>
033     * </p>
034     *
035     * @author Brian Wing Shun Chan
036     * @see CounterPersistence
037     * @see CounterPersistenceImpl
038     * @generated
039     */
040    public class CounterUtil {
041            /*
042             * NOTE FOR DEVELOPERS:
043             *
044             * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
045             */
046    
047            /**
048             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
049             */
050            public static void clearCache() {
051                    getPersistence().clearCache();
052            }
053    
054            /**
055             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
056             */
057            public static void clearCache(Counter counter) {
058                    getPersistence().clearCache(counter);
059            }
060    
061            /**
062             * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
063             */
064            public long countWithDynamicQuery(DynamicQuery dynamicQuery)
065                    throws SystemException {
066                    return getPersistence().countWithDynamicQuery(dynamicQuery);
067            }
068    
069            /**
070             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
071             */
072            public static List<Counter> findWithDynamicQuery(DynamicQuery dynamicQuery)
073                    throws SystemException {
074                    return getPersistence().findWithDynamicQuery(dynamicQuery);
075            }
076    
077            /**
078             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
079             */
080            public static List<Counter> findWithDynamicQuery(
081                    DynamicQuery dynamicQuery, int start, int end)
082                    throws SystemException {
083                    return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
084            }
085    
086            /**
087             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
088             */
089            public static List<Counter> findWithDynamicQuery(
090                    DynamicQuery dynamicQuery, int start, int end,
091                    OrderByComparator orderByComparator) throws SystemException {
092                    return getPersistence()
093                                       .findWithDynamicQuery(dynamicQuery, start, end,
094                            orderByComparator);
095            }
096    
097            /**
098             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)
099             */
100            public static Counter update(Counter counter, boolean merge)
101                    throws SystemException {
102                    return getPersistence().update(counter, merge);
103            }
104    
105            /**
106             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
107             */
108            public static Counter update(Counter counter, boolean merge,
109                    ServiceContext serviceContext) throws SystemException {
110                    return getPersistence().update(counter, merge, serviceContext);
111            }
112    
113            /**
114            * Caches the counter in the entity cache if it is enabled.
115            *
116            * @param counter the counter
117            */
118            public static void cacheResult(com.liferay.counter.model.Counter counter) {
119                    getPersistence().cacheResult(counter);
120            }
121    
122            /**
123            * Caches the counters in the entity cache if it is enabled.
124            *
125            * @param counters the counters
126            */
127            public static void cacheResult(
128                    java.util.List<com.liferay.counter.model.Counter> counters) {
129                    getPersistence().cacheResult(counters);
130            }
131    
132            /**
133            * Creates a new counter with the primary key. Does not add the counter to the database.
134            *
135            * @param name the primary key for the new counter
136            * @return the new counter
137            */
138            public static com.liferay.counter.model.Counter create(
139                    java.lang.String name) {
140                    return getPersistence().create(name);
141            }
142    
143            /**
144            * Removes the counter with the primary key from the database. Also notifies the appropriate model listeners.
145            *
146            * @param name the primary key of the counter
147            * @return the counter that was removed
148            * @throws com.liferay.counter.NoSuchCounterException if a counter with the primary key could not be found
149            * @throws SystemException if a system exception occurred
150            */
151            public static com.liferay.counter.model.Counter remove(
152                    java.lang.String name)
153                    throws com.liferay.counter.NoSuchCounterException,
154                            com.liferay.portal.kernel.exception.SystemException {
155                    return getPersistence().remove(name);
156            }
157    
158            public static com.liferay.counter.model.Counter updateImpl(
159                    com.liferay.counter.model.Counter counter, boolean merge)
160                    throws com.liferay.portal.kernel.exception.SystemException {
161                    return getPersistence().updateImpl(counter, merge);
162            }
163    
164            /**
165            * Returns the counter with the primary key or throws a {@link com.liferay.counter.NoSuchCounterException} if it could not be found.
166            *
167            * @param name the primary key of the counter
168            * @return the counter
169            * @throws com.liferay.counter.NoSuchCounterException if a counter with the primary key could not be found
170            * @throws SystemException if a system exception occurred
171            */
172            public static com.liferay.counter.model.Counter findByPrimaryKey(
173                    java.lang.String name)
174                    throws com.liferay.counter.NoSuchCounterException,
175                            com.liferay.portal.kernel.exception.SystemException {
176                    return getPersistence().findByPrimaryKey(name);
177            }
178    
179            /**
180            * Returns the counter with the primary key or returns <code>null</code> if it could not be found.
181            *
182            * @param name the primary key of the counter
183            * @return the counter, or <code>null</code> if a counter with the primary key could not be found
184            * @throws SystemException if a system exception occurred
185            */
186            public static com.liferay.counter.model.Counter fetchByPrimaryKey(
187                    java.lang.String name)
188                    throws com.liferay.portal.kernel.exception.SystemException {
189                    return getPersistence().fetchByPrimaryKey(name);
190            }
191    
192            /**
193            * Returns all the counters.
194            *
195            * @return the counters
196            * @throws SystemException if a system exception occurred
197            */
198            public static java.util.List<com.liferay.counter.model.Counter> findAll()
199                    throws com.liferay.portal.kernel.exception.SystemException {
200                    return getPersistence().findAll();
201            }
202    
203            /**
204            * Returns a range of all the counters.
205            *
206            * <p>
207            * 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.
208            * </p>
209            *
210            * @param start the lower bound of the range of counters
211            * @param end the upper bound of the range of counters (not inclusive)
212            * @return the range of counters
213            * @throws SystemException if a system exception occurred
214            */
215            public static java.util.List<com.liferay.counter.model.Counter> findAll(
216                    int start, int end)
217                    throws com.liferay.portal.kernel.exception.SystemException {
218                    return getPersistence().findAll(start, end);
219            }
220    
221            /**
222            * Returns an ordered range of all the counters.
223            *
224            * <p>
225            * 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.
226            * </p>
227            *
228            * @param start the lower bound of the range of counters
229            * @param end the upper bound of the range of counters (not inclusive)
230            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
231            * @return the ordered range of counters
232            * @throws SystemException if a system exception occurred
233            */
234            public static java.util.List<com.liferay.counter.model.Counter> findAll(
235                    int start, int end,
236                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
237                    throws com.liferay.portal.kernel.exception.SystemException {
238                    return getPersistence().findAll(start, end, orderByComparator);
239            }
240    
241            /**
242            * Removes all the counters from the database.
243            *
244            * @throws SystemException if a system exception occurred
245            */
246            public static void removeAll()
247                    throws com.liferay.portal.kernel.exception.SystemException {
248                    getPersistence().removeAll();
249            }
250    
251            /**
252            * Returns the number of counters.
253            *
254            * @return the number of counters
255            * @throws SystemException if a system exception occurred
256            */
257            public static int countAll()
258                    throws com.liferay.portal.kernel.exception.SystemException {
259                    return getPersistence().countAll();
260            }
261    
262            public static CounterPersistence getPersistence() {
263                    if (_persistence == null) {
264                            _persistence = (CounterPersistence)PortalBeanLocatorUtil.locate(CounterPersistence.class.getName());
265    
266                            ReferenceRegistry.registerReference(CounterUtil.class,
267                                    "_persistence");
268                    }
269    
270                    return _persistence;
271            }
272    
273            /**
274             * @deprecated
275             */
276            public void setPersistence(CounterPersistence persistence) {
277            }
278    
279            private static CounterPersistence _persistence;
280    }