Develop > Presentation layer > WebSphere Commerce foundation tag library > Tag: getData


GetData tag configuration

The <wcf:getData> tag, part of the WebSphere Commerce foundation tag library, allows you to retrieve service data objects from any WebSphere 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 WebSphere 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:

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

Modify 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 the site searches.

The example below shows the default expression builder. Note that the commented sections can be uncommented in the 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 WebSphere Commerce getData action. The getData action can fetch data from WebSphere Commerce services for use on a JSP page. 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 WebSphere 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.

The following tables describe the component data types:


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 WebSphere 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.

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.

Related reference

Tag: getData


+

Search Tips   |   Advanced Search