Creating a get-data-config.xml file
You can use getData tags and process-related service requests after creating a get-data-config.xml file. The get-data-config.xml file contains expression builders, each representing a different SQL query defined in the project's query template file. getData tags in the storefront JSP files can retrieve specific data from the database by referencing the appropriate expression builder.
About this task
Procedure
-
Create the get-data-config.xml file for the project.
- Open HCL Commerce Developer and switch to the Enterprise Explorer view.
- In the Project Explorer view, expand
Where YourProject is the project running your code using the getData tag.
- Right-click config and select .
- In the Folder name field, enter com.mycompany.commerce.project and click Finish.
- If the com.mycompany.commerce.project folder is not visible, right click on the config directory in the Enterprise Explorer view and click Refresh.
- Right-click the com.mycompany.commerce.project folder and select .
- In the File name field, enter get-data-config.xml and click Finish. The newly created get-data-config.xml file automatically opens.
-
Insert your project related expression builders into the get-data-config.xml file.
Each expression builder has the following properties:
- The name node uniquely identifies the expression builder, and is used by getData tags in the project JSP files when referring to an expression builder.
- The data-type-name node contains the noun type returned by this expression builder.
- The expression template node refers to an XPath query defined in the project query template file, used to retrieve specific information from the database. Parameters such as $projectID$ can be passed to the expression builder by a getData tag.
- Each param node contains a pair of name and value child nodes that define a parameter passed to the query template file. Each expression builder is associated with a specific Access Profile. This Access Profile, together with the defined XPath query, uniquely identifies a query in the query template file.
Each expression builder should resemble the following sample structure, replacing the empty nodes with your own project-related expression builders:<!-- Project related expression builder 1. --> <expression-builder> <name> </name> <data-type-name> </data-type-name> <expression-template> </expression-template> <param> <name> </name> <value> </value> </param> </expression-builder> <!-- Project related expression builder 2. --> <expression-builder> <name> </name> <data-type-name> </data-type-name> <expression-template> </expression-template> <param> <name> </name> <value> </value> </param> </expression-builder> <!-- Project related expression builder 3. --> <expression-builder> <name> </name> <data-type-name> </data-type-name> <expression-template> </expression-template> <param> <name> </name> <value> </value> </param> </expression-builder> </wcf:get-data-config>
Note: Although there are three expression builders in the sample expression builder structure, your own project-related expression builders can contain as many expression builders as needed.