Defining a top object definition in the explorer view

When you open a tool and select a store, the Management Center framework populates the explorer view with each child of the top object. You can load these child objects dynamically using the wcfGetChildrenService class, or you can instantiate the child objects as part of the top object definition's template.

Before you begin

Before defining a top object definition, review the following classes:

Procedure

  1. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
  2. 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.
  3. 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.
  4. Create your new top object file:
    OptionDescription
    WebSphere Commerce Version 7.0.0.0Feature Pack 1OpenLaszlo top object library file WebSphere Commerce Version 7.0.0.0Feature Pack 1Use the following syntax to create this file: Management_Center_componentname in camel caseTopObjectDefinition.lzx. For example, CatalogTopObjectDefinition.lzx. Within this file, the class name must follow this syntax: three-character Management Center component code in lower caseManagement_Center_componentTopObjectDefinition. For example, catCatalogTopObjectDefinition.
    Introduced in Feature Pack 2Top object definition file Introduced in Feature Pack 2Use the following syntax to create this file: Management_Center_componentname in camel caseTopObjectDefinition.def. For example, CatalogTopObjectDefinition.def. Within this file, the definition name must follow this syntax: three-character Management Center component code in lower caseManagement_Center_componentTopObjectDefinition. For example, catCatalogTopObjectDefinition.
  5. Within the new top object file:
    OptionDescription
    WebSphere Commerce Version 7.0.0.0Feature Pack 1OpenLaszlo top object library file WebSphere Commerce Version 7.0.0.0Feature Pack 1
    1. Create the new top object definition class. The following code snippet shows a sample top object definition class:
      <class name="catCatalogTopObjectDefinition" extends="wcfTopObjectDefinition" organizedObjectTypes="SalesCatalog"> 
      
          <!--- Retrieves the {@link catCatalogPrimaryObjectDefinition} child objects. --> 
       1   <wcfGetChildrenService url="/cmc/GetMasterCatalogObject" objectTypes="Catalog"> 
              <wcfServiceParam name="storeId"/> 
          </wcfGetChildrenService> 
      
          <!--- Retrieves the {@link catSalesCatalogPrimaryObjectDefinition} child objects. --> 
        1  <wcfGetChildrenService url="/cmc/GetSalesCatalogs" objectTypes="SalesCatalog"> 2
              <wcfServiceParam name="storeId"/> 
              <wcfServiceParam name="defaultLanguageId"/> 
          </wcfGetChildrenService> 
      
          <dataset name="template"> 3
              <object objectType="UnassignedCatalogEntries"/> 
          </dataset> 
      
      </class> 
      1 wcfGetChildrenService
      Returns the master catalog and the sales catalogs.
      2 organizedObjectTypes
      Instructs the Management Center framework to include each new instance of SalesCatalog as a child of the top object.
      3 template
      Instantiates an organizational object that is the parent of all unassigned catalog entries.
    2. Instantiate the new class as a child of the wcfBusinessObjectEditor instance:
      class name="extMyTool" extends="wcfBusinessObjectEditor"> 
      
      ... 
      
      <!—- Instantiate the top object definition --> 
      <extMyTopObject/> 
      
      ... 
    Introduced in Feature Pack 2Top object definition file Introduced in Feature Pack 2
    1. Create the new top object definition. The following code snippet shows a sample top object definition:
      <TopObjectDefinition definitionName="catCatalogTopObjectDefinition"
      	2 organizedObjectTypes="SalesCatalog">
      
          <!--- Retrieves the Catalog child objects. --> 
          1 <GetChildrenService url="/cmc/GetMasterCatalogObject" objectTypes="Catalog"> 
              <ServiceParam name="storeId"/> 
          </GetChildrenService> 
      
          <!--- Retrieves the SalesCatalog child objects. --> 
          1 <GetChildrenService url="/cmc/GetSalesCatalogs" objectTypes="SalesCatalog">
              <ServiceParam name="storeId"/>
              <ServiceParam name="defaultLanguageId"/>
          </GetChildrenService>
      
          3 <Xml name="template">
              <object objectType="UnassignedCatalogEntries"/>
          </Xml>
      
      </TopObjectDefinition>
      1 GetChildrenService
      Returns the master catalog and the sales catalogs.
      2 organizedObjectTypes
      Instructs the Management Center framework to include each new instance of SalesCatalog as a child of the top object.
      3 template
      Instantiates an organizational object that is the parent of all unassigned catalog entries.
    2. Add the new definition as a child element of the wcfBusinessObjectEditor definition:
      <BusinessObjectEditor definitionName="extMyTool"> 
      
      	... 
      
      	<!-- Add the top object definition --> 
      	<TopObjectDefinition baseDefinitionName="extMyTopObject"/>
      
      	... 
      
      </BusinessObjectEditor>
  6. WebSphere Commerce Version 7.0.0.0Feature Pack 1Add this new top 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.