Using Data Change event listeners, application-level Java code (e.g. the Space Inventory activity workflow rules) may register callbacks on startup with the datasource. The core would invoke this callback if:
For individual records, the core would provide that callback function with these parameters:
For bulk changes, the core would provide that callback function with these parameters:
The callback can optionally decide to log this change or inspect the SQL statement textually to determine if it needs to perform any other action.
The chief use case for adding logging on bulk changes would be complete audit logging and debugging.
Some other conditions are:
If you are writing application-level logic, such as the logic that synchronizes the Workspace Transactions table with the Rooms table, whether to commit at any point is an application-level decision. Some application-level rules, such as those that create autonumbered records, must commit as a part of the logic.
If you are writing a callback for audit-logging purposes, do not commit. If the transaction is canceled, the originating change – as well as any records you wrote to the log – will be rolled back in conjunction if one of the database transactions fails.
Some user actions trigger cascading updates to the database. For instance, if you delete a room, the product will clear all dependent references to that room in the other tables, e.g. the equipment, employee, work order, etc. tables. If you rename a room, the product will update all dependent tables.
The data change event notification fires only on the root record of the cascading change. For instance, in the case above, the data change event will fire when the product updates the room record, and your data change event handler will get a notification that a particular primary key record in the room table was deleted or updated. However, your handler will not receive notification that the equipment, employee, work order, etc. tables have changed.
To take another example, suppose you delete a building record. This will also delete all floor and room records as well as clear all references to that building, those floors, and those rooms throughout the database. However, your handler will receive notice only that the root building with a particular primary key was deleted.
This is the correct notification choice for two reasons. First, the root record is the one with the most precise information. In the case of cascading updates, the product knows which particular table and key is being changed. The application knows of the relations between tables and can react to the change as needed. Second, this behavior is consistent across all databases -- whether the cascading change is made in the database server itself (as is the case for Sybase) or in the ARCHIBUS Web Central server application (as is the case for Microsoft SQL Server and Oracle).
User changes the Division and Department in the Rooms table to change the department that is the “owner of record”. The space domain provides a callback workflow rule that updates the transaction table (the Workspace Transactions table) to audit the change.
On being notified of a single-record update to a Room (rm) table record this WFR:
On being notified of a bulk update to the Rooms table, this WFR:
resynchRoomPercentagesTable
activity parameter to Yes. Key reports and actions that depend on Space Transactions check this activity parameter before running and alert the user if the table needs to be resynched.Only the CRE/FM department personnel make bulk changes – such as when they use Replace Column in the Smart Client or Edit Data Multiple in the Extension for AutoCAD. They also tend to make bulk changes on just the portion of the inventory that is new and is not yet managed using Space Transactions. As such, it’s appropriate to ask these users to resynch after making extensive changes to the Room inventory.
The use case to change a room’s Category and Type and flow the appropriate change down to the Workspace Transactions table involves the same process.
The use case to change an Employee’s Primary-Room assignment in the employees (em) table also is the same process.
See RoomTransactionDataEventListener
This use case illustrates the need for the notification before the deletion occurs.
If a user deletes a room record, the data change event needs to archive the historical information for that room record that is currently in the Workspace Transactions table before the room is deleted. Otherwise, the room is deleted and the change already cascades to the Workspace Transactions table -- deleting the information that would need to be archived.
See RoomTransactionDataEventListener
The system activity supplies a logging callback workflow rule that the core calls whenever a user changes a User, Role, or Process Assignment record.
User uses the Smart Client, the Web Central ARCHIBUS Users form, or the My Profile form to change an afm_user record.
The callback workflow rule logs the single-record or bulk update to the table in the database event log, by recording the table, name of the user making the change, the date and time, and
In the case of an inquiry, the system administrator can review the log.
There are a number of cases in which the site can bypass the change events, for instance if users at the site:
Sites that need to record these kinds of events should use the database transaction log or database triggers.
However, sites may wish to have an application-level exception report that detects when this kind of change has taken place.
For instance, consider the use case in which the Space Inventory activity has a workflow rule that flows Room table changes to the Workspace Transactions table. Suppose a site then imports a set of room records using direct SQL statements that bypass the ARCHIBUS core. The activity can create an workflow rule that finds exceptions by comparing the values in the Rooms table to the most recent record in the Workspace Transactions table. If this exception report finds a difference it can set the resynchRoomPercentagesTable
activity parameter to Yes. Key reports and actions that depend on Space Transactions check this activity parameter before running and alert the user if the table needs to be resynched.