Pages

October 15, 2013

How to implement stateful MBOs

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:

POSTATUS for the PO (Purchase Order) object

WOSTATUS for the WORKORDER object

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:

Mbo > StatefulMbo > WORKORDER

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:

canChangeStatus(String changeToStatus, long accessModifier)Identifies whether the status of the object be changed to the specified value.If status change is not allowed, an exception is thrown.

changeStatus (String status, Date date, String memo)Changes the status of the object.This method compares the requested status and the current status by calling canChangeStatus before the change is performed. If the status change is allowed, the status change is performed and a status history record is written. If the status change is not allowed, an exception is thrown.

getInternalStatus()Returns the Internal value for the current status of the object

getStatusListName()Return the name of the domain associated with the status attribute.

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.

3 comments:

Thanks, I can implement change status on Custom App / Custom Object from Main Tab.But on List Tab , when I selected some rows, then click Change Status , I get error message : BMXAA4187E - The relationship WOCHANGESTATUS does not exist ... .What was I missing?

Follow MaximoDev on

Follow by Email

Google+ Followers

Disclaimer

The postings on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
The materials on this site are provided "AS IS" and the author will not be liable for any direct, indirect or incidental damages arising out or relating to any use or distribution of them.