Example: Deleting catalog filters

You can delete your catalog filters by using the Data Load utility. These examples use a CSV file to demonstrate how to delete your catalog filter data.

This example uses a CSV file to demonstrate how to insert, replace, or delete your data. You 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.

Deleting catalog filters deletes data from the CATFILTER or CATFLTDSC database tables. If the CSV input file includes information in a description column, then data in the CATFLTDSC table is deleted. If the description column is empty, then data in the CATFILTER table is deleted. The corresponding tables: CATFLTDSC, CFPRODUCTSET, CFCATGROUP, CFCONDGRP, CFCOND, CFCONDVAL are cascade deleted.

CSV file with sample data

CatalogFilter.csv

CSV file with sample data

Table 1. CatalogFilter
CatalogFilterName StoreIdentifier CatalogIdentifier EnglishDescription
CatalogFilterA AuroraESite AuroraESite ShortDesc for filter A
CatalogFilterB AuroraESite AuroraESite ShortDesc for filter B

CSV column and XML element definitions

CatalogFilterName
Required, String: The name of the catalog filter. Ensure that the combination of CatalogIdentifier, StoreIdentifier, and CatalogFilterName are unique.
StoreIdentifier
Required, String: The identifier of the store that the catalog filter belongs to.
CatalogIdentifier
Required, String: The identifier of the catalog that the catalog filter belongs to.
EnglishDescription
String: The description of the catalog filter in English. If this field is provided, then the corresponding CATFLTDSC is deleted, the CATFILTER is not deleted.

The following optional fields are for description of other languages:

  • GermanDescription
  • ItalianDescription
  • JapaneseDescription
  • KoreanDescription
  • PolishDescription
  • PortugueseDescription
  • RomanianDescription
  • RussianDescription
  • SChineseDescription
  • SpanishDescription
  • TChineseDescription
Other optional fields not included in the example are:
CatalogFilterId
Optional, String: The reference number of the catalog filter. If the reference number is provided in the CSV, then it is used. If this field is provided, then the CatalogFilterName, CatalogFilterName, CatalogIdentifier is not needed.

Business context data

The following code snippet from the wc-dataload-env.xml configuration file provides the required business context data:

<_config:BusinessContext storeIdentifier="AuroraESite" catalogIdentifier="AuroraESite">
</_config:BusinessContext>
storeIdentifier
String: The store identifier, for example "AuroraESite". This parameter is used when the storeIdentifier is not provided in the CSV file. If the storeIdentifier is provided in the CSV file, it is used. The storeIdentifier is used to retrieve the storeID and the ownerID.
catalogIdentifier
String: The catalog identifier, for example "AuroraESite". This parameter is used when the catalog identifier is not provided in the CSV file. If the catalogIdentifier is provided in the CSV file, it is used.

Mapping data

The following snippet from the sample configuration file demonstrates how to map each column of data in the source CSV file to a value.
<_config:DataReader 
     className="com.ibm.commerce.foundation.dataload.datareader.CSVReader" 
     firstLineIsHeader="true" 
     useHeaderAsColumnName="true" /> 

The following snippet from the sample configuration file demonstrates how to map each column of the data in the CSV file to a business object logical schema path. The attribute value represents the name of a column of the CSV file that is defined in the preceding configuration snippet. Each column in the CSV file must have a mapping to the logical schema path. If the optional fields specified are present in the CSV file, the mapping for them must be added.

<_config:DataMapping>
  <_config:mapping xpath="CatalogFilterIdentifier/UniqueID" value="CatalogFilterId" />      
  <_config:mapping xpath="CatalogFilterIdentifier/ExternalIdentifier/Identifier" value="CatalogFilterName" />
  <_config:mapping xpath="CatalogFilterIdentifier/ExternalIdentifier/StoreIdentifier/ExternalIdentifier/NameIdentifier" value="StoreIdentifier" />
  <_config:mapping xpath="CatalogFilterIdentifier/ExternalIdentifier/CatalogIdentifier/ExternalIdentifier/Identifier" value="CatalogIdentifier" />
  <_config:mapping xpath="usage" value="Usage" />
  <_config:mapping xpath="Description[0]/language" value="-1" valueFrom="Fixed"/>
  <_config:mapping xpath="Description[0]/value" value="EnglishDescription" />
  <_config:mapping xpath="Description[1]/language" value="-2" valueFrom="Fixed"/>
  <_config:mapping xpath="Description[1]/value" value="FrenchDescription" />
  <_config:mapping xpath="Description[2]/language" value="-3" valueFrom="Fixed"/>
  <_config:mapping xpath="Description[2]/value" value="GermanDescription" />
  <_config:mapping xpath="Description[3]/language" value="-4" valueFrom="Fixed"/>
  <_config:mapping xpath="Description[3]/value" value="ItalianDescription" />
  <_config:mapping xpath="Description[4]/language" value="-5" valueFrom="Fixed"/>
  <_config:mapping xpath="Description[4]/value" value="SpanishDescription" />
  <_config:mapping xpath="Description[5]/language" value="-6" valueFrom="Fixed"/>
  <_config:mapping xpath="Description[5]/value" value="PortugueseDescription" />
  <_config:mapping xpath="Description[6]/language" value="-7" valueFrom="Fixed"/>
  <_config:mapping xpath="Description[6]/value" value="SChineseDescription" />
  <_config:mapping xpath="Description[7]/language" value="-8" valueFrom="Fixed"/>
  <_config:mapping xpath="Description[7]/value" value="TChineseDescription" />
  <_config:mapping xpath="Description[8]/language" value="-9" valueFrom="Fixed"/>
  <_config:mapping xpath="Description[8]/value" value="KoreanDescription" />
  <_config:mapping xpath="Description[9]/language" value="-10" valueFrom="Fixed"/>
  <_config:mapping xpath="Description[9]/value" value="JapaneseDescription" />
  <_config:mapping xpath="Description[10]/language" value="-20" valueFrom="Fixed"/>
  <_config:mapping xpath="Description[10]/value" value="RussianDescription" />
  <_config:mapping xpath="Description[11]/language" value="-21" valueFrom="Fixed"/>
  <_config:mapping xpath="Description[11]/value" value="RomanianDescription" />
  <_config:mapping xpath="Description[12]/language" value="-22" valueFrom="Fixed"/>
  <_config:mapping xpath="Description[12]/value" value="PolishDescription" />
  <_config:mapping xpath="UserData/UserDataField[0]/Field1" value="Field1" />
  <_config:mapping xpath="UserData/UserDataField[0]/Field2" value="Field2" />
  <_config:mapping xpath="UserData/UserDataField[0]/Field3" value="Field3" />
  <_config:mapping xpath="" value="Delete"  deleteValue="1"/>
</_config:DataMapping>

Sample XML file

Business object mediator

The mediator class name is com.ibm.commerce.catalogfilter.dataload.mediator.CatalogFilterMediator. The corresponding logical schema is CatalogFilter.xsd.

Note: When you use a mediator that is provided with WebSphere Commerce with the Data Load utility, the utility assumes that you are loading data for all columns for a business object. If you want 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. For more information, see Configuring a column exclusion list.