This example invokes the emxIndentedTable.jsp with preProcessJPO: ${COMMON_DIR}/emxIndentedTable.jsp?mode=Edit&table=<indentedtable_name> &preProcessJPO=< JPO Name>:<Method Name> If both a preProcessURL and preProcessJPO are specified, the preProcessURL is processed first, then the preProcessJPO is processed. The pre process JPO specifies the programMap as an argument for the pre processing. The programMap contains the following HashMaps:
The above maps are packed using the packArgs method supported by JPO and passed to the pre process JPO being invoked. The pre process JPO can unpack this input parameter and use it for custom coding. You can read the arguments passed for the pre process JPO as given below HashMap programMap = (HashMap) JPO.unpackArgs(args); HashMap paramMap = (HashMap) programMap.get("paramMap"); HashMap requestMap = (HashMap) programMap.get("requestMap"); HashMap tableMap = (HashMap) programMap.get("tableMap"); The requestMap contains the languageStr. You can read the value as shown below: String languageStr = requestMap.get("languageStr"); The JPO can use the same method as described in Pre Process URL for an Editable Structure Browser, to get the objectList, or it can obtain them from the programMap that the table component passes to the JPO. The following code sample shows how a custom processing JPO can iterate through the table objectIds. This example reserves all of the objects in the objectList (as would likely be done in a preprocessing JPO): // unpack the incoming arguments into a HashMap called 'programMap' HashMap programMap = (HashMap)JPO.unpackArgs(args); // get the 'tableData' HashMap from the programMap HashMap HashMap tableData = (HashMap) programMap.get("tableData"); // get the 'objectList' MapList from the tableData HashMap MapList objectList = (MapList) tableData.get("ObjectList"); // loop through the objectList's list of object Maps Iterator objectListItr = objectList.iterator(); while(objectListItr.hasNext()){ // get the current object Map Map curObjectMap = (Map) objectListItr.next(); // get the current object's objectId from the current object Map String curObjectId = (String) curObjectMap.get("id"); // a comment to pass along with the object reserve operation String reserveComment = "This object is Reserved"; // create a BusinessObject, open the object, reserve the object, close the object BusinessObject curBusObject = new BusinessObject(curObjectId); curBusObject.open(context); curBusObject.reserve(context,reserveComment); curBusObject.close(context); } The pre process JPO returns a HashMap containing the keys defined in this table.
If the value of the Action key is Continue, then the system displays the standard edit page. If the value of the Action key is Stop, then the system does not display the standard edit page. If the Message key contains a value, it displays to the user as an alert message on top of the editable page (which is blank if the Action is Stop). When the user clicks OK in the message dialog, then the editable form page displays (if Action is Continue) or the blank form is closed (if Action is Stop). When the blank window is closed (when Action=STOP; Message contains a value), the onUnload event (cancelProcessJPO or cancelProcessURL) should not be called. |