use of org.openmrs.module.idgen.SequentialIdentifierGenerator in project openmrs-module-pihcore by PIH.
the class ConfigureHaitiIdGenerators method localZlIdentifierGenerator.
public SequentialIdentifierGenerator localZlIdentifierGenerator(PatientIdentifierType zlPatientIdentifierType) {
SequentialIdentifierGenerator localZlIdentifierGenerator;
try {
localZlIdentifierGenerator = getLocalZlIdentifierGenerator();
} catch (IllegalStateException ex) {
localZlIdentifierGenerator = new SequentialIdentifierGenerator();
localZlIdentifierGenerator.setName("Local ZL Identifier Generator");
localZlIdentifierGenerator.setUuid(PihCoreConstants.LOCAL_ZL_IDENTIFIER_GENERATOR_UUID);
localZlIdentifierGenerator.setIdentifierType(zlPatientIdentifierType);
localZlIdentifierGenerator.setBaseCharacterSet("ACDEFGHJKLMNPRTUVWXY1234567890");
localZlIdentifierGenerator.setMaxLength(6);
localZlIdentifierGenerator.setMinLength(6);
}
String prefix = getLocalZlIdentifierGeneratorPrefix();
int firstIdentifierBase = (int) Math.pow(10, (4 - prefix.length()));
localZlIdentifierGenerator.setPrefix(prefix);
localZlIdentifierGenerator.setFirstIdentifierBase(Integer.toString(firstIdentifierBase));
identifierSourceService.saveIdentifierSource(localZlIdentifierGenerator);
return localZlIdentifierGenerator;
}
Aggregations