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