Defining the main Recipes tool definition

In this lesson, you define the main definition for the Recipes tool. The tool definition must extend the Business Object Editor class, which is the base class for all Management Center tools. The business object editor includes support for the menu, toolbar, search widget, explorer view, and utilities view. It is responsible for managing all user interactions that allow the user to edit the business objects that are declared with this business object editor.

About this task

  • A single instance of TopObjectDefinition must be declared as a child of every business object editor. When the business object editor is initialized, an instance of this top object is instantiated.
  • At least one instance of Filter must be declared as a child of every business object editor. This filter is used to filter the objects that display in the explorer view and utilities view browse tab.
  • Multiple instances of OrganizationalObjectDefinition can be declared as children of a business object editor. Organization objects are instantiated only by declaring them in the template of the top object definition or of another organizational object definition.
  • At least one instance of PrimaryObjectDefinition must be declared as a child of every business object editor. There must be a primary object definition for every type of business object that can be returned through a search request or can be located by browsing for objects through the explorer view or utilities view.
  • Multiple instances of SearchDefinition can be declared as children of a business object editor. The search definitions are used to populate the list of search types available from the search area and utilities view search tab.

Procedure

  1. In the Enterprise Explorer view, expand LOBTools > WebContent > WEB-INF > src > xml > mycompany > recipe.
  2. Right-click the recipe folder and select New > File. Name your new file RecipeManagementToolDefinition.xml.
  3. Copy and paste the following sample code into your new file.
    
    <Definitions>
      <BusinessObjectEditor browseUtilityFilterTypes="MasterCategories,SalesCategories,Recipes" 
        definitionName="cmc/recipe/RecipeManagement" displayName="${ExtRecipeResources.recipe_DisplayName}" 
        explorerFilterTypes="Recipes" helpLink="">
        <dependency localName="ExtRecipeResources" moduleName="cmc/recipe/ExtRecipeResources"/>
    
        <!-- Context value for the master catalog id -->
        <ContextValue parameterName="masterCatalogId"/>
    
        <InitService baseDefinition="cmc/catalog/CatalogInitService"/>
    
        <!-- Filter definitions -->
        <ObjectTypeFilter displayName="Recipes" filterType="Recipes" isDefault="true" 
         objectTypes="RecipeCollectionNode,UnassignedRecipeNode,RecipeCollection"/>
        <ObjectTypeFilter baseDefinition="cmc/catalog/MasterCatalogGroupsFilter"/>
        <ObjectTypeFilter baseDefinition="cmc/catalog/SalesCatalogGroupsFilter"/>
    
        <!-- Recipe Top Objects -->
        <TopObjectDefinition baseDefinition="cmc/recipe/RecipeTopObjectDefinition"/>
    
        <!-- Recipe Organizational Objects -->
        <OrganizationalObjectDefinition baseDefinition="cmc/recipe/UnassignedRecipeNode"/>
        <OrganizationalObjectDefinition baseDefinition="cmc/recipe/RecipeCollectionNode"/>
    
        <!-- Recipe Primary Objects -->
        <PrimaryObjectDefinition baseDefinition="cmc/recipe/RecipeCollection"/>
        <PrimaryObjectDefinition baseDefinition="cmc/recipe/Recipe"/>
    
        <!-- search definitions -->
        <SearchDefinition baseDefinition="cmc/recipe/FindRecipes"/>
        <SearchDefinition baseDefinition="cmc/recipe/FindRecipeCollections"/>
    
      </BusinessObjectEditor>
    </Definitions>
  4. Add the new Recipes tool to the application menu:
    1. Expand LOBTools > WebContent > WEB-INF > src > xml > commerce > shell
    2. Open the ApplicationMenuItems.xml file for editing.
    3. Add your new menu definition to the file. Find the line that contains the text Application menu item for opening the Getting Started page., and copy the following code sample before this line.
      
      <!---
           Application menu item for opening the Recipe Management tool.
           Customization Part
      -->
      
      <ApplicationMenuItem actionName="openBusinessObjectEditor" displayName="${ExtRecipeResources.recipe_DisplayName}"
       id="recipeManagement"  package="cmc/shell" toolDefinition="cmc/recipe/RecipeManagement" usage="MyCompany_RecipeTool"/>
      
      Tip: The attribute usage="MyCompany_RecipeTool" refers to the name of the usage policy that is used to determine access to this menu item. You created this MyCompany_RecipeTool policy in a previous lesson.
    4. Locate the following code in the file.
      <dependency localName="shellResources" moduleName="cmc/shell/ShellResources"/>
    5. Add the following code before the line of code that you located. This code includes a dependency for your custom resource bundle so that Management Center can display the properties information that you defined for the new menu item.
      <dependency localName="ExtRecipeResources" moduleName="cmc/recipe/ExtRecipeResources"/>