Deprecated feature

Extending the get-data-config.xml file

You should extend the get-data-config.xml file when the configuration file has been provided for you. By extending the configuration, you can override the properties of the expression builder.

About this task

Complete this task when extending a service module, where the configuration file has been provided for you. If you are creating a new service module and the configuration file has not been provided for you, you must, however, create a new configuration file instead.

Procedure

  1. Create the get-data-config.xml file for the project.
    • Open HCL Commerce Developer and switch to the Enterprise Explorer view.
    • In the Enterprise Explorer view, expand YourProject > WebContent > WEB_INF > config.

      Where YourProject is the project running your code using the getData tag.

    • Right-click config and select New > Folder.
    • In the Folder name field, enter com.mycompany.commerce.project-ext and click Finish.
      Note: When creating any extensions folder, the folder name immediately ends with -ext. This ensures the original get-data-config.xml file located in the folder immediately preceding it remains unchanged. Instead, by extending the configuration, you can override the properties of the expression builder.
    • If the com.mycompany.commerce.project-ext 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-ext folder and select New > File .
    • In the File name field, enter get-data-config.xml and click Finish. The newly created get-data-config.xml extension file automatically opens.
  2. Determine which expression builders to extend from the base get-data-config.xml file and copy them into the extension file:
    1. Navigate to the folder immediately preceding the extension folder and double click the original provided get-data-config.xml file to open it in the default editor.
    2. Locate the expression builder definitions you want to extend and copy the section between each <expression-builder> and </expression-builder> tags.
    3. Paste the content copied from the base get-data-config.xml file into the extended get-data-config.xml file before the </wcf:get-data-config> line at the end of this file.
  3. Update the new expression builder in the extended 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.
    Note: You should only change the items you want to override in each expression builder.
    Each expression builder should resemble the following sample structure, replacing the empty nodes with your own project-related expression builders. Depending on which items you want to override, every node below may not reflect your changes:
    
    <!-- Project related expression builder extension 1. Note: every node may not apply to your specific scenario. -->	
    <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 extension 2. Note: every node may not apply to your specific scenario. -->
    <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 extension 3. Note: every node may not apply to your specific scenario. -->
    <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.

Results

After completing these steps, you have successfully extended a service module when the configuration file has been provided for you.