Enabling the version service for both Recipe & RecipeCollection
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
- In the Enterprise Explorer view, expand LOBTools > WebContent > config > mycompany > recipe > objectDefinitions.
- 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>
- 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 thetopTable
specified in the content versioning configuration file. - The
objectType
attribute value corresponds to the UI object type.
- The
- 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. - Include the create content version client action. This
action calls the service to create the version of the Recipe object.
<CreateContentVersionClientAction/>
- Include GetContentVersions services. This service gets
all the versions of the Recipe object. The following code snippet
shows a sample
- Save the RecipePrimaryObjectDefinition.def file.
- While still in RecipePrimaryObjectDefinition.def,
apply similar changes to the RecipeCollection primary object definition:
- 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>
- Include the reference object definition services. The
following code snippet shows a sample reference object definition
for RecipeCollection object:
<ReferenceObjectDefinition baseDefinitionName="wcfBaseContentVersion" referencedType="RecipeCollection"/>
- Include the create content version client action. This
action calls the service to create the version of the object.
<CreateContentVersionClientAction/>
- Save your changes.
- Include GetContentVersions services. This service gets
all the versions of the RecipeCollection object.