Sample: Loading marketing data

This sample demonstrates how to load marketing data into the WebSphere Commerce database with the Data Load utility. After you load the data, Management Center users can view and manage the marketing objects in the Marketing tool. By following this sample, you load data for marketing activities, e-Marketing Spots, customer segments, marketing content, and associated attachments for the marketing objects.

Before beginning

Ensure that any catalog entries, categories, email templates, or attachment managed files associated with the marketing objects that we are loading exist in the target store. When we use the Data Load utility to load marketing data, the utility creates only the marketing objects, descriptive information, and relationships. If the associated objects that the utility does not load do not exist in the target database, the load process can fail since the Data Load utility cannot resolve the unique ID values for the associated objects. If you plan to load marketing objects that need these types of associated objects, we must manually create the object before you load your marketing data. Notes:


About this sample

When you run this sample, the Data Load utility is configured to load marketing data into only the store that you specify. We can specify the store in the environment configuration file. The sample configuration files used to configure the Data Load utility are in the following directory and subdirectories:

We can use the Data Load utility only to insert, replace, or delete marketing objects. Running the utility in update mode to change marketing objects is not supported.

Note: When you run this sample, the utility loads data for all supported and configured marketing object types. The data for each object type is included in separate input files. To load data for only specific marketing objects, we can configure the Data Load utility when you run the utility from a command-line utility to load only specific objects. Use the -DLoadOrder parameter when you run the utility to identify the specific objects to load. To load multiple business objects, include the list of load item names for the objects in comma-separated list. Enclose the list in double quotation marks. For example, the following parameter indicates that the utility is to load only the business object load items for marketing activities:
-DLoadOrder="MarketingCampaign, MarketingActivity, MarketingElement, MarketingElementNVP"


Sample input and configuration files

The sample directory includes the following Data Load utility configuration files:

The following table lists the input files that we use to load the sample data. The table also identifies the business object mediators and business object configuration files that the Data Load utility uses to load the sample data.

Sample CSV input file Description and sample business object configuration file
MemberGroup.csv The Data Load utility uses this sample input file to load the data to create customer segments with descriptive information for only a specific store language. We can specify this language in the environment configuration file business context.

Business object configuration file
wc-loader-member-group.XML

Business object mediator
com.ibm.commerce.member.dataload.mediator.MemberGroupMediator

MemberGroupDescription.csv The Data Load utility uses this sample input file to load customer segment descriptive information for all supported languages.

Business object configuration file
wc-loader-member-group-description.XML

Business object mediator
com.ibm.commerce.member.dataload.mediator.MemberGroupDescriptionMediator

MemberGroupCondition.csv The Data Load utility uses this sample input file to load customer segment conditions.

Note: Any space characters within the input file are converted to new line characters in the condition XML string for an object in the database.

Business object configuration file
wc-loader-member-group-condition.XML

Business object mediator
com.ibm.commerce.foundation.dataload.businessobjectmediator.TableObjectMediator

Attachment.csv The Data Load utility uses this sample input file to load attachments with descriptive information in the default store language.

Business object configuration file
wc-loader-attachment.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.AttachmentMediator

AttachmentDescription.csv The Data Load utility uses this sample input file to load attachment descriptive information for all supported languages.

Business object configuration file
wc-loader-attachment-description.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.AttachmentDescriptonMediator

AttachmentAsset.csv The Data Load utility uses this sample input file to load attachment assets.

Business object configuration file
wc-loader-attachment-asset.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.AttachmentAssetMediator

AttachmentAssetLanguage.csv The Data Load utility uses this sample input file to load attachment asset and language relationships.

Business object configuration file
wc-loader-attachment-asset-language.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.AttachmentAssetLanguageMediator

MarketingContent.csv The Data Load utility uses this sample input file to load marketing content with descriptive information in the default store language.

Business object configuration file
wc-loader-marketing-content.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.MarketingContentMediator

MarketingContentDescription.csv The Data Load utility uses this sample input file to load marketing content descriptive information for all supported languages.

Business object configuration file
wc-loader-marketing-content-description.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.MarketingContentDescriptionMediator

MarketingContentAttachment.csv The Data Load utility uses this sample input file to load marketing content and attachment relationship with descriptive information in the default store language.

Business object configuration file
wc-loader-marketing-content-attachment.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.MarketingContentAttachmentMediator

MarketingContentAttachmentDescription.csv The Data Load utility uses this sample input file to load marketing content and attachment relationship descriptive information for all supported languages.

Business object configuration file
wc-loader-marketing-content-attachment-description.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.MarketingContentAttachmentDescriptionMediator

MarketingContentImageMap.csv The Data Load utility uses this sample input file to load marketing content image maps.

Business object configuration file
wc-loader-marketing-content-imagemap.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.MarketingContentImageMapMediator

Note: If you generate this file with the Data Extract utility, the value for the url and htmlDefinition columns can contain external identifier values that must be converted to internal ID values by the business object mediator.

MarketingSpot.csv The Data Load utility uses this sample input file to load e-Marketing Spots.

Business object configuration file
wc-loader-marketing-spot.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.MarketingSpotMediator

MarketingSpotDefaultContent.csv The Data Load utility uses this sample input file to load default content information for e-Marketing Spots.

Business object configuration file
wc-loader-marketing-spot-default-content.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.MarketingSpotDefaultContentMediator

Note: If you generate this file with the Data Extract utility, the value for the content column can include an external identifier value that must be converted to an internal ID value by the business object mediator. When you load an external identifier in this column, the utility first maps the value to DefaultContent/ContentUniqueID. The utility then converts the value based on the content type value and then stores the converted value in the database:

  • For marketing content, the utility assumes that the value is the COLLATERAL.NAME. The mediator then converts the value to the COLLATERAL_ID and saves the value in the DMEMSPOTDEF.CONTENT column.

  • For catalog entry content, the utility assumes that the value is the CATENTRY.PARTNUMBER. The mediator then converts the value to the CATENTRY_ID and saves the value in the DMEMSPOTDEF.CONTENT column.

  • For category content, the utility assumes that the value is the CATGROUP.IDENTIFIER. The mediator then converts the value to the CATGROUP_ID and saves the value in the DMEMSPOTDEF.CONTENT column.

  • For any other content type, the value is stored in the DMEMSPOTDEF.CONTENT column as-is.

MarketingSpotDefaultTitle.csv The Data Load utility uses this sample input file to load default title information for e-Marketing Spots.

Business object configuration file
wc-loader-marketing-spot-default-title.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.MarketingSpotDefaultTitleMediator

Note: If you generate this file with the Data Extract utility, the value for the contentName column can include an external identifier value that must be converted to an internal ID value by the business object mediator. When you load an external identifier in this column, the utility first maps the value to DefaultMarketingSpotTitle/ContentUniqueID. The business object mediator then converts the value from the COLLATERAL.NAME database column value to the COLLATERAL_ID value that is saved in the database.

MarketingActivity.csv The Data Load utility uses this sample input file to load marketing web, dialog, and email activities, and search rules.

Business object configuration file
wc-loader-marketing-activity.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.MarketingActivityMediator

MarketingCampaign.csv The Data Load utility uses this sample input file to load marketing campaigns.

Business object configuration file
wc-loader-marketing-campaign.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.MarketingCampaignMediator

MarketingElement.csv The Data Load utility uses this sample input file to load marketing elements for marketing activities.

Business object configuration file
wc-loader-marketing-element.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.MarketingElementMediator

MarketingElementNVP.csv The Data Load utility uses this sample input file to load marketing element name-value pairs for marketing activities.

Business object configuration file
wc-loader-marketing-elementnvp.XML

Business object mediator
com.ibm.commerce.marketing.dataload.mediator.MarketingElementNVPMediator

Note: If you use the Data Extract utility to generate the MarketingElementNVP.csv file, the utility can convert the value for this column or element when the value includes a unique ID. Depending on the name column or element value, the Data Extract utility converts the unique ID value for the value column or element to be the corresponding external identifier value. When you load the data, the Data Load utility converts the values to the appropriate unique ID value in the target database. The utilities convert the unique ID values for the following name column or element values:

  • For a list of catalog entry ID values, the Data Extract utility converts the ID values to the catalog entry part numbers. When you load the data, the Data Load utility converts each part number to the appropriate CATENTRY_ID value in the target database.

  • For a list of category ID values, the Data Extract utility converts the ID values to the category identifier. When you load the data, the Data Load utility converts the identifier to the appropriate CATGROUP_ID values.

  • For a list of attribute dictionary attribute ID values, the Data Extract utility converts the ID values to the external attribute identifier. When you load the data, the Data Load utility converts the identifier to the appropriate ATTR_ID values.

  • For a list of attribute value IDs for attribute dictionary attributes, the Data Extract utility converts the ID values to the external attribute value identifier. When you load the data, the Data Load utility converts the identifier to the appropriate ATTRVAL_ID values.

  • For a list of content ID values, the Data Extract utility converts the ID values to the marketing content name. When you load the data, the Data Load utility converts the content name to the appropriate COLLATERAL_ID values.

  • For e-Marketing Spot ID values, the Data Extract utility converts the ID values to the e-Marketing Spot name and usage type. The name and usage type are separated by a line ('|') separator character, for example, "ShoppingCartRight_CatEntries|MARKETING". The default usage type is MARKETING. When you load the data, the Data Load utility converts the part number to the appropriate EMSPOT_ID value.

  • For promotion ID values, the Data Extract utility converts the ID values to the promotion administrative name. When you load the data, the Data Load utility converts the name to the appropriate PX_PROMOTION_ID value.

  • For a list of customer segment ID values, the Data Extract utility converts the ID values to the customer segment member group name. When you load the data, the Data Load utility converts the name to the appropriate MBRGRP_ID value.

  • For email message ID values, the Data Extract utility converts the ID values to the email message name. When you load the data, the Data Load utility converts the message name to the appropriate EMLMSG_ID value.

  • For any other name value, the Data Extract utility does not convert the value for the value column or element.


Procedure

  1. Copy the sample configuration files and directories to a local directory.

  2. Edit your copy of the sample environment configuration files to set the configuration variables for the environment. All of the sample configuration files used in this sample include values for a default WebSphere Commerce Developer environment that uses an Apache Derby database. If the environment settings are different, change the configured values in these files to match the environment. For more information about updating an environment configuration file, see Configure the data load environment settings.

  3. (Developer) On a command line, go to the WCDE_installdir\bin directory.

  4. (Linux) Open a command line in the Utility server Docker container. Change the directory to utilities_root/bin directory.
    For information about entering and leaving containers, see Running utilities from the Utility server Docker container.

  5. Enter the following command to run the sample data load order file and load the information that included in this sample:

    • (Linux) ./dataload.sh ../samples/DataLoad/Marketing/wc-dataload.xml

    • (Developer) dataload ..\samples\DataLoad\Marketing\wc-dataload.xml


Verifying results

To verify that the marketing data is loaded, complete the following tasks:


Removing the sample data from the WebSphere Commerce database

Edit the wc-dataload.XML load order configuration file to change the value of the dataLoadMode attribute from "Insert" to "Delete" to run the Data Load utility in delete mode. When you run the utility in delete mode, the utility deletes the data in the database that matches the rows in the sample input files. You do not need to edit the value for Delete column in the input files.

Compare the data in the database with the input files to verify that the data no longer exists in the database.

In Management Center, verify that we can no longer view the marketing objects in the Marketing tool.