use of org.openmrs.GlobalProperty in project openmrs-core by openmrs.
the class LocationServiceTest method getDefaultLocation_shouldReturnDefaultLocationForTheImplementation.
/**
* @see LocationService#getDefaultLocation()
*/
@Test
public void getDefaultLocation_shouldReturnDefaultLocationForTheImplementation() {
// set the global property for default location to something other than Unknown Location
GlobalProperty gp = new GlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_LOCATION_NAME, "Test Parent Location", "Testing default Location");
Context.getAdministrationService().saveGlobalProperty(gp);
Assert.assertEquals("Test Parent Location", Context.getLocationService().getDefaultLocation().getName());
}
use of org.openmrs.GlobalProperty in project openmrs-core by openmrs.
the class PatientServiceTest method createPatientIdentifierTypeLockedGPAndSetValue.
/**
* Creates a new Global Property to lock patient identifier types by setting its value
*
* @param propertyValue value for patient identifier types locked GP
*/
public void createPatientIdentifierTypeLockedGPAndSetValue(String propertyValue) {
GlobalProperty gp = new GlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_PATIENT_IDENTIFIER_TYPES_LOCKED);
gp.setPropertyValue(propertyValue);
Context.getAdministrationService().saveGlobalProperty(gp);
}
use of org.openmrs.GlobalProperty in project openmrs-core by openmrs.
the class ExistingOrNewVisitAssignmentHandlerTest method beforeCreateEncounter_shouldResolveEncounterAndVisitTypeUuidsAsGlobalPropertyValues.
/**
* @see ExistingOrNewVisitAssignmentHandler#beforeCreateEncounter(Encounter)
*/
@Test
public void beforeCreateEncounter_shouldResolveEncounterAndVisitTypeUuidsAsGlobalPropertyValues() {
final String encounterTypeUuid = "759799ab-c9a5-435e-b671-77773ada74e4";
final String visitTypeUuid = "c0c579b0-8e59-401d-8a4a-976a0b183519";
Encounter encounter = Context.getEncounterService().getEncounter(1);
Assert.assertNull(encounter.getVisit());
Assert.assertEquals(encounterTypeUuid, encounter.getEncounterType().getUuid());
Calendar calendar = Calendar.getInstance();
calendar.setTime(encounter.getEncounterDatetime());
calendar.set(Calendar.YEAR, 1900);
encounter.setEncounterDatetime(calendar.getTime());
GlobalProperty gp = new GlobalProperty(OpenmrsConstants.GP_ENCOUNTER_TYPE_TO_VISIT_TYPE_MAPPING, encounterTypeUuid + ":" + visitTypeUuid);
Context.getAdministrationService().saveGlobalProperty(gp);
new ExistingOrNewVisitAssignmentHandler().beforeCreateEncounter(encounter);
Assert.assertNotNull(encounter.getVisit());
// should be set according toencounterTypeUuid:visitTypeUuid
Assert.assertEquals(1, encounter.getEncounterType().getEncounterTypeId().intValue());
Assert.assertEquals(Context.getVisitService().getVisitTypeByUuid(visitTypeUuid), encounter.getVisit().getVisitType());
}
use of org.openmrs.GlobalProperty in project openmrs-core by openmrs.
the class GlobalLocaleListTest method globalPropertyChanged_shouldSetAllowedLocalesIfGlobalPropertyIsAnEmptyString.
@Test
public void globalPropertyChanged_shouldSetAllowedLocalesIfGlobalPropertyIsAnEmptyString() {
GlobalProperty gp = new GlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_LOCALE_ALLOWED_LIST, "");
globalLocaleList.globalPropertyChanged(gp);
assertThat(globalLocaleList.getAllowedLocales(), contains(Locale.ROOT));
}
use of org.openmrs.GlobalProperty in project openmrs-module-coreapps by openmrs.
the class CoreAppsActivator method started.
/**
* @see ModuleActivator#started()
*/
public void started() {
// purge old global property no longer used
GlobalProperty defaultDashboard = Context.getAdministrationService().getGlobalPropertyObject(CoreAppsConstants.GP_DEFAULT_DASHBOARD);
if (defaultDashboard != null) {
Context.getAdministrationService().purgeGlobalProperty(defaultDashboard);
}
log.info("Core Apps Module started");
}
Aggregations