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:
- 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.
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?
I'm learning Maximo and I don't understand what does getTranslator () mean ?
You need to create two dialog box. 1. STATUS 2. list_status
list_status dialog box is used on the list page, STATUS dialog is used on main page of the application, works for that mbo.
Hi Bruno, from where did you figure out the below? How did you arrive at this conclusion. I was trying to debug an issue and i tried to check the codes but could not find from where the call to the method canChangeStatus is initiated.
With your blog entry, i was able to troubleshoot the issue however interested to find out how you figured it.
“The list is the result of calls to the canChangeStatus method for each of the possible statuses from the synonym domain. “