use of org.openmrs.PersonAttributeType in project openmrs-core by openmrs.
the class PersonServiceTest method purgePersonAttributeType_shouldThrowAnErrorWhileTryingToDeletePersonAttributeTypeWhenPersonAttributeTypesAreLocked.
/**
* @see PersonService#purgePersonAttributeType(PersonAttributeType)
* @throws PersonAttributeTypeLockedException
*/
@Test(expected = PersonAttributeTypeLockedException.class)
public void purgePersonAttributeType_shouldThrowAnErrorWhileTryingToDeletePersonAttributeTypeWhenPersonAttributeTypesAreLocked() throws Exception {
PersonService ps = Context.getPersonService();
createPersonAttributeTypeLockedGPAndSetValue("true");
PersonAttributeType pat = ps.getPersonAttributeType(1);
ps.purgePersonAttributeType(pat);
}
use of org.openmrs.PersonAttributeType in project openmrs-core by openmrs.
the class PersonServiceTest method shouldUnretirePersonAttributeType.
@Test
public void shouldUnretirePersonAttributeType() {
PersonAttributeType pat = personService.getPersonAttributeType(RETIRED_PERSON_ATTRIBUTE_TYPE);
personService.unretirePersonAttributeType(pat);
PersonAttributeType unretiredPat = personService.getPersonAttributeType(UNRETIRED_PERSON_ATTRIBUTE_TYPE);
assertFalse(unretiredPat.getRetired());
assertNull(unretiredPat.getRetiredBy());
assertNull(unretiredPat.getRetireReason());
assertNull(unretiredPat.getDateRetired());
}
use of org.openmrs.PersonAttributeType in project openmrs-core by openmrs.
the class PersonServiceTest method getAllPersonAttributeTypes_shouldReturnAllPersonAttributeTypesExcludingRetiredWhenIncludeRetiredIsFalse.
/**
* @see PersonService#getAllPersonAttributeTypes(null)
*/
@Test
public void getAllPersonAttributeTypes_shouldReturnAllPersonAttributeTypesExcludingRetiredWhenIncludeRetiredIsFalse() throws Exception {
executeDataSet("org/openmrs/api/include/PersonServiceTest-createRetiredPersonAttributeType.xml");
List<PersonAttributeType> attributeTypes = Context.getPersonService().getAllPersonAttributeTypes(false);
assertTrue("At least one element, otherwise no checking for retired will take place", attributeTypes.size() > 0);
boolean foundRetired = false;
for (PersonAttributeType personAttributeType : attributeTypes) {
if (personAttributeType.getRetired()) {
foundRetired = true;
break;
}
}
Assert.assertFalse("There should be no retired person attribute type found in the list", foundRetired);
}
use of org.openmrs.PersonAttributeType in project openmrs-core by openmrs.
the class PersonDAOTest method getSavedPersonAttributeTypeName_shouldGetSavedPersonAttributeTypeNameFromDatabase.
/**
* @see PersonDAO#getSavedPersonAttributeTypeName(org.openmrs.PersonAttributeType)
*/
@Test
public void getSavedPersonAttributeTypeName_shouldGetSavedPersonAttributeTypeNameFromDatabase() {
PersonAttributeType pat = Context.getPersonService().getPersonAttributeType(1);
// save the name from the db for later checks
String origName = pat.getName();
String newName = "Race Updated";
assertFalse(newName.equals(origName));
// change the name on the java pojo (NOT in the database)
pat.setName(newName);
// the value from the database should match the original name from the
// pat right after /it/ was fetched from the database
String nameFromDatabase = dao.getSavedPersonAttributeTypeName(pat);
assertEquals(origName, nameFromDatabase);
}
use of org.openmrs.PersonAttributeType in project openmrs-module-pihcore by PIH.
the class LegacyMasterPatientIndexSetup method setupConnectionToMasterPatientIndex.
public static void setupConnectionToMasterPatientIndex(RuntimeProperties customProperties) {
String url = customProperties.getLacollineServerUrl();
String username = customProperties.getLacollineUsername();
String password = customProperties.getLacollinePassword();
if (url == null || username == null || password == null) {
log.warn("Not configuring link to Lacolline server (url, username, and password are required)");
return;
}
Map<String, PatientIdentifierType> identifierTypeMap = new HashMap<String, PatientIdentifierType>();
identifierTypeMap.put("a541af1e-105c-40bf-b345-ba1fd6a59b85", Context.getPatientService().getPatientIdentifierTypeByUuid(ZlConfigConstants.PATIENTIDENTIFIERTYPE_ZLEMRID_UUID));
// TODO create PatientIdentifierType for Lacolline KE dossier number
identifierTypeMap.put("e66645eb-03a8-4991-b4ce-e87318e37566", Context.getPatientService().getPatientIdentifierTypeByUuid(ZlConfigConstants.PATIENTIDENTIFIERTYPE_EXTERNALDOSSIERNUMBER_UUID));
// TODO create PatientIdentifierType for Lacolline dental dossier number
Map<String, Location> locationMap = new HashMap<String, Location>();
locationMap.put("23e7bb0d-51f9-4d5f-b34b-2fbbfeea1960", Context.getLocationService().getLocationByUuid(LACOLLINE_LOCATION_UUID));
Map<String, PersonAttributeType> attributeTypeMap = new HashMap<String, PersonAttributeType>();
attributeTypeMap.put("340d04c4-0370-102d-b0e3-001ec94a0cc1", Metadata.getPhoneNumberAttributeType());
RemoteServerConfiguration config = new RemoteServerConfiguration();
config.setUrl(url);
config.setUsername(username);
config.setPassword(password);
config.setIdentifierTypeMap(identifierTypeMap);
config.setLocationMap(locationMap);
config.setAttributeTypeMap(attributeTypeMap);
Context.getService(ImportPatientFromWebService.class).registerRemoteServer("lacolline", config);
}
Aggregations