GetData tag configuration

The <wcf:getData> tag, part of the HCL Commerce foundation tag library, allows you to retrieve service data objects from any HCL Commerce service and associate them with a newly declared scripting variable with a given ID. This specified ID also associates the SDO objects with a specified scope. Unless otherwise specified, the Java object created is an instance of java.util.List that contains the list of service data objects.

The getData tag is configured by the HCL Commerce getData action. This action searches for configuration files named get-data-config.xml in the WEB-INF/config directory. The configuration files must adhere to the following rules:

  • They must have get-data-config as the root element.
  • There should be one configuration file for each component that is configured for use with the getData action.
  • Base component configuration files are expected in WEB-INF/config/base/component/get-data-config.xml, where component is a directory that is unique to the component.
  • Client extensions must be located in WEB-INF/config/ext/.global/get-data-config. Client extensions are loaded after base component configurations.

All paths in this file are relative to the installed location of your Web application, such as the Portlet WAR (MVCPortlet.war).

Modifying the get-data-config file can also change the behavior of business components. For example, the Catalog component, by default, enables search by part number and name (case sensitive). You can change this behavior to only enable catalog searching by part number, or to only allow searching by name, to improve the performance of your site searches.

The example below shows the default expression builder. Note that the commented sections can be uncommented in your client extension to change the search behavior.
<expression-builder>
  <name>findAllCatentriesBasicSearch</name>
  <data-type-name>CatalogEntry</data-type-name>
  <class>com.ibm.commerce.catalog.internal.client.taglib.util.CatalogSearchExpressionBuilder</class>
  <method>formatExpression</method>
  <param>
    <name>template</name>
    <!-- 
      Default config is search the catalog entry by part number or name. 
      To improve performance, user can comment this <value> section and uncomment one of the following two <value> sections 
      for searching by part number only or searching by name only. 
      Note that only one <value> section should be uncommented.
    -->
    <!-- Search catalog entry by part number or name -->
    <value>/CatalogEntry[($catEntryTypes$) and search(CatalogEntryIdentifier/ExternalIdentifier/PartNumber='$partNumber$' or Description/Name='$name$')]</value>
    <!-- Search catalog entry by part number only-->
    <!-- 
      <value>/CatalogEntry[($catEntryTypes$) and search(CatalogEntryIdentifier/ExternalIdentifier/PartNumber='$partNumber$')]</value>
     -->
    <!-- Search catalog entry by name only-->
    <!-- 
      <value>/CatalogEntry[($catEntryTypes$) and search(Description/Name='$name$')]</value>
     -->
  </param>
</expression-builder>

get-data-config element

The get-data-config element configures the HCL Commerce getData action. The getData action can fetch data from HCL Commerce services for use on a JSP page. You must register component data types as part of the get-data-config element in order for them to be recognized by the getData action.

name type description
data-type wcf:data-typeComplexType The data-type element declares a supported data type for the getData action.
client-facade wcf:client-facadeComplexType The client-facade element declares the component client facade that invokes the HCL Commerce service that fetches the desired data.
expression-builder wcf:expression-builderComplexType The expression-builder element declares expression builders. An expression builder handles the complexity of composing a query expression. You need to supply only the name of the expression builder and values for the its published input parameters.

date-typeComplex

name type description
name xsd:String The name of the data type. This name correlates the data type with the client facade and expression builder declarations.
description xsd:String A description of the data type.
type xsd:String The fully qualified Java class or interface name of the data type. For HCL Commerce components, this is the noun SDO type.

client-facadeComplexType

name type description
data-type-name xsd:string The name of the data type with which the client facade definition is associated.
class xsd:String The fully qualified Java class name of the component client facade that is used by the getData action when data of the matching type is requested. The client facade class must have a constructor that takes two parameters:
  • business context
  • security callback
The business context is of type 'com.ibm.commerce.foundation.common.datatypes.BusinessContextType'.

The security callback handler is of type 'javax.security.auth.callback.CallbackHandler'.

method xsd:String The name of the method in the component client facade class used to fetch the data requested by the getData action. The method accepts an instance of 'com.ibm.commerce.oagis9.datatypes.GetType' and returns an instance of ShowXXXDataAreaType for the specific noun that is being requested.

expression-builderComplexType

name type description
name xsd:string The name of the expression builder. This value is specified using the "expressionBuilder" to fetch the data requested by the getData action. The method must be able to accept an instance of 'com.ibm.commerce.oagis9.datatypes.GetType' and return an instance of the ShowXXXDataAreaType for the specific noun that is being requested.
description xsd:string A description of the expression builder.
data-type-name xsd:string The name of the data type with which this expression builder definition will be associated.
  • either
    name type description
    class xsd:string The fully qualified Java class name of the expression builder. This class must have a default constructor.
    method xsd:string The method name of the expression builder. This method must accept a java.util.Map and return an instance of 'com.ibm.commerce.oagis9.datatypes.ExpressionType'. The map is the parameter map which maps names of type String to values of type String[]. If there are parameter values for the parameter name, then the String array will have a length greater than one.
  • or
    name type description
    expression-template xsd:string The expression template that is used to compose the expression. The expression can include substitution parameters of the form $name$ that will be replaced with parameter values of the same name. If a parameter name has multiple values, only the first value is used.
    expression-language xsd:string The expression language for the specified expression template. If this value is not specified, then wcf:XPath is used.
name type description
param optional The param element is used to declare parameters that are expected by the expression builder. If one or more value elements are specified as part of the declaration, then those values are passed to the expression builder. If the same parameter name is used when coding the getData tag, the specified values are used, and the param element declarations are ignored. Undeclared parameter names can be specified and passed to the expression builder.

param

name type description
name xsd:string The name of a parameter that is expected by the expression builder.
description xsd:string A description of the parameter.
value xsd:string A default value for the parameter.