Application Configuration Settings API
You can retrieve platform configuration settings by using the com.servicemax.core.utils.ConfigurationSettings Groovy API.
Use the following method to retrieve setting values for specified applications, setting identifiers, and users:
public static Object getSettingValue(String applicationFullIdentifier, String settingIdentifier, String username)
Returned values depend on the data types of the specified settings.
Following is the logic flow to retrieve current active setting values for applicationFullIdentifier, settingIdentifier, and username:
1. Use the configuration for the user’s preferred role or group if available.
2. If not, use the configuration for the Standard User.
3. If not, return the default value or null in cases where settings or applications do not exist or where default values are not set.
Option List Example
Returns setting values of the IOption data type.
import com.servicemax.core.utils.ConfigurationSettings;
import com.intalio.core.data.api.IOption
IOption[] optionSetting = (IOption[]) ConfigurationSettings.getSettingValue("some_app", ""some_opt_setting"", Max.effectiveUsername());
UUID Example
Returns setting values of the UUID data type.
import com.servicemax.core.utils.ConfigurationSettings;
import java.util.UUID
UUID uuidSetting = (UUID) ConfigurationSettings.getSettingValue("some_app", ""some_uuid_setting"", Max.effectiveUsername());
Timestamp Example
Returns setting values of the Joda DateTime data type.
import com.servicemax.core.utils.ConfigurationSettings;
import org.joda.time.DateTime;
DateTime timestampSetting = (DateTime) ConfigurationSettings.getSettingValue("some_app", ""some_timestamp_setting"", Max.effectiveUsername());
Date Example
Returns setting values of the Joda LocalDate data type.
import com.servicemax.core.utils.ConfigurationSettings;
import org.joda.time.LocalDate;
LocalDate localDateSetting = (LocalDate) ConfigurationSettings.getSettingValue("some_app", ""some_localdate_setting"", Max.effectiveUsername());
Quantity Example
Returns setting values of the IQuantity data type.
import com.servicemax.core.utils.ConfigurationSettings;
import com.intalio.core.data.api.IQuantity;
IQuantity quantitySetting = (IQuantity) ConfigurationSettings.getSettingValue("some_app", ""some_quantity_setting"", Max.effectiveUsername());
For more information: