com.sap.portal.pcm.admin

Interface ILockHandle


public interface ILockHandle

The interface that helps to protect the current object against concurrent changes.

Cooperative locking is assumed, meaning it is the responsibility of the application to obey the lock and not to perform any changes if the lock could not be acquired.


Nested Class Summary
static class ILockHandle.LockInfo
          The class that describes the current state of a lock.
 
Method Summary
 ILockHandle.LockInfo getLockInfo()
          Gets the lock information for this object.
 boolean refreshLock(String userId, String sessionId)
          Indicates whether the lock is still owned by the specified user and session and updates the time of last access, extending the protection span to the default initial value.
 boolean releaseLock(String userId, String sessionId)
          Releases the lock for the current object.
 boolean setLock(String userId, String sessionId, String description)
          Sets the lock for the current object.
 boolean takeLock(String userId, String sessionId, String description)
          Attempts to acquire the lock for the current object even though the object is locked for a different user or session.
 

Method Detail

setLock

boolean setLock(String userId,
                String sessionId,
                String description)
Sets the lock for the current object.

Parameters:
userId - the ID of the user, as returned from IPrincipal.getUniqueID()
sessionId - an application defined parameter that could allow, for example, to distinguish between different editor instances
description - a description of the locking application
Returns:
true if the lock could be acquired or if the object was already locked for the same user and session; false if the object cannot be locked, because it is already locked for a different user or session

getLockInfo

ILockHandle.LockInfo getLockInfo()
Gets the lock information for this object.

Use the returned instance fields to retrieve information regarding this lock.

Returns:
the lock information for this object or null if the object is not locked

releaseLock

boolean releaseLock(String userId,
                    String sessionId)
Releases the lock for the current object.

This operation fails if the object is locked for a different user or session.

Parameters:
userId - the ID of the user, as returned from IPrincipal.getUniqueID()
sessionId - an application defined parameter that could allow for example to distinguish between different editor instances
Returns:
true if the lock is released; false if the lock still belongs to the specified user and session

refreshLock

boolean refreshLock(String userId,
                    String sessionId)
Indicates whether the lock is still owned by the specified user and session and updates the time of last access, extending the protection span to the default initial value.

Parameters:
userId - the ID of the user, as returned from IPrincipal.getUniqueID()
sessionId - an application defined parameter that could allow for example to distinguish between different editor instances
Returns:
true if the lock is refreshed

takeLock

boolean takeLock(String userId,
                 String sessionId,
                 String description)
Attempts to acquire the lock for the current object even though the object is locked for a different user or session.

This action works when the protection of the lock has expired.

Parameters:
userId - the ID of the user, as returned from IPrincipal.getUniqueID()
sessionId - an application defined parameter that could allow for example to distinguish between different editor instances
description - a description of the locking application
Returns:
true if the lock could be acquired or if the object was already locked for the same user and session; false if the object cannot be locked because, for example, it is already locked for a different user or session and the protection span is not over
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] EP-RUNTIME [sap.com] tc/ep/semantics/api api EP-PIN
[sap.com] EP-BASIS-API [sap.com] tc/epbc/pcm/admin/public/api api EP-PIN
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM


Copyright 2013 SAP AG Complete Copyright Notice