Understanding Mbos and MboSets

This entry is part of the Maximo Java Development series.

Maximo Business Objects (MBOs) are a set of Java classes that implements the data persistence layer and business rules in Maximo/TPAE infrastructure. Those Java class files are stored in the [SMPDIR]\maximo\applications\maximo\businessobjects directory and are packaged in the businessobjects.jar file.
Roughly speaking there are two types of objects Mbo and MboSet.

  • An Mbo represents a record in a table. It has business intelligence and persistence methods. It can be compared to a session/entity bean in J2EE.
  • An MboSet is a collection of Mbo objects. It has methods to manipulate, iterate and query data.

To access data (Mbo) you first have to access the table (MboSet). The following example shows how to retrieve all the assets located in BEDFORD site.

MboSetRemote assetSet = getMboSet("ASSET");
assetSet.setWhere("LOCATION='BEDFORD'");
MboRemote asset=null;
for(int i=0; (asset=assetSet.getMbo(i))!=null; i++)
{
...
}

  • The getMboSet method gets a reference the ASSET table.
  • The setWhere method specifies the SQL where clause that must be applied to filter data. If the setWhere is not invoked, the entire table will be fetched.
  • The getMbo method returns a specific element of the MboSet collection. The first invocation of getMbo method automatically fetches data and initialize the MboSet.

Now that you have an Mbo object it is possible to read field values using the getXxxx methods.

String assetnum = asset.getString("ASSETNUM");
int assetid = asset.getInt("ASSETID");

To modify the value of a field the setValue methods can be used.

asset.setValue("DESCRIPTION", "New description");

In the previous examples we have used the basic psdi.mbo.Mbo and psdi.mbo.MboSet classes. However many Maximo objects have a specific handler class that is specified in the Class field of the object definition in the Database Configuration application. For the ASSET object it is psdi.app.asset.AssetSet and it extends psdi.mbo.MboSet class. Associated to psdi.app.asset.AssetSet there is psdi.app.asset.Asset that extends psdi.mbo.Mbo class. Those two specialized classes provides specific methods and logic to manage assets.
The following code snippet shows how to fetch an asset from Maximo database and understand if it is a rotating asset or not using the isRotating() method.

AssetSetRemote assetSet = (AssetSetRemote)getMboSet("ASSET");
assetSet.setWhere("ASSETNUM='1000'");
AssetRemote asset = (AssetRemote)assetSet.getMbo(0);
System.out.println("Is rotating: " + asset.isRotating());

You have just walked the first step in the long journey of the Maximo/TPAE developer…
For more articles look at Maximo MBO Java Development page.

Understanding Mbos and MboSets

13 thoughts on “Understanding Mbos and MboSets

  1. Hi Bruno,

    I need to compare two fields ( both belongs to the different object in db2 ) and out of which one field belongs to the incident object and second belongs to the different object and if it's equal then we need to set some value ? What will be the best way to achieve this task ? Is it possible through the Java codes ?

    Thanks in Advance

  2. Thanks Bruno…:) It seems script will not work for us. we are using TSRM 7.2.1 . You made all the thing very easy for the beginners…:) Super Awesome..:)

  3. Really very nice blog information for this one and more technical skills are improve,i like that kind of post.
    Really very nice blog information for this one and more technical skills are improve,i like that kind of post.

  4. I work in app support supporting a maximo application and I’d like to build some dev skills just to debug bmx errors that get reported. The 3rd line are underzealous at collaborating and infosec are overzealous at blocking training material do you have a start point for someone who just wants to look into the code to diagnose a bmx message?

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top