Extending Maximo 7 Business Objects

At times it is necessary to override or extend the functionality in core MAXIMO. This can be achieved by ‘extending’ methods in the Maximo business objects. The following section outlines the process involved in extending the add() method in the Items application. This same approach can be used to extend any add() method from the core Maximo business objects. Review the javadocs for more details on methods available.

Scenario: On insert of an item in the Item Master application, we would like an extra field to be set to a specific value on the Item table. In order to perform this functionality, follow the steps below to extend the add() method on the Item package.

By reviewing the javadocs, the add method can be located in the Item object. We will need to create two new files, ItemTest and ItemTestSet. ItemTest will extend the add() method in the Item class and ItemTestSet will return the reference of our new object ‘ItemTest’.

We need to create our two new java files that will extend core MAXIMO. Here are the two files:

ItemTest.java


package psdi.app.item;
import psdi.util.*;
import psdi.mbo.*;
import java.rmi.*;

public class ItemTest extends Item implements ItemRemote
{
  public ItemTest(MboSet ms) throws MXException, RemoteException
  {
    super(ms);
  }
  /**
  * Add a new item - set field default value for extra field
  * Set itemextra01 field to be 'TEST' each time an item is created.
  * Note: itemextra01 field does not exist, this is used as an example.
  * The add method is overridden. The super.add will add all other
  * calls in the original add method of the Item class.
  **/
  public void add() throws MXException, RemoteException
  {
    setValue("itemextra01", "TEST");
    super.add();
  }
}

ItemTestSet.java


package psdi.app.item;
import psdi.mbo.*;
import psdi.util.*;
import java.rmi.*;

public class ItemTestSet extends ItemSet implements ItemSetRemote
{
  public ItemTestSet(MboServerInterface ms) throws MXException, RemoteException
  {
    super(ms);
  }
  protected Mbo getMboInstance(MboSet ms) throws MXException, RemoteException
  {
    return new ItemTest(ms);
  }
}

Next, All class files should be compiled and rmic’d. The command to rmic is:

In a DOS cmd prompt, change directory to maximo_root\applications\maximo\businessobjects\classes\

rmic -d . psdi.app.item.ItemTest
 rmic -d . psdi.app.item.ItemTestSet

 

We need to update the database with our new class files. The two tables that will need to be affected are Maxobject and Maxobjectcfg. The field ‘classname’ in the two tables needs to be registered with the new class ItemTestSet for the ITEM Business Object. Below are the updates for each table:

update maxobject set classname='psdi.app.item.ItemTestSet' where objectname='ITEM';
update maxobjectcfg set classname='psdi.app.item.ItemTestSet' where objectname='ITEM';

Launch Maximo and open the Item Master application. When the application launches, select insert from the toolbar. You will notice that the application will insert a new record with the extra field defaulting to the value ‘TEST’.

Note: itemextra01 field does not exist, this is used as an example. If the field itemextra01 is created, it will also need to be added to the presentation for it to be displayed.

Provided by IBM Support

Did You Know...

As Maximo Experts, we have developed several add-on products for Maximo that mobilize the work force, simplifies assignments, provides ad-hoc reporting capabilities and facilitates the seamless integration of Service Requests into Maximo.

Check out our products by clicking on the following links: EZMaxMobile, EZMaxPlanner and EZMaxRequest.

Find Out More

6 thoughts on “Extending Maximo 7 Business Objects

  1. Hi! Thank you for your post, usefull as always) I have one question. In application designer I added pushbuttons. For each pushbutton I defined specific mxevent and saved the configuration.
    After I pushed the button in application maximo executes mxevent.
    Can you explain, how maximo realize what java method should be executed?
    From your post I figered out that maximo implements methods from MBO class. Every application manage related MBO. Is it right that full list of available for implementation methods in specific application defined in java class of related MBO?

      1. Thank you for reply!
        I already checked app development guide for maximo 7.1. There’re minor differences from guide for maximo 6.2 in event processing question) Guide explains event processing like:
        “Events defined in a presentation file are tied to a method in the code or an event tag in the JSP pages. Maximo is an event driven product. When you perform an action, Maximo sends an “Event” to the back end which invokes and runs a method associated with the event.”
        But guide give’s no explanation about where’s defined the linkage “specific mxevent”-“specific method”?
        For example, i have pushbutton with predefined mxevent=”startcenter” in application. When i push that button maximo sends me to the Start Center application. If I want to change system behaviour I have to modify underlying logic. In other words i must “extend” methods associated with that event. But i can’t find where) What java class i have to modify? It’s the question.
        I think that all interactions with business objects (add, delete, attribute chages and others) must be defined in object main class and classes which extends main class. Like psdi.app.item.ItemTestSet for psdi.app.item.

          1. I’m not sure about it, but I believe that maximo sends the event to the method “CallMethod(event)” to the parent object of the button.
            the CallMethod method of a DataBean (probably the bean of a dialog or a table that is parent of the button) calls the CallBeanMethod that tries to call the method that has the name that is written in the mxevent tag in your button.
            if it doesn’t find the method, it gets the parent of this object (the parent of the dialog is the active Mbo) and tries to call the method again.

            finding the method or not, if there is a dialog or an application or a menu that the ID is the same as the string defined in the mxEvent property, maximo will show it.

Leave a Reply