Package com.storedobject.core
Class UserActionLog
java.lang.Object
com.storedobject.core.StoredObject
com.storedobject.core.UserActionLog
- All Implemented Interfaces:
Displayable,StringFiller,HasId
Represents a log of actions performed by users on specific objects.
- Author:
- Syam
-
Field Summary
Fields inherited from class com.storedobject.core.StoredObject
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidConfigures the column definitions for the associated entity by adding mappings of property names to their database column types.Retrieves the timestamp indicating when the action was performed.Retrieves the associated StoredObject instance related to the objectId field.Retrieves the identifier of the referenced object associated with this instance.Retrieves the UserAction associated with this UserActionLog.Retrieves the unique identifier associated with the user's action.static voidAdds index configurations to the specifiedIndicesby including the columns "Object" and "UserAction" in the index.static voidsave(StoredObject object, String action) Saves the provided stored object with the specified action.voidsetActedAt(Timestamp actedAt) Updates the timestamp for when an action was performed.voidUpdates the object identifier while ensuring certain conditions are met.voidsetObject(StoredObject object) Sets the object associated with this log entry.voidsetObject(BigDecimal idValue) Sets the object ID by wrapping the provided BigDecimal value into anIdinstance.voidsetUserAction(Id userActionId) Sets the user action identifier for the current instance.voidsetUserAction(UserAction userAction) Sets the user action for the current object by extracting the ID from the provided UserAction instance.voidsetUserAction(BigDecimal idValue) Sets the user action by creating and assigning an instance of Id based on the provided id value.voidValidates the data of the current object and its properties.Methods inherited from class com.storedobject.core.StoredObject
addLink, addLink, addLink, addLink, addLink, addLink, addLink, addLink, checkCurrency, checkCurrency, checkForDuplicate, checkForDuplicate, checkTimeZone, checkTransaction, clearObjectLinks, contemporary, copy, copy, count, count, count, count, count, count, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, create, created, delete, delete, delete, deleted, directUpdate, equals, exists, exists, exists, exists, exists, existsFileData, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsMaster, existsMaster, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, family, family, family, family, fill, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, getActor, getAttachment, getAttachmentId, getChildren, getContemporaryOf, getDeleted, getDeleted, getExistsCondition, getExistsCondition, getFileData, getFileData, getHistorical, getId, getKeyIndex, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getNotExistsCondition, getNotExistsCondition, getParent, getParent, getParent, getParentId, getParentId, getParentId, getRelated, getRelated, getTransaction, getTransactionId, getTransactionIP, getUnique, getUniqueCondition, hashCode, inserted, isModified, isVirtual, list, list, list, list, list, list, list, list, list, list, list, list, list, listDeletedIds, listFileData, listFileData, listHistory, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listTree, listTree, listTree, listTree, listViaQuery, listViaQuery, load, load, load, load, loadAttributesFrom, loaded, loading, makeNew, makeVirtual, migrate, moduleName, nextVersion, objectLink, objectLink, objectLink, objectLinks, objectLinks, old, person, previousVersion, previousVersion, query, query, query, query, query, query, query, query, query, query, query, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, reload, reload, reloaded, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeReverseLinks, removeReverseLinks, save, save, save, save, save, save, save, save, save, save, save, save, save, save, save, saved, saving, setMaster, setRawValue, setTransaction, stringify, tableName, timestamp, toCode, toDisplay, toString, transacting, undelete, undelete, undeleted, updated, user, userId, validate, validateChildAttach, validateChildDetach, validateChildUpdate, validateDelete, validateInsert, validateParentAttach, validateParentDetach, validateParentUpdate, validateUndelete, validateUpdate, valueEquals
-
Constructor Details
-
UserActionLog
public UserActionLog()Constructor.
-
-
Method Details
-
columns
Configures the column definitions for the associated entity by adding mappings of property names to their database column types.- Parameters:
columns- the Columns object to which the column definitions are to be added
-
indices
Adds index configurations to the specifiedIndicesby including the columns "Object" and "UserAction" in the index.- Parameters:
indices- An instance ofIndicesto which index configurations will be added.
-
setObject
Updates the object identifier while ensuring certain conditions are met.- Parameters:
objectId- The new identifier to set for the object. Must be a valid Id and meet the restrictions imposed by the method. If the object is currently loading or the new identifier is the same as the existing one, the operation will proceed. Otherwise, an exception is thrown.- Throws:
Set_Not_Allowed- If the object is not in a valid state to allow the update.
-
setObject
Sets the object ID by wrapping the provided BigDecimal value into anIdinstance.- Parameters:
idValue- The BigDecimal value representing the object ID to be set.
-
setObject
Sets the object associated with this log entry. If the provided object is null, the associated object ID is set to null. Otherwise, the object ID is set to the ID of the provided object.- Parameters:
object- TheStoredObjectto associate with this log entry, ornullto disassociate any previously associated object.
-
getObjectId
Retrieves the identifier of the referenced object associated with this instance.- Returns:
- the identifier of the referenced object as an
Id.
-
getObject
Retrieves the associated StoredObject instance related to the objectId field.- Returns:
- The StoredObject instance corresponding to the objectId, or null if no such association exists.
-
setUserAction
Sets the user action identifier for the current instance. This method updates the user action ID only if the instance is not in a loading state and the given user action ID differs from the current one. If the conditions are not met, an exception is thrown to indicate the operation is not allowed.- Parameters:
userActionId- the identifier of the user action to be set- Throws:
Set_Not_Allowed- if the user action ID cannot be updated due to invalid conditions
-
setUserAction
Sets the user action by creating and assigning an instance of Id based on the provided id value.- Parameters:
idValue- the unique identifier value used to represent a user action, as a BigDecimal
-
setUserAction
Sets the user action for the current object by extracting the ID from the provided UserAction instance.- Parameters:
userAction- An instance of UserAction. If null, the user action will be set to null. If not null, the ID of the provided UserAction will be used.
-
getUserActionId
Retrieves the unique identifier associated with the user's action.- Returns:
- the ID representing the user's action as an instance of
Id.
-
getUserAction
Retrieves the UserAction associated with this UserActionLog.- Returns:
- the UserAction object linked to this UserActionLog, based on the userActionId.
-
setActedAt
Updates the timestamp for when an action was performed.- Parameters:
actedAt- the Timestamp object representing the new "acted at" time. Cannot be set if the provided timestamp matches the existing one, unless the object is in a loading state.- Throws:
Set_Not_Allowed- if the new timestamp is identical to the current timestamp and the object is not in a loading state.
-
getActedAt
Retrieves the timestamp indicating when the action was performed.- Returns:
- a
Timestampobject representing the date and time the action occurred.
-
validateData
Validates the data of the current object and its properties.- Overrides:
validateDatain classStoredObject- Parameters:
tm- the transaction manager used to validate and check the data.- Throws:
Exception- if validation fails due to invalid or missing values.
-
save
Saves the provided stored object with the specified action.- Parameters:
object- the stored object to be saved, which contains the data that needs to be persistedaction- the action describing the type of save operation to be performed- Throws:
Exception- if an error occurs during the save operation
-