Class ModelAudit<M extends Model>
java.lang.Object
com.onenetwork.platform.data.model.ModelAudit<M>
public class ModelAudit<M extends Model>
extends java.lang.Object
Captures an audit entry for a Model. This includes the Model itself with all its attributes,
along with audit-specific information like the action name, transaction id, etc.
-
Constructor Summary
Constructors Constructor Description ModelAudit(M model)
Constructs a new ModelAudit on the given Model instance -
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.lang.String
getActionDetail()
java.lang.String
getActionName()
java.util.Calendar
getLastModifiedDate()
java.lang.String
getLastModifiedRole()
java.lang.String
getLastModifiedUser()
M
getModel()
java.util.Calendar
getPtxDate()
java.lang.String
getPtxId()
java.lang.Long
getPtxSeq()
java.lang.Integer
getPtxVersion()
int
hashCode()
void
setActionDetail(java.lang.String actionDetail)
void
setActionName(java.lang.String actionName)
void
setLastModifiedRole(java.lang.String lastModifiedRole)
void
setModel(M model)
void
setPtxDate(java.util.Calendar ptxDate)
void
setPtxId(java.lang.String ptxId)
void
setPtxSeq(java.lang.Long ptxSeq)
void
setPtxVersion(java.lang.Integer ptxVersion)
org.json.JSONObject
toJSONObject()
Returns a JSON representation of this ModelAudit.org.json.JSONObject
toJSONObject(PlatformUserProfile profile)
Returns a JSON representation of this ModelAudit.java.lang.String
toString()
-
Constructor Details
-
ModelAudit
Constructs a new ModelAudit on the given Model instance- Parameters:
model
- Model object containing all the attributes of the Model itself for the audit entry
-
-
Method Details
-
getModel
- Returns:
- Model attributes associated with the audit entry
-
setModel
- Parameters:
model
- Model attributes associated with the audit entry
-
getActionName
public java.lang.String getActionName()- Returns:
- action which triggered the audit
-
setActionName
public void setActionName(java.lang.String actionName)- Parameters:
actionName
- action which triggered the audit
-
getActionDetail
public java.lang.String getActionDetail()- Returns:
- additional information around the action which triggered the audit
-
setActionDetail
public void setActionDetail(java.lang.String actionDetail)- Parameters:
actionDetail
- additional information around the action which triggered the audit
-
getPtxId
public java.lang.String getPtxId()- Returns:
- "Platform Transaction Id", an identifier which uniquely identifies the database transaction within the local Platform instance. This is a non-sequential identifier.
-
setPtxId
public void setPtxId(java.lang.String ptxId)- Parameters:
ptxId
- "Platform Transaction Id", an identifier which uniquely identifies the database transaction within the local Platform instance. This is a non-sequential identifier.
-
getPtxSeq
public java.lang.Long getPtxSeq()- Returns:
- "Platform Transaction Sequence", a global sequence number assigned during initial audit insert and used later when determining ptxVersion. This is a transient identifier which is generally not expected to be used by clients.
-
setPtxSeq
public void setPtxSeq(java.lang.Long ptxSeq)- Parameters:
ptxSeq
- "Platform Transaction Sequence", a global sequence number assigned during initial audit insert and used later when determining ptxVersion. This is a transient identifier which is generally not expected to be used by clients.
-
getPtxDate
public java.util.Calendar getPtxDate()- Returns:
- "Platform Transaction Date", representing the date when the database transaction identified by ptxId was actually committed. This value is only populated if Log Mining is enabled. It is possible to have multiple ModelAudit records for the same Model with the same ptxDate; therefore when ordering audits, you should order by ptxDate, ptxVersion.
-
setPtxDate
public void setPtxDate(java.util.Calendar ptxDate)- Parameters:
ptxDate
- "Platform Transaction Date", representing the date when the database transaction identified by ptxId was actually committed. This value is only populated if Log Mining is enabled. It is possible to have multiple ModelAudit records for the same Model with the same ptxDate; therefore when ordering audits, you should order by ptxDate, ptxVersion.
-
getPtxVersion
public java.lang.Integer getPtxVersion()- Returns:
- "Platform Transaction Version", capturing the strict ordering of updates for a given model instances. An integer starting from 1 and incrementing by 1 for each audit entry for a given model syId.
-
setPtxVersion
public void setPtxVersion(java.lang.Integer ptxVersion)- Parameters:
ptxVersion
- "Platform Transaction Version", capturing the strict ordering of updates for a given model instances. An integer starting from 1 and incrementing by 1 for each audit entry for a given model syId.
-
getLastModifiedRole
public java.lang.String getLastModifiedRole()- Returns:
- the lastModifiedRole captures the role of the user who last modified the object state. A String in the json containing role related information of the user is returned in the format {"roleName": "SampleRoleName","roleType":"SampleRoleType","roleEnt":"SampleEntName","roleOrg":"SampleOrgName","roleSite":"SampleSiteName"}
-
setLastModifiedRole
public void setLastModifiedRole(java.lang.String lastModifiedRole)- Parameters:
lastModifiedRole
- captures the role of the user who last modified the object state. A String in the json containing role related information of the user must be provided in the format {"roleName": "SampleRoleName","roleType":"SampleRoleType","roleEnt":"SampleEntName","roleOrg":"SampleOrgName","roleSite":"SampleSiteName"}
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equals
in classjava.lang.Object
-
toJSONObject
public org.json.JSONObject toJSONObject()Returns a JSON representation of this ModelAudit. Will use system default for Date and other localized formats. -
toJSONObject
Returns a JSON representation of this ModelAudit. Will consult the given user profile for Date and other localized formats.- Parameters:
profile
- user profile, from which localized date format and other information is taken
-
getLastModifiedDate
public java.util.Calendar getLastModifiedDate()- Returns:
- the date when this audit took place, taken from Model.LastModifiedDate
-
getLastModifiedUser
public java.lang.String getLastModifiedUser()- Returns:
- username of the user who modified this model and caused this audit, taken from Model.LastModifiedUser
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-