Example: Deleting catalog filter catalog group selections
We can delete the catalog filter catalog group selections using the Data Load utility. These examples use a CSV file to demonstrate how to delete the catalog filter catalog group selection 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 file with sample catalog filter catalog group selection data
In this example, the data source is a CSV file named CatalogFilterCategory.csv. The file contains sample catalog filter data. Each column is delimited by a comma.
Sample data
CatalogFilterName StoreIdentifier CatalogIdentifier SelectionType CatalogGroupIdentifier ConditionGroupRelation CatalogFilterA Aurora Aurora Exclude Lounge Chairs Or CatalogFilterA Aurora Aurora Include Office Chairs And
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.
- SelectionType
- Required, String: The type of the catalog entry selection: Include, Exclude.
- CatalogGroupIdentifier
- Required, String: The identifier of the catalog group to include or exclude in this catalog filter.
- ConditionGroupRelation
- Optional, String: This field is reserved and can be used to extend the catalog filter logic.
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.
- Delete
- (String) Indicates whether to delete this record. This field takes effect when dataLoadMode is "replace". If the value of this field equals to deleteValue, the corresponding record is deleted. The default deleteValue is 1, deleteValue can be configured under <DataMapping> element in BusinessObjectConfigFile.
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="Extended Sites Catalog Asset Store"> </_config:BusinessContext>
- storeIdentifier
- String: The store identifier. 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. 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. The mapping logical schema path is specified in the following table.
<_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="CatalogGroupSelection/CatalogGroupSelectionIdentifier/ExternalIdentifier/CatalogGroupIdentifier/ExternalIdentifier/GroupIdentifier" value="CatalogGroupIdentifier" /> <_config:mapping xpath="CatalogGroupSelection/conditionGroupRelation" value="ConditionGroupRelation" /> <_config:mapping xpath="CatalogGroupSelection/selection" value="SelectionType" /> <_config:mapping xpath="CatalogGroupSelection/UserData/UserDataField[0]/Field1" value="Field1" /> <_config:mapping xpath="CatalogGroupSelection/UserData/UserDataField[0]/Field2" value="Field2" /> <_config:mapping xpath="CatalogGroupSelection/UserData/UserDataField[0]/Field3" value="Field3" /> <_config:mapping xpath="CatalogGroupSelection/UserData/UserDataField[0]/Field4" value="Field4" /> <_config:mapping xpath="CatalogGroupSelection/UserData/UserDataField[0]/Field5" value="Field5" /> <_config:mapping xpath="" value="Delete" deleteValue="1"/> </_config:DataMapping>
Business object mediator
The mediator class name is CatalogFilterCategorySelectionMediator. The corresponding logical schema is CatalogFilter.xsd.
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.