com.flexive.shared
Class FxLock

java.lang.Object
  extended by com.flexive.shared.FxLock
All Implemented Interfaces:
java.io.Serializable

public class FxLock
extends java.lang.Object
implements java.io.Serializable

Lock for contents or resources in general

Author:
Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Field Summary
(package private) static FxLock NO_LOCK_PK
           
(package private) static FxLock NO_LOCK_RESOURCE
           
 
Constructor Summary
FxLock(FxLockType lockType, long created, long expires, long userId, FxPK lockedPK)
          Ctor for a content lock
FxLock(FxLockType lockType, long created, long expires, long userId, java.lang.Object obj)
          Ctor that decides locked resource depending on class of obj
FxLock(FxLockType lockType, long created, long expires, long userId, java.lang.String lockedResource)
          Ctor for a resource lock
 
Method Summary
 java.util.Date getCreatedDate()
          Get the date when the lock was created
 long getCreatedTimestamp()
          Get the timestamp when the lock was created
 long getDuration()
          Get the remaining duration of the lock
 java.util.Date getExpiresDate()
          Get the date when the lock expires
 long getExpiresTimestamp()
          Get the timestamp when the lock expires
 FxPK getLockedPK()
          Getter for the FxPK of the locked content
 java.lang.String getLockedResource()
          Getter for the name of the locked resource
 FxLockType getLockType()
          Getter for the lock type
 long getUserId()
          Getter for the user id that issued the lock
 boolean isContentLock()
          Is this lock for a content instance?
 boolean isExpired()
          Has this lock expired?
 boolean isLocked()
          Is this an actual lock?
 boolean isResourceLock()
          Is this lock for a generic resource?
 boolean isUnlockable()
          Can this lock (probably) be unlocked by the calling user?
static FxLock noLockPK()
           
static FxLock noLockResource()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_LOCK_PK

static final FxLock NO_LOCK_PK

NO_LOCK_RESOURCE

static final FxLock NO_LOCK_RESOURCE
Constructor Detail

FxLock

public FxLock(FxLockType lockType,
              long created,
              long expires,
              long userId,
              FxPK lockedPK)
Ctor for a content lock

Parameters:
lockType - type of the lock
created - when was the lock created
expires - when does the lock expire
userId - user id that issued the lock
lockedPK - FxPK of the locked content instance

FxLock

public FxLock(FxLockType lockType,
              long created,
              long expires,
              long userId,
              java.lang.String lockedResource)
Ctor for a resource lock

Parameters:
lockType - type of the lock
created - when was the lock created
expires - when does the lock expire
userId - user id that issued the lock
lockedResource - unique name of the locked resource

FxLock

public FxLock(FxLockType lockType,
              long created,
              long expires,
              long userId,
              java.lang.Object obj)
Ctor that decides locked resource depending on class of obj

Parameters:
lockType - type of the lock
created - when was the lock created
expires - when does the lock expire
userId - user id that issued the lock
obj - resource to lock
Method Detail

getLockType

public FxLockType getLockType()
Getter for the lock type

Returns:
lock type

isLocked

public boolean isLocked()
Is this an actual lock?

Returns:
if this FxLock instance is an actual lock

getUserId

public long getUserId()
Getter for the user id that issued the lock

Returns:
user id that issued the lock

isContentLock

public boolean isContentLock()
Is this lock for a content instance?

Returns:
if this lock is for a content instance

isResourceLock

public boolean isResourceLock()
Is this lock for a generic resource?

Returns:
if this lock is for a generic resource

getLockedResource

public java.lang.String getLockedResource()
Getter for the name of the locked resource

Returns:
name of the locked resource

getLockedPK

public FxPK getLockedPK()
Getter for the FxPK of the locked content

Returns:
FxPK of the locked content

getCreatedTimestamp

public long getCreatedTimestamp()
Get the timestamp when the lock was created

Returns:
timestamp when the lock was created

getCreatedDate

public java.util.Date getCreatedDate()
Get the date when the lock was created

Returns:
date when the lock was created

getExpiresTimestamp

public long getExpiresTimestamp()
Get the timestamp when the lock expires

Returns:
timestamp when the lock expires

getExpiresDate

public java.util.Date getExpiresDate()
Get the date when the lock expires

Returns:
date when the lock expires

isExpired

public boolean isExpired()
Has this lock expired?

Returns:
lock expired

isUnlockable

public boolean isUnlockable()
Can this lock (probably) be unlocked by the calling user?

Returns:
if this lock can be unlocked by the calling user

getDuration

public long getDuration()
Get the remaining duration of the lock

Returns:
remaining duration of the lock

noLockPK

public static FxLock noLockPK()

noLockResource

public static FxLock noLockResource()