Samples > Data load utility samples > Examples: Mapping data > Examples: Mapping inventory data


Example: Deleting ATP inventory configuration

Use the data load utility to delete ATP inventory configuration data from the database.


CSV file with sample ATP inventory configuration data

In this example the data source will be a CSV file named ATPconfig_delete.csv. The file contains sample ATP inventory configuration data with minimum columns that are necessary for "delete" dataLoadMode. Each column is delimited by a comma.

CatalogEntryMediator is used to delete catalog entry data together with ATP inventory configuration data. FulfillmentPropertyMediator is used to delete ATP inventory configuration data only, with no impact to corresponding catalog entry data.

CSV file with sample data

  PartNumber ParentPartNumber Type
Example-PN-10001   Product
Example-PN-100012 Example-PN-10001 Item

If "markForDelete" property is set as true in business object configuration file, the BASEITEM record and ITEMSPC record are not deleted from database, MARKFORDELETE value of these records will be updated to "1" instead. Otherwise, records in table BASEITEM and ITEMSPC are deleted from database, corresponding records in other tables are also deleted due to Cascade restriction, for example, when a BASEITEM record is deleted, the corresponding BASEITMDSC record is deleted too.


CSV file column definitions

PartNumber

(Mandatory, string) The reference number that identifies the part number of the catalog entry. It uniquely identifies a catalog entry for a particular owner. This field is mandatory and cannot be null.

ParentPartNumber

(String) The part number of a parent product of this item. It is used to retrieve BASEITEM_ID in BASEITEM table, together with the owner id of this item.

Type

(Mandatory, string) This field defines the type of catalog entry. The values for Type are "Item", "Product", "Bundle", and "Package". This field is mandatory and cannot be null.

Other optional fields not included in the example are:

CatalogEntryUniqueId

(Long) The identifier of the catalog entry. It is used to retrieve a record in CATENTRY table, then BASEITEM_ID, ITEMSPC_ID, and CATENTTYPE_ID can be got from the record. If this field is not specified in CSV file, PartNumber is used to retrieve these IDs.

ParentCatalogEntryUniqueId

(Long) The identifier of the parent catalog entry. It is used to retrieve the BASEITEM_ID corresponding to the parent catalog entry. If this field is not specified in CSV file, BASEITEM_ID will be retrieved by ParentPartNumber.


Business context data

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

<_config:BusinessContext storeIdentifier="ConsumerDirect" langId="-1">
</_config:BusinessContext>

storeIdentifier

(String) The identifier of the store this catalog entry belongs to, such as ConsumerDirect.

langId

(Int) The identifier of a language which is used to load data to BASEITEMDSC. Default value is "-1".


Map 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">               
<_config:Data>             
<_config:column number="1" name="PartNumber" />                     
<_config:column number="2" name="ParentPartNumber" />                     
<_config:column number="3" name="Type" />               
</_config:Data>
</_config:DataSource>

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 which is defined in the configuration snippet above. Each column in the CSV file must have a mapping to the logical schema path.

<_config:DataMapping>       
<_config:mapping xpath="CatalogEntryIdentifier/ExternalIdentifier/PartNumber" value="PartNumber" valueFrom="InputData"/>       
<_config:mapping xpath="ParentCatalogEntryIdentifier/ExternalIdentifier/PartNumber" value="ParentPartNumber" valueFrom="InputData"/>       
<_config:mapping xpath="catalogEntryTypeCode" value="Type" valueFrom="InputData"/> 
</_config:DataMapping>


Business object mediator

The data load utility provides a business object mediator for deleting ATP inventory configuration data together with catalog entry data. The mediator class name is com.ibm.commerce.catalog.dataload.mediator.CatalogEntryMediator. For deleting inventory configuration data only, the mediator class name is com.ibm.commerce.catalog.dataload.mediator.FulfillmentPropertyMediator


+

Search Tips   |   Advanced Search