Healthcare IT Blog

A place to blog about Healthcare Informatics Software Development Implementations

image

How to change status of Work Orders in Maximo using MBOs

By Technical Team Technosoft |23 September 2014

The 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.

1.Writing code and creating WAR file

Before writing the code you will need to include library “BusinessObjects.jar” in your project. This jar file is available in Maximo installation folder.

Import required packages

import psdi.server.MXServer;
import psdi.security.UserInfo;
import psdi.app.workorder.WOSet;
import psdi.app.workorder.WO;

Get instance of MXServer class

MXServer mxServer = MXServer.getMXServer();           
Get UserInfo of any authorized Maximo user
UserInfo userInfo = mxServer.getUserInfo("maxadmin");                                                      

Get WOSet object by passing UserInfo as parameter. If we pass userInfo here of some user lacking required privileges then 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);                                                                   

Initialize variable with desired Work Order status

String desiredStatus = "COMP";

Initialize memo variable which can be used for adding comment like reasons/details of changing status

String memo = "";                                   

This method changes Word Oder status by updating rows in MAXIMO tables WORKORDER, WOSTATUS etc

wo.changeMaxStatus(desiredStatus, mxServer.getDate(), memo);

Ask Maximo to persist your changes

 woSet.save();

Close WOSet so that memory resources are freed.

woSet.close();

2. Deploying your WAR file

To deploy your WAR file you must place it in MAXIMO.ear file. To do that extract MAXIMO.ear file and copy your WAR file in the root directory. You also need to make changes in the application.xml file in MAXIMO.ear located at MAXIMO.ear\META-INF.

Right above <!-- List of EJB modules --> line in application.xml insert description of your web module as under:
               <module id="WebModule_SomeUniqueNumbericID">
                              <web>
                                             <web-uri>YourWar.war</web-uri>
                                             <context-root>/YourWebModuleName</context-root>
                              </web>
               </module>

After making these changes recreate MAXIMO.ear file and redeploy it on BEA Weblogic server.