Example: Calling a Business Function with Audit Parameters
The following code sample is an example of a dynamic Java connector calling a business function that performs a purchase order, and it shows the parameters required for passing audit information. Step 4 contains the input values for a purchase order business function and step 5 contains the audit data set for the purchase order.
//Step 1: Login: int sessionID = Connector.getInstance().login("user", "pwd", "env", "role"); //Pre-condition: Create the SpecDictionary or BSFNSpecSource BSFNSpecSource specSource = new OneworldBSFNSpecSource(sessionID); //The dynamic Java connector enables you to use hash tables to enter parameter values. This example code illustrates how to use the HashMap class to enter parameter values: Map input = new HashMap(); //The dynamic Java connector enables you to use hash tables to retrieve output values. This example code illustrates how to use the Hash table class to retrieve output values: Map output = addressbook.getValues(); // Step 2: Look up the business function method from SpecDictionary or BSFNSpec Source: BSFNMethod bsfnMethod = (BSFNMethod)specSource.getBSFNMethod("F4311EndDoc"); // Step 3: Create the executable method from the business function metadata: ExecutableMethod purchaseorder = bsfnMethod.createExecutable(); // Step 4: Set parameter values: purchaseorder.setValues(inputParams); purchaseorder.setValue("mnJobNumber",""); purchaseorder.setValue("mnOrderNumberAssigned",""); purchaseorder.setValue("szRelatedOrderType",""); purchaseorder.setValue("szComputerID",""); purchaseorder.setValue("cUseWorkFiles",""); purchaseorder.setValue("mnProcessID",""); purchaseorder.setValue("mnTransactionID",""); //Step 5: Set GUID,ApplicationID,WorkstationName,IPAddress for Audit purchaseorder.setGUID("10.139.193.107.3434235324223423"); purchaseorder.setApplicationID("INTEROP") purchaseorder.setWorkstationName("DENOSCL244"); purchaseorder.setIPAddress("10.139.193.107"); // Step 6: Execute the business function: try { BSFNExecutionWarning warning=purchaseorder.execute(sessionID);