Configuring parametric search to search on custom data
Before new properties can be used as search conditions in a query template, you must configure parametric search to define the object path mapping so that the query can identify the corresponding column in the database table.
About this task
The component configuration file, wc-component.xml, contains a section for
the data service layer. It can be divided into 3 main subsections:
- Data mediator information
- Context information
- Attribute mapping information
Procedure
- Open HCL Commerce Developer.
-
If you have not already done so, create the component configuration file. When you create a
custom service module, this file is generated for you, and you can skip this step. However, for
default HCL Commerce service modules, you must not directly modify the default
wc.component.xml file.
-
Open the component configuration file in any text or XML editor:
- For custom service modules, open workspace_dir/WC/xml/config/servicemodulename/wc-component.xml
- For default HCL Commerce service modules, open workspace_dir/WC/xml/config/servicemodulename-ext/wc-component.xml
-
Add object path mappings for your custom data. The following example shows an associated table,
XWARRANTY, being defined as associated with the CATENTRY table. Two columns, WARTERM and WARTYPE,
are mapped to the UserData area, as
UserData/UserDataField/Warterm
andUserData/UserDataField/Wartype
<_config:dataservice dataMediatorType="JDBC" metadataClass="com.mycompany.commerce.catalog.facade.server.metadata.MyCompanyMetaData"> <_config:mapping> <_config:key name="CatalogEntry" /> <_config:basetable name="CATENTRY" useAllColumns="false"> <_config:associatedtable name="XWARRANTY" useAllColumns="false"> <_config:columns name="WARTERM" propertyName="UserData/UserDataField/Warterm" caseSensitive="false" /> <_config:columns name="WARTYPE" propertyName="UserData/UserDataField/Wartype" caseSensitive="false" /> </_config:associatedtable> </_config:basetable> </_config:mapping> </_config:dataservice>
-
Save and close the file. The following example is a sample complete
wc-component.xml file:
<?xml version="1.0" encoding="UTF-8"?> <_config:DevelopmentComponentConfiguration xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../xsd/wc-component.xsd "> <_config:dataservice dataMediatorType="JDBC" metadataClass="com.mycompany.commerce.catalog.facade.server.metadata.MyCompanyMetaData"> <_config:mapping> <_config:key name="CatalogEntry" /> <_config:basetable name="CATENTRY" useAllColumns="false"> <_config:associatedtable name="XWARRANTY" useAllColumns="false"> <_config:columns name="WARTERM" propertyName="UserData/UserDataField/Warterm" caseSensitive="false" /> <_config:columns name="WARTYPE" propertyName="UserData/UserDataField/Wartype" caseSensitive="false" /> </_config:associatedtable> </_config:basetable> </_config:mapping> </_config:dataservice> </_config:DevelopmentComponentConfiguration>