Class JpaResourceLock
java.lang.Object
com.broadleafcommerce.common.messaging.provider.jpa.domain.JpaResourceLock
- All Implemented Interfaces:
Serializable
Represents a single lock on a resource held in the current datastore. This is often used to
prevent concurrent mutating operations on the same resource. A common application of this concept
is the locking of sandbox workflow operations on the same Trackable resource.
- Author:
- Jeff Fischer
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
get_id()
A generally descriptive key that identifies the overall concept for which the lock is taking place.The contextId of the Trackable resource to lockThe time at which the lock will naturally expireWhether or not the resource is lockedOptional information related to the lock.The time at which the lock was set to truegetToken()
The token assigned the last time the lock was set to true.An alias used to represent the Java type of the resource being locked.int
hashCode()
void
void
setConceptKey
(String conceptKey) A generally descriptive key that identifies the overall concept for which the lock is taking place.void
setContextId
(String contextId) The contextId of the Trackable resource to lockvoid
setExpirationTimestamp
(Instant expirationTimestamp) The time at which the lock will naturally expirevoid
Whether or not the resource is lockedvoid
setOptional
(String optional) Optional information related to the lock.void
setTimestamp
(Instant timestamp) The time at which the lock was set to truevoid
The token assigned the last time the lock was set to true.void
setTypeAlias
(String typeAlias) An alias used to represent the Java type of the resource being locked.toString()
-
Constructor Details
-
JpaResourceLock
public JpaResourceLock()
-
-
Method Details
-
get_id
-
getContextId
The contextId of the Trackable resource to lock- Returns:
- The contextId of the Trackable resource to lock
-
getTypeAlias
An alias used to represent the Java type of the resource being locked. This is most often the Java class simple name.- Returns:
- An alias used to represent the Java type of the resource being locked
-
getOptional
Optional information related to the lock. May contain sandboxId, or other relevant information, such as status.- Returns:
- The optional information to include with the lock
-
getConceptKey
A generally descriptive key that identifies the overall concept for which the lock is taking place.WorkflowTransitionHelper#LOCK_CONCEPT_KEY
is an example that identifies locks for sandbox workflows. Other concept keys may be used to apply locks for the same resource under a different context.- Returns:
- A generally descriptive key
-
getLocked
Whether or not the resource is locked- Returns:
- Whether or not the resource is locked
-
getTimestamp
The time at which the lock was set to true- Returns:
- The time at which the lock was set to true
-
getExpirationTimestamp
The time at which the lock will naturally expire- Returns:
- The time at which the lock will naturally expire
-
getToken
The token assigned the last time the lock was set to true. The token simply identifies the lock record and can be used to unlock the resource.- Returns:
- The token assigned the last time the lock was set to true
-
set_id
-
setContextId
The contextId of the Trackable resource to lock- Parameters:
contextId
- The contextId of the Trackable resource to lock
-
setTypeAlias
An alias used to represent the Java type of the resource being locked. This is most often the Java class simple name.- Parameters:
typeAlias
- An alias used to represent the Java type of the resource being locked
-
setOptional
Optional information related to the lock. May contain sandboxId, or other relevant information, such as status.- Parameters:
optional
- The optional information to include with the lock
-
setConceptKey
A generally descriptive key that identifies the overall concept for which the lock is taking place.WorkflowTransitionHelper#LOCK_CONCEPT_KEY
is an example that identifies locks for sandbox workflows. Other concept keys may be used to apply locks for the same resource under a different context.- Parameters:
conceptKey
- A generally descriptive key
-
setLocked
Whether or not the resource is locked- Parameters:
locked
- Whether or not the resource is locked
-
setTimestamp
The time at which the lock was set to true- Parameters:
timestamp
- The time at which the lock was set to true
-
setExpirationTimestamp
The time at which the lock will naturally expire- Parameters:
expirationTimestamp
- The time at which the lock will naturally expire
-
setToken
The token assigned the last time the lock was set to true. The token simply identifies the lock record and can be used to unlock the resource.- Parameters:
token
- The token assigned the last time the lock was set to true
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode()
-