org.opencms.gwt.shared
Class CmsLockInfo

java.lang.Object
  extended by org.opencms.gwt.shared.CmsLockInfo
All Implemented Interfaces:
com.google.gwt.user.client.rpc.IsSerializable

public class CmsLockInfo
extends Object
implements com.google.gwt.user.client.rpc.IsSerializable

A bean for storing information about whether a resource could be locked or not, and if not, why.

Since:
8.0.0

Nested Class Summary
static class CmsLockInfo.State
          An enum indicating the success or type of failure of a locking operation.
 
Constructor Summary
protected CmsLockInfo()
          Empty constructor for serialization.
  CmsLockInfo(CmsLockInfo.State state, String user, String exceptionMessage)
          Creates a new lock info bean.
 
Method Summary
 boolean couldLock()
          Returns true if the locking succeeded.
static CmsLockInfo forChangedResource(String user)
          Creates a new info bean for a resource which has changed since it was opened.
static CmsLockInfo forError(String errorMessage)
          Creates a new info bean for other types of errors.
static CmsLockInfo forLockedResource(String lockUser)
          Returns a lock info bean for a resource locked by another user.
static CmsLockInfo forSuccess()
          Returns a lock info bean for a successful lock operation.
 String getErrorMessage()
          Returns the additional error message.
 CmsLockInfo.State getState()
          Returns the state of the locking operation.
 String getUser()
          Returns the user name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsLockInfo

public CmsLockInfo(CmsLockInfo.State state,
                   String user,
                   String exceptionMessage)
Creates a new lock info bean.

Parameters:
state - the state of the locking operation
user - a user name
exceptionMessage - an additional error message

CmsLockInfo

protected CmsLockInfo()
Empty constructor for serialization.

Method Detail

forChangedResource

public static CmsLockInfo forChangedResource(String user)
Creates a new info bean for a resource which has changed since it was opened.

Parameters:
user - the user by which it was changed
Returns:
the new lock info bean

forError

public static CmsLockInfo forError(String errorMessage)
Creates a new info bean for other types of errors.

Parameters:
errorMessage - the additional error message
Returns:
the new lock info bean

forLockedResource

public static CmsLockInfo forLockedResource(String lockUser)
Returns a lock info bean for a resource locked by another user.

Parameters:
lockUser - the other user
Returns:
the new lock info bean

forSuccess

public static CmsLockInfo forSuccess()
Returns a lock info bean for a successful lock operation.

Returns:
the new lock info bean

couldLock

public boolean couldLock()
Returns true if the locking succeeded.

Returns:
true if the locking succeeded

getErrorMessage

public String getErrorMessage()
Returns the additional error message.

Returns:
the additional error message

getState

public CmsLockInfo.State getState()
Returns the state of the locking operation.

Returns:
the state of the locking operation

getUser

public String getUser()
Returns the user name.

Returns:
a user name