How to implement stateful MBOs

This entry is part of the Maximo Java Development series.

Many objects in Maximo has a STATUS attribute that can be changed using the status icon or the change status menu option. The STATUS attribute is always associated with a synonym domain that has the valid statuses for the object. Examples of these domains are:


The objects with changes of status must inherit from the StatefulMbo class which provides the basic functionality to change the status. For example the WORKORDER object has the following class hierarchy:

The synonym domain is associated with the STATUS attribute, and this domain has an internal and external value. The value stored in the database and displayed on the screen is the external value for an attribute with a synonym domain.



The most important methods available in the StatefulMbo class are:

Passing the NOACCESSCHECK flag in the accessModifier parameter can be used to indicate that the status can be changed even if it is invalid.
Two similar methods that can be used to manipulate internal status values are: canChangeMaxStatus and changeMaxStatus.

When the user selects the 'Change Status' option, the framework displays a dialog box that lists the valid statuses to which the object can change.



The list is the result of calls to the canChangeStatus method for each of the possible statuses from the synonym domain. If the canChangeStatus method throws an exception, the status is not listed.
When the user selects the new status, the framework calls the changeStatus method that first call the the canChangeStatus method (again) to validate the change and then update the status and status history.

Labels: , ,