Settings (formerly global properties 1.8 and below) are configuration variables that the user can set through the Administration menu, without restarting or recompiling the application. They're useful when module code needs to refer to a value that's unique to a particular installation, such as a concept ID number or a file path.
ADDING A SETTING (formerly global property 1.8 and below) FOR YOUR MODULE
Settings (formerly global properties 1.8 and below) are defined in your module's config file. The property is added when the module is started if it doesn't already exist in the OpenMRS installation. See the module config file documentation for instructions to define properties in your module.
READING A SETTING (formerly global property 1.8 and below) IN CODE
Setting (formerly global property 1.8 and below) values or objects can be retrieved through the API's AdministrationService. See the API documentation for AdministrationService and for the GlobalProperty class.
Some of the core OpenMRS settings (formerly global properties 1.8 and below) are described at http://wiki.openmrs.org/display/docs/Global+Properties+Descriptions .
READING A SETTING (formerly global property 1.8 and below) IN A JSP
From the EHSDI 204 Module Development class slides on OpenMRS tags:
"<openmrs:globalProperty> tag: Used to access settings (formerly global properties 1.8 and below), which are name/value pairs stored in the database If var is specified, var becomes attribute with the property value If not, then property value printed to response For example... The setting (formerly global property 1.8 and below) called "concept.weight" stores the ID of the concept to use for patient weight observations This can set as an attribute called weightConceptId as follows... <openmrs:globalProperty key="concept.weight" var="weightConceptId"/>"
To view the class slides, download the course material ZIP file . Lesson 12 covers OpenMRS tags.
SETTING A SETTING (formerly global property 1.8 and below) VALUE
Settings (formerly global properties 1.8 and below) are set in the Administration menu under Maintenance > Manage Settings (formerly global properties 1.8 and below). You can try it here on the demo site. (Username is admin, password is test).
To make it easier for users to configure your module, you can create an administration page that displays the Settings (formerly global properties 1.8 and below) portlet. The portlet allows you to show only specific properties, rather than the entire list of settings (formerly global properties 1.8 and below). Remember to add the link for this admin page to your module's extension.html.AdminList::getLinks() method so it appears on the OpenMRS Administration page.
You can also redirect users to the configuration page with the RequireConfiguration Taglib when a value hasn't been set.
In the API, some AdministrationService::getGlobalProperty() method signatures allow you to specify a default value.