Defining a primary object

You can use primary object definitions to describe the business objects that are managed by a business object editor, such as products, campaigns, and promotions.

Before you begin

Before defining a primary object, ensure that you:
  1. Review the Management Center modeling guidelines.
  2. Create the Management Center services required to support the primary object, such as create, update, delete, or search services.
  3. Work with these services to develop client libraries, new commands, and business logic.
  4. Create new Management Center objects.
  5. Review the lzx/commerce/foundation/restricted/ObjectDefinition.lzx/wcfPrimaryObjectDefinition class for more information about primary object definitions.

Procedure

  1. Select a unique object type, such as Product.
  2. Define an image that the Management Center can use to display instances of this object type.
  3. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
  4. Complete one of the following steps:
    • WebSphere Commerce Version 7.0.0.0Feature Pack 1In the Enterprise Explorer view, expand LOBTools > WebContent > WEB-INF > src > lzx.
    • Introduced in Feature Pack 2In the Enterprise Explorer view, expand LOBTools > WebContent > config.
  5. Create a directory to store your new file.
    OptionDescription
    WebSphere Commerce Version 7.0.0.0Feature Pack 1OpenLaszlo library file WebSphere Commerce Version 7.0.0.0Feature Pack 1Use a directory structure similar to the following example: LOBTools/WebContent/WEB-INF/src/lzx/your_company_name/Management_Center_component/objectDefinitions, where Management_Center_component is the name of your new custom tool.
    Introduced in Feature Pack 2Definition file Introduced in Feature Pack 2Use a directory structure similar to the following example: LOBTools/WebContent/config/your_company_name/Management_Center_component/objectDefinitions, where Management_Center_component is the name of your new custom tool.
  6. Create your new primary object file:
    OptionDescription
    WebSphere Commerce Version 7.0.0.0Feature Pack 1OpenLaszlo primary object library file WebSphere Commerce Version 7.0.0.0Feature Pack 1For example, ProductPrimaryObjectDefinition.lzx. Within this file, the class name must follow this syntax: three-character Management Center component code in lower caseManagement_Center_componentPrimaryObjectDefinition. For example, catProductPrimaryObjectDefinition.
    Introduced in Feature Pack 2Primary object definition file Introduced in Feature Pack 2For example, ProductPrimaryObjectDefinition.def. Within this file, the definition name must follow this syntax: three-character Management Center component code in lower caseManagement_Center_componentPrimaryObjectDefinition. For example, catProductPrimaryObjectDefinition.
  7. Within the new primary object file:
    OptionDescription
    WebSphere Commerce Version 7.0.0.0Feature Pack 1OpenLaszlo primary object library file WebSphere Commerce Version 7.0.0.0Feature Pack 1
    1. Create the new primary object definition class. The following code snippet shows a sample primary object definition class:
      <class name="extMyPrimaryObjectDefinition" 
          extends="wcfPrimaryObjectDefinition" 
          objectType="MyPrimaryObject" 
          icon="myPrimaryObjectIcon" 
          headerIcon="myPrimaryObjectHeaderIcon" 
          propertiesClass="myPrimaryObjectProperties" 
          idProperty="myIdProperty" 
          displayNameProperty="myDisplayNameProperty" 
          displayName="${myResources.myPrimaryObject_DisplayName.string}" 
          newDisplayName="${myResources.myPrimaryObject_NewDisplayName.string}"> 
      
          ... 
      
      </class> 
    2. Specify the create, update, or delete services for the primary object.
    3. Specify any custom services to be used by the primary object.
    4. Declare the property definitions for this primary object.
    5. Declare the child objects for this primary object.
    6. Declare the reference objects for this primary object.
    Introduced in Feature Pack 2Primary object definition file Introduced in Feature Pack 2
    1. Create the new primary object definition. The following code snippet shows a sample primary object definition:
      <PrimaryObjectDefinition definitionName="extMyPrimaryObjectDefinition"
          objectType="MyPrimaryObject"
          icon="myPrimaryObjectIcon"
          headerIcon="myPrimaryObjectHeaderIcon"
          propertiesDefinitionName="myPrimaryObjectProperties"
          idProperty="myIdProperty"
          displayNameProperty="myDisplayNameProperty"
          displayName="${myResources.myPrimaryObject_DisplayName}"
          newDisplayName="${myResources.myPrimaryObject_NewDisplayName}">
      
          ... 
      
      </PrimaryObjectDefinition>
    2. Specify the create, update, or delete services for the primary object.
    3. Specify any custom services to be used by the primary object.
    4. Declare the property definitions for this primary object.
    5. Declare the child objects for this primary object.
    6. Declare the reference objects for this primary object.
  8. Open the file that contains the business object editor and complete one of the following steps:
    OptionDescription
    WebSphere Commerce Version 7.0.0.0Feature Pack 1Instantiate the new primary object definition class as a child of the business object editor class WebSphere Commerce Version 7.0.0.0Feature Pack 1
    <class name="extMyTool" extends="wcfBusinessObjectEditor"> 
    
        ... 
    
        <!—- Primary object definitions --> 
        <extMyPrimaryObjectDefinition/> 
    
        ... 
    
    </class> 
    Introduced in Feature Pack 2Add the new primary object definition as a child element of the business object editor definition Introduced in Feature Pack 2
    <BusinessObjectEditor definitionName="extMyTool"> 
    
        ... 
    
        <!-- Primary object definitions --> 
        <PrimaryObjectDefinition definitionName="extMyPrimaryObjectDefinition"/> 
    
        ... 
    
    </BusinessObjectEditor>
  9. WebSphere Commerce Version 7.0.0.0Feature Pack 1Add the new primary object library file to the application.

What to do next

After you complete your customization:
Version Steps
  1. Right-click LOBTools Project; then click Build OpenLaszlo Project to produce an updated ManagementCenter.swf file under the workspace_dir\LOBTools\WebContent directory. This setting is the default environment setting.
  2. Test your changes by viewing them in the Management Center, using this URL: https://hostname:8000/lobtools.
  3. Deploy your changes to your production environment.
Introduced in Feature Pack 2
  1. Test your changes by viewing them in the Management Center, using this URL: https://hostname:8000/lobtools.
  2. Deploy your changes to your production environment.