Example: Categories

We can insert, replace, or delete your category data simultaneously by using the Data Load utility. These examples uses a CSV file to demonstrate how to insert, replace, or delete your categories data.

This example uses a CSV file to demonstrate how to insert, replace, or delete your data. We can also create and use an XML formatted file to insert, replace, or delete your data. If you choose to create and use an XML formatted file, ensure that your XML elements use the same names as are used for CSV column names.


CSV column and XML element definitions

Other optional fields not included in the example are:


Insert or replace - CSV file with sample category data

The sample file contains category data CSV file with sample category data

Formatted CSV file with column headings
GroupIdentifier TopGroup ParentGroupIdentifier Sequence Name ShortDescription LongDescription Thumbnail FullImage Published Keyword
TV_category true TV category TV short description TV long description TV_thumb/image.jpg TV_full/image.jpg 1 TV Keyword
LCD_category false TV_category 1 LCD TV LCD TV short description LCD TV long description LCD_TV_thumb/image.jpg LCD_TV_full/image.jpg 0 LCD Keyword
Appl_category true Appliances category Appliances short description Appliances long description app_thumb/image.jpg app_full/image.jpg 1 Appliances Keyword
Fridge_category false Appl_category 2 Refrigerators Refrigerator short description Refrigerator long description fridge_thumb/image.jpg fridge_full/image.jpg 1 Refrigerator Keyword


Delete - CSV file with sample category data

To delete a category, add a Delete column to your CSV file. In this example, the data source is a CSV file. The file contains sample category data. Rows where the flag is set to 1 in the Delete column have the associated category deleted. Rows that do not have anything in the Delete column have the associated categories inserted or replaced, depending on whether previous data exists in the database. CSV file with sample category data

Formatted CSV file with column headings
GroupIdentifier TopGroup ParentGroupIdentifier Sequence Name ShortDescription LongDescription Thumbnail FullImage Published Keyword Delete
TV_category true TV category TV short description TV long description TV_thumb/image.jgp TV_full/image.jgp 1 TV Keyword 1
LCD_category false TV_category 1 LCD TV LCD TV short description LCD TV long description LCD_TV_thumb/image.jpg LCD_TV_full/image.jpg 0 LCD Keyword 1
Appl_category true Appliances category Appliance short description Appliances long description app_thumb/image.jpg app_full/image.jpg 1 Appliances Keyword
Fridge_category false Appl_category 2 Refrigerators Refrigerator short description Refrigerator long description fridge_thumb/image.jpg fridge_full/image.jpg 1 Refrigerator Keyword


Mapping data

The following code snippet from the catalog group loader configuration file demonstrates how to map each value to a business object logical schema path.

If you perform an insert or replace operation, do not specify the "Delete" column in the CSV file or we can leave the "Delete" column empty.


Business object mediator

The mediator class name is CatalogGroupMediator.

Note: This mediator does not support marking a category for delete. If you define a mapping to update the MARKFORDELETE column for category and set a category to be marked for delete in an input file, the Data Load utility explicitly deletes the category. The operation also deletes any related records in table CATTOGRP, CATGRPREL, CATGPENREL tables for the category. The CatalogGroupMediator mediator supports marking a category for delete through a configurable property. To enable this property, add the following configuration in the <_config:BusinessObjectMediator> element of the business object configuration file:

Note: When we use a mediator that is provided with WebSphere Commerce with the Data Load utility, the utility assumes that we are loading data for all columns for a business object. To update the data in only specific columns, configure a column exclusion list for the load process. A column exclusion list causes the Data Load utility to ignore specific columns during the load operation. If you do not use a column exclusion list, the utility updates all columns in the row of a database table row when the utility updates the row. If no value is set in the input file, the utility can replace the existing column value with a default value or set the value to be null. See Configure a column exclusion list.