Using the RetailUtility external Java class

Describes how to use the external RetailUtility Java™ class to check that required attributes exist.

Description

A collaboration object based on the ItemValidation collaboration template checks that required attributes exist and contain data by using an external Java class called RetailUtility, located in the Java package com.ibm.wbi.retail.utils. It recursively parses each fully qualified attribute string to determine if the value of the attribute is NULL or BLANK.

Methods in the class

The class contains the following methods:
public boolean checkRequiredAttribute(BusObj busObj, Vector attrs, Vector err) \ 
throws Exception 
This method, checkRequiredAttribute, takes as input the Retail_Item business object and two Vectors. The first Vector contains the list of fully qualified attribute names to be checked for NULL or BLANK values. On return, the second Vector contains the list of missing attributes (those containing NULL or BLANK values). The method returns true if no attribute data is missing; it returns false if any required attribute data is missing.
public boolean checkRequiredAttribute(BusObj busObj, String attr, Vector err) \ 
throws Exception 
This method, also named checkRequiredAttribute, operates the same as the previous method, except it takes as input a single fully qualified attribute name.
public boolean checkComplexFilters(BusObj busObj, Vector complexFilters) \ 
throws Exception 
checkComplexFilters, takes as input the Retail_Item business object and one Vector. The Vector contains HashMaps of complexFilters to be checked. If any of the complex filters evaluate to true, then true is returned. If none of them evaluate to true, then false is returned.
public boolean checkComplexFilter(BusObj busObj, HashMap complexFilter) \ 
throws Exception
This method, checkComplexFilter, operates the same as the previous method, except that it takes as input a HashMap of a single complex filter.

Runtime behavior

At runtime, if the collaboration object's missing attribute data check logic is enabled (the value of the Retail_Item business object's attribute named in the configuration property ITEM_COMMAND_ATTRIBUTE exists in the REQUIRED_ATTRIBUTE_CMDS property), and the required attribute Vector contains elements, this class must be added to a directory or to a jar file contained in one of the following: Access to this external Java class via the ICS CLASSPATH or CWCLASSES path is also required in order to successfully compile the ItemValidation collaboration template.

Parent topic: Validating an item by requiring data for specific attributes