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
Procedure
- Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
- Complete one of the following steps:
- In the Enterprise Explorer view, expand .
- In the Enterprise Explorer view, expand .
- Create a directory to store your new file.
Option Description OpenLaszlo library file Use 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. Definition file Use 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. - Create your new top object file:
Option Description OpenLaszlo top object library file Use 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.Top object definition file Use 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. - Within the new top object file:
Option Description OpenLaszlo top object library file - 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.
- Instantiate the new class as a child of the wcfBusinessObjectEditor
instance:
class name="extMyTool" extends="wcfBusinessObjectEditor"> ... <!—- Instantiate the top object definition --> <extMyTopObject/> ...
Top object definition file - 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.
- Add the new definition as a child element of the wcfBusinessObjectEditor
definition:
<BusinessObjectEditor definitionName="extMyTool"> ... <!-- Add the top object definition --> <TopObjectDefinition baseDefinitionName="extMyTopObject"/> ... </BusinessObjectEditor>
- Create the new top object definition class. The following code
snippet shows a sample top object definition class:
- Add this new top object library file to the application.
What to do next
Version | Steps |
---|---|
|
|
|