468 IBM Branch Transformation Toolkit 5.1 Migration and Usage Guidelines
import com.ibm.btt.cs.invoker.base.*;
import com.ibm.btt.cs.servlet.CSConstants;
import javax.naming.InitialContext;
import btt.bank.business.logic.*;
b. Add code to the method parseRequestData(String arg0), which uses
BeanInvokerFormatter instance to unformat the request data and put the
result into a hashtable, as shown in Example 8-51.
Example 8-51 WithdrawalServerOpInvoker.parseRequestData()
try {
//** Prepare session data in ejb parameters
getEjbParameters().put(Constants.SESSION_ID,
getSystemData().getSessionId());
getEjbParameters().put(CSConstants.DATAAPPLICATIONIDKEY,
getSystemData().getSubsessionId());
//** Get BranchId value from request data
Tokenizer tokens = getDelimitedTokenizer(arg0); //The arg0 is request data
BeanInvokerFormatter formatter = getFormatter();
String s = formatter.unformatString((String)tokens.nextToken("#"),null);
getEjbParameters().put("BranchId", s);
//** Get AccountNumber value
s = formatter.unformatString((String)tokens.nextToken("#"),null);
getEjbParameters().put("AccountNumber", s);
//** Get Date value
java.util.Date aDate =
formatter.unformatDate((String)tokens.nextToken("#"),true,"ymd",true,"/");
getEjbParameters().put("Date", aDate);
//** Get Amount value
Float amt = (Float) formatter.unformatFloat((String)tokens.nextToken("#"));
getEjbParameters().put("Amount", amt);
} catch (Exception e) {
throw new DSEInvalidRequestException(Constants.COMPID, "", e.getMessage());
}
c. Add code to the method processRespondData(Object arg0), which uses
BeanInvokerFormatter instance to format the SAE execution result to a
string for client withdrawal operation, as shown in Example 8-52.
Example 8-52 WithdrawalServerOpInvoker.processRespondData()
Hashtable haResult = (Hashtable)arg0;//The arg0 is SAE execution result.
BeanInvokerFormatter formatter = getFormatter();