Develop > Controller layer > Application developer > Trading subsystem > Extensions to terms and conditions


Deploy 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.

You can also deploy a new term using a custom deployment command. The custom command 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

  1. Create a new interface (like DeploySurchargeTCCmd in the following sample) by extending com.ibm.commerce.contract.commands.DeployExtendedTCCmd.  The variable defaultCommandClassName of the new interface should be defined to be the name of the new deployment command in Step 2 (like DeploySurchargeTCCmdImpl in the following sample).

  2. Create a new deployment command (like DeploySurchargeTCCmdImpl in the following sample) by extending com.ibm.commerce.contract.commands.DeployExtendedTCCmdImpl and implementing the new interface.

  3. Compile the Java classes and copy the class files into a new JAR file. Add the new JAR file to the class path.

  4. If you have not defined a entry for the new term in the TCSUBTYPE table, run the following SQL statement: insert into tcsubtype(TCSUBTYPE_ID, TCTYPE_ID, ACCESSBEANNAME, DEPLOYCOMMAND) Values ( 'YourTcSubtypeID','YourTctypeID', null, 'YourDeployCommandName'); If you already defined a entry for the new term in the TCSUBTYPE table, run the following SQL statement: update tcsubtype set DEPLOYCOMMAND= 'YourDeployCommandName'where tcsubtype_id= 'YourTcSubtypeId'; In the following sample, YourTctypeID is ExtendedTC, YourTcSubtypeI is SurChargeTC, and YourDeployCommandName is com.ibm.commerce.sample.contract.commands.DeploySurchargeTCCmd


Results

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");   }
       

}


Related concepts

What's new in terms and conditions

Import and exporting contracts with extended terms defined

Extensions to terms and conditions

Related reference

TCConfiguration.xml file


+

Search Tips   |   Advanced Search