This chapter provides information about coding the extension Java class. Sample code is provided with your installation of Oracle Communications MetaSolv Solution, and the sample code provides concrete code examples of extension Java classes. See "Extensions Sample Code" for detailed information about the sample code.
All extension Java classes must extend the extension framework through the class ExtensionRoot located in the package com.metasolv.custom.common.extension. Extending the extension framework is necessary to access the data passed from the execution point. Therefore, all new extension Java classes should contain the following lines of code, or some derivation of them:
import com.metasolv.custom.common.extension.ExtensionRoot public class MyExtension extends ExtensionRoot
A derivation of the code could be that the extension Java class directly, or indirectly, extends ExtensionRoot. For example, all of the sample source code extends SampleExtensionRoot rather than ExtensionRoot. That is because SampleExtensionRoot extends ExtensionRoot, adding a middle layer to the inheritance that provides common functionality used by all the sample classes. You may wish to create a similar class, or even use the SampleExtensionRoot class, depending on what you are developing.
All of the sample source code implements the class Extension. This is really not necessary because ExtensionRoot implements Extension. Therefore, by inheritance, any class that extends ExtensionRoot implements Extension.
This section provides an overview about methods of accessing data passed from the execution point, and provides class details.
Extension Java classes cannot define input parameters. Rather, data passed from the execution point can be accessed by the extension Java class through the extension framework. Specifically, the class ExtensionRoot defines the following methods:
protected final Policy getPolicy() protected final Entity[] getParameter()
Though these methods are defined as protected, they are available to the extension Java class because it inherits from the class in which the methods are defined (ExtensionRoot). From these two methods, the following data can be retrieved:
Execution mode
The execution mode tells you if the execution point that invoked the extension class is defined as synchronous or asynchronous. This information was entered in the UI when defining the extension.
Execution point
The execution point tells you the point at which the extension class was invoked. This information is passed in the form of building block ID, process point ID, and action type ID. The unique combination defines a specific execution point such as Assign Queues or Reject Task.
Execution point data
The execution point data is the specific data that is associated with each supported execution point. This information is passed in the form of a name/value pair array. See "Supported Execution Points" for the specific data that is passed from each execution point.
This section provides details about the policy and entity class.
As mentioned in the "Overview" section, the method getPolicy() returns Policy. However, it actually returns an instance of the class PlugInPolicy, which extends Policy. Therefore, you can caste the returned Policy to PlugInPolicy, which makes an instance of the class PlugInPolicy available to the extension Java class.
The class PlugInPolicy defines the following methods:
public String getExecutionMode(); public PlugInExecutionPoint getExecutionPoint();
Calling the method getExecutionMode() from the extension Java class returns a String that indicates if the execution mode is synchronous or asynchronous. Calling the method getExecutionPoint() returns an instance of the class PlugInExecutionPoint.
The class PlugInExecutionPoint defines the following methods:
int getBuildingBlock(); int getProcessPoint(); int getActionType();
Calling these methods returns the combination of building block ID, process point ID, and action type ID that defines an execution point. See "Supported Execution Points" for more information.
As mentioned in the "Overview" section, the method getParameter() returns an Array of Entity classes. Another class, ExtensionData, extends the class Entity. Since ExtensionData is a child of Entity, Entity can be casted to ExtensionData. Casting Entity to ExtensionData makes the Array of ExtensionData available to the extension Java class.
The class ExtensionData defines the following method:
public NameValuePair[] getNameValuePairs()
Calling this method from the extension Java class returns an Array of NameValuePair classes. The name/value pairs represent the specific data that is defined for each supported execution point. See "Supported Execution Points" for more information.
Finally, the class NameValuePair defines the following methods:
public String getName(); public String[] getValue();
Calling these methods returns the String name and the String values. It is important to note that all value data is of type String.