May 30, 2012

Retrieve multiple attribute values from an Mbo

This entry is part of the Maximo Java Development series.

Maximo MBOs are not exactly lightweight, however there are some little tricks to improve performances and reduce system resources consumption.
One of the most common mistakes that I have seen is the redundant use of getters methods of the psdi.mbo.Mbo class.
In the following example three calls to getString/getInt methods are made to retrieve the attribute values from an Mbo object.

MboSetRemote mboset = getMboSet("ASSET");
MboRemote asset = mboset.getMbo(0);

String assetnum = asset.getString("ASSETNUM");
String assetdesc = asset.getString("DESCRIPTION");
int assetPriority = asset.getInt("PRIORITY");
Rather than retrieving data from attributes individually you can use the getMboValueData(String[]) method to retrieve several attributes in a single call.
String[] attrs = { "ASSETNUM", "DESCRIPTION", "PRIORITY" };

MboSetRemote mboset = getMboSet("ASSET");
MboRemote asset = mboset.getMbo(0);

MboValueData[] valData = asset.getMboValueData(attrs);
String assetnum = valData[0].getData();
String assetdesc = valData[1].getData();
int assetPriority = valData[2].getDataAsInt();

This implementation is more efficient because it makes only one remote call to the server instead of three.

Going one step further, it is possible to apply the same approach on the MboSet. In the following snippet the three attributes are retrieved in one call for the first 10 rows of the MboSet.
String[] attrs = { "ASSETNUM", "DESCRIPTION", "PRIORITY" };
MboSetRemote mboset = getMboSet("ASSET");

MboValueData[][] valData = mboset.getMboValueData(0, 10, attrs);
String assetnum0 = valData[0][0].getData();
String assetdesc0 = valData[0][1].getData();
int assetPriority0 = valData[0][2].getDataAsInt();
String assetnum1 = valData[1][0].getData();
The first parameter of getMboValueData method is the starting position of the required Mbo in the MboSet. The second parameter is the number of Mbos required. Passing MboConstants.ALLROWS the entire MboSet is retrieved.

May 29, 2012

Maximo is Magic!

Few months ago Gartner has published its Magic Quadrant for Delivery Utility Enterprise Asset Management and guess what?
IBM Maximo Asset Management (aka MAM) is positioned it the upper right corner.

Download the Magic Quadrant for Delivery Utility Enterprise Asset Management from Gartner's website for free.

May 28, 2012

Extending Maximo Business Objects

This entry is part of the Maximo Java Development series.

Sometimes it is necessary to override or extend the functionality in Maximo. This can be achieved by extending methods in the Maximo Business Objects.
This article outlines the process involved in extending the out-of-the-box class to initialize the description field to a specific value.

Create Java Classes
We will need to create two new files an Mbo and an MboSet. The will extend the add() method in the class. It is a good common practice to use a well defined 1st level package name like 'cust' to group all the custom code.
Now open Eclipse and create a new Java class named and paste the following code.

import java.rmi.RemoteException;
import psdi.mbo.*;
import psdi.util.*;

public class Item extends implements
  public Item(MboSet ms) throws MXException, RemoteException

  public void add() throws MXException, RemoteException
    setValue("description", "TEST");
Note how we have overridden the add() method of the class to insert the initialization of the description field.
Every time you override a Maximo method remember to call the super() method to preserve any preexisting behavior.

The ItemSet class does not contain any logic. It simply returns the reference of our new object.

import java.rmi.RemoteException;
import psdi.mbo.*;
import psdi.util.*;

public class ItemSet extends implements
  public ItemSet(MboServerInterface ms) throws MXException, RemoteException

  protected Mbo getMboInstance(MboSet ms) throws MXException, RemoteException
    return new Item(ms);

Deploy Maximo EAR
After having compiled the two Java classes (should be done automatically by Eclipse), go in bin\cust\psdi\app\item folder and copy those two .class files into [SMPDIR]\maximo\applications\maximo\businessobjects\classes\cust\psdi\app\item.
Now rebuild the Maximo EAR file, redeploy it and restart your server (or use this fast method).

Update database
Now we have to tell Maximo to use the new classes. Open the Database Configuration application, select the ITEM object and put into the Class field.

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 description field defaulting to the value 'TEST'.

May 26, 2012

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");
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 and it extends psdi.mbo.MboSet class. Associated to there is 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");
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.

May 22, 2012

Hide data conditionally for a specific group

This entry is part of the Conditional Expressions HowTo.

A very typical customization task is to restrict the visibility of data within Maximo/TPAE applications based on certain conditions.
For example you may wish to hide all the purchase orders that have a total costs higher than 1000$ for a specific group. Here is a small tutorial about how you can achieve this.

Open Administration - Conditional Expression Manager application and create the following conditional expression.

  • Condition: POCOST
  • Description: Total cost is less than 1000
  • Expression: totalcost<1000

Now go to the Security - Security Groups application. Choose the desired group and open the Data Restrictions tab.
Create the following Object Restriction:

  • Object: PO
  • Reevaluate: true
  • Condition: POCOST

If you now logon with a user belonging to the chosen group and open the Purchase Orders application you will see that only POs with a total cost of less than 1000 will be listed.

There are three types of object restrictions that may be used to accomplish different goals:
  • Hidden: The objects for which the condition is evaluated to true will be displayed as XXXXX and cannot be selected.
  • Qualified: The objects for which the condition is evaluated to false will be hidden.
  • Readonly: The objects for which the condition is evaluated to true cannot be updated.

May 21, 2012

How to make a field required using a conditional expression

This entry is part of the Conditional Expressions HowTo.

In this post I will show how to make the Remarks field required in the Receiving application when returning items. This is just an example and the same configuration can be used to hide or show any field based on a particular condition.
similar post describes how to achieve the same functionality using Data Restrictions.

Define conditional expression

Open Administration - Conditional Expression Manager application. Create the following conditional expression.
  • Condition: MATRETURN
  • Description: Return material
  • Expression: issuetype='RETURN'
  • Always Evaluate: False

Configure RECEIPTS application

Open System Configuration - Platform Configuration - Applications Designer application and edit the RECEIPTS application. Select the Remarks field of the Material Receipts section of Material Receipts tab and open the properties window. Click on Configure Conditional Properties button (on TPAE 7.5 it is in the Advanced tab) and configure it as follows.
  • Signature Option: READ
  • Security Group: EVERYONE
  • Property: inputmode
  • Value: required

Here is how the Conditional Properties properties should look like.

Now open the Receipts application you will see that the remarks field is now required when returning an item.

May 15, 2012

Maximo BIRT reports resources

Checkout this great page with a lot of useful information and reference material on Maximo BIRT reports.
I you are a Maximo report developer you may also wish to follow IBM's Maximo architect and lead designer Pam Denny on twitter.

May 13, 2012

Maximo Data Types

Here is the complete list of available data types in TPAE/Maximo. The most used are marked in bold.
  • ALN - Alphanumeric characters, mixed case
  • AMOUNT - Decimal number, used for currency
  • BLOB - Binary large object
  • CLOB - Character large object
  • CRYPTO - Encrypted binary
  • CRYPTOX - Encrypted binary (one-way)
  • DATE - Date only, no time
  • DATETIME - Date and time
  • DECIMAL - Decimal number
  • DURATION - Duration, 1:30 is displayed to mean one and one-half hours
  • FLOAT - Floating number
  • GL - General Ledger account
  • INTEGER - Integer number
  • LONGALN - Long Alphanumeric
  • LOWER - Lowercase characters
  • SMALLINT - Small integer
  • TIME - Time only, no date
  • UPPER - Uppercase characters
  • YORN - Yes or No, the database contains 1 or 0

May 9, 2012

The Maximo specialist Swiss Army Knife

Have you ever felt at war during the roll-out of a complex customization or when you have to rush to debug and fix a complex problem?
Sometimes being a Maximo specialist is like being a soldier. That's why you need the best tool at hand to do your job. That's why I have selected my personal set of portable apps that I have copied on my USB stick so I can plug in every computer in order to quickly become productive on every system.
By failing to prepare, you are preparing to fail.

Here is my selection of free (or almost free) tools.
  • Notepad++: A powerful and free text editor that supports UNIX/DOS file formats, column mode editing, filesystem search, macros, source formatters and more...
  • 7zip: Probably the best free file compression/archiver. WinRAR and WinZip are not really free and are less flexible or less powerful.
  • DBVisualizer: An outstanding universal SQL client. Unfortunately it not completely free. Try the DBVisualizer Personal evaluation license and you will never leave it. A valid free alternative is SQuirreL.
  • Postman REST Client: A Chrome plugin to play with HTTP calls against the Maximo Integration Framework. If you are a Firefox user then try HTTPRequester.
  • SoapUI: A test tool useful to simulate HTTP and WebServices calls. A must have for developing MIF integrations.
  • JD: A small and accurate Java decompiler is often useful to understand the inner behavior of Maximo classes.
  • BareTail: A simple a tail program for Windows to look at Maximo logs in realtime.
  • FileZilla: Open Source FTP client when you have to transfer files from/to UNIX servers.
  • portaPuTTY: The portable version of the famous Telnet/SSH client.
  • Beyond Compare: A great tool to compare files and directories. It isn't free but worth the price. A good free alternative is WinMerge.
  • IrfanView: Simple and fast image viewer.
  • TreeSizeFree: When you need to free some disk space this may prove useful.

May 8, 2012

Improving BIRT report style

I have always been an admirer of beautifully designed web sites. Today's mobile and desktop application have beautiful and eye-catching UIs. To my eyes the current design of out of the box Maximo BIRT reports has an old-fashioned style that doesn't sound pleasant to my eyes. That's why I decided to tweak the Maximo out of the box styles in order to be able to quickly improve the look of any Maximo report.
All the customer I have worked with have really liked this reporting style and asked me to apply it to all their custom reports.

Maximo report templates uses a library of styles stored in a file named MaximoSystemLibrary.rptlibrary stored under birt\libraries folder. Starting from this, I have created a MaximoSystemLibraryCustom.rptlibrary file adjusting some default styles and adding few other that may be used to create grouped tables.

Setup the custom report library

Download the MaximoSystemLibraryCustom.rptlibrary file from here and copy into [SMPDIR]\maximo\reports\birt\libraries folder.
Rebuild and redeploy the maximo EAR file.

Modify report
Now that we have set up the custom report library into Maximo application we have to use it in a report. For this example we will start from the Asset Move History report that is provided by Maximo.
Go under [SMPDIR]\maximo\reports\birt\reports\ASSET and copy assetmove_history.rptdesign report definition into a new file named assetmove_history_new.rptdesign.
You may want to import this report in your BIRT editor but this in not required for this example because changes can be made with a simple text editor.
Now open the assetmove_history_new.rptdesign and replace the following row (should be around line 20)
<property name="fileName">MaximoSystemLibrary.rptlibrary</property>
with this
<property name="fileName">MaximoSystemLibraryCustom.rptlibrary</property>

This will tell BIRT to use our new styles library.

On many out of the box reports there are awful black borders on tables and section. A light blue border if nicer and also helps the reader to focus on data instead of report layout.
To further improve the report, replace all occurrences of Color">#000000</property> with Color">A0B0C0</property> in the report XML definition.

This is the result that we have achieved.

Original style

New style

The new style has:
  • Slightly bigger report title.
  • Bluish lines and table borders
  • Lighter solid (non-dotted) lines between the table rows
If you like this template feel free to use it and leave a comment here or give a Google +1 to this post.

BIRT Resources
For Maximo Base Services up through, BIRT Designer 2.1.2 is used.  For Maximo Base Services starting with, BIRT Designer 2.3.2 is used.

The BIRT 2.1.2 designer can be downloaded here. Information on installing and configuring the BIRT Designer for use in Maximo is located here.

The BIRT 2.3.2 designer can be downloaded here. Information on installing and configuring the BIRT Designer for use in Maximo is
located here.

May 2, 2012

Resource for upgrading multiple Maximo products

Having several Maximo products coexisting on the same installation basically requires that all the products depends on the same Maximo Base Services level.
This IBM wiki  describes in detail how to install and upgrade multiple Maximo products on the same TPAE server.