July 31, 2012

Integrating Maximo with Java application through RMI

This entry is part of the Maximo Java Development series.

In this article I will describe how to call Maximo business objects methods remotely using a Java RMI connection. This technique can be useful to integrate Maximo in custom applications written in Java or to perform a particular processing of data stored in Maximo database using an external application.
For simplicity I will describe how to create a sample Java project using Eclipse to print the list of assets. However, this technique can be used in any Java application.
First of all you have to copy some jar files from the Maximo server to your development system. Go in the application deployment directory (e.g. WebSphere\AppServer\profiles\ctgAppSrv01\installedApps\ctgCell01\MAXIMO.ear) and copy the businessobjects.jar file and the entire lib directory.
Launch Eclipse, create an empty Java project and add the businessobject.jar and icu4j.jar files to the project classpath. Your project should look like this.


Now create an empty class named com.maximodev.MxRemoteConnection and paste the following code into it.

package com.maximodev;

import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.util.MXSession;

public class MxRemoteConnection
{
 
  /**
  * Sample main method to connect to Maximo server and list all the assets
  */
  public static void main(String[] args) throws Exception
  {
    MXSession session = getConnection("192.168.18.128", 13400, "MXServer", "maxadmin", "maxadmin");

    MboSetRemote assetMboSet = session.getMboSet("ASSET");
    assetMboSet.setOrderBy("ASSETNUM");
 
    MboRemote assetMbo;
    for(int j=0; ((assetMbo = assetMboSet.getMbo(j)) != null); j++)
    {
      String assetNum = assetMbo.getString("ASSETNUM");
      String location = assetMbo.getString("LOCATION");
      String desc = assetMbo.getString("DESCRIPTION");
      System.out.println(assetNum + " - " + location + " - " + desc);
    }    
  }

  private static MXSession getConnection(String host, int rmiPort, String serverName, String user, String pwd)
  {
    MXSession session = MXSession.getSession();

    String connHost = host + ":" + rmiPort + "/" + serverName;
    System.out.println("Connecting to " + connHost);

    session.setHost(connHost);
    session.setUserName(user);
    session.setPassword(pwd);

    try
    {
      session.connect();
    }
    catch (Exception e)
    {
      e.printStackTrace();
      return null;
    }
    System.out.println("Connection OK");

    return session;
  }
}

Update the parameters passed to the getConnection method in the first line of the main method according to your environment.
  • host: Hostname of the Maximo server
  • rmiPort: The RMI port of the Maximo application server. The default value is 13400. To find it, open the Maximo logs and search for a row like this - BMXAA6461I - Bound rmi://thehost:13400/MXServer
  • serverName: Name of the Maximo application server. The default value is MXServer.
  • user: Username used to connect.
  • pwd: Password used to connect.

Now run the Java application and it will (hopefully) connect to you Maximo/TPAE server and list all your assets. If you are having problems finding the correct settings, you may try to test RMI connection using the checkmxserver utility in [SMPDIR]\maximo\tools\maximo\internal directory.

Apart from the getConnection method the previous code snippet is very similar to any Maximo MBO Java code. The only relevant difference is in the following line of code.

MboSetRemote assetMboSet = session.getMboSet("ASSET");

This means you have to use the MXSession object to retrieve the first MboSet. After that you can use the same identical APIs used in standard MBO development.

July 30, 2012

Change the default table sorting

Many Maximo applications have a default sort in the tables that displays objects both in the 'List' tab and in the details of the objects. Those default order by clauses can be easily changed with the Application Designer.
This technique, used in conjunction with the automatic display of table results, can greatly improve the usability of a Maximo application and speedup the completion of user's tasks.
For example you may want to show the work orders with nearest Scheduled Start in the Work Order Tracking application.
Open the WOTRACK application in the Application Designer and select main table. Right click on it and select 'Properties' to bring up the Control Properties dialog. Type 'WOPRIORITY' the Order By field and then select the 'Start Empty' checkbox and untick it again.


Close the Control Properties dialog and save the application.
Now open the Work Order Tracking application and you will see that the work orders with the lower priority will be automatically listed.
If you want to reverse the ordering use the DESC keyword. In our example the Order By field will be 'WOPRIORITY DESC'.
The same technique can also be used to modify the sorting of the tables in the other application tabs.

July 19, 2012

How to log all Maximo SQL statements

Here is a useful IBM Technote that explains how to capture all SQL statements issued from Maximo/TPAE when using DB2 database.
I think it may be useful to analyze users queries and performance bottlenecks.

July 15, 2012

Maximo Integration Framework Tutorial

Another GREAT tutorial from Daniel Ng about importing inventory data from an external source. The tutorial walks through the process of setting up a basic MIF to import data into Maximo through a set of database tables.
Here is the link to the article.

July 4, 2012

How to make a attribute required using Data Restrictions

This entry is part of the Conditional Expressions HowTo.

In this post I will show how to make required the remarks field of the MATRECTRANS object for returned items. This is just an example and the same configuration can be used to make a field mandatory based on a particular condition.
A similar post describes how to achieve the same functionality using Conditional UI.

Define conditional expression
Open Administration - Conditional Expression Manager application. Create the following conditional expression.

Find attribute details
Open the Receiving application in the Purchasing module and open an order with a material receipt. Locate the Remarks field.



Configure the Attribute Restriction

Go to Security Groups application. Open the EVERYONE group (or any other group your user belong to) and go to the Data Restrictions tab. Under Attribute Restrictions create the following entry:
  • Object: MATRECTRANS
  • Attribute: REMARK
  • Type: REQUIRED
  • Condition: MATRETURN


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

If this procedure is not working please check that all the 'independent groups' to which your test user is assigned have the same restriction.

July 2, 2012

Maximo Consultant 2012 salary poll

Have you participated to the Maximo salary poll? What is your monthly net salary as a Maximo Consultant? On the 13th of July I have launched an open poll asking what is the monthly net salary as a Maximo Consultant. In 2 weeks I have received 64 votes that can be hard to decipher.


The population sample is obviously not statistically valid but we can still try to draw some considerations.

  • The V-shaped curve is probably caused by two factors.
    • Experienced EAM/CMMS consultants can easily earn more than 5000$ while young Maximo/TPAE specialists are in the lower range of the chart.
    • Average salary in US and North Europe is very different from emerging markets like India, China and Brazil.
  • There is a good chance for Maximo consultants to grow economically. There are some markets where Maximo jobs are really in demand. 

Feel free to comment this post and add your opinions about these results.