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