Tutorials > Contracts > Extend the existing contract model


Register the new terms and conditions object

This section refers to relating a terms and conditions object to a new business policy.

In the WebSphere Commerce contracts and policies framework, terms and conditions (also referred to as terms) provide a way to describe an agreement between a buyer and a seller. Terms and conditions can be used in various types of trading agreements, such as contract and RFQ. Terms and conditions objects usually refer to business policies with an optional adjustment. For example, a price terms and conditions object is created by choosing one of the price policy objects. In the price term, an account manager can make adjustments to the store standard price, such as:

Each of the adjustments is specified as a term and condition.

When you create a new business policy, there must be at least one terms and conditions object that refers to this business policy, if the policy is to be used in a contract. You can either relate an existing term and condition object to the new business policy (this is done by capturing the relationship between the existing terms and conditions object and the new business policy in the XSD (XML schema definition) files), or you can create a new terms and conditions object that is related to the new business policy.

In the following sections, we will register the MyTC as our new term and condition object. This object will be created in later steps.


Procedure

  1. Register the new term and condition in the database

    When you are creating a new terms and condition object, you must update the database schema to include this object. The database tables that must be updated are TCTYPE and TCSUBTYPE.

    1. Run the following SQL statements to register the new term and condition in the database:

          insert into TCTYPE (TCTYPE_ID) values ('MyTC');     insert into TCSUBTYPE (TCSUBTYPE_ID, TCTYPE_ID, ACCESSBEANNAME, DEPLOYCOMMAND) 
              values ('MySubTC', 'MyTC', 'com.ibm.commerce.contract.objects.MySubTCAccessBean', 
                  'com.mycompany.mycommands.MySubTCDeployCmd');             
      

  2. Register the new term and condition in the contract XSD

    To create the new XSD file:

    1. Navigate to the WC_eardi../images/locale/screensnap/xml/trading/xsd directory.

    2. In this directory, create a new XSD file called CustomizedBuyerContract.xsd and add the following contents:

         
      <?xml version="1.0"?>    
      <schema targetNamespace="http://www.ibm.com/WebSphereCommerce"
                  xmlns="http://www.w3.org/2001/XMLSchema"
                  xmlns:wc="http://www.ibm.com/WebSphereCommerce"
                  elementFormDefault="qualified"
                  attributeFormDefault="unqualified">             
             
      <!-- include basic trading agreement xsd -->         
             
      <include schemaLocation="BuyerContract.xsd" />        
      <complexType name="MyTCType">            
      <complexContent>                
      <extension base="wc:TermConditionType"/>            
      </complexContent>        
      </complexType>        
      <element name="MySubTC" substitutionGroup="wc:AbstractCustomizedTC">            
      <complexType>                
      <complexContent>                    
      <extension base="wc:MyTCType">                        
      <sequence>                            
      <element ref="wc:ProductSetPolicyRef"/>                        
      </sequence>                        
      <attribute name="attr1" type="normalizedString" 
                                   use="required"/>                        
      <attribute name="attr2" type="int" use="required"/>                    
      </extension>                
      </complexContent>            
      </complexType>        
      </element>         
         
      </schema>             
      

    3. Save the new file.

  3. Use the new contract XSD file

    In this step, we update the Package.xsd file to remove the BuyerContract.xsd file and instead include the CustomizedBuyerContract.xsd file,...

    1. Navigate to the following WC_eardi../images/locale/screensnap/xml/trading/xsd directory.

    2. Open the Package.xsd file in a text editor.

    3. Locate the section about the BuyerContract.xsd and modify it...

         
      <!--include schemaLocation="BuyerContract.xsd"/-->    
      <include schemaLocation="CustomizedBuyerContract.xsd"/>             
      


Previous topic:
Create a new business policy


Next topic: Create the enterprise bean


+

Search Tips   |   Advanced Search