What are beans in IBM Maximo The information provided in this post is based on my Maximo 6 experience. I don’t know if or to which extent it has changed in Maximo 7. Answer There are 2 types of Beans in IBM Maximo, AppBean and DataBean. AppBean The AppBean manage application functionality, such as WOTRACK or ASSET. This class is defined in the beanclass attribute of the presentation tag in the application’s XML. If you export the WOTRACK application xml and go to the bottom of the file you can see a group of actions (action tag) defining actions and their corresponding method in the AppBean beanclass. For instance if you’d like to add a button on WOTRACK to approve a workorder (OOTB in Maximo 7 but not in 6) besides of creating the SIGOPTION and TOOLBAR records for that operation you’d also have to develop custom Java code for it, this would be done in the AppBean. DataBean Image by jacobdotcosta via Flickr
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
What are beans in IBM MaximoThe information provided in this post is based on my Maximo 6 experience. I don’t know if or to which extent it has changed in Maximo 7.
AnswerThere are 2 types of Beans in IBM Maximo, AppBean and DataBean.
AppBeanThe AppBean manage application functionality, such as WOTRACK or ASSET. This class is defined in the beanclass attribute of the presentation tag in the application’s XML.
If you export the WOTRACK application xml and go to the bottom of the file you can see a group of actions (action tag) defining actions and their corresponding method in the AppBean beanclass.
For instance if you’d like to add a button on WOTRACK to approve a workorder (OOTB in Maximo 7 but not in 6) besides of creating the SIGOPTION and TOOLBAR records for that operation you’d also have to develop custom Java code for it, this would be done in the
AppBean.
DataBean
Image by jacobdotcosta via Flickr
Data Beans can manage both dialog boxes and tables. The DataBean class associated is defined in the beanclass attribute of both the dialog and table tags in the application’s XML.
For instance, on dialog boxes you can use a DataBean to control what to do when the OK button is pressed (submit() method).
On tables you can do things such as custom the way to load the MBOSet on that table (getMboSet() method).
You have to have in mind that the flow control of the dialog’s execution is quite complex. For instance, if you don’t provide a submit() method on your dialog’s bean class, Maximo will try executing other methods and will end up executing the execute() (I think this is the method) method of the MBOSet asociated with your dialog (defined with the mboname attribute of the dialog tag).
Bean Class Sample In Maximo
That's an exciting stuff. Bean classes are mostly used for user interface operations in Maximo such
as Dialog boxes or button events. Bean classes are using top classes like mbo classes to make its
operations.
Today I wanna give you a bean class example. My scenario is like that. I have created a custom
made dialog box. I just copied it from LIBRARY.XML file and then pasted it to the applications XML.
I customized the dialog using application designer. It is important that you should give the
classpath of your custom made bean class in application XML file. Don't worry about that I am going
to give the details in how to create a custom dialog box in Maximo section. I have added some
buttons in dialog which will be triggered from custom bean class that i've created.
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.
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.
Setting up a Conditional Domain
Technote (FAQ)
Question
How can I have a domain with values that show up conditionally?
Answer
It is possible with Maximo 7.1.1.4 and newer versions to create and associate a condition to domain entries so that they only appear when the criteria is met.
A domain value can have more than one condition associated to it if there was more than one condition under which you wanted the value to display in the domain.Say for example you wanted to have an ALN Domain associated to a field that allowed users to select a Sub Type value based on the current Work Type value of a Work Order record.You would create the SUBTYPE ALN Domain and associate it to a field used for the SUBTYPE field.Add all values you want to be available in the domain and save the domain.
Next create a Conditon(s) to associate to the domain values.For values you want to display when the Work Type is PM you would do the following:
From the Administration module, select the Conditional Expression Manager application.Select New Row.The Condition will have a numeric value, you can change this to something you will remember like SUBPMLeave Type set to Expression.In the Expression field enter::WORKTYPE = ‘PM’Check Always Evaluate if you want the value to be evaluated without the result being cached in the MBO first.Save.Go back to the Domains application and select the SUBTYPE domain.Select a value you want to associate this condition to and expand the details of the value by selecting the blue triangle icon to the left of the value.Select the View/Modify Conditions buttonSelect New RowValue ID should already be filled out.Select your condition of SUBPM for the Condition Number.In this case the Object Name would be WORKORDER as this is the main object of the application in which this is used.Type is set to Expression and the Expression populates when the Condition is selected.Save.The value the condition has been associated to will only display when the condition criteria is met.If you wanted the value to display for two or more conditions, you would add a new row in the View/Modify Condition screen for that value.
Note: This method can also be used to make certain domain values site specific if the condition is set for siteid without making the entire list need to be set at a site level.