How to Change Status of Work Orders in Maximo Using MBOs
Want to learn more about how to change the status of a work order in Maximo? Check out this tutorial demonstrating how to change its status using MBOs.
Join the DZone community and get the full member experience.
Join For FreeThe process of changing work orders status in Maximo involves writing your code and packaging it in a WAR file and then placing that WAR file in the MAXIMO.ear and redeployment of Maximo Asset Management System on BEA Weblogic Server.
Writing Code and Creating a WAR File
Before writing the code, you will need to include the library BusinessObjects.jar
in your project. This jar file is available in Maximo installation folder. Now, we can import the required packages.
List of the import
required packages mentioned below:
import psdi.server.MXServer;
import psdi.security.UserInfo;
import psdi.app.workorder.WOSet;
import psdi.app.workorder.WO;
Get an instance of the MXServer
class:
MXServer mxServer = MXServer.getMXServer();
Get UserInfo of any authorized Maximo user
UserInfo userInfo = mxServer.getUserInfo("maxadmin");
Next, you will need to get the WOSet
object by passing UserInfo
as the parameter. If we pass the userInfo
here, some of the users lacking required privileges that returned WOSet will be empty.
WOSet woSet = (WOSet)mxServer.getMboSet("WORKORDER", userInfo);
Set your where clause for filtering records in woSet
woSet.setUserWhere("WONUM = '1045' ");
Get first WO object from WOSet
WO wo = (WO)woSet.getMbo(0);
Next, you will need to initialize the variable with the desired work order status
String desiredStatus = "COMP";
Now, you will need to initialize the memo variable, which can be used for adding comments, like the reasons or details of changing the status.
String memo = "";
This method changes the Work Oder status by updating rows in the MAXIMO tables WORKORDER
, WOSTATUS
, etc.
wo.changeMaxStatus(desiredStatus, mxServer.getDate(), memo);
Next, you will need to ask Maximo to persist your changes:
woSet.save();
Now, close WOSet
so that memory resources are freed:
woSet.close();
Deploying Your WAR File
When deploying your WAR file, you must place it in the MAXIMO.ear
file. To do that, you will extract the MAXIMO.ear
file and copy your WAR file in the root directory. You also need to make changes in the application.xml
file in the MAXIMO.ear
located at MAXIMO.ear\META-INF
.
Right above <!-- List of EJB modules --> line in the application.xml
, insert the description of your web module as the following:
<module id="WebModule_SomeUniqueNumbericID">
<web>
<web-uri>YourWar.war</web-uri>
<context-root>/YourWebModuleName</context-root>
</web>
</module>
After making these changes, you will recreate the MAXIMO.ear
file and redeploy it on BEA Weblogic server. These are the methods that we can follow to change the status of the work orders in Maximo using MBOs.
Conclusion
We can change the status of work orders in Maximo using MBOs by, firstly, writing the code and creating the war file in Maximo.ear. Then, we can employ the Maximo Asset Management System on the BEA Weblogic Server. This is the best solution to solving this problem.
Published at DZone with permission of Kayleigh Davis. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments