October 26, 2012

Reset the value of a field when another field is modified

This entry is part of the Maximo Java Development series.

Today I want to share with you some Java sample code to reset the value of a field when another field is modified.
In the example below I have implemented a little piece of logic to reset the WORKORDER.SUPEVISOR field when the WORKORDER.OWNERGROUP is modified.


Here is the Java code.

package cust.psdi.app.workorder;

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

/**
 * Custom field class to reset the supervisor when the Owner Group is changed
 */
public class FldWOOwnerGroup extends psdi.app.workorder.FldWOOwnerGroup
{
  public FldWOOwnerGroup(MboValue mbv) throws MXException
  {
    super(mbv);  
  }

  public void action() throws MXException, RemoteException
  {
    if (!getMboValue().isNull() &&
        !getMboValue().equals(getMboValue().getPreviousValue()))
    {
      getMboValue("SUPERVISOR").setValueNull(NOACCESSCHECK|NOVALIDATION_AND_NOACTION);
    }

    super.action();
  }
}

Deploy the FldWOOwnerGroup.class file in your Maximo source tree and attach it on WORKORDER.OWNERGROUP field using the Database Configuration application.

October 19, 2012

IBM's mobile solutions for Maximo

This article is outdated!
IBM Anywhere is now available.

In several forums and groups I have recently seen, there is some confusion around the current IBM's mobile solutions for Maximo so I will try to give my personal view on this hot topic.
Before going on keep in mind that this analysis is updated to the current situation as of October 2012 and may become outdated in few months.


Overview

Roughly speaking IBM delivers two mobile solutions for Maximo: IBM Maximo Everyplace and IBM Mobile Suite. Let's have a closer look to them.

IBM Maximo Everyplace basically adds two features to Maximo:
  • Allows to access Maximo from mobile devices browsers
    • Mobile Safari: iPhone, iPod touch and iPad
    • Android 2.1 and 2.2 native browser
  • Ability to configure screens for mobile devices running supported browsers through enhanced Application Designer
Here is how it looks on an iPhone.



IBM Mobile Suite is a family of solutions to provide remote access to the Maximo in connected and disconnected environments.
It runs on the following platforms:
  • PDA: Microsoft Windows Mobile 5.0, 6.1, or 6.5.1
  • PC: Microsoft Windows XP, Vista or 7

These are few screenshots of the app.



Side-by-Side Comparison


Everyplace Mobile
Connection mode Always connected Connected or disconnected
Supported Maximo versions Starting from Maximo 7.1.1.7 Starting from Maximo 6
Supported mobile devices iPhone, iPod touch, iPad, Android Windows Mobile 6.x , Windows XP, Vista, 7
Client technology Runs in Web Browser (no client installation required) Java ME native client
Barcode scanning No ‘embedded’ barcode scanning feature Native barcode scanning
Screen editor Configurable using the standard Application Designer (WYSIWYG) Configurable through XML editing
Configuration No specific configuration required Query and supporting data configuration needed
Provided applications No Out-Of-The-Box application provided Three version designed for specific business scenarios: Work Manager, Inventory Manager, Asset Manager
Extensions and add-ons support Works with all TPAE-based products: MAM, TAMIT, SCCD, Utilities, Oil and Gas, Life Sciences, Transportation, etc. (no complex visualizations for Spatial, Scheduler) Only MAM is supported but can be extended to include additional fields from industry add-ons


Final Considerations

I cannot go into every details of how the two solutions works and can be configured so I will give you my personal opinions about what may be the best approach (at the moment).
These are my thoughts:

  • Last year IBM acquired Worklight. This is the strategic mobile platform for IBM so we have to expect some changes in this direction especially for Maximo Mobile. I would guess we will see something new before the end of 2013.
  • IBM will be focusing more on Android. This platform is an open platform with a lot of rugged devices already on the market.
  • Mobile platforms supported by Maximo Mobile are almost dead. Windows Mobile 6.x is close to its end and Windows XP/Vista/7 are not valid mobile platforms.

So what is my suggestion?
If you cannot wait for the next Maximo Mobile 7.5 release in 2013 and you don't absolutely need a 'disconnected mode' I would suggest to start mobilizing your workforce on Android/Everyplace couple. This will give many advantages:
  • Everyplace is quite cheap and easy to rollout.
  • Android is probably the best hardware platform to bet on for industrial usage.
  • It will give you the option to switch to the next Maximo Mobile leveraging the Android devices you already have bought.

Note: Obviously I know there are a lot of non-IBM mobile solutions for Maximo.


References

If you want to learn more here are some useful links:


Update: If you are using Maximo Everyplace please take a look at my Android App for IBM Maximo Everyplace.

How to create Maximo demo database (MAXDEMO)

The Maximo contains an extremely useful command to create a demo database filled with a sample data. This can be really helpful when learning haw Maximo works.

Tho create the demo database perform these steps.
  • Stop the application server (MXServer)
  • Open a command prompt
  • Move to:[SMP_DIR]\maximo\tools\maximo
  • Issue the following command:
    maxinst -s[INDEXTABLESPACE] -t[DATATABLESPACE]

By default both tablespaces are equals to MAXDATA so the following command should work.

maxinst -sMAXDATA -tMAXDATA


To create an empty databasse add the -imaximo parameter.

maxinst -imaximo -sMAXDATA -tMAXDATA


For further details about the maxdemo command see this IBM technote.

October 18, 2012

Custom condition Java class

Sometimes standard Conditional Expressions are not enough. Sometimes the logic to implement is too complex to be implemented using an SQL expression. In such cases Maximo allows to implement the condition logic in a custom condition class using Java.

To implement a condition class you must extend psdi.common.condition.CustomCondition and override evaluateCondition and toWhereClause methods. Here is a sample class.

public class IsIssueProblem implements CustomCondition
{
  public boolean evaluateCondition(MboRemote mbo, Object obj)
         throws MXException, RemoteException
  {
    if (mbo.getString("ISSUETYPE").equalsIgnoreCase("PROBLEM"))
    {
      return false;
    }
    else
    {
      return false;
    }
  }

  public String toWhereClause(Object obj, MboSetRemote mbs)
         throws MXException, RemoteException
  {
    // ensure this method is not called by throwing an Exception
    throw new MXApplicationException("", "");
  }
}

The provided snippet works for all Conditional Expression usages except for QUALIFIED security restrictions. In this cases you have to implement the toWhereClause method to return a valid SQL clause.

The Maximo JavaDocs for the two methods better explain how the two methods should be implemented.


evaluateCondition

Evaluate the condition.
For data restrictions having a condition (SecurityRestrict other than object Qualified), the object framework will call this method for each Mbo and set the Mbo and MboValue flags appropriately.

Parameters:
  • mbo - The mbo to be evaluated
  • param - Any object of parameter that is understood by the condition class. For data restrictions, this param is not used. To use it, some of the framework logic must be overridden in the Mbo.
Returns:
  • The result of the evaluation. For data restrictions, True means the restriction will be applied.


toWhereClause

Convert the condition to a where clause. If the condition class will be used for "QUALIFIED" object security type, this method should return a where clause. If the condition should NOT be used for "QUALIFIED", it should throw an exception to indicate it is an error when attempted to be used. This method has to be thread safe. For qualified object data restrictions (SecurityRestrict) having a condition type of Class, the object framework (MboSet) will call this method to construct the Where clause.

Parameters:
  • param - For data restrictions, this is not used by the object framework. To use param you must override some of the framework logic in your MboSet.
  • msr - The MboSet whose Where clause is being constructed

Returns:
  • The where clause that can be used to query the database

October 17, 2012

Find large Maximo tables on DB2

I this article I have explained how to list the larger database tables and indexes on Oracle.
On DB2 you can use the following one.

SELECT name, card, npages, fpages, stats_time
FROM sysibm.systables
WHERE creator = 'MAXIMO' 
AND type='T'
ORDER BY card DESC;

The returned columns are:
  • NAME: Name of the table
  • CARD: Number of rows
  • NPAGES: Total number of pages on which the rows of the table exist
  • FPAGES: Total number of pages
  • STATS_TIME: Date when the statistics of the table were collected

The STATS_TIME is important both to understand if statistics are updated in your database (which is important for performances) and for check if the data retrieved is updatad. If timestamps here are too old you should regenerate database statistics. You can do this selecting Update Statistics action from the Database Configuration application menu.

October 14, 2012

How to change Maximo skin

As you probably know, in recent versions of Maximo IBM has introduced a new look of the user interface.
The two available skins are called classic and tivoli09. The following screenshots show the two looks.

Skin: classic

Skin: tivoli09

The new skin is available starting from Maximo 7.1.1.5 although it may not be set as the default one.
You can easily switch between the different skins in several ways described hereafter.


Set the skin globally
The setting used to determine if the new skin should be used is different depending on the Maximo version:
  • TPAE 7.1 - Property webclient.skin in [SMP_DIR]\applications\maximo\properties\webclient.properties
  • TPAE 7.5 - Property mxe.webclient.skin in the System Properties
The procedures to change this setting are obviously different.

TPAE 7.1
  • Open [SMP_DIR]\applications\maximo\properties\webclient.properties file with a text editor.
  • Search for webclient.skin property
  • Remove the pound sign (#) before the property definition if exists 
  • Update the value of this property to classic or tivoli09
  • Save the webclient.properties file.
  • Rebuild and redeploy the Maximo enterprise archive (EAR) file.

TPAE 7.5
  • Login to Maximo as an Administrator
  • Go to System Properties app
  • Find the mxe.webclient.skin property
  • Remove the value tivoli09 from the Global Value field
  • Run the Live refresh and save.
  • Sign out and sign in to test.


Set the skin for a single user session

To use a specific skin you can append the following parameter (prefixed by a & character) to the link used to launch Maximo.
  • To use the new skin - skin=tivoli09
  • To use the old skin - skin=classic
For example to use a classic skin on Maximo 7.5 you can use a link like this: http://[MAXIMOHOST]/maximo/webclient/login/login.jsp?welcome=true&skin=classic


Set the skin for a specific application

To apply the new GUI skin to an individual application, perform the following steps:
  • Log in as MAXADMIN.
  • Launch the Application Designer and open the application for which you want to set the skin.
  • Click the Export Application Definition button on the toolbar.
  • Save the XML file to your hard drive.
  • Open the XML file in a text editor, and add the skin attribute to the presentation element:
    presentation id="XXXXX" mboname="YYYYY" skin="tivoli09"
  • Save the XML file.
  • Import the modified XML using the Import Application Definition button on the toolbar
  • Click to save the change that you have made.

October 11, 2012

How to display a YES/NO dialog and get user input

This entry is part of the Maximo Java Development series.

In this little article I'm going to show how to display a dialog box with Yes/No or OK/Cancel buttons and how to capture the user's input to execute some custom logic. For example, you have a Java method attached to a button on the toolbar or to an action menu entry as described in this article and you want to display a warning message asking for confirmation before executing some processing.

This can be easily achieved extending the application AppBean class.
The following snippet is an extension of the WOTRACK app bean that declares a method that displays a custom message box (MyGroup/YesNoDialog) and performs some action if the users clicks the Yes button.

package cust.psdi.webclient.beans.workorder;

public class CustWorkorderAppBean extends psdi.webclient.beans.workorder.WorkorderAppBean 
{
  public int RUNJAVA() throws MXException, RemoteException
  {
    WebClientEvent event = clientSession.getCurrentEvent();
    int msgRet = event.getMessageReturn();   
    if (msgRet < 0)
    {
      throw new MXApplicationException("MyGroup", "YesNoDialog");
    }
    else if (msgRet == WebClientRuntime.MSG_BTNYES)
    {
      // Implement your logic here
      return EVENT_HANDLED;
    }
    return EVENT_HANDLED;
  }
}

Refer to this article about how to define a custom Yes/No dialog box.
Refer to this article for attaching a Java method to a button or menu entry.
This article explains how to achieve a similar goal in MBO code.