Deploying custom extended terms
When you created the entry in the TCSUBTYPE table for an extended term, you had a choice of specifying its deploy command. If you did not specify the value, then no deployment command is called to deploy the extended term during the contract deployment process.
About this task
You can also deploy a new term with a custom deployment
command. The custom command that is recorded in the TCSUBTYPE table
is used for deployment. The deployment command must implement an interface
that extends com.ibm.commerce.contract.commands.DeployExtendedTCCmd,
and
the command must extend com.ibm.commerce.contract.commands.DeployExtendedTCCmdImpl
.
To use a custom deployment command to deploy an extended term:
Procedure
Example
- YourTctypeID as the value for
ExtendedTC
- YourTcSubtypeI as the value for
SurChargeTC
- YourDeployCommandName as the value for
com.ibm.commerce.sample.contract.commands.DeploySurchargeTCCmd
Example interface:
package com.ibm.commerce.sample.contract.commands;
import java.util.*;
import com.ibm.commerce.command.*;
public interface DeploySurchargeTCCmd extends
com.ibm.commerce.contract.commands.DeployExtendedTCCmd
{
/**
* The fully qualified name of this class.
*/
public final static String NAME =
"com.ibm.commerce.productset.commands.DeploySurchargeTCCmd";
/**
* The fully qualified name of the default implementation
class.
*/
public static String defaultCommandClassName =
"com.ibm.commerce.productset.commands.DeploySurchargeTCCmdImpl";
}
Example implementation:
package com.ibm.commerce.sample.contract.commands;
import com.ibm.commerce.contract.objects.*;
import com.ibm.commerce.contract.helper.*;
DeploySurchargeTCCmdImpl.java
public class DeploySurchargeTCCmdImpl extends
com.ibm.commerce.contract.commands.DeployExtendedTCCmdImpl
implements DeploySurchargeTCCmd
{
public void performExecute() throws ECException{
ECTrace.entry(ECTraceIdentifiers.COMPONENT_CONTRACT,
this.CLASSNAME, "performExecute");
try{
if(this.tcId != null){
ExtendedTermConditionAccessBean etcAB = new
ExtendedTermConditionAccessBean();
etcAB.setInitKey_referenceNumber(com.ibm.commerce.base.objects.WCSStringConverter
.LongToString(tcId));
Map properties = etcAB.getProperties();
ECTrace.trace(ECTraceIdentifiers.COMPONENT_CONTRACT,
this.CLASSNAME, "performExecute","The properties of the TC which
TermCond_id='"+
com.ibm.commerce.base.objects.WCSStringConverter.LongToString((Long)tcId)+"'
is:"+ properties.toString());
}
}catch(Exception e){
ECTrace.trace(ECTraceIdentifiers.COMPONENT_CONTRACT,
this.CLASSNAME, "performExecute","An exception was thrown when
deploying the extended TC:");
e.printStackTrace();
}
ECTrace.exit(ECTraceIdentifiers.COMPONENT_CONTRACT,
this.CLASSNAME, "performExecute");
}
}