IBM Support

Extending Maximo using Java Classes - Product XML and Extension Settings

Technical Blog Post


Abstract

Extending Maximo using Java Classes - Product XML and Extension Settings

Body

A common issue when we are extending maximo objects using java classes is the absence of proper extension information in your product xml. This file tells not only which maximo objects we are extending but it can also be used to point maximo installation - updatedb - to the proper database change scripts (dbc) that will install your product. Usually, it is even common to ignore such xml when customizing maximo and, in place of it, make usage of Migration Manager to "install" your product objects, including structural changes in database, presentations and others.

In this post we will explore how to use the product xml to correctly extend maximo objects.

A Maximo Object (MBO) comprehends four files: two java classes and two remote interfaces. An MBO is also defined as a database table or a database view or even a non-persitent object, against which the logic present in java classes will be performed. The two java classes we have for an MBO are: the MBO Set class and the MBO class itself. MBO Set is a class that contains logic that makes sense for a set of records and it is directly related to the whole database table; examples are psdi.app.asset.AssetSet and psdi.app.workorder.WOSet. An MBO class contains logic related to a single table record. Most of the business logic is within these classes. Examples: psdi.app.asset.Asset and psdi.app.workorder.WO. Each remote interface is related to one of these two classes and it means that both MBO Set and MBO are enabled to be remotely accessed, using Java's RMI. Example of interfaces: psdi.app.asset.AssetRemote or psdi.app.asset.AssetSetRemote, which are, respectively, remote interfaces of the Asset MBO and Asset MBO Set.

Summing up, for Asset we have, in \applications\maximo\businessobjets\classes:

psdi.app.asset.AssetRemote
psdi.app.asset.AssetSetRemote
psdi.app.asset.Asset
psdi.app.asset.AssetSet

(.class files)

Also, in MAXOBJECT, maximo metadata table where Asset entity is defined, we have MAXOBJECT.CLASSNAME = psdi.app.asset.AssetSet, which links the maximo object definition and maximo object classes. Note that the link is made using the MBO Set class, because this is the class that represents the business logic related to the whole table or view as previously said.

Now, let's say we want to extend Maximo Asset object and add our own logic behind some of their methods. In order to do that we need to make sure we follow a couple of points:

  • Implement your own MBO Set, MBO and remote interfaces, extending the original classes (inheritance). This is a good practice used in Industry Solutions and Add-On's development; classes and interfaces are created even if we don't need to add extra code within all of them.
  • Inform the extension in your product xml. This will make sure the correspondent MAXOBJECT.CLASSNAME will be updated with the proper MBO Set reference during updatedb process. At the same time, it will reorganize the hierarchy of all the Asset classes of all the products that extend Asset features, in a single hierarchy, which is done changing the byte code of classes and interfaces. It is also part of updatedb.

Next, more information about these two topics.

 

Implement your own classes and interfaces

It is important to note that:

All MBO Remote interfaces must extend psdi.mbo.MboRemote
All MBO Set Remote interfaces must extend psdi.mbo.MboSetRemote
All MBO classes must extend psdi.mbo.Mbo AND must implement its own Remote Interface
All MBO Set classes must extend psdi.mbo.MboSet AND must implement its own Remote Interface.

When creating our own classes, it is recommended the usage of a prefix for your package and file names. In Maximo Industry Solutions, it is used PLUSX, where X is a letter that differentiate the several products. So, for a Maximo for Transportation extension of Asset we will have the following:

psdi.plust.app.asset.PlusTAssetRemote
psdi.plust.app.asset.PlusTAssetSetRemote
psdi.plust.app.asset.PlusTAsset
psdi.plust.app.asset.PlusTAssetSet

Internally, each java file looks like this:

public interface PlusTAssetRemote extends AssetRemote {...}
public interface PlusTAssetSetRemote extends AssetSetRemote {...}
public class PlusTAsset extends Asset implements PlusTAssetRemote {...}
public class PlusTAssetSet extends AssetSet implements PlusTAssetSetRemote {...}

Note the standard behind the name of interfaces and classes. All of them are derived from MBO name.



Informing extension in product xml

Product xmls are stored in applications\maximo\properties\product folder. They are read and executed in alphabetical order by updatedb. Product xmls inform the database scripts that must be executed to have that product installed and also it informs the java classes that this product is extending. Let's get transportation product xml and see how Asset extension has been defined over there:

image

Note how the interface and mbo classes are specified here. Interfaces use class tag. MBO's use mbo and mboset tags.

Other common tag that must be specified in xml extension is the field, which is used to inform field classes extension:

image

 

 

 

 

In this example, our class psdi.plust.app.asset.PlusTFldAssetItemnum is extending maximo core class psdi.app.asset.FldAssetItemnum, which is specified in the object ASSET (MAXOBJECT), attribute ITEMNUM (MAXATTRIBUTE).

Finally, we have yet a proper tag used to inform extension of an Application Service:

image

[{"Business Unit":{"code":"BU005","label":"IoT"}, "Product":{"code":"SSLKT6","label":"Maximo Asset Management"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":""}]

UID

ibm11133373