Modeling Management Center object definitions

In the Management Center, a business object represents an entity that is stored on the WebSphere Commerce Server. The objects that are created to build the Recipe tool were defined in the previous tutorial. For extended sites, the inherited object concept is introduced, and the object definitions must change to support it. In this lesson, you remodel the Recipes tool objects for extended sites.

About this task

To support extended sites, the object definitions are different from other tutorials in the Recipes tool scenario. The object definitions for extended sites must support specific rules and specifications. When a user logs in to the asset store itself, the objects are local and there are no inherited objects; the asset store does not inherit. The same object can be local if you are logged in to the asset store; the object becomes an inherited object when you log in to the extended site. For more information, see Management Center modeling guidelines for extended sites.

In an extended sites model, objects fall into one of the two following categories:
Local objects
Objects belonging to the current store that the business user is logged on.
Inherited objects
Objects that are owned by a parent asset store.
Permission to act on an object depends on where you are logged in and the kind of store access that you have. The permitted actions are a design decision and depend on how you want it to behave. The following table illustrates the design for the extended site relationship within the Recipes tool. The rules to define the extended site relationships are flexible. The assumptions in the following table are only an example for the Recipes tool scenario. You can make your own design decisions for other customizations.
Action Logged in to local store (access only to local store) Logged in to local store (access to both local and asset store) Logged in to asset store
List Recipes Show recipes from the local and asset store. Show recipes from the local and asset store. Show recipes from the asset store.
Update Recipe Update local store recipes. Update local and asset store recipes. Update asset store recipes.
Update/Delete Usage Associations for a Recipe Update/Delete Usage Associations for a Recipe from the local store. Update/Delete Usage Associations for a Recipe from the local + asset store. Update/Delete Usage Associations for a Recipe from the asset store
Create a Usage Association for a Recipe You can create a new usage association for any recipe. The usage association is owned by the local store. The products can come from both stores. You can create a new usage association for any recipe. The usage association is owned by the local store or asset store. For the asset store, the product must come from the asset store. Similar to merchandising associations. Create a Usage Association for a Recipe from the asset store.
Create a Recipe instruction for a Recipe from the asset store If the recipe belongs to the local store, you can add new instruction in the local store. If the recipe belongs in the parent store, you cannot add instruction in the local store. If the recipe belongs to the local store, you can add new instructions in the local store. If the recipe belongs in the parent store, you cannot add instructions in the local store. If the recipe belongs to the local store, you can add new instructions in the local store. If the recipe belongs in the parent store, you cannot add a Recipe instruction. Recipes and recipe instructions must all belong to the same store.
Update Recipe Instruction local local + asset asset
Delete Recipe Instruction local local + asset asset
Create an Ingredient for a Recipe If the recipe belongs to the local store, you can add new ingredient in the local store. If the recipe belongs in the parent store, you cannot add ingredients. local + asset asset
Update/Delete Ingredient local local + asset asset
List Ingredient-CatEntry Association local local + asset asset
Delete Ingredient-CatEntry Associations local local + asset asset
Create Integredient-CatEntry associations local local + asset asset
Assign Recipe to Recipe Collection local local + asset asset
  1. If a user who has access to only the asset store is logged in to the asset store, only the recipes that belong to the asset store are listed.
  2. If a user who has access to only the local store is logged in to the local store, the recipes that belong to the asset store and the local store are listed.
  3. If a user who has access to both the local store and the asset store are logged in to the local store, the recipes that belong to the asset store and the local store are listed.
The following diagram is a UML representation of the user interface object model for the extended sites Recipes tool.
UML representation of the extended sites Recipes tool.
  • Recipe is the primary object.
  • ChildRecipe is a ParentReference Object. It represents the relationship of Recipe and Recipe collection.
  • RecipeNode is a node in an explorer tree view.
  • RecipeNode is an OrganizationalObject.
  1. The Management Center must be able to distinguish local Recipes from inherited Recipes. To do so, two object definitions are required. This requirement holds true for all object definitions that are inherited for your asset store.
  2. The full primary object definition code is contained in the following file:
    • WebSphere Commerce Version 7.0.0.0Feature Pack 1RecipePrimaryObjectDefinition.lzx
    • Feature Pack 2Feature Pack 3RecipePrimaryObjectDefinition.def
    According to Management Center modeling guidelines for extended sites, you must duplicate all your primary business object definitions and introduce:
    • WebSphere Commerce Version 7.0.0.0Feature Pack 1the baseDefinition
    • Feature Pack 2Feature Pack 3a base definition
    The following code samples contain fragments of the object Recipe collection. Compared with the definition in the following topic Defining primary objects, there are three related object type definitions, BaseRecipeCollection, RecipeCollection, and InheritedRecipeCollection. The primary object Recipe also has three related definitions.
    WebSphere Commerce Version 7.0.0.0Feature Pack 1
    
    <!-- this is the base object definition from which all recipe objects will inherit -->
    <class name="
    recBaseRecipeCollectionPrimaryObjectDefinition"
    extends="wcfPrimaryObjectDefinition"
                    isBaseDefinition="true" 
                    creatable="false"
                    idProperty="collectionId"
                    objectType="BaseRecipeCollection"
                    objectGroups="RecipeCollectionGroup"
                   
    displayName="${extRecipeResources.recipeCollection_DisplayName.string}"
                    displayNameProperty="collectionName"    
                   
    newDisplayName="${extRecipeResources.recipeCollection_NewDisplayName.string}"
                    propertiesClass="recCollectionProperties" 
                    searchType="FindRecipeCollections">             
                                
                    ......
    </class>
    
    <!-- this object definition represents the local Recipe object -->
    <class name="
    recRecipeCollectionPrimaryObjectDefinition"
    extends="wcfPrimaryObjectDefinition"
                    idProperty="collectionId"
                    objectType="RecipeCollection"
                    
    baseType="BaseRecipeCollection"
                   
    displayName="${extRecipeResources.recipeCollection_DisplayName.string}"
                    displayNameProperty="collectionName"  
                   
    newDisplayName="${extRecipeResources.recipeCollection_NewDisplayName.string}"
                    creatable="true"
                    icon="catalogIcon"
                    headerIcon="catalogHeaderIcon" >   
                    <wcfCreateService
    sendDefaultLanguageProperties="true"
    url="/cmc/CreateRecipeCollection">
                    <wcfServiceParam name="storeId"/>
                    <wcfServiceParam name="defaultLanguageId"
    parameterName="languageId"/>
                    </wcfCreateService>       
                    ......                                             
        
    </class>  
    
    <!-- this object definition defines Recipe objects that are inherited from the asset store -->
    <class name="
    recInheritedRecipeCollectionPrimaryObjectDefinition"
    extends="wcfPrimaryObjectDefinition"
                    idProperty="collectionId"
                    objectType="InheritedRecipeCollection" 
                    
    baseType="BaseRecipeCollection"
                    creatable="false"
                    icon="inheritedProductIcon"
                    headerIcon="inheritedProductHeaderIcon"       
                    compatibleObjectTypes="RecipeCollection">       
                                              
                    ......
    </class>  
    
    In the preceding code fragments:
    • The wcfCreateService is only defined in the RecipeCollection object definition. The base Recipe object definition is used only as a way of creating a common ancestor for all recipe object types. The Recipe tool never creates instances of the BaseRecipe. Think of this definition as an abstract class. The inherited recipe is only one recipe that is created in the asset store. An inherited recipe cannot be created in the local store. The object definition is marked as creatable="false" or with no creatable attribute. The Management Center framework does not allow you to create objects of this type.
    • Only RecipeCollection object is creatable, and it defines wcfCreateService.
    • The RecipePrimaryObjectDefinition.lzx file includes wcfRegisterObjectDefinition instances. All primary object-related definitions should be registered. All base object definitions must be registered. For more information, see wcfRegisterObjectDefinition.
    Feature Pack 2Feature Pack 3
    <!-- This is the base recipe collection object definition. The RecipeCollection and InheritedRecipeCollection object definitions inherit from this definition.-->
    <PrimaryObjectDefinition definitionName="BaseRecipeCollection"
    	displayName="${extRecipeResources.recipeCollection_DisplayName}"
    	displayNameProperty="collectionName"
    	idProperty="collectionId"
    	isBaseDefinition="true"
    	newDisplayName="${extRecipeResources.recipeCollection_NewDisplayName}"
    	objectGroups="RecipeCollectionGroup"
    	objectType="BaseRecipeCollection"
    	propertiesDefinitionName="recCollectionProperties"
    	searchType="FindRecipeCollections">				
    			......
    </PrimaryObjectDefinition>
    
    <!-- this object definition represents the local Recipe Collection object -->
    <PrimaryObjectDefinition baseDefinitionName="BaseRecipeCollection"
    	creatable="true"
    	definitionName="RecipeCollection"
    	displayName="${extRecipeResources.recipeCollection_DisplayName}"
    	displayNameProperty="collectionName"
    	headerIcon="catalogHeaderIcon"
    	icon="catalogIcon"
    	idProperty="collectionId"
    	newDisplayName="${extRecipeResources.recipeCollection_NewDisplayName}"
    	objectType="RecipeCollection">
    	<CreateService sendDefaultLanguageProperties="true"
    		url="/cmc/CreateRecipeCollection">
    		<ServiceParam name="storeId"/>
    		<ServiceParam name="defaultLanguageId" parameterName="languageId"/>
    	</CreateService>
    </PrimaryObjectDefinition>
    
    <!-- This object definition defines Recipe Collection objects that are inherited from the asset store -->
    <PrimaryObjectDefinition baseDefinitionName="BaseRecipeCollection"
    	compatibleObjectTypes="RecipeCollection"
    	definitionName="InheritedRecipeCollection"
    	headerIcon="inheritedProductHeaderIcon"
    	icon="inheritedProductIcon"
    	idProperty="collectionId"
    	objectType="InheritedRecipeCollection">	
    	<ParentReferenceObjectDefinition baseDefinitionName="recInheritedChildRecipe"/>
    </PrimaryObjectDefinition>
    In the preceding code fragments:
    • The CreateService is only defined in the RecipeCollection object definition. The BaseRecipeCollection object definition is used only as a way of creating a common ancestor for all recipe collection object types. The Recipe tool never creates instances of the BaseRecipeCollection. Think of this definition as an abstract class. The inherited recipe collection can be created only in the asset store. An inherited recipe cannot be created in the local store. The object definition is marked as creatable="false" or with no creatable attribute. The Management Center framework does not allow you to create objects of this type.
    • Only the RecipeCollection object is creatable, and it defines CreateService.
  3. Reference objects also must be redefined. An example can be seen in the following sample code; this code is similar to the code for primary objects, with the following differences:
    • WebSphere Commerce Version 7.0.0.0Feature Pack 1Only the base definition needs wcfRegisterObjectDefinition.
    • The wcfCreateService is defined in the base object.
    Users with the correct authority can create inherited reference objects. The inherited reference object also needs the create service.
    WebSphere Commerce Version 7.0.0.0Feature Pack 1
    <!-- this is the base RecipeAssociationDefinition -->
    <wcfRegisterObjectDefinition objectType="BaseRecipeAssociation"
    	objectDefinitionClass="recBaseRecipeAssociationDefinition" />
    <class name="recBaseRecipeAssociationDefinition"
    	extends="wcfReferenceObjectDefinition" isBaseDefinition="true"
    	objectType="BaseRecipeAssociation" copyProtected="true"
    	objectGroups="RecipeAssociationReferenceGroup"
    	idProperty="associationId" allowDuplicates="false">
    	<wcfCreateService url="/cmc/CreateRecipeAssociation"
    		sendAll="false">
    		<wcfServiceParam name="storeId">
    			<wcfEnablementCondition conditionId="objectTypeCondition"
    				negate="true" checkObjectDefinition="true" propertyName="objectType"
    				enablementValue="InheritedRecipeAssociation" />
    		</wcfServiceParam>
    		<wcfServiceParam name="objectStoreId" parameterName="storeId"
    			propertyName="objectStoreId" parentProperty="true">
    			<wcfEnablementCondition conditionId="objectTypeCondition"
    				checkObjectDefinition="true" propertyName="objectType"
    				enablementValue="InheritedRecipeAssociation" />
    		</wcfServiceParam>
    		<wcfServiceParam name="catentryId" objectPath="CatalogEntry"
    			propertyName="catentryId" />
    		<wcfServiceParam name="recipeId" parentProperty="true" />
    	</wcfCreateService>
    	......
    </class>
    <!-- RecipeAssociation definition. this object definition represents the local RecipeAssociation object -->
    <class name="recRecipeAssociationDefinition"
    	extends="wcfReferenceObjectDefinition" objectType="RecipeAssociation"
    	baseType="BaseRecipeAssociation"
    	referencedTypes="Product,InheritedProduct">
    	<wcfTrueEnablementCondition />
    </class>
    <!--  Inherited  RecipeAssociation definition. this object definition defines RecipeAssociation objects that are inherited from the asset store -->
    <class name="recInheritedRecipeAssociationDefinition"
    	extends="wcfReferenceObjectDefinition"
    	objectType="InheritedRecipeAssociation"
    	baseType="BaseRecipeAssociation" referencedType="InheritedProduct">
    </class>
    Feature Pack 2Feature Pack 3
    <!-- This is the base recipe association object definition -->    
    <ReferenceObjectDefinition allowDuplicates="false"
    	copyProtected="true"
    	definitionName="BaseRecipeAssociation"
    	idProperty="associationId"
    	isBaseDefinition="true"
    	objectGroups="RecipeAssociationReferenceGroup"
    	objectType="BaseRecipeAssociation">
    	<CreateService sendAll="false" url="/cmc/CreateRecipeAssociation">
    		<ServiceParam name="storeId">
    			<EnablementCondition checkObjectDefinition="true"
    				conditionId="objectTypeCondition"
    				enablementValue="InheritedRecipeAssociation"
    				negate="true" propertyName="objectType"/>
    		</ServiceParam>
    		<ServiceParam name="objectStoreId" parameterName="storeId"
    			parentProperty="true" propertyName="objectStoreId">
    			<EnablementCondition checkObjectDefinition="true”
    				conditionId="objectTypeCondition"
    				enablementValue="InheritedRecipeAssociation"
    				propertyName="objectType"/>
    		</ServiceParam>
    		<ServiceParam name="catentryId" objectPath="CatalogEntry"
    			propertyName="catentryId"/>
    		<ServiceParam name="recipeId" parentProperty="true"/>
    	</CreateService>
    	.......		   
    </ReferenceObjectDefinition>
    <!-- RecipeAssociation definition. this object definition represents the local RecipeAssociation object -->	
    <ReferenceObjectDefinition baseDefinitionName="BaseRecipeAssociation"
    	definitionName="recRecipeAssociationDefinition"
    	objectType="RecipeAssociation"
    	referencedTypes="Product,InheritedProduct">           
    	<TrueEnablementCondition/> 	 	
    </ReferenceObjectDefinition>
    <!--  Inherited  RecipeAssociation definition. this object definition defines RecipeAssociation objects that are inherited from the asset store -->
    <ReferenceObjectDefinition baseDefinitionName="BaseRecipeAssociation"
    	definitionName="recInheritedRecipeAssociationDefinition"
    	objectType="InheritedRecipeAssociation" referencedType="InheritedProduct">
    </ReferenceObjectDefinition>
  4. Add the new Inherited object type into the Top object definition. The following code samples show how to add the inherited object type into the Top object definition:
    File Code sample
    RecipeTopObjectDefinition.lzx
    
       <class
    name="recUnassignedRecipeOrganizationalObjectDefinition"
                    extends="wcfOrganizationalObjectDefinition" 
                    objectType="UnassignedRecipeNode"             
                   
    displayName="${extRecipeResources.recipeNotInCollection_DisplayName.string}"
                    organizedObjectTypes="Recipe,
    InheritedRecipe">
                    ......
                    </class>
                    <class
    name="recRecipeCollectionOrganizationalObjectDefinition"
                    extends="wcfOrganizationalObjectDefinition" 
                    objectType="RecipeCollectionNode"
                    organizedObjectTypes="RecipeCollection,
    InheritedRecipeCollection" 
                   
    displayName="${extRecipeResources.recipeCollection_TreeNode.string}">
                    
                    <!-- Get children service to retrieve all recipe
    collections -->
                    <wcfGetChildrenService
    url="/cmc/GetRecipeCollections" objectTypes="RecipeCollection,
    InheritedRecipeCollection">       
                            <wcfServiceParam name="storeId"/>    
              
                    </wcfGetChildrenService>
                            ......
                    </class>
    
    RecipeTopObjectDefinition.def
    <OrganizationalObjectDefinition definitionName="UnassignedRecipeNode"
    	displayName="${extRecipeResources.recipeNotInCollection_DisplayName}"
    	objectType="UnassignedRecipeNode"
    	organizedObjectTypes="Recipe,InheritedRecipe">
    	......  			
    </OrganizationalObjectDefinition>
    	
    <OrganizationalObjectDefinition definitionName="RecipeCollectionNode"
    	displayName="${extRecipeResources.recipeCollection_TreeNode}"
    	objectType="RecipeCollectionNode"
    	organizedObjectTypes="RecipeCollection,InheritedRecipeCollection">
    		
    	<!-- Get children service to retrieve all recipe collections -->
    	<GetChildrenService objectTypes="RecipeCollection,InheritedRecipeCollection"
    		url="/cmc/GetRecipeCollections">
    		<ServiceParam name="storeId"/>		
    		<ServiceParam name="defaultLanguageId"/>	
    	</GetChildrenService>
    	......
    </OrganizationalObjectDefinition>

Procedure

  1. Import the object definition files:
    1. In WebSphere Commerce Developer, select File > Import.
    2. In the Import window, expand General and select File System, then click Next.
    3. Set the From directory to the following directory:
      • WebSphere Commerce Version 7.0.0.0Feature Pack 1TutorialEsiteSourceCode\LOBTools\WebContent\WEB-INF\src\lzx\mycompany\recipe\objectDefinitions
      • Feature Pack 2Feature Pack 3TutorialEsiteSourceCode\LOBTools\WebContent\config\mycompany\recipe\objectDefinitions
      Set the Into folder to the following folder:
      • WebSphere Commerce Version 7.0.0.0Feature Pack 1workspace_dir\LOBTools\WebContent\WEB-INF\src\lzx\mycompany\recipe\objectDefinitions
      • Feature Pack 2Feature Pack 3workspace_dir\LOBTools\WebContent\config\mycompany\recipe\objectDefinitions
      WebSphere Commerce Version 7.0.0.0Feature Pack 1
      Screen capture that displays the Import dialog in WebSphere Commerce Developer.
      Feature Pack 2Feature Pack 3
      Screen capture that displays the Import dialog in WebSphere Commerce Developer.
    4. Click Finish.
  2. You have new object definitions to represent the inherited versions of your user interface objects. Add those new object definitions to the business object editor. The following code samples contain the modified version of your business object editor with the necessary object definition instances. Copy this code to the following location:
    • WebSphere Commerce Version 7.0.0.0Feature Pack 1workspace_dir\LOBTools\WebContent\WEB-INF\src\lzx\mycompany\recipe\RecipeManagementToolDefinition.lzx
    • Feature Pack 2Feature Pack 3workspace_dir\LOBTools\WebContent\config\mycompany\recipe\RecipeManagementToolDefinition.def
    OptionDescription
    WebSphere Commerce Version 7.0.0.0Feature Pack 1RecipeManagementToolDefinition.lzx WebSphere Commerce Version 7.0.0.0Feature Pack 1
    <library>
    	<class name="recRecipeManagement" extends="wcfBusinessObjectEditor" 
    	helpLink="" displayName="${extRecipeResources.recipe_DisplayName.string}"
    	browseUtilityFilterTypes="Recipes,MasterCategories,SalesCategories"
    	explorerFilterTypes="Recipes">			
    		<!-- Context value for the master catalog id -->
    	    <wcfContextValue parameterName="masterCatalogId"/>
    		<catCatalogInitService/>		
    		<!-- Filter definitions -->
    		<wcfObjectTypeFilter filterType="Recipes"  displayName="Recipes" isDefault="true"
    			objectTypes="RecipeCollectionNode,UnassignedRecipeNode,RecipeCollection,InheritedRecipeCollection" />			
    		<catMasterCatalogGroupsFilter />
    		<catSalesCatalogGroupsFilter />				
    		<!-- Recipe Top Objects -->
    		<recRecipeTopObjectDefinition/>			
    	    <!-- Recipe Organizational Objects -->
       		<recUnassignedRecipeOrganizationalObjectDefinition/>
    	    <recRecipeCollectionOrganizationalObjectDefinition/>
    	    <!-- Recipe Primary Objects -->
    		<recRecipeCollectionPrimaryObjectDefinition/>
     		<recRecipePrimaryObjectDefinition/>	 	 
     		<recInheritedRecipeCollectionPrimaryObjectDefinition/> 	
     		<recInheritedRecipePrimaryObjectDefinition/> 	
     		<!-- search definitions -->
     		<recFindRecipesSearchDefinition/>		 	
        	<recFindRecipeCollectionsSearchDefinition/> 		
    	</class>		
    </library>
    Feature Pack 2Feature Pack 3RecipeManagementToolDefinition.def Feature Pack 2Feature Pack 3
    <Definitions>
    	<BusinessObjectEditor
    		browseUtilityFilterTypes="Recipes,MasterCategories,SalesCategories"
    		definitionName="recRecipeManagement"
    		displayName="${extRecipeResources.recipe_DisplayName}"
    		explorerFilterTypes="Recipes" helpLink="">
    		<!-- Context value for the master catalog id -->
    		<ContextValue parameterName="masterCatalogId"/>
    		<InitService baseDefinitionName="catCatalogInitService"/>
    		<!-- Filter definitions -->
    		<ObjectTypeFilter displayName="Recipes" filterType="Recipes"
    			isDefault="true"
    	objectTypes="RecipeCollectionNode,UnassignedRecipeNode,RecipeCollection,InheritedRecipeCollection"/>
    		<ObjectTypeFilter baseDefinitionName="catMasterCatalogGroupsFilter"/>
    		<ObjectTypeFilter baseDefinitionName="catSalesCatalogGroupsFilter"/>
    		<!-- Recipe Top Objects -->
    		<TopObjectDefinition baseDefinitionName="recRecipeTopObjectDefinition"/>
    		<!-- Recipe Organizational Objects -->
       		<OrganizationalObjectDefinition
    			baseDefinitionName="UnassignedRecipeNode"/>
    		<OrganizationalObjectDefinition
    			baseDefinitionName="RecipeCollectionNode"/>
    		<!-- Recipe Primary Objects -->
    		<PrimaryObjectDefinition baseDefinitionName="RecipeCollection"/>
     		<PrimaryObjectDefinition baseDefinitionName="Recipe"/>
     		<PrimaryObjectDefinition baseDefinitionName="InheritedRecipeCollection"/>
     		<PrimaryObjectDefinition baseDefinitionName="InheritedRecipe"/>
     		<!-- search definitions -->
     		<SearchDefinition baseDefinitionName="FindRecipes"/>	
    		<SearchDefinition baseDefinitionName="FindRecipeCollections"/>
    	</BusinessObjectEditor>
    </Definitions>
  3. WebSphere Commerce Version 7.0.0.0Feature Pack 1Right-click the LOBTools project and select Build OpenLaszlo Project.