Posted by: jacobdotcosta | 09/04/2010

Creating an Attribute customization using custom classes in Maximo


MBO code snippet
Image by jacobdotcosta via Flickr

Although Maximo (IBM Tivoli) 7 allows much customization to be done using the applications own mechanisms such as Domains, Conditional Expression Manager, etc there are still some situations which require the use of custom classes. In this post I’ll describe how to use custom classes for Attributes (aka FLDs) in Maximo.

Class Inheritance

The definition of custom classes in Maximo start at the Database Configuration application. Here one can check out either if a specific attribute has a custom class associated or not. This information is stored on the MAXATTRIBUTESCFG database table.

Unlike MBOs which always have a class associated, attributes may have none.

When you come to the point where you need to add you own customization, if the attribute already has a class associated you only need to extend that class and add your custom code.

If you want to customize an attribute that has no class associated you have several base classes points available depending on what you want your FLD to do. The starting point in the FLD inheritance hierarchy is the psdi.mbo.MboValueAdapter class. This is the class you’ll use for standard actions, validations and business rules . If you check the Javadocs you can see that this class is already a superclass for quite a number of classes such as Domain specific classes, application specific classes, etc.

Either way you should always call for the super method in your customization in order to keep the existing functionality.

Methods

The two main methods for an FLD are validate() and action(). They’re have similar method signatures, taking no parameters and throwing psdi.util.MXException and java.rmi.RemoteException. They should be used however for 2 different tasks.

validate()

Validate should be used to check the data introduced in the attribute. You may need to check values on other fields or obtain related data from other MBOs. All errors found during data validation should be managed using exceptions, usually psdi.util.MXApplicationException which extends psdi.util.MXException.

No actions should be launched in this method. By actions I mean for instance modifying the value of another field, this should be left to be done in the action() method.

The validate() method will be called prior to the action() method.

action()

This method will only be called if the data was successfully validated. Here is the place where all the actions should be performed, such as calculating values for other fields, etc.

Creating Classes

If you’d like some kind of automation when it comes to generating code for FLDs, and other Maximo objects, you can check out my Maximo Framework project. Maximo Framework is an OSS project for generating class code for IBM Maximo, hosted at Google Code. It contains a Maven Plugin that generates code for MBO, FLDs, CRONTASKSs, etc.

Reblog this post [with Zemanta]
Advertisements

Responses

  1. […] This post was mentioned on Twitter by Antonio Jacob Costa, openmaximo.net. openmaximo.net said: Creating an Attribute customization using custom classes in #Maximo « openmaximo http://bit.ly/bU3Ct9 #ibm #tivoli #mam […]

  2. […] by WP Greet Box WordPress PluginHere is another Maximo blog called openmaximo.  His recent post on Creating an Attribute customization using custom classes in Maximo is great at explaining what the methods do when extending MBO’s. Related Posts:Maximo […]

  3. […] Creating an Attribute customization using custom classes in Maximo (openmaximo.wordpress.com) […]

  4. […] Creating an Attribute customization using custom classes in Maximo (openmaximo.wordpress.com) […]

  5. Hello,

    If you can help me with this please, I need to know how I can use actions in Maximo to delete certain Asset Attribute values (I have managed using escalations and actions but it will delete all the attributes that are associated with the asset, nevertheless, I need to be able to select.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: