Creating the object definition for the customer segment attribute

Create a new object definition for the new customer segment attribute to collect input from the Management Center user interface. When business users fill in data about the new attribute in a customer segment, the object definition persists the data in the MGPCONDELE database table.

Before you begin

Review the following topics to ensure that you understand object definitions in Management Center and the wcfChildObjectDefinition class that you must extend:
You must also understand the following object definitions:
Option Description
Base object definition classes
Base object definitions

These definitions are stored in the LOBTools/WebContent/config/commerce/marketing/restricted/customerSegment/CustomerSegmentElementObjectDefinition.def file.

Review the MGPCONDELE table:

About this task

In the Marketing tool, each customer segment attribute must have an object definition. Each object definition is an extension class of the wcfChildObjectDefinition class.

Procedure

  1. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
  2. Create a directory to store your new customer segment object definition.
    Use a directory structure similar to the following example:
    • WebSphere Commerce Version 7.0.0.0Feature Pack 1LOBTools/WebContent/WEB-INF/src/lzx/your_company_name/marketing/objectDefinitions/customerSegment/
    • Introduced in Feature Pack 2LOBTools/WebContent/config/your_company_name/marketing/objectDefinitions/customerSegment/
  3. Create the new file for the customer segment attribute object definition:
    OptionDescription
    WebSphere Commerce Version 7.0.0.0Feature Pack 1OpenLaszlo class file WebSphere Commerce Version 7.0.0.0Feature Pack 1Name the file using this syntax: attribute_nameObjectDefinition.lzx; for example, LoyaltyPointsObjectDefinition.lzx.
    Introduced in Feature Pack 2Definition file Introduced in Feature Pack 2Name the file using this syntax: attribute_nameObjectDefinition.def; for example, LoyaltyPointsObjectDefinition.def.
  4. Define the new customer segment attribute object definition:
    OptionDescription
    WebSphere Commerce Version 7.0.0.0Feature Pack 1Create a new child object class WebSphere Commerce Version 7.0.0.0Feature Pack 1
    1. Define a new child object class to represent a customer segment attribute OR list or AND list condition that:
      Here is an example:
      <library> 
      <class
          name = "mktLoyaltyPointsListObjectDefinition"
          extends = "wcfChildObjectDefinition"
          objectType = "LoyaltyPointsList"
          baseType = "mktCSElementAndOrListConditionObjectDefinition">
          <wcfChildObjectDefinition
              objectType = "LoyaltyPointsCondition"
              baseType = "mktCSElementSimpleConditionObjectDefinition">
              <dataset name = "template">
                  <conditionVariable>loyalty</conditionVariable>
              </dataset>
              <wcfPropertyDefinition
                  propertyName = "conditionValue"
                  required = "true"
                  type = "integer"
                  displayName = "Number of points"/>
          </wcfChildObjectDefinition>
      </class>
    2. Define another new child object class that:
      • Extends from wcfChildObjectDefinition.
      • Has a globally unique objectType value.
      • Is a singleInstance object.
      • Has a templateTypeProperty defined.
      • Has an idProperty of elementName.
      • Has a dataset named template.
      • Has one or more child wcfObjectTemplate objects defined.
      • Contains a child instance of a class that extends from mktCSElementAndOrListConditionObjectDefinition.
      Here is an example:
      <class
          name = "extLoyaltyPointsObjectDefinition"
          extends = "wcfChildObjectDefinition"
          objectType = "LoyaltyPoints"
          singleInstance = "true"
          templateTypeProperty = "template"
          idProperty = "elementName">
          <dataset name = "template">
              <elementName>LoyaltyPoints</elementName>
              <template>ignore</template>
          </dataset>
          <mktLoyaltyPointsListObjectDefinition/>
          <wcfObjectTemplate templateType = "ignore" displayName = "Ignore customer loyalty points">
              <dataset name = "template"/>
          </wcfObjectTemplate>
          <wcfObjectTemplate templateType = "lessThan" displayName = "Number of points is less than or equal to the following number">
              <dataset name = "template">
                  <object objectType = "LoyaltyPointsList">
                      <elementName>loyalty</elementName>
                      <conditionUsage>orListCondition</conditionUsage>
                      <object objectType = "LoyaltyPointsCondition">
                          <conditionOperator>&lt;=</conditionOperator>
                      </object>
                  </object>
              </dataset>
          </wcfObjectTemplate>
          <wcfObjectTemplate templateType = "greaterThan" displayName = "Number of points is greater than or equal to the following number">
              <dataset name = "template">
                  <object objectType = "LoyaltyPointsList">
                      <elementName>loyalty</elementName>
                      <conditionUsage>orListCondition</conditionUsage>
                      <object objectType = "LoyaltyPointsCondition">
                          <conditionOperator>&gt;=</conditionOperator>
                      </object>
                  </object>
              </dataset>
          </wcfObjectTemplate>
          <wcfObjectTemplate templateType = "between" displayName = "Number of points is within the following range">
              <dataset name = "template">
                  <object objectType = "LoyaltyPointsList">
                      <elementName>loyalty</elementName>
                      <conditionUsage>andListCondition</conditionUsage>
                      <object objectType = "LoyaltyPointsCondition" name="upperBound">
                          <conditionOperator>&lt;=</conditionOperator>
                      </object>
                      <object objectType = "LoyaltyPointsCondition" name="lowerBound">
                          <conditionOperator>&gt;=</conditionOperator>
                      </object>
                  </object>
              </dataset>
          </wcfObjectTemplate>
      </class>
      </library> 
    Introduced in Feature Pack 2Create a new child object definition Introduced in Feature Pack 2
    1. Define a new child object definition to represent a customer segment attribute OR list or AND list condition that:
      Here is an example:
      <Definitions> 
         <ChildObjectDefinition
            definitionName = "mktLoyaltyPointsListObjectDefinition"
            objectType = "LoyaltyPointsList"
            baseDefinitionName = "mktCSElementAndOrListConditionObjectDefinition">
            <ChildObjectDefinition
               objectType = "LoyaltyPointsCondition"
               baseType = "mktCSElementSimpleConditionObjectDefinition">
               <Xml name = "template">
                  <conditionVariable>loyalty</conditionVariable>
               </Xml>
               <PropertyDefinition
                  propertyName = "conditionValue"
                  required = "true"
                  type = "integer"
                  displayName = "Number of points"/>
            </ChildObjectDefinition>
         </ChildObjectDefinition>
      </Definitions>
    2. Define another new child object definition that:
      • Extends from wcfChildObjectDefinition.
      • Has a globally unique objectType value.
      • Is a singleInstance object.
      • Has a templateTypeProperty defined.
      • Has an idProperty of elementName.
      • Has an Xml element named template.
      • Has one or more child ObjectTemplate elements defined.
      • Contains a child definition that is based on mktCSElementAndOrListConditionDefinition.
      Here is an example that adds this new child object definition as a child element of the Definitions element:
      <ChildObjectDefinition
         definitionName = "extLoyaltyPointsObjectDefinition"
         objectType = "LoyaltyPoints"
         singleInstance = "true"
         templateTypeProperty = "template"
         idProperty = "elementName">
         <Xml name = "template">
            <elementName>LoyaltyPoints</elementName>
            <template>ignore</template>
         </Xml>
         <ChildObjectDefinition baseDefinitionName = "mktLoyaltyPointsListObjectDefinition"/>
         <ObjectTemplate templateType = "ignore"
            displayName = "Ignore customer loyalty points">
            <Xml name = "template"/>
         </ObjectTemplate>
         <ObjectTemplate templateType = "lessThan"
            displayName = "Number of points is less than or equal to the following number">
            <Xml name = "template">
               <object objectType = "LoyaltyPointsList">
                  <elementName>loyalty</elementName>
                  <conditionUsage>orListCondition</conditionUsage>
                  <object objectType = "LoyaltyPointsCondition">
                     <conditionOperator><=</conditionOperator>
                  </object>
               </object>
            </Xml>
         </ObjectTemplate>
         <ObjectTemplate templateType = "greaterThan"
            displayName = "Number of points is greater than or equal to the following number">
            <Xml name = "template">
               <object objectType = "LoyaltyPointsList">
                  <elementName>loyalty</elementName>
                  <conditionUsage>orListCondition</conditionUsage>
                  <object objectType = "LoyaltyPointsCondition">
                     <conditionOperator>&gt;=</conditionOperator>
                  </object>
               </object>
            </Xml>
         </ObjectTemplate>
         <ObjectTemplate templateType = "between"
            displayName = "Number of points is within the following range">
            <Xml name = "template">
               <object objectType = "LoyaltyPointsList">
                  <elementName>loyalty</elementName>
                  <conditionUsage>andListCondition</conditionUsage>
                  <object objectType = "LoyaltyPointsCondition" name="upperBound">
                     <conditionOperator><=</conditionOperator>
                  </object>
                  <object objectType = "LoyaltyPointsCondition" name="lowerBound">
                     <conditionOperator>&gt;=</conditionOperator>
                  </object>
               </object>
            </Xml>
          </ObjectTemplate>
      <ChildObjectDefinition>
  5. WebSphere Commerce Version 7.0.0.0Feature Pack 1Add a reference to the new object definition file in the MarketingExtensionsLibrary.lzx file.

    The file is stored at this path:

    LOBTools/WebContent/WEB-INF/src/lzx/commerce/marketing/

    The line of code that references the new object definition should look like the following example:

    <include href="../../your_company_name/marketing/objectDefinitions/customerSegment/attribute_nameObjectDefinition.lzx"/>

  6. Register the new object with the top customer segment AND list object definition:
    OptionDescription
    WebSphere Commerce Version 7.0.0.0Feature Pack 1Open the LOBTools/WebContent/WEB-INF/src/lzx/commerce/marketing/objectDefinitions/customerSegment/TopAndListObjectDefinition.lzx file WebSphere Commerce Version 7.0.0.0Feature Pack 1
    1. Add an instance of the new customer segment condition single instance object by inserting a line similar to the following example (see the line in bold font):
      <class name="mktTopAndListObjectDefinition"
      	extends="wcfChildObjectDefinition"
      	objectType="TopAndList" idProperty="elementName">
      
      	<!-- ... -->
      	<extLoyaltyPointsObjectDefinition/>
      	<!-- ... -->
      </class>
    2. Save and close the file.
    Introduced in Feature Pack 2Open the LOBTools/WebContent/config/commerce/marketing/objectDefinitions/customerSegment/TopAndListObjectDefinition.def file Introduced in Feature Pack 2
    1. Add an instance of the new customer segment condition single instance object by inserting an element similar to the following example (see the line in bold font):
      <ChildObjectDefinition definitionName="mktTopAndListObjectDefinition"
      	idProperty="elementName" objectType="TopAndList">
      	…
      	<ChildObjectDefinition baseDefinitionName="mktZipCodeObjectDefinition"/>
      	…
      </ChildObjectDefinition>
    2. Save and close the file.