ex6_72.txt
来自「j2ee core design patterns」· 文本 代码 · 共 34 行
TXT
34 行
Example 6.72 ViewAccountDetailsCommand
public class AccountCommand implements Command {
public AccountCommand() { }
// view account details operation
public ResponseContext execute(RequestContext requestContext) {
String accountId =
requestContext.getStringParameter("AccountId");
/** Use an business delegate to retrieve data
* from application service, and store result
* in a response object.
* Note: Object creation could be avoided via
* factory, but for example purposes object
* instantiation is shown **/
AccountDelegate delegate = new AccountDelegate();
AccountTO accountTO;
accountTO= delegate.getAccountProfile(accountId);
// This info could come from biz-tier components
String logicalViewName = "AccountProfile";
ResponseContextFactory factory =
ResponseContextFactory.getInstance();
ResponseContext responseContext =
factory.createResponseContext(accountTO, logicalViewName);
return responseContext;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?