Task command接口:
public interface CreateAccountCmd extends com.ibm.commerce.command.TaskCommand {
/**
* The IBM copyright notice field.
*/
public static final String COPYRIGHT = com.ibm.commerce.copyright.IBMCopyright.SHORT_COPYRIGHT;
/**
* The name of this interface.
*/
public final static String NAME = "com.ibm.commerce.account.commands.CreateAccountCmd";
/**
* The name of the default implementation class.
*/
public final static String defaultCommandClassName = "com.ibm.commerce.account.commands.CreateAccountCmdImpl";
...
}
Task command实现类:
public class CreateAccountCmdImpl extends com.ibm.commerce.command.TaskCommandImpl implements CreateAccountCmd {
/**
* The IBM copyright notice field.
*/
public static final String COPYRIGHT = com.ibm.commerce.copyright.IBMCopyright.SHORT_COPYRIGHT;
/**
* The name of the default implementation.
*/
public final static String CLASSNAME = "com.ibm.commerce.account.commands.CreateAccountCmdImpl";
...
public void performExecute() throws ECException {
final String methodName = "performExecute";
ECTrace.entry(ECTraceIdentifiers.COMPONENT_CONTRACT, this.getClass().getName(), methodName);
super.performExecute();
}
...
}
task command被别的代码调用时:
CreateAccountCmd task =
(CreateAccountCmd) CommandFactory.createCommand(
CreateAccountCmd.class.getName(),
storeId);
task.setCommandContext(getCommandContext());
task.setAccountElement(accountElement);
task.execute();
inAccountId = task.getAccountId();
task command sample code
最新推荐文章于 2024-06-29 14:56:44 发布