Question

Is there a way to get the IBM Websphere Commerce Foundation framework (WCF) sort data?

E.g. this snippet from a Websphere Commerce JSP file:

<wcf:getData type="com.ibm.commerce.store.facade.datatypes.GeoNodeType[]"
             var="geoNodes" varException="geoNodeException" expressionBuilder="findChildGeoNodesByGeoNodeUniqueID">
  <wcf:param name="accessProfile" value="IBM_Store_All" />
  <wcf:param name="parentUniqueId" value="${provinceId}" />
</wcf:getData>

How would I get this to sort the data by a given data field in GeoNodeType? Can I add something like <wcf:param name="sortBy" value="Description" /> ?

Was it helpful?

Solution

ExpressionBuilder "findChildGeoNodesByGeoNodeUniqueID" from your example is declared in /Stores/WebContent/WEB_INF/config/com.ibm.commerce.store/get-data-config.xml as follows:

<expression-builder>
    <name>findChildGeoNodesByGeoNodeUniqueID</name>
    <data-type-name>GeoNode</data-type-name>
    <expression-template>{_wcf.ap=$accessProfile$}/GeoNode[ParentGeoNodeIdentifier[UniqueID='$parentUniqueId$']]</expression-template>
    <param>
        <name>accessProfile</name>
        <value>IBM_Store_All</value>
    </param>
    <param>
        <name>parentUniqueId</name>
        <value></value>
    </param>
</expression-builder>

According to expression-builder tag docs, if expression-language is not specified inside expression-builder tag - XPath language is used by default. Unfortunately XPath does not support ordering.

I imagine that you can still implement your own ExpressionBuilder class (I haven't done that), implement any kind of sorting inside this new class, and then specify it in get-data-config.xml

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top