Class BDMAuditUtils
java.lang.Object
com.bonitasoft.processbuilder.extension.BDMAuditUtils
Utility class providing methods to automatically set creation and modification
metadata on Business Data Model (BDM) objects using Java Reflection.
This class assumes that all target BDM objects implement the following methods:
getCreationDate(): returns OffsetDateTimesetCreationDate(OffsetDateTime)setCreatorId(Long)setCreatorName(String)setModificationDate(OffsetDateTime)setModifierId(Long)setModifierName(String)
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TcreateOrUpdateAuditData(T bdmObject, T newBdmObject, Class<T> clazz, UserRecord initiator, Long persistenceId) Applies audit metadata (creation or modification) to a BDM object.
-
Method Details
-
createOrUpdateAuditData
public static <T> T createOrUpdateAuditData(T bdmObject, T newBdmObject, Class<T> clazz, UserRecord initiator, Long persistenceId) Applies audit metadata (creation or modification) to a BDM object. If the object passed asbdmObjectisnull, the object provided innewBdmObjectis used as the target (creation).- Type Parameters:
T- The generic type of the BDM object.- Parameters:
bdmObject- The existing BDM object (may benullfor creation/update).newBdmObject- The object to use ifbdmObjectisnull. Must be an already instantiated BDM object.clazz- The class of the BDM (used for logging purposes).initiator- The user performing the action.persistenceId- The persistence ID of the object (used for logging/update determination).- Returns:
- The updated (or newly created) BDM object of type T.
- Throws:
IllegalArgumentException- If bothbdmObjectandnewBdmObjectarenull.RuntimeException- If a reflection error occurs (e.g., missing setter methods).
-