001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.lock.service;
022:
023: import com.liferay.lock.model.Lock;
024: import com.liferay.portal.PortalException;
025: import com.liferay.portal.SystemException;
026:
027: import java.rmi.RemoteException;
028:
029: import java.util.Set;
030:
031: /**
032: * <a href="LockServiceUtil.java.html"><b><i>View Source</i></b></a>
033: *
034: * @author Brian Wing Shun Chan
035: *
036: */
037: public class LockServiceUtil {
038:
039: public static void clear() throws RemoteException, SystemException {
040: LockService lockService = LockServiceFactory.getService();
041:
042: lockService.clear();
043: }
044:
045: public static Lock getLock(String className, Comparable pk)
046: throws PortalException, RemoteException, SystemException {
047:
048: LockService lockService = LockServiceFactory.getService();
049:
050: return lockService.getLock(className, pk);
051: }
052:
053: public static Set getLocksByCompanyId(long companyId)
054: throws RemoteException, SystemException {
055:
056: LockService lockService = LockServiceFactory.getService();
057:
058: return lockService.getLocksByCompanyId(companyId);
059: }
060:
061: public static Set getLocksByUserId(long userId)
062: throws RemoteException, SystemException {
063:
064: LockService lockService = LockServiceFactory.getService();
065:
066: return lockService.getLocksByUserId(userId);
067: }
068:
069: public static boolean hasLock(String className, Comparable pk,
070: long userId) throws RemoteException, SystemException {
071:
072: LockService lockService = LockServiceFactory.getService();
073:
074: return lockService.hasLock(className, pk, userId);
075: }
076:
077: public static boolean isLocked(String className, Comparable pk)
078: throws RemoteException, SystemException {
079:
080: LockService lockService = LockServiceFactory.getService();
081:
082: return lockService.isLocked(className, pk);
083: }
084:
085: public static void lock(String className, Comparable pk,
086: long companyId, long userId, long expirationTime)
087: throws PortalException, RemoteException, SystemException {
088:
089: LockService lockService = LockServiceFactory.getService();
090:
091: lockService.lock(className, pk, companyId, userId,
092: expirationTime);
093: }
094:
095: public static void unlock(String className, Comparable pk)
096: throws RemoteException, SystemException {
097:
098: LockService lockService = LockServiceFactory.getService();
099:
100: lockService.unlock(className, pk);
101: }
102:
103: }
|