System Settings API
To retrieve configured platform System Settings records, you can use the com.servicemax.core.utils.SystemInfo Groovy API.
Methods
Retrieve Value of Specified System Setting
public static Object getSystemValue(String systemSettingName)
Retrieve Default Language Configured on Platform
public static LanguageInfo getDefaultLanguage()
Retrieve Default Time Zone or Abbreviation
public static String getDefaultTimezoneName()
public static String getDefaultTimezoneAbbreviation()
Examples
Get Value of ldap_port Setting
def ldapPort = SystemInfo.getSystemValue("io_ldap_port");
Get Value of Instance URL
def instanceURL = SystemInfo.getSystemValue("io_instance_url");
Get Default Language
def defaultLanguage = SystemInfo.getDefaultLanguage();
Get Language Code
defaultLanguage.getLanguageCode();
defaultLanguage.getDateFormat();
defaultLanguage.getLocale();
defaultLanguage.getUUID();
defaultLanguage.getDefaultAddressFormat();
defaultLanguage.isSupported();
Get Default Time Zone Name
def defaultTimeZoneName = SystemInfo.getDefaultTimezoneName();
def defaultTimeZone = SystemInfo.getDefaultTimezoneAbbreviation();
Data Type Retrieval Examples
To work with the following examples, import these classes:
import org.joda.time.Period;
import com.servicemax.core.utils.SystemInfo;
import com.servicemax.core.utils.Definitions;
import com.intalio.core.data.quantity.Quantity;
import com.servicemax.core.Database;
Get Interval Property
def period = SystemInfo.getSystemValue("io_access_token_lifespan");
println "Period: ${period.toString()}";
Get Option Property
def landingPage = SystemInfo.getOptionFieldValue("io_default_landing_page");
println "Landing Page: ${landingPage}";
Get Quantity Property
def maxAttachmentSize = SystemInfo.getFieldIntValue("io_maximum_attachment_size");
println "Max attachment size: ${maxAttachmentSize}";
Get Relationship Property for Relationship Data Type Field
def namespaceId = SystemInfo.getSystemValue("io_default_namespace");
def namespace = Database.querySingleResult("SELECT * from io_namespace where io_uuid = :io_uuid", [io_uuid:namespaceId]);
println "Namespace ${namespace.io_name}"
Get URL Property for URL Data Type Field
def instanceURL = SystemInfo.getURI("io_instance_url");
println "Instance URL $instanceURL"
Get User Session Property for Interval Data Type Field
def user_session = SystemInfo.getInterval("io_user_session_timeout");
For more information: