public class LockObject extends TieSystemObject
The different lock types are:
The LockHolder attribute refers to the DirectoryUser that holds the USERLOCK and is implicitly set for User Lock. Similarly, the LockedForSession attribute is the id of the session that holds the SESSIONLOCK and is implicitly set for Session Lock.
The LockState attribute is not updateable. Going from one
LockState to another using
PublicObject.lock(LockObjectDefinition lodef)
method results in a new LockObject being created. The
old LockObject is orphaned.
Orphaned LockObjects are freed by the GarbageCollectionAgent.
A LockObject can be multiply referenced by several PublicObjects.
The PublicObject.lock(LockObject lo)
method
enables one to share LockObjects.
A LockObject can be updated using the
PublicObject.updateLock(LockObject lo)
method.
When the PublicObject.unlock()
method is invoked,
the LockObject attribute on the PublicObject is set to null.
The LockObject is orphaned and freed by the
GarbageCollectionAgent.
Since the LockObject is a SystemObject, it can only be explicitly created and updated by administrators. They are otherwise created in the context of locking operations through special system options.
The semantics discussed in the method descriptions below for managing locks on a PublicObject reflect the out-of-the-box locking behavior. The policy for locking/unlocking a PublicObject in various lockstates; modifying and freeing a locked PublicObject can be changed by modifying the Policy on the ClassObject representing that PublicObject. You can also change the Policy for a specific instance, if desired.
To define a new policy with a custom semantic, construct a Policy object using the API. Details on how to create a new policy are in the Developer's Guide. The OPERATION attribute for the Policy must equal the OPERATION for which you are trying to change the semantic. The implementation for the policy must reside in the server side subclass of LockObject class, i.e. S_TieLockObject or its subclass. The implementation method must also take a server side S_PublicObject as a parameter and be public. The implementation is dynamically invoked.
The policy can be associated with the ClassObject representing the
PublicObject or the
instance by using LibraryObject.putPolicy(Policy po)
.
Associating the Policy with the ClassObject affects the behavior for
all PublicObjects in the system. Associating the Policy with the instance
only applies the policy for that specific instance.
Modifier and Type | Field and Description |
---|---|
static String |
CLASS_NAME
This class name for this class.
|
static String |
LOCKEDFORSESSION_ATTRIBUTE
Indicates the Long id of the session that holds the lock.
|
static String |
LOCKENTRY_ATTRIBUTE
Indicates the coresponding LockEntry.
|
static String |
LOCKHOLDER_ATTRIBUTE
Indicates the DirectoryUser that is the owner of the lock
and is used for USERLOCKs.
|
static String |
LOCKSTATE_ATTRIBUTE
Indicates the integer constant state of the lock and is
the type of lock on this object.
|
static int |
LOCKSTATE_HARDLOCK
Represents a HardLock state.
|
static int |
LOCKSTATE_SESSIONLOCK
Represents a SessionLock state.
|
static int |
LOCKSTATE_SOFTLOCK
Represents a SoftLock state.
|
static int |
LOCKSTATE_UNLOCK
Represents unlock state.
|
static int |
LOCKSTATE_USERLOCK
Represents a UserLock state.
|
static String |
LOCKTIMEOUT_ATTRIBUTE
The actual time at which the lock on a publicobject should
auto-expire.
|
ACTIVE_ATTRIBUTE, POLICYBUNDLE_ATTRIBUTE, POLICYLISTS_ATTRIBUTE, PROPERTYBUNDLE_ATTRIBUTE
DOMAIN_UNIQUENAME_DEFAULT_DELIMITER, m_ClassId, m_Id, m_Session, NAME_ATTRIBUTE
Modifier | Constructor and Description |
---|---|
protected |
LockObject(LibrarySession session,
Long id,
Long classId,
S_LibraryObjectData data)
Constructs a LockObject object.
|
Modifier and Type | Method and Description |
---|---|
LockEntry |
createEquivalentLockEntry(PublicObject po)
Creates an equivalent LockEntry, and updates this instance to refer to it.
|
LockObject |
getClonedLockObject(PublicObject po)
Returns a LockObject that can be used to lock another PublicObject.
|
static LockObject[] |
getExpiredTimedLocks(LibrarySession session,
int maxItems,
int offset)
Gets a set of expired timed LockObjects.
|
long |
getLockedForSession()
Returns the id of the session that is holding a session lock on the
PublicObject (that refer to this lockobject),
or returns 0 if the PublicObject that refers to this LockObject has
no session lock.
|
LockEntry |
getLockEntry()
Returns the LockEntry that corresponds to this LockObject.
|
DirectoryUser |
getLockHolder()
Returns the directory user who holds the lock on the PublicObject(s)
(that refer to this lockobject) or null if the lock holder has been
deleted.
|
int |
getLockState()
Returns the lock state of this object
|
String |
getLockStateLabel()
Gets the localized String label for the LockState set for
this instance.
|
Date |
getLockTimeOut()
Returns the Lock time value for this LockObject.
|
PublicObject[] |
getReferringPublicObjects()
Get the PublicObjects that refer to this LockObject
|
PublicObject[] |
getReferringPublicObjects(SortSpecification sort)
Get the PublicObjects that refer to this LockObject, sorted according
to the specified SortSpecification.
|
LockObject |
getShareableLockObject(PublicObject po)
Returns a LockObject that can be used to lock another PublicObject.
|
boolean |
isLockedForSession()
Returns true if the PublicObject that refers to this LockObject has a
session lock i.e. the LockState of this object is
LOCKSTATE_SESSIONLOCK and it has a LockedForSession attribute value
that is not 0.
|
boolean |
isLockedForSessionByCurrentSession()
Returns true if there is a session lock held by this object, and it is
held by the invoking session.
|
boolean |
isShared()
Checks if this lockobject is referenced by multiple PublicObjects
|
int |
release()
Release an expired LockObject.
|
void |
setLockState(int lockstate)
Sets the Lock state of the LockObject
|
void |
setLockTimeOut(Date timeout)
Sets the Lock time out of the LockObject.
|
static String |
toLockStateLabel(int lockState)
Converts the specified LockState constant to a
localized label.
|
static String |
toLockStateLabel(int lockState,
LibrarySession session)
Converts the specified LockState constant to a
localized label, using the Localizer from the specified
LibrarySession.
|
static String |
toLockStateLabel(int lockState,
Localizer localizer)
Converts the specified LockState constant to a
localized label, using the specified Localizer.
|
String |
toString()
Return information regarding the LockState and LockHolder
Returns information in the format
LockState =
|
protected static LockObject[] |
vectorToLockObjectArray(Vector vector)
convert a Vector of LockObject to an array of LockObject.
|
addCategory, constructSystemObject, constructSystemObjectVector, free, freeCategories, getCategories, getCategories, getCategories, getCategories, getPolicyBundle, getPolicyLists, handleCreate, hasPropertyBundleAttribute, isActive, postCreate, postUpdate, preCreate, preUpdate, putPolicy, removeAllPolicies, removePolicy, removePolicy, setActive, setPolicyBundle, setPolicyLists
added, addSimpleProperty, addSimpleProperty, applyProperties, auditCreated, auditUpdated, canPurge, checkIfPropertyBundleSupported, checkRequiredAttributeSet, clearCopyContext, clearFreeContext, clearUpdateContext, compareTo, constructIdArray, constructIdArray, constructLibraryObject, constructLibraryObjectVector, createDedicatedPropertyBundle, createInstance, deriveDomainUniqueName, dispose, equals, equals, free, freeAll, get, getAttribute, getAttributeByUpperCaseName, getAttributes, getAttributesByUpperCaseNames, getAuditDomainContext, getAuditEventFolderContext, getClassId, getClassname, getClassName, getClassObject, getCommonName, getCommonNameAndClass, getCopyContext, getCreateContext, getData, getDefinition, getDefinitionForSimplePropertyUpdates, getEffectivePolicyListElements, getEventualAttributeByUpperCaseName, getFreeContext, getId, getLabel, getName, getObjectReferenceAttribute, getOperationActionSpecificationContext, getPropertyBundle, getPropertyValue, getPublicObjectAttribute, getResourceString, getResourceString, getSchemaObjectAttribute, getSession, getSessionInterface, getSharedStateFactory, getSimpleObjectAttribute, getSimpleProperties, getSimpleProperty, getSimplePropertyValue, getStringIdentifier, getSystemObjectAttribute, getTraceLogger, getUpdateContext, handleAdminModeChange, handleEvent, handleFree, handleUpdate, hashCode, hasNameAttribute, invalidateState, invokeOperation, invokeOperation, invokeServerMethod, isConnected, isCoreEventPostingEnabled, isInstanceOf, isPersistent, isTraced, isValidEventType, lockRows, lookupInstanceLabel, performPostCreateExtensions, performPostFreeExtensions, performPostUpdateExtensions, performPreCreateExtensions, performPreFreeExtensions, performPreUpdateExtensions, postEvent, postEvent, postFree, preFree, prePostAuditEvent, putProperty, putProperty, removeAllProperties, removeAllSimpleProperties, removeAllSimpleProperties, removed, removeProperty, removeSimpleProperty, removeSimpleProperty, renderAsRandomAccessContent, renderAsReader, renderAsStream, setAttribute, setAttribute, setAttributes, setAttributes, setCopyContext, setFreeContext, setId, setName, setPropertyBundle, setPropertyValue, setUpdateContext, trace, trustHandleCreate, trustHandleCreateAsAdmin, trustHandleFree, trustHandleFreeAsAdmin, trustHandleUpdate, trustHandleUpdateAsAdmin, update, updateAndExposeDefinition, validatePropertyValues, vectorLibraryObjectElement, vectorToLibraryObjectArray, verifyAdministrationMode, verifyConnected, verifyPersistent, verifySystemUserAccess, verifyTargetObject
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getAttributeByUpperCaseName, getClassId, getId, getSessionInterface
getTraceLogger, isTraced, trace
public static final String CLASS_NAME
public static final String LOCKTIMEOUT_ATTRIBUTE
public static final String LOCKHOLDER_ATTRIBUTE
public static final String LOCKSTATE_ATTRIBUTE
public static final String LOCKEDFORSESSION_ATTRIBUTE
public static final String LOCKENTRY_ATTRIBUTE
public static final int LOCKSTATE_UNLOCK
public static final int LOCKSTATE_HARDLOCK
A PublicObject can be hard locked by either:
A PublicObject that is hard locked can be unlocked by an administrator or by a user with Unlock and Update permission.
A PublicObject can be hard locked if it is currently:
If the current state is soft lock, the PublicObject has to first be unlocked before attempting a hard lock.
To share a LockObject that is in the hard lock state using the
PublicObject.lock(LockObject lo)
, the user must have Lock
permission in the ACL of the PublicObject that is going to share
the LockObject.
To update a LockObject that is in hard lock state using the
PublicObject.updateLock(LockObjectDefinition lodef)
method, the user must have Lock permission in the ACL of the
PublicObject that is referred to by this LockObject.
public static final int LOCKSTATE_SOFTLOCK
A PublicObject can be soft locked by either:
A PublicObject that is soft locked can be unlocked by an administrator or by a user with unlock and Update permission.
A PublicObject can be soft locked if it is currently:
If current state is hard lock, the PublicObject has to first be unlocked before attempting a soft lock.
To share a LockObject that is in the soft lock state using the
PublicObject.lock(LockObject lo)
, the user must have the Lock
permission in the ACL of the PublicObject that is going to share
the LockObject.
To update a LockObject that is in the soft lock state using the
PublicObject.updateLock(LockObjectDefinition lodef)
method, the
user must have Lock permission in the ACL of the PublicObject that
is referred to by this LockObject.
CM SDK uses soft locks in its default versioning policy to prevent previous versions from being modified.
public static final int LOCKSTATE_USERLOCK
A PublicObject can be user locked by:
A PublicObject that is user locked can be unlocked by the user who locked it or by an administrator.
A PublicObject can be user locked if it is currently:
If the current state is hard or soft locked, the PublicObject cannot be user locked. It will have to first be unlocked.
To share a LockObject that is in the user locked state using the
PublicObject.lock(LockObject lo)
method, the user requesting to
share the lock must be the LockHolder on this LockObject.
To update a LockObject that is in the user locked state using the
PublicObject.updateLock(LockObjectDefinition lodef)
method, the
user requesting to update the lock must be the LockHolder
on this LockObject.
CM SDK uses the user lock state to lock Family, VersionSeries, VersionDescription and Document upon checking out a versioned document in its default versioning policy.
public static final int LOCKSTATE_SESSIONLOCK
A PublicObject can be session locked by:
A PublicObject that is session locked can only be unlocked by the session that holds the lock or by an administrator.
If the session ends without unlocking the session lock on a PublicObject, CM SDK automatically releases the lock on the PublicObject.
A PublicObject can be session locked if it is currently:
If the current state is hard or soft locked, a PublicObject cannot be session locked. It will have to first be unlocked.
To share a LockObject that is in the session lock state using the
PublicObject.lock(LockObject lo)
method, the session id of the
session requesting to share the lock must be same as the
LockedForSession attribute value on this LockObject.
To update a LockObject that is in the session lock state using the
PublicObject.updateLock(LockObjectDefinition lodef)
method, the
session id of the session requesting to update the lock must be the same as
the LockedForSession attribute value on this LockObject.
protected LockObject(LibrarySession session, Long id, Long classId, S_LibraryObjectData data) throws IfsException
session
- current LibrarySessionid
- object idclassId
- class iddata
- data componentsIfsException
- if the operation failspublic Date getLockTimeOut() throws IfsException
IfsException
- if operation failspublic void setLockTimeOut(Date timeout) throws IfsException
timeout
- the actual time at which the lock should expireIfsException
- if operation failspublic int getLockState() throws IfsException
IfsException
- if operation fails.public void setLockState(int lockstate) throws IfsException
lockstate
- lockstate the integer value for the lockstateIfsException
- if operation failspublic DirectoryUser getLockHolder() throws IfsException
IfsException
- if operation fails.public LockEntry getLockEntry() throws IfsException
IfsException
- if the operation fails.public long getLockedForSession() throws IfsException
IfsException
- if operation fails.public boolean isLockedForSession() throws IfsException
IfsException
- if operation fails.public boolean isLockedForSessionByCurrentSession() throws IfsException
IfsException
- if operation fails.public LockObject getShareableLockObject(PublicObject po) throws IfsException
Creates a clone of the target object unless it is a SystemLockObject, or if it is not yet assocated with any PublicObject.
po
- the PublicObject being locked with this instanceIfsException
- if operation fails.public LockObject getClonedLockObject(PublicObject po) throws IfsException
Creates a clone of the target object unless it is a SystemLockObject, or if it is not yet assocated with any PublicObject.
po
- the PublicObject being locked with this instanceIfsException
- if operation fails.public LockEntry createEquivalentLockEntry(PublicObject po) throws IfsException
po
- the PublicObject being locked with this instanceIfsException
- if operation fails.public String getLockStateLabel() throws IfsException
IfsException
- if operation fails.public static String toLockStateLabel(int lockState) throws IfsException
lockState
- the LockState constant.IfsException
- if operation fails.public static String toLockStateLabel(int lockState, LibrarySession session) throws IfsException
lockState
- the LockState constantsession
- the LibrarySession, whose current
Localizer will be used for the conversionIfsException
- if operation fails.public static String toLockStateLabel(int lockState, Localizer localizer) throws IfsException
lockState
- the LockState constant.localizer
- the Localizer that performs the conversionIfsException
- if operation fails.public PublicObject[] getReferringPublicObjects() throws IfsException
IfsException
- if operation fails.public PublicObject[] getReferringPublicObjects(SortSpecification sort) throws IfsException
sort
- specification of how the referring PublicObjects
are to be sortedIfsException
- if operation fails.public boolean isShared() throws IfsException
IfsException
- if operation fails.public static LockObject[] getExpiredTimedLocks(LibrarySession session, int maxItems, int offset) throws IfsException
session
- the admin-enabled sessionmaxItems
- the maximum number of entries to returnoffset
- the offset for the queryIfsException
- if the operation failspublic int release() throws IfsException
IfsException
- if the operation failspublic String toString()
Returns information in the format
LockState =
toString
in class LibraryObject
protected static LockObject[] vectorToLockObjectArray(Vector vector)
vector
- Vector of LockObject objectsCopyright © 2023. All rights reserved.