The DEAT Business Rule Pattern Language

Russell R. Hurlbut, Ph.D.

Previous | Table of Contents | Next

Rule Pattern 16: Unit of Work

Problem Describing a Set of Actions that must be performed in their Entirety or Not at All

Processes can be composed of many activities. Often some or all of these activities must be considered an atomic unit of work. In other words, if the set of activities cannot be completed, then the net effect should be as if they did not occur at all. The scope of these activities may be sufficiently fine grained that they can be considered in the same scope as a database transaction. In such instances, a simple rollback within the application instance may suffice. In other cases, the scope is sufficiently large that a compensating transaction or action must be executed to restore the prior state.


Define a collection of actions as an atomic transaction. A stable state is declared for the initiation of the atomic transaction that will be restored if the transaction is rolled back. The start activity and end activity are also identified to delimit the scope of changes.

Example Posting Employee Data

A service bureau posts a client's employee data in periodic batch jobs after receipt of a data file. Each file contains payroll, classification, and personal data records. If an employee that has records in more that one record format may end up with only partial posting if a record contains data that does not pass validation. The service bureau is required to either process all of the records for a given employee or none at all until data corrections have been made. This example demonstrates how a portion of a workflow process is rolled back while preserving the remainder.
Posting Employee Data Parameters
Stable state employee data posted
Start activity process personal data
End activity process payroll data

Example Pension Benefit Election

A company policy stipulates that a pension benefit election packet is prepared for each employee at time of termination if they are eligible to immediately commence receiving benefit payments. The employee has 90 days to make an election. If the election is not received within that period, the transaction is cancelled, leaving only the calculation results. This example rolls back the entire processing from the granularity of a single entity rather than the entire set of entities, or employees. Conditions may also be established that required the rollback of the entire batch.

Pension Benefit Election Parameters
Stable state calculation completed
Start activity produce packet
End activity process election

UML Representation and Related Patterns

With the integration of adaptive use case extension to the UML, a single UseCaseSegment may be identified as a parameter to establish the scope of activities defined in the Unit Of Work business rule pattern.

Previous | Table of Contents | Next
Copyright 1998 Expertech.Ltd. All Rights Reserved.