Class JpaResourceLock
- java.lang.Object
-
- com.broadleafcommerce.common.messaging.provider.jpa.domain.JpaResourceLock
-
- All Implemented Interfaces:
Serializable
@Entity public class JpaResourceLock extends Object implements 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JpaResourceLock()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(Object other)booleanequals(Object o)Stringget_id()StringgetConceptKey()A generally descriptive key that identifies the overall concept for which the lock is taking place.StringgetContextId()The contextId of the Trackable resource to lockInstantgetExpirationTimestamp()The time at which the lock will naturally expireBooleangetLocked()Whether or not the resource is lockedStringgetSandboxId()The sandboxId in which the workflow operation is taking place.InstantgetTimestamp()The time at which the lock was set to trueStringgetToken()The token assigned the last time the lock was set to true.StringgetTypeAlias()An alias used to represent the Java type of the resource being locked.inthashCode()voidset_id(String _id)voidsetConceptKey(String conceptKey)A generally descriptive key that identifies the overall concept for which the lock is taking place.voidsetContextId(String contextId)The contextId of the Trackable resource to lockvoidsetExpirationTimestamp(Instant expirationTimestamp)The time at which the lock will naturally expirevoidsetLocked(Boolean locked)Whether or not the resource is lockedvoidsetSandboxId(String sandboxId)The sandboxId in which the workflow operation is taking place.voidsetTimestamp(Instant timestamp)The time at which the lock was set to truevoidsetToken(String token)The token assigned the last time the lock was set to true.voidsetTypeAlias(String typeAlias)An alias used to represent the Java type of the resource being locked.StringtoString()
-
-
-
Method Detail
-
get_id
public String get_id()
-
getContextId
public String getContextId()
The contextId of the Trackable resource to lock- Returns:
- The contextId of the Trackable resource to lock
-
getTypeAlias
public String 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
-
getSandboxId
public String getSandboxId()
The sandboxId in which the workflow operation is taking place.- Returns:
- The sandboxId in which the workflow operation is taking place.
-
getConceptKey
public String getConceptKey()
A generally descriptive key that identifies the overall concept for which the lock is taking place.WorkflowTransitionHelper#LOCK_CONCEPT_KEYis 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
public Boolean getLocked()
Whether or not the resource is locked- Returns:
- Whether or not the resource is locked
-
getTimestamp
public Instant getTimestamp()
The time at which the lock was set to true- Returns:
- The time at which the lock was set to true
-
getExpirationTimestamp
public Instant getExpirationTimestamp()
The time at which the lock will naturally expire- Returns:
- The time at which the lock will naturally expire
-
getToken
public String 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
public void set_id(String _id)
-
setContextId
public void setContextId(String contextId)
The contextId of the Trackable resource to lock- Parameters:
contextId- The contextId of the Trackable resource to lock
-
setTypeAlias
public void setTypeAlias(String typeAlias)
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
-
setSandboxId
public void setSandboxId(String sandboxId)
The sandboxId in which the workflow operation is taking place.- Parameters:
sandboxId- The sandboxId in which the workflow operation is taking place.
-
setConceptKey
public void setConceptKey(String conceptKey)
A generally descriptive key that identifies the overall concept for which the lock is taking place.WorkflowTransitionHelper#LOCK_CONCEPT_KEYis 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
public void setLocked(Boolean locked)
Whether or not the resource is locked- Parameters:
locked- Whether or not the resource is locked
-
setTimestamp
public void setTimestamp(Instant timestamp)
The time at which the lock was set to true- Parameters:
timestamp- The time at which the lock was set to true
-
setExpirationTimestamp
public void setExpirationTimestamp(Instant expirationTimestamp)
The time at which the lock will naturally expire- Parameters:
expirationTimestamp- The time at which the lock will naturally expire
-
setToken
public void setToken(String token)
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
-
canEqual
protected boolean canEqual(Object other)
-
-