Configuration Settings
The standard qualifiers shipped with SAP Enterprise POS often rely on configuration settings (as maintained and deployed by Configurator) to fine tune their behavior.
The following code sample demonstrates how you can retrieve Configuration settings for the currently executing User Defined Function (UDF) from the Request Dispatch Information object:
Syntax
UdfConfig udfConfig = aRequestDispatchInfo.getUDFConfiguration();
String udfId = udfConfig.getUdfId();
String udfDescription = udfConfig.getDescription();
This example demonstrates how to retrieve settings that are generic to all UDFs. Typically, you will want to retrieve settings that are specific to the type of UDF (such as Item Sell or Tender Payment) that you are qualifying. Access to such settings requires knowledge of the actual UdfConfig
subclass
used for a particular function, so that you can properly cast the UdfConfig
instance. For more information on feature-specific User Exits, see POS Item Feature.
In addition, we provide a standard interface to retrieve other application-specific configuration settings, as shown in the following sample code fragment:
Syntax
// Get the configuration service provider from the aRequestDispatchInfo
// method argument.
IConfigurationProvider configProvider = aRequestDispatchInfo.
getContextualInfoProvider().getConfigurationProvider();
// Fetch the configuration settings for fees.
ConfigCollection feesConfigCollection = (ConfigCollection)
aConfigurationProvider.
getConfiguration(ConfigComponentNames.FEE_COMPONENT_NAME);
// Throw an exception if the expected configuration settings are not
// available.
if (feesConfigCollection == null) {
ExceptionLib.abort("Failed to fetch Fees configuration component.", LOG);
}
// Get the settings (the “configuration instance”) for the fee with the
// identifier “FeeXyz”. Throw an exception if the expected fee instance
// is not available. Note that you must know the expected type of the
// configuration instance in order to properly cast it.
Fee feeConfig = (Fee) feesConfigCollection.get(“FeeXyz”);
if (feeConfig == null) {
ExceptionLib.abort(“Unable to find fee configuration for FeeXyz”, LOG);
}
// Use the fee settings.
String feeDescription = feeConfig.getDescription();
For details of particular configuration components, see SAP Enterprise POS JavaDocs.