Purpose: Used to allow a single version timestamp to be used for optimistic locking.
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| protected int | |
| public static final int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | TimestampLockingPolicy(String
the field where the write lock value will be stored. fieldName)PUBLIC: Create a new TimestampLockingPolicy. |
| public | TimestampLockingPolicy(DatabaseField
the field where the write lock value will be stored. field)INTERNAL: Create a new TimestampLockingPolicy. |
| LOCAL_TIME | back to summary |
|---|---|
| public static final int LOCAL_TIME | |
| retrieveTimeFrom | back to summary |
|---|---|
| protected int retrieveTimeFrom | |
| SERVER_TIME | back to summary |
|---|---|
| public static final int SERVER_TIME | |
| TimestampLockingPolicy | back to summary |
|---|---|
| public TimestampLockingPolicy() PUBLIC: Create a new TimestampLockingPolicy. Defaults to using the time retrieved from the server. | |
| TimestampLockingPolicy | back to summary |
|---|---|
| public TimestampLockingPolicy(String fieldName) PUBLIC: Create a new TimestampLockingPolicy. Defaults to using the time retrieved from the server.
| |
| TimestampLockingPolicy | back to summary |
|---|---|
| public TimestampLockingPolicy(DatabaseField field) INTERNAL: Create a new TimestampLockingPolicy. Defaults to using the time retrieved from the server.
| |
| compareWriteLockValues | back to summary |
|---|---|
| public int compareWriteLockValues(Object value1, Object value2) Overrides org. Implements org. INTERNAL: This method compares two writeLockValues. The writeLockValues should be non-null and of type java.sql.Timestamp. Returns: -1 if value1 is less (older) than value2; 0 if value1 equals value2; 1 if value1 is greater (newer) than value2. Throws: NullPointerException if the passed value is null; ClassCastException if the passed value is of a wrong type.
| |
| getBaseValue | back to summary |
|---|---|
| public <T> T getBaseValue() Overrides org. Implements org. INTERNAL: This is the base value that is older than all other values, it is used in the place of null in some situations.
| |
| getDefaultLockingFieldType | back to summary |
|---|---|
| protected <T> Class Overrides org. INTERNAL: Return the default timestamp locking filed java type, default is Timestamp.
| |
| getInitialWriteValue | back to summary |
|---|---|
| protected <T> T getInitialWriteValue(AbstractSession session) Overrides org. INTERNAL: returns the initial locking value
| |
| getNewLockValue | back to summary |
|---|---|
| public <T> T getNewLockValue(ModifyQuery query) Overrides org. INTERNAL: Returns the new Timestamp value.
| |
| getValueToPutInCache | back to summary |
|---|---|
| public <T> T getValueToPutInCache(AbstractRecord row, AbstractSession session) Overrides org. Implements org. INTERNAL: Return the value that should be stored in the identity map. If the value is stored in the object, then return a null.
| |
| getWriteLockUpdateExpression | back to summary |
|---|---|
| public Expression getWriteLockUpdateExpression(ExpressionBuilder builder, AbstractSession session) Overrides org. Implements org. INTERNAL: Return an expression that updates the write lock
| |
| getWriteLockValue | back to summary |
|---|---|
| public <T> T getWriteLockValue(Object domainObject, Object primaryKey, AbstractSession session) Overrides org. Implements org. INTERNAL: This method will return the optimistic lock value for the object.
| |
| incrementWriteLockValue | back to summary |
|---|---|
| protected Number incrementWriteLockValue(Number numberValue) Overrides org. INTERNAL: Timestamp versioning should not be able to do this. Override the superclass behavior.
| |
| isNewerVersion | back to summary |
|---|---|
| public boolean isNewerVersion(Object currentValue, Object domainObject, Object primaryKey, AbstractSession session) Overrides org. Implements org. INTERNAL: Compares the value with the value from the object (or cache). Will return true if the currentValue is newer than the domainObject.
| |
| isNewerVersion | back to summary |
|---|---|
| public boolean isNewerVersion(AbstractRecord databaseRow, Object domainObject, Object primaryKey, AbstractSession session) Overrides org. Implements org. INTERNAL: Compares the value from the row and from the object (or cache). Will return true if the row is newer than the object.
| |
| isNewerVersion | back to summary |
|---|---|
| public boolean isNewerVersion(Object firstLockFieldValue, Object secondWriteLockFieldValue) Overrides org. INTERNAL: Compares two values. Will return true if the firstLockFieldValue is newer than the secondWriteLockFieldValue.
| |
| setUsesServerTime | back to summary |
|---|---|
| public void setUsesServerTime(boolean usesServerTime) PUBLIC: Set if policy uses server time. | |
| useLocalTime | back to summary |
|---|---|
| public void useLocalTime() PUBLIC: set this policy to get the time from the local machine. | |
| useServerTime | back to summary |
|---|---|
| public void useServerTime() PUBLIC: set this policy to get the time from the server. | |
| usesLocalTime | back to summary |
|---|---|
| public boolean usesLocalTime() PUBLIC: Return true if policy uses local time. | |
| usesServerTime | back to summary |
|---|---|
| public boolean usesServerTime() PUBLIC: Return true if policy uses server time. | |