Creating a new custom presentation bean
You can create a new bean to control your custom dialog.
You create a new bean when you want to:
- Pre-populate attribute fields with data from other sources
- Extend current button functionality
- Add new button functionality
The new bean must extend PmScInputSpecBean, which is the default bean for all dialogs.
package com.ibm.ism.pmsc.webclient.beans.shoppingcr;
import java.rmi.RemoteException;
import psdi.mbo.MboConstants;
import psdi.util.MXException;
public class MyCustomPresentationBean extends PmScInputSpecBean {
/* Insert new or overridden routines here */
}
In your custom dialog, the beanclass property is changed from PmScInputSpecBean
to MyCustomPresentationBean
.
Pre-populating attribute fields
By default, attribute input fields are pre-populated with the default value of the Attribute specified in the offering definition. If no default value is defined for the attribute, the input field will be blank.
protected void initialize() throws MXException, RemoteException
{
super.initialize();
this.setValue("aln1", "John Doe", MboConstants.NOACCESSCHECK);
this.setValue("num2", "12345", MboConstants.NOACCESSCHECK);
moveTo(0);
}
Overriding button functionality
Button | PmScInputSpecBean | Functionality | Notes |
---|---|---|---|
Add to Cart | opencrdr() | Copies attribute input information from PMSCCRSPECV records to TICKETSPEC records and launches Shopping Cart application. | Only valid for supply chain services in Offering Catalog object |
Execute/Launch | execute() | Copies attribute input information from PMSCCRSPECV records to TICKETSPEC records and launches workflow or launch-in-context entry associated with action service. | Only valid for action services in Offering Catalog object |
Cancel | cancelClicked() | Cleans up records created when offering was selected and closes dialog. | none |
Add to Favorites | addtofav() | Adds the selected offering to the Favorite Offerings list. | Only appears if offering not already in Favorite Offerings |
OK | okClicked() | Updates TICKETSPEC records with the values entered by the user. | Only valid for Shopping Cart, View Shopping Carts, and View Catalog Requests objects |
You can override any one of the PmScInputSpecBean routines to extend the functionality provided.
int execute() throws MXException, RemoteException
{
System.out.println("Executing service");
super.execute();
return EVENT_HANDLED;
}
In a more complicated scenario, if you have an external application that reads data from table A in database XYZ, you could override the bean's execute routine to copy any information from the Service Catalog database records (e.g. PMSCCRSPECV, PMSCCR, PMSCOFFERING) to table. Once you complete the tasks then call the super.execute() routine to launch the external program.
int execute() throws MXException, RemoteException
void addtofav() throws MXException, RemoteException
int opencrdr() throws MXException, RemoteException
int cancelClicked() throws MXException, RemoteException
int okClicked() throws MXException, RemoteException
Adding new button functionality
int email() throws MXException, RemoteException
{
/* Add code to gather information from PMSCSRVOFF record to send to user */
/* Add code to email information to user*/
return EVENT_HANDLED;
}