Introduced in Feature Pack 2

Enabling the version service for both Recipe & RecipeCollection

Introduced in Feature Pack 2 In this lesson, you update the primary object definition for the Recipe and RecipeCollection objects. In the primary object definition file, you add the functionality to retrieve the list of versions, create versions, and update versions of Recipe and RecipeCollection.

About this task

Procedure

  1. In the Enterprise Explorer view, expand LOBTools > WebContent > config > mycompany > recipe > objectDefinitions.
  2. Open the RecipePrimaryObjectDefinition.def file and locate the following code, then perform the following steps below it:
    <RefreshService url="/cmc/GetRecipeByRecipeId">
    <ServiceParam name="storeId"/>
    <ServiceParam name="recipeId" propertyName="recipeId"/>
    </RefreshService>
    1. Include GetContentVersions services. This service gets all the versions of the Recipe object. The following code snippet shows a sample GetContentVersions service for the Recipe object.
      <GetChildrenService objectTypes="ContentVersion" url="/cmc/GetContentVersions">
      		<ServiceParam name="storeId"/>
      		<ServiceParam name="objectId" propertyName="recipeId"/>
      		<ServiceParam name="objectType" value="Recipe"/>
      		<ServiceParam name="basedOnVersionNumber" propertyName="basedOnVersionNumber"/>
      </GetChildrenService>
      Note:
      • The propertyName represents the name of the property of the UI object that uniquely identifies the object. This is usually the same as the primary key of the topTable specified in the content versioning configuration file.
      • The objectType attribute value corresponds to the UI object type.
    2. Include the reference object definition services. The following code snippet shows a sample reference object definition for Recipe object:
      <ReferenceObjectDefinition baseDefinitionName="wcfBaseContentVersion" referencedType="Recipe"/>

      The value of the referencedType attribute is the UI object type.

    3. Include the create content version client action. This action calls the service to create the version of the Recipe object.
      <CreateContentVersionClientAction/>
  3. Save the RecipePrimaryObjectDefinition.def file.
  4. While still in RecipePrimaryObjectDefinition.def, apply similar changes to the RecipeCollection primary object definition:
    1. Include GetContentVersions services. This service gets all the versions of the RecipeCollection object.
      The following code snippet shows a sample GetContentVersions service for the RecipeCollection object:
      <GetChildrenService objectTypes="ContentVersion" url="/cmc/GetContentVersions">
      		<ServiceParam name="storeId"/>
      		<ServiceParam name="objectId" propertyName="collectionId"/>
      		<ServiceParam name="objectType" value="RecipeCollection"/>
      		<ServiceParam name="basedOnVersionNumber" propertyName="basedOnVersionNumber"/>
      </GetChildrenService> 
    2. Include the reference object definition services. The following code snippet shows a sample reference object definition for RecipeCollection object:
      <ReferenceObjectDefinition baseDefinitionName="wcfBaseContentVersion" referencedType="RecipeCollection"/>
    3. Include the create content version client action. This action calls the service to create the version of the object.
      <CreateContentVersionClientAction/>
    4. Save your changes.

Results