001    /**
002     * Copyright (c) 2000-2012 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;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.MethodCache;
019    import com.liferay.portal.kernel.util.ReferenceRegistry;
020    
021    /**
022     * The utility for the counter local service. This utility wraps {@link com.liferay.counter.service.impl.CounterLocalServiceImpl} and is the primary access point for service operations in application layer code running on the local server.
023     *
024     * <p>
025     * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.
026     * </p>
027     *
028     * @author Brian Wing Shun Chan
029     * @see CounterLocalService
030     * @see com.liferay.counter.service.base.CounterLocalServiceBaseImpl
031     * @see com.liferay.counter.service.impl.CounterLocalServiceImpl
032     * @generated
033     */
034    public class CounterLocalServiceUtil {
035            /*
036             * NOTE FOR DEVELOPERS:
037             *
038             * Never modify this class directly. Add custom service methods to {@link com.liferay.counter.service.impl.CounterLocalServiceImpl} and rerun ServiceBuilder to regenerate this class.
039             */
040    
041            /**
042            * Adds the counter to the database. Also notifies the appropriate model listeners.
043            *
044            * @param counter the counter
045            * @return the counter that was added
046            * @throws SystemException if a system exception occurred
047            */
048            public static com.liferay.counter.model.Counter addCounter(
049                    com.liferay.counter.model.Counter counter)
050                    throws com.liferay.portal.kernel.exception.SystemException {
051                    return getService().addCounter(counter);
052            }
053    
054            /**
055            * Creates a new counter with the primary key. Does not add the counter to the database.
056            *
057            * @param name the primary key for the new counter
058            * @return the new counter
059            */
060            public static com.liferay.counter.model.Counter createCounter(
061                    java.lang.String name) {
062                    return getService().createCounter(name);
063            }
064    
065            /**
066            * Deletes the counter with the primary key from the database. Also notifies the appropriate model listeners.
067            *
068            * @param name the primary key of the counter
069            * @throws PortalException if a counter with the primary key could not be found
070            * @throws SystemException if a system exception occurred
071            */
072            public static void deleteCounter(java.lang.String name)
073                    throws com.liferay.portal.kernel.exception.PortalException,
074                            com.liferay.portal.kernel.exception.SystemException {
075                    getService().deleteCounter(name);
076            }
077    
078            /**
079            * Deletes the counter from the database. Also notifies the appropriate model listeners.
080            *
081            * @param counter the counter
082            * @throws SystemException if a system exception occurred
083            */
084            public static void deleteCounter(com.liferay.counter.model.Counter counter)
085                    throws com.liferay.portal.kernel.exception.SystemException {
086                    getService().deleteCounter(counter);
087            }
088    
089            /**
090            * Performs a dynamic query on the database and returns the matching rows.
091            *
092            * @param dynamicQuery the dynamic query
093            * @return the matching rows
094            * @throws SystemException if a system exception occurred
095            */
096            @SuppressWarnings("rawtypes")
097            public static java.util.List dynamicQuery(
098                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
099                    throws com.liferay.portal.kernel.exception.SystemException {
100                    return getService().dynamicQuery(dynamicQuery);
101            }
102    
103            /**
104            * Performs a dynamic query on the database and returns a range of the matching rows.
105            *
106            * <p>
107            * 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.
108            * </p>
109            *
110            * @param dynamicQuery the dynamic query
111            * @param start the lower bound of the range of model instances
112            * @param end the upper bound of the range of model instances (not inclusive)
113            * @return the range of matching rows
114            * @throws SystemException if a system exception occurred
115            */
116            @SuppressWarnings("rawtypes")
117            public static java.util.List dynamicQuery(
118                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
119                    int end) throws com.liferay.portal.kernel.exception.SystemException {
120                    return getService().dynamicQuery(dynamicQuery, start, end);
121            }
122    
123            /**
124            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
125            *
126            * <p>
127            * 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.
128            * </p>
129            *
130            * @param dynamicQuery the dynamic query
131            * @param start the lower bound of the range of model instances
132            * @param end the upper bound of the range of model instances (not inclusive)
133            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
134            * @return the ordered range of matching rows
135            * @throws SystemException if a system exception occurred
136            */
137            @SuppressWarnings("rawtypes")
138            public static java.util.List dynamicQuery(
139                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
140                    int end,
141                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
142                    throws com.liferay.portal.kernel.exception.SystemException {
143                    return getService()
144                                       .dynamicQuery(dynamicQuery, start, end, orderByComparator);
145            }
146    
147            /**
148            * Returns the number of rows that match the dynamic query.
149            *
150            * @param dynamicQuery the dynamic query
151            * @return the number of rows that match the dynamic query
152            * @throws SystemException if a system exception occurred
153            */
154            public static long dynamicQueryCount(
155                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
156                    throws com.liferay.portal.kernel.exception.SystemException {
157                    return getService().dynamicQueryCount(dynamicQuery);
158            }
159    
160            public static com.liferay.counter.model.Counter fetchCounter(
161                    java.lang.String name)
162                    throws com.liferay.portal.kernel.exception.SystemException {
163                    return getService().fetchCounter(name);
164            }
165    
166            /**
167            * Returns the counter with the primary key.
168            *
169            * @param name the primary key of the counter
170            * @return the counter
171            * @throws PortalException if a counter with the primary key could not be found
172            * @throws SystemException if a system exception occurred
173            */
174            public static com.liferay.counter.model.Counter getCounter(
175                    java.lang.String name)
176                    throws com.liferay.portal.kernel.exception.PortalException,
177                            com.liferay.portal.kernel.exception.SystemException {
178                    return getService().getCounter(name);
179            }
180    
181            public static com.liferay.portal.model.PersistedModel getPersistedModel(
182                    java.io.Serializable primaryKeyObj)
183                    throws com.liferay.portal.kernel.exception.PortalException,
184                            com.liferay.portal.kernel.exception.SystemException {
185                    return getService().getPersistedModel(primaryKeyObj);
186            }
187    
188            /**
189            * Returns a range of all the counters.
190            *
191            * <p>
192            * 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.
193            * </p>
194            *
195            * @param start the lower bound of the range of counters
196            * @param end the upper bound of the range of counters (not inclusive)
197            * @return the range of counters
198            * @throws SystemException if a system exception occurred
199            */
200            public static java.util.List<com.liferay.counter.model.Counter> getCounters(
201                    int start, int end)
202                    throws com.liferay.portal.kernel.exception.SystemException {
203                    return getService().getCounters(start, end);
204            }
205    
206            /**
207            * Returns the number of counters.
208            *
209            * @return the number of counters
210            * @throws SystemException if a system exception occurred
211            */
212            public static int getCountersCount()
213                    throws com.liferay.portal.kernel.exception.SystemException {
214                    return getService().getCountersCount();
215            }
216    
217            /**
218            * Updates the counter in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
219            *
220            * @param counter the counter
221            * @return the counter that was updated
222            * @throws SystemException if a system exception occurred
223            */
224            public static com.liferay.counter.model.Counter updateCounter(
225                    com.liferay.counter.model.Counter counter)
226                    throws com.liferay.portal.kernel.exception.SystemException {
227                    return getService().updateCounter(counter);
228            }
229    
230            /**
231            * Updates the counter in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
232            *
233            * @param counter the counter
234            * @param merge whether to merge the counter with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
235            * @return the counter that was updated
236            * @throws SystemException if a system exception occurred
237            */
238            public static com.liferay.counter.model.Counter updateCounter(
239                    com.liferay.counter.model.Counter counter, boolean merge)
240                    throws com.liferay.portal.kernel.exception.SystemException {
241                    return getService().updateCounter(counter, merge);
242            }
243    
244            /**
245            * Returns the Spring bean ID for this bean.
246            *
247            * @return the Spring bean ID for this bean
248            */
249            public static java.lang.String getBeanIdentifier() {
250                    return getService().getBeanIdentifier();
251            }
252    
253            /**
254            * Sets the Spring bean ID for this bean.
255            *
256            * @param beanIdentifier the Spring bean ID for this bean
257            */
258            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
259                    getService().setBeanIdentifier(beanIdentifier);
260            }
261    
262            public static java.util.List<java.lang.String> getNames()
263                    throws com.liferay.portal.kernel.exception.SystemException {
264                    return getService().getNames();
265            }
266    
267            public static long increment()
268                    throws com.liferay.portal.kernel.exception.SystemException {
269                    return getService().increment();
270            }
271    
272            public static long increment(java.lang.String name)
273                    throws com.liferay.portal.kernel.exception.SystemException {
274                    return getService().increment(name);
275            }
276    
277            public static long increment(java.lang.String name, int size)
278                    throws com.liferay.portal.kernel.exception.SystemException {
279                    return getService().increment(name, size);
280            }
281    
282            public static void rename(java.lang.String oldName, java.lang.String newName)
283                    throws com.liferay.portal.kernel.exception.SystemException {
284                    getService().rename(oldName, newName);
285            }
286    
287            public static void reset(java.lang.String name)
288                    throws com.liferay.portal.kernel.exception.SystemException {
289                    getService().reset(name);
290            }
291    
292            public static void reset(java.lang.String name, long size)
293                    throws com.liferay.portal.kernel.exception.SystemException {
294                    getService().reset(name, size);
295            }
296    
297            public static CounterLocalService getService() {
298                    if (_service == null) {
299                            _service = (CounterLocalService)PortalBeanLocatorUtil.locate(CounterLocalService.class.getName());
300    
301                            ReferenceRegistry.registerReference(CounterLocalServiceUtil.class,
302                                    "_service");
303                            MethodCache.remove(CounterLocalService.class);
304                    }
305    
306                    return _service;
307            }
308    
309            public void setService(CounterLocalService service) {
310                    MethodCache.remove(CounterLocalService.class);
311    
312                    _service = service;
313    
314                    ReferenceRegistry.registerReference(CounterLocalServiceUtil.class,
315                            "_service");
316                    MethodCache.remove(CounterLocalService.class);
317            }
318    
319            private static CounterLocalService _service;
320    }