Guidelines for Writing Structure Tree JPO

If you define a JPO for a structure tree category, it must contain the business logic to fetch the object list required for structure navigation.

The JPO class must have the mxMain method implemented. The JPO methods are defined with the following signature.

public static Object methodName(matrix.db.Context context, 
String[] args) 
throws Exception
{
}

The input arguments are:


  • Context--passed in always.
  • String[] args--will have one element of type HashMap.

The input argument "arg" is a HashMap, which contains the details of the object to be processed. The data structure of this input parameter (HashMap) is defined below:

Key Name Data Type This key is assigned to the:

languageStr

String

Language string for the current browser setting. The program can use this key for any internationalization purpose.

New Value

String

Applicable only for use with Update Program and Update Function. Key "New Value" is assigned to the new value changed by the user.

objectId

String

Business object Id (OID) to be used in the current form page.

Old Value

String

Applicable only for use with Update Program and Update Function. Key "Old Value" is assigned to the actual value for the field before the user changed it.

relId

String

Relationship id (RelID) to be used for the form page.

requestMap

HashMap

Key "requestMap" is assigned to a HashMap, which contains a set of key/value pairs as available in the request object. The keys are of type String (parameter names) and the values are of type String (parameter value).

The JPO method can extract the information from the input argument for processing the data.

public static Object methodName(matrix.db.Context context, 
String[] args) throws Exception
{
HashMap programMap = (HashMap) JPO.unpackArgs(args);
HashMap requestMap = (HashMap) programMap.get("requestMap");
HashMap paramMap = (HashMap) programMap.get("paramMap");
String  objectId = (String) requestMap.get("objectId"); 
String  relId = (String) paramMap.get("relId"); 
String  languageStr = (String) requestMap.get("languageStr"); 
?
return object
}

The method returns an object of appropriate type depending on the where it is used. The details of return types are explained in the following sections.