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.portal.service;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.ReferenceRegistry;
019    
020    /**
021     * The utility for the lock local service. This utility wraps {@link com.liferay.portal.service.impl.LockLocalServiceImpl} and is the primary access point for service operations in application layer code running on the local server.
022     *
023     * <p>
024     * 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.
025     * </p>
026     *
027     * @author Brian Wing Shun Chan
028     * @see LockLocalService
029     * @see com.liferay.portal.service.base.LockLocalServiceBaseImpl
030     * @see com.liferay.portal.service.impl.LockLocalServiceImpl
031     * @generated
032     */
033    public class LockLocalServiceUtil {
034            /*
035             * NOTE FOR DEVELOPERS:
036             *
037             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.LockLocalServiceImpl} and rerun ServiceBuilder to regenerate this class.
038             */
039    
040            /**
041            * Adds the lock to the database. Also notifies the appropriate model listeners.
042            *
043            * @param lock the lock
044            * @return the lock that was added
045            * @throws SystemException if a system exception occurred
046            */
047            public static com.liferay.portal.model.Lock addLock(
048                    com.liferay.portal.model.Lock lock)
049                    throws com.liferay.portal.kernel.exception.SystemException {
050                    return getService().addLock(lock);
051            }
052    
053            /**
054            * Creates a new lock with the primary key. Does not add the lock to the database.
055            *
056            * @param lockId the primary key for the new lock
057            * @return the new lock
058            */
059            public static com.liferay.portal.model.Lock createLock(long lockId) {
060                    return getService().createLock(lockId);
061            }
062    
063            /**
064            * Deletes the lock with the primary key from the database. Also notifies the appropriate model listeners.
065            *
066            * @param lockId the primary key of the lock
067            * @return the lock that was removed
068            * @throws PortalException if a lock with the primary key could not be found
069            * @throws SystemException if a system exception occurred
070            */
071            public static com.liferay.portal.model.Lock deleteLock(long lockId)
072                    throws com.liferay.portal.kernel.exception.PortalException,
073                            com.liferay.portal.kernel.exception.SystemException {
074                    return getService().deleteLock(lockId);
075            }
076    
077            /**
078            * Deletes the lock from the database. Also notifies the appropriate model listeners.
079            *
080            * @param lock the lock
081            * @return the lock that was removed
082            * @throws SystemException if a system exception occurred
083            */
084            public static com.liferay.portal.model.Lock deleteLock(
085                    com.liferay.portal.model.Lock lock)
086                    throws com.liferay.portal.kernel.exception.SystemException {
087                    return getService().deleteLock(lock);
088            }
089    
090            public static com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() {
091                    return getService().dynamicQuery();
092            }
093    
094            /**
095            * Performs a dynamic query on the database and returns the matching rows.
096            *
097            * @param dynamicQuery the dynamic query
098            * @return the matching rows
099            * @throws SystemException if a system exception occurred
100            */
101            @SuppressWarnings("rawtypes")
102            public static java.util.List dynamicQuery(
103                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
104                    throws com.liferay.portal.kernel.exception.SystemException {
105                    return getService().dynamicQuery(dynamicQuery);
106            }
107    
108            /**
109            * Performs a dynamic query on the database and returns a range of the matching rows.
110            *
111            * <p>
112            * 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.
113            * </p>
114            *
115            * @param dynamicQuery the dynamic query
116            * @param start the lower bound of the range of model instances
117            * @param end the upper bound of the range of model instances (not inclusive)
118            * @return the range of matching rows
119            * @throws SystemException if a system exception occurred
120            */
121            @SuppressWarnings("rawtypes")
122            public static java.util.List dynamicQuery(
123                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
124                    int end) throws com.liferay.portal.kernel.exception.SystemException {
125                    return getService().dynamicQuery(dynamicQuery, start, end);
126            }
127    
128            /**
129            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
130            *
131            * <p>
132            * 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.
133            * </p>
134            *
135            * @param dynamicQuery the dynamic query
136            * @param start the lower bound of the range of model instances
137            * @param end the upper bound of the range of model instances (not inclusive)
138            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
139            * @return the ordered range of matching rows
140            * @throws SystemException if a system exception occurred
141            */
142            @SuppressWarnings("rawtypes")
143            public static java.util.List dynamicQuery(
144                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
145                    int end,
146                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
147                    throws com.liferay.portal.kernel.exception.SystemException {
148                    return getService()
149                                       .dynamicQuery(dynamicQuery, start, end, orderByComparator);
150            }
151    
152            /**
153            * Returns the number of rows that match the dynamic query.
154            *
155            * @param dynamicQuery the dynamic query
156            * @return the number of rows that match the dynamic query
157            * @throws SystemException if a system exception occurred
158            */
159            public static long dynamicQueryCount(
160                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
161                    throws com.liferay.portal.kernel.exception.SystemException {
162                    return getService().dynamicQueryCount(dynamicQuery);
163            }
164    
165            public static com.liferay.portal.model.Lock fetchLock(long lockId)
166                    throws com.liferay.portal.kernel.exception.SystemException {
167                    return getService().fetchLock(lockId);
168            }
169    
170            /**
171            * Returns the lock with the primary key.
172            *
173            * @param lockId the primary key of the lock
174            * @return the lock
175            * @throws PortalException if a lock with the primary key could not be found
176            * @throws SystemException if a system exception occurred
177            */
178            public static com.liferay.portal.model.Lock getLock(long lockId)
179                    throws com.liferay.portal.kernel.exception.PortalException,
180                            com.liferay.portal.kernel.exception.SystemException {
181                    return getService().getLock(lockId);
182            }
183    
184            public static com.liferay.portal.model.PersistedModel getPersistedModel(
185                    java.io.Serializable primaryKeyObj)
186                    throws com.liferay.portal.kernel.exception.PortalException,
187                            com.liferay.portal.kernel.exception.SystemException {
188                    return getService().getPersistedModel(primaryKeyObj);
189            }
190    
191            /**
192            * Returns a range of all the locks.
193            *
194            * <p>
195            * 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.
196            * </p>
197            *
198            * @param start the lower bound of the range of locks
199            * @param end the upper bound of the range of locks (not inclusive)
200            * @return the range of locks
201            * @throws SystemException if a system exception occurred
202            */
203            public static java.util.List<com.liferay.portal.model.Lock> getLocks(
204                    int start, int end)
205                    throws com.liferay.portal.kernel.exception.SystemException {
206                    return getService().getLocks(start, end);
207            }
208    
209            /**
210            * Returns the number of locks.
211            *
212            * @return the number of locks
213            * @throws SystemException if a system exception occurred
214            */
215            public static int getLocksCount()
216                    throws com.liferay.portal.kernel.exception.SystemException {
217                    return getService().getLocksCount();
218            }
219    
220            /**
221            * Updates the lock in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
222            *
223            * @param lock the lock
224            * @return the lock that was updated
225            * @throws SystemException if a system exception occurred
226            */
227            public static com.liferay.portal.model.Lock updateLock(
228                    com.liferay.portal.model.Lock lock)
229                    throws com.liferay.portal.kernel.exception.SystemException {
230                    return getService().updateLock(lock);
231            }
232    
233            /**
234            * Updates the lock in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
235            *
236            * @param lock the lock
237            * @param merge whether to merge the lock 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.
238            * @return the lock that was updated
239            * @throws SystemException if a system exception occurred
240            */
241            public static com.liferay.portal.model.Lock updateLock(
242                    com.liferay.portal.model.Lock lock, boolean merge)
243                    throws com.liferay.portal.kernel.exception.SystemException {
244                    return getService().updateLock(lock, merge);
245            }
246    
247            /**
248            * Returns the Spring bean ID for this bean.
249            *
250            * @return the Spring bean ID for this bean
251            */
252            public static java.lang.String getBeanIdentifier() {
253                    return getService().getBeanIdentifier();
254            }
255    
256            /**
257            * Sets the Spring bean ID for this bean.
258            *
259            * @param beanIdentifier the Spring bean ID for this bean
260            */
261            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
262                    getService().setBeanIdentifier(beanIdentifier);
263            }
264    
265            public static void clear()
266                    throws com.liferay.portal.kernel.exception.SystemException {
267                    getService().clear();
268            }
269    
270            public static com.liferay.portal.model.Lock getLock(
271                    java.lang.String className, long key)
272                    throws com.liferay.portal.kernel.exception.PortalException,
273                            com.liferay.portal.kernel.exception.SystemException {
274                    return getService().getLock(className, key);
275            }
276    
277            public static com.liferay.portal.model.Lock getLock(
278                    java.lang.String className, java.lang.String key)
279                    throws com.liferay.portal.kernel.exception.PortalException,
280                            com.liferay.portal.kernel.exception.SystemException {
281                    return getService().getLock(className, key);
282            }
283    
284            public static com.liferay.portal.model.Lock getLockByUuid(
285                    java.lang.String uuid)
286                    throws com.liferay.portal.kernel.exception.PortalException,
287                            com.liferay.portal.kernel.exception.SystemException {
288                    return getService().getLockByUuid(uuid);
289            }
290    
291            public static boolean hasLock(long userId, java.lang.String className,
292                    long key) throws com.liferay.portal.kernel.exception.SystemException {
293                    return getService().hasLock(userId, className, key);
294            }
295    
296            public static boolean hasLock(long userId, java.lang.String className,
297                    java.lang.String key)
298                    throws com.liferay.portal.kernel.exception.SystemException {
299                    return getService().hasLock(userId, className, key);
300            }
301    
302            public static boolean isLocked(java.lang.String className, long key)
303                    throws com.liferay.portal.kernel.exception.SystemException {
304                    return getService().isLocked(className, key);
305            }
306    
307            public static boolean isLocked(java.lang.String className,
308                    java.lang.String key)
309                    throws com.liferay.portal.kernel.exception.SystemException {
310                    return getService().isLocked(className, key);
311            }
312    
313            public static com.liferay.portal.model.Lock lock(long userId,
314                    java.lang.String className, long key, java.lang.String owner,
315                    boolean inheritable, long expirationTime)
316                    throws com.liferay.portal.kernel.exception.PortalException,
317                            com.liferay.portal.kernel.exception.SystemException {
318                    return getService()
319                                       .lock(userId, className, key, owner, inheritable,
320                            expirationTime);
321            }
322    
323            public static com.liferay.portal.model.Lock lock(long userId,
324                    java.lang.String className, java.lang.String key,
325                    java.lang.String owner, boolean inheritable, long expirationTime)
326                    throws com.liferay.portal.kernel.exception.PortalException,
327                            com.liferay.portal.kernel.exception.SystemException {
328                    return getService()
329                                       .lock(userId, className, key, owner, inheritable,
330                            expirationTime);
331            }
332    
333            public static com.liferay.portal.model.Lock lock(
334                    java.lang.String className, java.lang.String key,
335                    java.lang.String owner, boolean retrieveFromCache)
336                    throws com.liferay.portal.kernel.exception.SystemException {
337                    return getService().lock(className, key, owner, retrieveFromCache);
338            }
339    
340            public static com.liferay.portal.model.Lock lock(
341                    java.lang.String className, java.lang.String key,
342                    java.lang.String expectedOwner, java.lang.String updatedOwner,
343                    boolean retrieveFromCache)
344                    throws com.liferay.portal.kernel.exception.SystemException {
345                    return getService()
346                                       .lock(className, key, expectedOwner, updatedOwner,
347                            retrieveFromCache);
348            }
349    
350            public static com.liferay.portal.model.Lock refresh(java.lang.String uuid,
351                    long expirationTime)
352                    throws com.liferay.portal.kernel.exception.PortalException,
353                            com.liferay.portal.kernel.exception.SystemException {
354                    return getService().refresh(uuid, expirationTime);
355            }
356    
357            public static void unlock(java.lang.String className, long key)
358                    throws com.liferay.portal.kernel.exception.SystemException {
359                    getService().unlock(className, key);
360            }
361    
362            public static void unlock(java.lang.String className, java.lang.String key)
363                    throws com.liferay.portal.kernel.exception.SystemException {
364                    getService().unlock(className, key);
365            }
366    
367            public static void unlock(java.lang.String className, java.lang.String key,
368                    java.lang.String owner, boolean retrieveFromCache)
369                    throws com.liferay.portal.kernel.exception.SystemException {
370                    getService().unlock(className, key, owner, retrieveFromCache);
371            }
372    
373            public static LockLocalService getService() {
374                    if (_service == null) {
375                            _service = (LockLocalService)PortalBeanLocatorUtil.locate(LockLocalService.class.getName());
376    
377                            ReferenceRegistry.registerReference(LockLocalServiceUtil.class,
378                                    "_service");
379                    }
380    
381                    return _service;
382            }
383    
384            /**
385             * @deprecated
386             */
387            public void setService(LockLocalService service) {
388            }
389    
390            private static LockLocalService _service;
391    }