use of org.openmrs.module.idgen.service.IdentifierSourceService in project openmrs-module-mirebalais by PIH.
the class MirebalaisHospitalActivatorIT method testThatActivatorDoesAllSetup.
@Test
@DirtiesContext
public void testThatActivatorDoesAllSetup() throws Exception {
MirebalaisHospitalService service = Context.getService(MirebalaisHospitalService.class);
IdentifierSourceService identifierSourceService = Context.getService(IdentifierSourceService.class);
LocationService locationService = Context.getLocationService();
/**
* ConfigureIdGenerators configureIdGenerators = new ConfigureIdGenerators(identifierSourceService, locationService);
*
* IdentifierPool localZlIdentifierPool = service.getLocalZlIdentifierPool();
* RemoteIdentifierSource remoteZlIdentifierSource = service.getRemoteZlIdentifierSource();
* SequentialIdentifierGenerator dossierSequenceGenerator = service.getDossierSequenceGenerator(PihCoreConstants.UHM_DOSSIER_NUMBER_IDENTIFIER_SOURCE_UUID);
*
* PatientIdentifierType zlIdentifierType = Context.getPatientService().getPatientIdentifierTypeByUuid(HaitiPatientIdentifierTypes.ZL_EMR_ID.uuid());
* PatientIdentifierType dossierNumberIdentifierType = Context.getPatientService().getPatientIdentifierTypeByUuid(HaitiPatientIdentifierTypes.DOSSIER_NUMBER.uuid());
*
* AutoGenerationOption autoGenerationOption = Context.getService(IdentifierSourceService.class).getAutoGenerationOption(zlIdentifierType);
*
* assertEquals(HaitiPatientIdentifierTypes.ZL_EMR_ID.uuid(), zlIdentifierType.getUuid());
* assertEquals(zlIdentifierType, autoGenerationOption.getIdentifierType());
* assertEquals(localZlIdentifierPool, autoGenerationOption.getSource());
*
* assertEquals(PihCoreConstants.LOCAL_ZL_IDENTIFIER_POOL_UUID, localZlIdentifierPool.getUuid());
* assertEquals(PihCoreConstants.LOCAL_ZL_IDENTIFIER_POOL_BATCH_SIZE, localZlIdentifierPool.getBatchSize());
* assertEquals(PihCoreConstants.LOCAL_ZL_IDENTIFIER_POOL_MIN_POOL_SIZE, localZlIdentifierPool.getMinPoolSize());
*
* assertEquals(PihCoreConstants.REMOTE_ZL_IDENTIFIER_SOURCE_UUID, remoteZlIdentifierSource.getUuid());
* assertEquals(configureIdGenerators.getRemoteZlIdentifierSourceUrl(), remoteZlIdentifierSource.getUrl());
* assertEquals(configureIdGenerators.getRemoteZlIdentifierSourceUsername(), remoteZlIdentifierSource.getUser());
* assertEquals(configureIdGenerators.getRemoteZlIdentifierSourcePassword(), remoteZlIdentifierSource.getPassword());
*
* assertEquals("A", dossierSequenceGenerator.getPrefix());
* assertEquals(new Integer(7), dossierSequenceGenerator.getMaxLength());
* assertEquals(new Integer(7), dossierSequenceGenerator.getMinLength());
* assertEquals("0123456789", dossierSequenceGenerator.getBaseCharacterSet());
* assertEquals("000001", dossierSequenceGenerator.getFirstIdentifierBase());
* assertEquals(PihCoreConstants.UHM_DOSSIER_NUMBER_IDENTIFIER_SOURCE_UUID, dossierSequenceGenerator.getUuid());
* assertEquals(dossierNumberIdentifierType, dossierSequenceGenerator.getIdentifierType());
* assertEquals(2, Context.getService(IdentifierSourceService.class).getAutoGenerationOptions(dossierNumberIdentifierType).size());
*/
assertNotNull(Context.getService(ImportPatientFromWebService.class).getRemoteServers().get("lacolline"));
}
use of org.openmrs.module.idgen.service.IdentifierSourceService in project openmrs-module-mirebalais by PIH.
the class MirebalaisHospitalServiceImpl method getIdentifierSource.
private <T extends IdentifierSource> T getIdentifierSource(String uuid, Class<T> sourceType) {
IdentifierSourceService iss = Context.getService(IdentifierSourceService.class);
IdentifierSource source = iss.getIdentifierSourceByUuid(uuid);
if (source == null) {
throw new IllegalStateException(sourceType.getSimpleName() + " has not been configured");
}
return (T) source;
}
use of org.openmrs.module.idgen.service.IdentifierSourceService in project openmrs-module-pihcore by PIH.
the class PihCoreActivator method started.
// TODO test
@Override
public void started() {
try {
MetadataMappingService metadataMappingService = Context.getService(MetadataMappingService.class);
PatientService patientService = Context.getPatientService();
FormService formService = Context.getFormService();
LocationService locationService = Context.getLocationService();
EncounterService encounterService = Context.getEncounterService();
VisitService visitService = Context.getVisitService();
IdentifierSourceService identifierSourceService = Context.getService(IdentifierSourceService.class);
ConceptService conceptService = Context.getService(ConceptService.class);
if (config == null) {
// hack to allow injecting a mock config for testing
// currently only one of these
config = Context.getRegisteredComponents(Config.class).get(0);
}
setDispositionConfig(config);
installMetadataBundles(config);
setGlobalProperties(config);
setExtraIdentifierTypes(metadataMappingService, patientService, config);
MergeActionsSetup.registerMergeActions();
LocationTagSetup.setupLocationTags(locationService, config);
HtmlFormSetup.setupHtmlFormEntryTagHandlers();
MetadataMappingsSetup.setupGlobalMetadataMappings(metadataMappingService, locationService, encounterService, visitService);
MetadataMappingsSetup.setupPrimaryIdentifierTypeBasedOnCountry(metadataMappingService, patientService, config);
MetadataMappingsSetup.setupFormMetadataMappings(metadataMappingService);
PatientIdentifierSetup.setupIdentifierGeneratorsIfNecessary(identifierSourceService, locationService, config);
PacIntegrationSetup.setup(config);
AttachmentsSetup.migrateAttachmentsConceptsIfNecessary(conceptService);
// RetireProvidersSetup.setupRetireProvidersTask();
} catch (Exception e) {
Module mod = ModuleFactory.getModuleById("pihcore");
ModuleFactory.stopModule(mod);
throw new RuntimeException("failed to setup the required modules", e);
}
}
use of org.openmrs.module.idgen.service.IdentifierSourceService in project openmrs-module-pihcore by PIH.
the class ConfigureHaitiIdGenerators method getIdentifierSource.
private <T extends IdentifierSource> T getIdentifierSource(String uuid, Class<T> sourceType) {
IdentifierSourceService iss = Context.getService(IdentifierSourceService.class);
IdentifierSource source = iss.getIdentifierSourceByUuid(uuid);
if (source == null) {
throw new IllegalStateException(sourceType.getSimpleName() + " has not been configured");
}
return (T) source;
}
Aggregations