Adapter Check Value Callbacks
When using both fixed resource domains and dynamic resource domains, you may allow the users of the adapter to enter their own parameter values, allowing them to add to the current list of values for the resource domain. To enable the adapter to validate these values, you use callbacks known as
adapter check values. Adapter check values are resource domain mechanisms that function very much like resource domain lookups. Any value in a parameter that is not part of the parameter's resource domain list may be validated by an adapter check value. For more information, see
Registering Resource Domains.
Adapter check values can also validate resource domain lookups for each unique value that is not part of a resource domain list that is complete (that is, a list that does not accept the values supplied by the users of the adapter). For example, suppose the sequence parameter named colors contains the values "White", "Gray", "Black", and "Red". After a resource domain lookup, the resource domain list contains "Black" and "Gray". Assuming that the resource domain is configured appropriately, the adapter service editor performs an adapter check value callback for "Red" and "White". If it finds either value, it deletes the cell containing that value or overwrites it, if the sequence is in a field map.
To use an adapter check value callback, you must:
Set the following methods of the
ResourceDomainValues class as follows:
Method | Description |
ResourceDomainValues.setComplete(false) | Allows the users of the adapter to supply values. Sets a flag named complete. When using both fixed resource domains and dynamic resource domains, you can allow the users of the adapter to enter their own values, allowing them to add to the current list of values for the resource domain. |
ResourceDomainValues.setCanValidate(true) | Enables the adapter to validate the user supplied values using adapter check values callbacks. The WmManagedConnection.adapterCheckValue method validates the user supplied values. Sets the canValidate flag |
ResourceDomainValues.setDisabled | Disables the parameter in the adapter service editor. |
If both of these flags are set properly, the adapter service editor calls the following method for each value that is not already in the resource domain:
Boolean adapterCheckValue(String serviceName,
String resourceDomainName,
String[][] values,
String testValue)
Parameter Name | Description |
serviceName | Class name of the adapter service. |
resourceDomainName | Registered name of the resource domain. |
values | A multi-dimensional array that is populated with the current value of the parameters upon which the current lookup depends, as specified in the WmTemplateDescriptor.setResourceDomain call. |
testValue | Value being checked. |
Register the adapter check value callback at the same time you register the resource domain name, using the
WmAdapterAccess.addCheckValue method. For more information, see
Registering Resource Domains.