Feature Pack 5

Define the Primary Object for folder

Feature Pack 5

In this lesson, you are creating a primary object definition for your e-Marketing Spot folders. A primary object definition describes a top-level business object that exists as its own entity independent of other objects. This definition for your folders defines the base object from which your e-Marketing Spot folders are derived.

Feature Pack 6 or laterAttention: This tutorial is based on the folder support that is included in Feature Pack 5 and is not recommended if you are on a newer feature pack level. Beginning with Feature Pack 6, support is provided by default for grouping e-Marketing Spots, activities, customer segments, marketing content, promotions, and attribute dictionary attributes. This support includes the capability of creating, changing, and deleting folders within the Management Center Catalogs, Marketing, and Promotions tools. You are not able to group folders created by following this tutorial with folders that are created by using Management Center. If you create Management Center folders by following the steps included in this tutorial, delete those folders before you create folders by using Management Center. For more information about folders, see Folders.

Feature Pack 7 or laterSupport is provided by default for grouping content pages and layouts in the Commerce Composer tool. This support includes creating, changing, and deleting folders with the Commerce Composer tool.

About this task

An e-Marketing Spot can exist within multiple folders at one time. Create a collection reference object definition to define the relationships between folders and e-Marketing Spots to ensure that you can include e-Marketing Spots in folders.

By defining the primary object for your folders, you define the business object editor that retrieves and displays folder information. e-Marketing Spot folders use the folder noun from the file wc-infrastructure-clientobjects.xml. This file contains information about how the parameters in the services are mapped to create the appropriate BOD for the web services.

For more information about defining primary objects, see defining a primary object.

The following object Model chart provides a summary of the relationships your introducing by creating your e-Marketing Spot folder primary object definition.
Object model diagram

Complete the following steps to create the EMarketingSpotFolderPrimaryObjectDefinition.def file. This file contains the primary object definition for your marketing folders.

Procedure

  1. In the Enterprise Explorer view, navigate to LOBTools > WebContent > config > commerce > marketing > objectDefinitions.
  2. Right-click objectDefinitions; click New > Other > General > File
  3. In the File name field, enter EMarketingSpotFolderPrimaryObjectDefinitions.def, click Finish.
  4. Open the EMarketingSpotFolderPrimaryObjectDefinitions.def for editing, and add the following code into the file:
    <?xml version="1.0" encoding="UTF-8"?>
     
    <!---
                This definition defines the base object from which EMarketingSpotFolder and InheritedEMarketingSpotFolderare derived.
                An E-Marketing Spot  folder is an object used to organize E-Marketing Spots so that they can be found easily.
                AnEMarketingSpot can be in multiple folders at the same time which is why this class uses a collection reference object
                definition to define the relationship between folders and E-Marketing Spots.
                EE-Marketing folders use the Folder noun from the file wc-infrastructure-clientobjects.xml
                which contains information on how the parameters in the services
                are mapped to create the appropriate BOD for the Web services.
          -->
     
     
    <Definitions>
          <PrimaryObjectDefinition creatable="false"
                definitionName="extBaseEMarketingSpotFolderPrimaryObjectDefinition"
                displayName="${extMarketingResources.EmarketingSpotFolderObjectName}"
                displayNameProperty="identifier"
                idProperty="folderId"
                isBaseDefinition="true"
                newDisplayName="${extMarketingResources.EmarketingSpotFolder_newEMarketingSpotFolderDisplayName}"
                newObjectMenuItemText="${extMarketingResources.contextMenuNewEMarketingSpotFolder}"
                objectGroups="EMarketingSpotFolderGroup"
                propertiesDefinitionName="extEMarketingSpotFolderProperties"
                writeUsage="IBM_ManageMarketingTool"> 
               
                <!--- This service retrieves all the child folders.  -->
                <GetChildrenService objectTypes="EMarketingSpotFolderReference,InheritedEMarketingSpotFolderReference" url="/cmc/GetChildFolders">
                      <ServiceParam name="storeId"/>
                      <ServiceParam name="folderId" propertyName="folderId"/>
                      <ServiceParam name="folderObjectType" value="EMarketingSpotFolder"/>
                </GetChildrenService>
               
                <!--- This service retrieves all the folder items that belong to this folder. -->
                <GetChildrenService objectTypes="EMarketingSpotFolderItemReference,EMarketingSpotFolderInheritedItemReference,InheritedEMarketingSpotFolderInheritedItemReference" url="/cmc/GetEMarketingSpotFolderItems">
                      <ServiceParam name="storeId"/>
                      <ServiceParam name="folderId" propertyName="folderId"/>
                      <ServiceParam name="defaultLanguageId"/>
                </GetChildrenService>
               
                <!---
                      Retrieves the extBaseEMarketingSpotFolderPrimaryObjectDefinition object that is the parent to this object.
                -->
                <GetReferencesService url="/cmc/GetParentFolder">
                      <ServiceParam name="storeId"/>
                      <ServiceParam name="objectStoreId" propertyName="objectStoreId"/>
                      <ServiceParam name="folderId" propertyName="folderId"/>
                      <ServiceParam name="parentFolderId" propertyName="parentFolderId"/>
                      <ServiceParam name="folderObjectType" value="EMarketingSpotFolder"/>
                </GetReferencesService>
               
                <!-- Refresh Service to reload the properties of the folder -->
                <RefreshService url="/cmc/GetFolderById">
                <ServiceParam name="storeId"/>
                <ServiceParam name="folderId" propertyName="folderId"/>
                <ServiceParam name="folderObjectType" value="EMarketingSpotFolder"/>
                </RefreshService>
               
                <!--- This is the folder_id defined in the FOLDER table, which indicates the primary key of this folder. -->
                <PropertyDefinition copyProtected="true" propertyName="folderId"/>
               
                <!--- This is the identifier of the folder. -->
                <PropertyDefinition displayName="${extMarketingResources.EMarketingSpotFolder_name}" maximumSize="254" propertyName="identifier" required="true" trim="true"/>
               
                <!--- This is the description of the folder. -->
            <PropertyDefinition displayName="${extMarketingResources.EMarketingSpotFolder_description}" maximumSize="254" propertyName="description" type="string"/>
                     
                <Xml name="template">
                      <folderType>EMarketingSpotFolder</folderType>              
                </Xml>
               
                <!--- Reference to the parent of the folder. -->
                <ParentReferenceObjectDefinition baseDefinitionName="extEMarketingSpotFolderReferenceObjectDefinition"/>
                <!--- Navigation list definition for navigating from the folder item to the E-Marketing Spot. -->
                <NavigationListDefinition baseDefinitionName="extEMarketingSpotFolderItemGridChildList" isDefault="true"/>
               
                <!--- Navigation list definition for navigating from the folder to its child items. -->
                <NavigationListDefinition baseDefinitionName="extEMarketingSpotFolderGridChildList" toolbarIcon="categoryListToolbarIcon"/>  
                                                         
          </PrimaryObjectDefinition>
         
          <!--
                Defines the object to be used to represent folders owned by the local store.
           -->
          <PrimaryObjectDefinition baseDefinitionName="extBaseEMarketingSpotFolderPrimaryObjectDefinition" creatable="false" definitionName="EMarketingSpotFolder" objectType="EMarketingSpotFolder" headerIcon="GenericFolderHeaderIcon" icon="GenericFolderIcon">
                <!--- Collection reference to the items that belong to the folder and are owned by the local store. -->
     
                <CollectionReferenceObjectDefinition baseDefinitionName="extEMarketingSpotFolderItemReferenceObjectDefinition"/>
               
                <!--- Collection reference to the items that belong to the folder and are owned by the asset store. -->
     
                <CollectionReferenceObjectDefinition baseDefinitionName="extEMarketingSpotFolderInheritedItemReferenceObjectDefinition"/>
               
    </PrimaryObjectDefinition>
         
         
         
          <!--
                Defines the object to be used to represent folders owned by the asset store.
           -->
          <PrimaryObjectDefinition baseDefinitionName="extBaseEMarketingSpotFolderPrimaryObjectDefinition" compatibleObjectTypes="EMarketingSpotFolder" creatable="false" definitionName="InheritedEMarketingSpotFolder" objectType="InheritedEMarketingSpotFolder" headerIcon="InheritedGenericFolderHeaderIcon" icon="InheritedGenericFolderIcon">
               
                <!--- Reference to the parent of the folder. -->
                <ParentReferenceObjectDefinition baseDefinitionName="extInheritedEMarketingSpotFolderReferenceObjectDefinition"/>
     
                <!--- Collection reference to the items that belong to the folder and are owned by the asset store. -->
                <CollectionReferenceObjectDefinition baseDefinitionName="extInheritedEMarketingSpotFolderInheritedItemReferenceObjectDefinition"/>
          </PrimaryObjectDefinition>
         
          <!-- The relationship between this folder and its local parent -->           
          <ParentReferenceObjectDefinition definitionName="extEMarketingSpotFolderReferenceObjectDefinition" derivedId="true" idProperty="folderReferenceId" objectGroups="EMarketingSpotFolderReferenceGroup" objectType="EMarketingSpotFolderReference" referencedType="EMarketingSpotFolder"/>
         
          <!-- The relationship between this folder and its asset store parent -->
          <ParentReferenceObjectDefinition definitionName="extInheritedEMarketingSpotFolderReferenceObjectDefinition" derivedId="true" idProperty="folderReferenceId" objectGroups="EMarketingSpotFolderReferenceGroup" objectType="InheritedEMarketingSpotFolderReference" referencedType="InheritedEMarketingSpotFolder"/>
         
          <!-- The relationship between a folder and local E-Marketing Spots in this folder. -->
          <CollectionReferenceObjectDefinition allowDuplicates="false" baseDefinitionName="extBaseEMarketingSpotFolderItemReferenceObjectDefinition" initializeObjectStoreId="true"  objectGroups="EMarketingSpotFolderItemReferenceGroup" definitionName="extEMarketingSpotFolderItemReferenceObjectDefinition" objectType="EMarketingSpotFolderItemReference" referencedTypes="EMarketingSpot">
         
                <TrueEnablementCondition  conditionType="childObjectCondition"/>
          </CollectionReferenceObjectDefinition>
         
          <!-- The relationship between this folder and asset store E-Marketing Spots in this folder. -->
          <CollectionReferenceObjectDefinition allowDuplicates="false" baseDefinitionName="extBaseEMarketingSpotFolderItemReferenceObjectDefinition" initializeObjectStoreId="true" objectGroups="EMarketingSpotFolderItemReferenceGroup" definitionName="extEMarketingSpotFolderInheritedItemReferenceObjectDefinition" objectType="EMarketingSpotFolderInheritedItemReference" referencedTypes="InheritedEMarketingSpot">
               
                <TrueEnablementCondition conditionType="childObjectCondition"/>
          </CollectionReferenceObjectDefinition>
         
          <!-- The relationship between an inherited folder and an inherited E-Marketing Spot in this folder. -->
          <CollectionReferenceObjectDefinition allowDuplicates="false" baseDefinitionName="extBaseEMarketingSpotFolderItemReferenceObjectDefinition" objectGroups="EMarketingSpotFolderItemReferenceGroup" definitionName="extInheritedEMarketingSpotFolderInheritedItemReferenceObjectDefinition" objectType="InheritedEMarketingSpotFolderInheritedItemReference" referencedTypes="InheritedEMarketingSpot">
               
                <TrueEnablementCondition conditionType="childObjectCondition"/>
          </CollectionReferenceObjectDefinition>
         
          <!-- The class to represent relationships between folders and E-Marketing Spots. These relationships are called folder items. -->
          <CollectionReferenceObjectDefinition definitionName="extBaseEMarketingSpotFolderItemReferenceObjectDefinition" isBaseDefinition="true" idProperty="folderItemID">
               
                <!--- Create service to create the relationship between the parent folder and folder item reference. -->
                <CreateService url="/cmc/CreateFolderItemReference">
                      <ServiceParam name="storeId"/>
                      <ServiceParam name="objectStoreId" parentProperty="true" propertyName="objectStoreId"/>
                      <ServiceParam name="folderItemStoreId" parameterName="folderItemStoreId" propertyName="objectStoreId" objectPath="EMarketingSpotGroup"/>
                      <ServiceParam name="folderId" parentProperty="true" propertyName="folderId"/>
                      <ServiceParam name="folderItemReferenceId" objectPath="EMarketingSpotGroup" propertyName="uniqueId"/>
                </CreateService>
         
               
                <!--- Delete service to delete the relationship between the parent folder and folder item reference. -->
                <DeleteService url="/cmc/DeleteFolderItemReference">
                      <ServiceParam name="storeId"/>
                      <ServiceParam name="folderItemStoreId" parameterName="folderItemStoreId" propertyName="objectStoreId" objectPath="EMarketingSpotGroup"/>
                      <ServiceParam name="folderId" parentProperty="true" propertyName="folderId"/>
                      <ServiceParam name="folderItemReferenceId" objectPath="EMarketingSpotGroup" propertyName="uniqueId"/>
                      <ServiceParam name="folderItemType" propertyName="folderItemType"/>
                </DeleteService> 
     
                <TrueEnablementCondition conditionId="objectTypeFolderCondition" conditionType="childObjectCondition"/>
               
                <Xml name="template">
                      <folderItemType>MarketingSpotType</folderItemType>
                </Xml>           
          </CollectionReferenceObjectDefinition>
               
    </Definitions>
  5. Save your changes. Compilation errors can display regarding the following values. These errors are resolved when you define the properties view in the following lesson:
    propertiesDefinitionName="extEMarketingSpotFolderProperties" 
    <NavigationListDefinition baseDefinitionName="extEMarketingSpotFolderItemGridChildList" isDefault="true"/>
    <NavigationListDefinition baseDefinitionName="extEMarketingSpotFolderGridChildList" toolbarIcon="categoryListToolbarIcon"/>

Results

By adding the preceding code, you declare a PrimaryObjectDefinition named extBaseEMarketingSpotFolderPrimaryObjectDefinition. This code is the base object definition for both extended site store and asset store folders. This object definition defines a get child service to return sub folders and defines a get child service to return the e-Marketing Spots in the folder. The file defines a get parent folder service that retrieves the object that is the parent to this object. A definition of the ParentReferenceObjectDefinition is included which acts as a reference to the parent object for the folder. There are also two navigation list definitions: one for the list of sub folders and one for the list of e-Marketing spots.

Following the base object definition in the code sample, is the primary object definitions for the EMarketingSpotFolder and InheritedEMarketingSpotFolder objects. These object definitions represent both the extended site and asset store folders.

After the folder object definitions, the code includes two ParentReferenceObjectDefinitions. The first definition declares a reference object to be used between a folder and a local folder. The second definition declares an object to be used between a folder and an inherited folder.

Three CollectionReferenceObjectDefinitions follow the two ParentReferenceObjectDefinitions. These definitions represent the relationship between folders and e-Marketing spots, both local and inherited. This file also includes the CollectionReferenceObjectDefinition named extBaseEMarketingSpotFolderItemReferenceObjectDefinition. This object definition is the base object definition for the collection reference objects of both the local and inherited folder to e-Marketing Spot relationships.

The code sample also defines the create and delete services to create and delete the relationship between a parent folder and folder item reference.

Note: Ensure the folderItemtype you include in the preceding code matches the noun name value that is defined for the e-Marketing Spot <folderItemType>MarketingSpotType</folderItemType>