diff --git a/registration-processor/pre-processor/registration-processor-packet-classifier-stage/src/main/java/io/mosip/registration/processor/stages/packetclassifier/tagging/impl/ExceptionBiometricsTagGenerator.java b/registration-processor/pre-processor/registration-processor-packet-classifier-stage/src/main/java/io/mosip/registration/processor/stages/packetclassifier/tagging/impl/ExceptionBiometricsTagGenerator.java index 19d70cec360..76b526d6b5e 100644 --- a/registration-processor/pre-processor/registration-processor-packet-classifier-stage/src/main/java/io/mosip/registration/processor/stages/packetclassifier/tagging/impl/ExceptionBiometricsTagGenerator.java +++ b/registration-processor/pre-processor/registration-processor-packet-classifier-stage/src/main/java/io/mosip/registration/processor/stages/packetclassifier/tagging/impl/ExceptionBiometricsTagGenerator.java @@ -1,99 +1,155 @@ -package io.mosip.registration.processor.stages.packetclassifier.tagging.impl; - -import io.mosip.kernel.core.exception.BaseCheckedException; -import io.mosip.kernel.core.logger.spi.Logger; -import io.mosip.registration.processor.core.constant.JsonConstant; -import io.mosip.registration.processor.core.exception.util.PlatformErrorMessages; -import io.mosip.registration.processor.core.logger.RegProcessorLogger; -import io.mosip.registration.processor.packet.storage.exception.ParsingException; -import io.mosip.registration.processor.stages.packetclassifier.dto.FieldDTO; -import io.mosip.registration.processor.stages.packetclassifier.tagging.TagGenerator; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.StringJoiner; - -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; -import org.springframework.stereotype.Component; - -@Component -@ConditionalOnExpression(value = "'${mosip.regproc.packet.classifier.tag-generators}'.contains('MosipExceptionBiometrics')") -public class ExceptionBiometricsTagGenerator implements TagGenerator { - - /** Tag name that will used be while tagging exception biometrics */ - @Value("${mosip.regproc.packet.classifier.tagging.exceptionbiometrics.tag-name:EXCEPTION_BIOMETRICS}") - private String tagName; - - /** This mapping will contain the short words for each missing biometrics, the values will used for concatenating in the tags */ - @Value("#{${mosip.regproc.packet.classifier.tagging.exceptionbiometrics.bio-value-mapping:{'leftLittle':'LL','leftRing':'LR','leftMiddle':'LM','leftIndex':'LI','leftThumb':'LT','rightLittle':'RL','rightRing':'RR','rightMiddle':'RM','rightIndex':'RI','rightThumb':'RT','leftEye':'LE','rightEye':'RE'}}}") - private Map bioValueMapping; - - /** The tag value that will be used by default when the packet does not have value for the tag field */ - @Value("${mosip.regproc.packet.classifier.tagging.not-available-tag-value}") - private String notAvailableTagValue; - - /** The reg proc logger. */ - private static Logger regProcLogger = RegProcessorLogger.getLogger(ExceptionBiometricsTagGenerator.class); - - private static String BIOMETRICS_DELIMITER = ","; - - /** - * {@inheritDoc} - */ - @Override - public List getRequiredIdObjectFieldNames() throws BaseCheckedException { - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public Map generateTags(String workflowInstanceId, String registrationId, String process, - Map idObjectFieldDTOMap, Map metaInfoMap, int iteration) throws BaseCheckedException { - try { - Map tags = new HashMap(1); - String exceptionBiometricsString = metaInfoMap.get(JsonConstant.EXCEPTIONBIOMETRICS); - if(exceptionBiometricsString == null) { - regProcLogger.warn("{} --> {}, setting tag value as {}", - PlatformErrorMessages.RPR_PCM_EXCEPTION_BIOMETRICS_ENTRY_NOT_AVAILABLE.getCode(), - PlatformErrorMessages.RPR_PCM_EXCEPTION_BIOMETRICS_ENTRY_NOT_AVAILABLE.getMessage(), - notAvailableTagValue); - tags.put(tagName, notAvailableTagValue); - return tags; - } - JSONObject exceptionBiometricsJsonObject = new JSONObject(exceptionBiometricsString); - if(!exceptionBiometricsJsonObject.has(JsonConstant.EXCEPTIONBIOMETRICSAPPLICANT)) { - regProcLogger.warn("{} --> {}, setting tag value as {}", - PlatformErrorMessages.RPR_PCM_EXCEPTION_BIOMETRICS_APPLICANT_ENTRY_NOT_AVAILABLE.getCode(), - PlatformErrorMessages.RPR_PCM_EXCEPTION_BIOMETRICS_APPLICANT_ENTRY_NOT_AVAILABLE.getMessage(), - notAvailableTagValue); - tags.put(tagName, notAvailableTagValue); - return tags; - } - JSONObject applicantJsonObject = exceptionBiometricsJsonObject.getJSONObject( - JsonConstant.EXCEPTIONBIOMETRICSAPPLICANT); - - if (applicantJsonObject == null || applicantJsonObject.length() == 0) - tags.put(tagName, ""); - else { - StringJoiner exceptionBiometricStringJoiner = new StringJoiner(BIOMETRICS_DELIMITER); - for(Map.Entry entry : bioValueMapping.entrySet()) { - if(applicantJsonObject.has(entry.getKey())) - exceptionBiometricStringJoiner.add(entry.getValue()); - } - tags.put(tagName, exceptionBiometricStringJoiner.toString()); - } - - return tags; - } catch (JSONException e) { - throw new ParsingException( - PlatformErrorMessages.RPR_PCM_META_INFO_JSON_PARSING_FAILED.getMessage(), e); - } - } - -} +package io.mosip.registration.processor.stages.packetclassifier.tagging.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.StringJoiner; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import io.mosip.kernel.core.exception.BaseCheckedException; +import io.mosip.kernel.core.logger.spi.Logger; +import io.mosip.kernel.core.util.StringUtils; +import io.mosip.registration.processor.core.constant.JsonConstant; +import io.mosip.registration.processor.core.exception.util.PlatformErrorMessages; +import io.mosip.registration.processor.core.logger.RegProcessorLogger; +import io.mosip.registration.processor.core.packet.dto.FieldValue; +import io.mosip.registration.processor.packet.storage.exception.ParsingException; +import io.mosip.registration.processor.stages.packetclassifier.dto.FieldDTO; +import io.mosip.registration.processor.stages.packetclassifier.tagging.TagGenerator; + +@Component +@ConditionalOnExpression(value = "'${mosip.regproc.packet.classifier.tag-generators}'.contains('MosipExceptionBiometrics')") +public class ExceptionBiometricsTagGenerator implements TagGenerator { + + /** Tag name that will used be while tagging exception biometrics */ + @Value("${mosip.regproc.packet.classifier.tagging.exceptionbiometrics.tag-name:EXCEPTION_BIOMETRICS}") + private String tagName; + + /** This mapping will contain the short words for each missing biometrics, the values will used for concatenating in the tags */ + @Value("#{${mosip.regproc.packet.classifier.tagging.exceptionbiometrics.bio-value-mapping:{'leftLittle':'LL','leftRing':'LR','leftMiddle':'LM','leftIndex':'LI','leftThumb':'LT','rightLittle':'RL','rightRing':'RR','rightMiddle':'RM','rightIndex':'RI','rightThumb':'RT','leftEye':'LE','rightEye':'RE'}}}") + private Map bioValueMapping; + + /** The tag value that will be used by default when the packet does not have value for the tag field */ + @Value("${mosip.regproc.packet.classifier.tagging.not-available-tag-value}") + private String notAvailableTagValue; + + @Value("#{T(java.util.Arrays).asList('${mosip.regproc.packet.classifier.tagging.exceptionbiometrics.before-exception-metainfo-change.reg-client-versions:}')}") + private List regClientVersionsBeforeExceptionMetaInfoChange; + + /** The reg proc logger. */ + private static Logger regProcLogger = RegProcessorLogger.getLogger(ExceptionBiometricsTagGenerator.class); + + private static String BIOMETRICS_DELIMITER = ","; + + @Autowired + ObjectMapper mapper; + + /** + * {@inheritDoc} + */ + @Override + public List getRequiredIdObjectFieldNames() throws BaseCheckedException { + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public Map generateTags(String workflowInstanceId, String registrationId, String process, + Map idObjectFieldDTOMap, Map metaInfoMap, int iteration) throws BaseCheckedException { + try { + Map tags = new HashMap(1); + String exceptionBiometricsString = metaInfoMap.get(JsonConstant.EXCEPTIONBIOMETRICS); + if(exceptionBiometricsString == null) { + regProcLogger.warn("{} --> {}, setting tag value as {}", + PlatformErrorMessages.RPR_PCM_EXCEPTION_BIOMETRICS_ENTRY_NOT_AVAILABLE.getCode(), + PlatformErrorMessages.RPR_PCM_EXCEPTION_BIOMETRICS_ENTRY_NOT_AVAILABLE.getMessage(), + notAvailableTagValue); + tags.put(tagName, notAvailableTagValue); + return tags; + } + JSONObject exceptionBiometricsJsonObject = new JSONObject(exceptionBiometricsString); + String regClientVersion = getRegClientVersionFromMetaInfo(registrationId, process, metaInfoMap); + JSONObject applicantJsonObject = null; + // if the version is not found in metainfo then consider it is as older and + // expect applicant to be available inside the exception biometrics + if (regClientVersion == null || (regClientVersion != null + && regClientVersionsBeforeExceptionMetaInfoChange.contains(regClientVersion))) { + if (!exceptionBiometricsJsonObject.has(JsonConstant.EXCEPTIONBIOMETRICSAPPLICANT)) { + regProcLogger.warn("{} --> {}, setting tag value as {}", + PlatformErrorMessages.RPR_PCM_EXCEPTION_BIOMETRICS_APPLICANT_ENTRY_NOT_AVAILABLE.getCode(), + PlatformErrorMessages.RPR_PCM_EXCEPTION_BIOMETRICS_APPLICANT_ENTRY_NOT_AVAILABLE + .getMessage(), + notAvailableTagValue); + tags.put(tagName, notAvailableTagValue); + return tags; + } + applicantJsonObject = exceptionBiometricsJsonObject + .getJSONObject(JsonConstant.EXCEPTIONBIOMETRICSAPPLICANT); + + } else { + if (!exceptionBiometricsJsonObject.has(JsonConstant.INDIVIDUAL_BIOMETRICS)) { + regProcLogger.warn("{} --> {}, setting tag value as {}", + PlatformErrorMessages.RPR_PCM_EXCEPTION_BIOMETRICS_APPLICANT_ENTRY_NOT_AVAILABLE.getCode(), + PlatformErrorMessages.RPR_PCM_EXCEPTION_BIOMETRICS_APPLICANT_ENTRY_NOT_AVAILABLE + .getMessage(), + notAvailableTagValue); + tags.put(tagName, notAvailableTagValue); + return tags; + } + applicantJsonObject = exceptionBiometricsJsonObject + .getJSONObject(JsonConstant.INDIVIDUAL_BIOMETRICS); + } + + + if (applicantJsonObject == null || applicantJsonObject.length() == 0) + tags.put(tagName, ""); + else { + StringJoiner exceptionBiometricStringJoiner = new StringJoiner(BIOMETRICS_DELIMITER); + for(Map.Entry entry : bioValueMapping.entrySet()) { + if(applicantJsonObject.has(entry.getKey())) + exceptionBiometricStringJoiner.add(entry.getValue()); + } + tags.put(tagName, exceptionBiometricStringJoiner.toString()); + } + + return tags; + } catch (JSONException | JsonProcessingException e) { + throw new ParsingException( + PlatformErrorMessages.RPR_PCM_META_INFO_JSON_PARSING_FAILED.getMessage(), e); + } + } + + private String getRegClientVersionFromMetaInfo(String id, String process, Map metaInfoMap) + throws JSONException, JsonProcessingException + { + String metadata = metaInfoMap.get(JsonConstant.METADATA); + String version = null; + if (StringUtils.isNotEmpty(metadata)) { + JSONArray jsonArray = new JSONArray(metadata); + + for (int i = 0; i < jsonArray.length(); i++) { + if (!jsonArray.isNull(i)) { + org.json.JSONObject jsonObject = (org.json.JSONObject) jsonArray.get(i); + FieldValue fieldValue = mapper.readValue(jsonObject.toString(), FieldValue.class); + if (fieldValue.getLabel().equalsIgnoreCase(JsonConstant.REGCLIENTVERSION)) { + version = fieldValue.getValue(); + break; + } + } + } + } + return version; + } +} diff --git a/registration-processor/pre-processor/registration-processor-packet-classifier-stage/src/test/java/io/mosip/registration/processor/stages/packetclassifier/tagging/impl/ExceptionBiometricsTagGeneratorTest.java b/registration-processor/pre-processor/registration-processor-packet-classifier-stage/src/test/java/io/mosip/registration/processor/stages/packetclassifier/tagging/impl/ExceptionBiometricsTagGeneratorTest.java index ecde7bbf539..bcf78ae0638 100644 --- a/registration-processor/pre-processor/registration-processor-packet-classifier-stage/src/test/java/io/mosip/registration/processor/stages/packetclassifier/tagging/impl/ExceptionBiometricsTagGeneratorTest.java +++ b/registration-processor/pre-processor/registration-processor-packet-classifier-stage/src/test/java/io/mosip/registration/processor/stages/packetclassifier/tagging/impl/ExceptionBiometricsTagGeneratorTest.java @@ -1,123 +1,248 @@ -package io.mosip.registration.processor.stages.packetclassifier.tagging.impl; - -import static org.junit.Assert.assertEquals; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.modules.junit4.PowerMockRunner; -import org.powermock.reflect.Whitebox; -import org.springframework.cloud.context.config.annotation.RefreshScope; - -import io.mosip.kernel.core.exception.BaseCheckedException; -import io.mosip.registration.processor.core.constant.JsonConstant; -import io.mosip.registration.processor.packet.storage.exception.ParsingException; - -/** - * The Class PacketValidatorStageTest. - */ -@RefreshScope -@RunWith(PowerMockRunner.class) -@PowerMockIgnore({ "javax.management.*", "javax.net.ssl.*", "com.sun.org.apache.xerces.*", - "javax.xml.*", "org.xml.*" }) -public class ExceptionBiometricsTagGeneratorTest { - - private static String tagName = "EXCEPTION_BIOMETRICS"; - - private static String notAvailableTagValue = "--TAG_VALUE_NOT_AVAILABLE--"; - - @InjectMocks - private ExceptionBiometricsTagGenerator exceptionBiometricsTagGenerator; - - @Before - public void setup() throws Exception { - Whitebox.setInternalState(exceptionBiometricsTagGenerator, "tagName", tagName); - Map bioValueMapping = new LinkedHashMap<>(); - bioValueMapping.put("leftLittle", "LL"); - bioValueMapping.put("leftRing", "LR"); - bioValueMapping.put("leftMiddle", "LM"); - bioValueMapping.put("leftIndex", "LI"); - bioValueMapping.put("leftThumb", "LT"); - bioValueMapping.put("rightLittle", "RL"); - bioValueMapping.put("rightRing", "RR"); - bioValueMapping.put("rightMiddle", "RM"); - bioValueMapping.put("rightIndex", "RI"); - bioValueMapping.put("rightThumb", "RT"); - bioValueMapping.put("leftEye", "LE"); - bioValueMapping.put("rightEye", "RE"); - Whitebox.setInternalState(exceptionBiometricsTagGenerator, "bioValueMapping", bioValueMapping); - Whitebox.setInternalState(exceptionBiometricsTagGenerator, "notAvailableTagValue", - notAvailableTagValue); - } - - @Test - public void testGenerateTagsForExceptionBiometricsAvailable() throws BaseCheckedException { - Map metaInfoMap = new HashMap<>(); - metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, - "{\"applicant\" : {\"leftEye\" : {\"type\" : \"iris\", \"missingBiometric\" : \"leftEye\",\"reason\" : \"Missing biometrics\",\"exceptionType\" : \"Permanent\",\"individualType\" : \"INDIVIDUAL\"}}}"); - Map tags = - exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, metaInfoMap, 0); - assertEquals("LE", tags.get(tagName)); - } - - @Test - public void testGenerateTagsForExceptionBiometricsAvailableForAllModalites() - throws BaseCheckedException { - Map metaInfoMap = new HashMap<>(); - metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, - "{\n \"introducer\" : { },\n \"applicant-auth\" : { },\n \"applicant\" : {\n \"leftEye\" : {\n \"type\" : \"Iris\",\n \"missingBiometric\" : \"leftEye\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightEye\" : {\n \"type\" : \"Iris\",\n \"missingBiometric\" : \"rightEye\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightIndex\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightIndex\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightLittle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightLittle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightRing\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightRing\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightMiddle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightMiddle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftIndex\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftIndex\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftLittle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftLittle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftRing\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftRing\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftMiddle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftMiddle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftThumb\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftThumb\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightThumb\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightThumb\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n }\n }\n}"); - Map tags = - exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, metaInfoMap, 0); - assertEquals("LL,LR,LM,LI,LT,RL,RR,RM,RI,RT,LE,RE", tags.get(tagName)); - } - - @Test - public void testGenerateTagsForExceptionBiometricsNotAvailable() throws BaseCheckedException { - Map metaInfoMap = new HashMap<>(); - metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, "{\"applicant\" : {}}"); - Map tags = - exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, metaInfoMap, 0); - assertEquals("", tags.get(tagName)); - } - - @Test - public void testGenerateTagsForExceptionBiometricsApplicantNotAvailable() throws BaseCheckedException { - Map metaInfoMap = new HashMap<>(); - metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, "{}"); - Map tags = - exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, metaInfoMap, 0); - assertEquals(notAvailableTagValue, tags.get(tagName)); - } - - @Test(expected = ParsingException.class) - public void testGenerateTagsForMetaInfoMapExceptionBiometricsContainingInvalidJSON() - throws BaseCheckedException { - Map metaInfoMap = new HashMap<>(); - metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, - "\"type\" : \"iris\", \"missingBiometric\" : \"leftEye\",\"reason\" : \"Missing biometrics\",\"exceptionType\" : \"Permanent\",\"individualType\" : \"INDIVIDUAL\"}]"); - exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, metaInfoMap, 0); - } - - @Test - public void testGenerateTagsForMetaInfoMapDoesNotContainExceptionBiometrics() - throws BaseCheckedException { - Map metaInfoMap = new HashMap<>(); - Map tags = - exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, metaInfoMap, 0); - assertEquals(notAvailableTagValue, tags.get(tagName)); - } - - @Test - public void getRequiredIdObjectFieldNamesTest() throws Exception { - List result = exceptionBiometricsTagGenerator.getRequiredIdObjectFieldNames(); - assertEquals(result, null); - } - -} +package io.mosip.registration.processor.stages.packetclassifier.tagging.impl; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.modules.junit4.PowerMockRunner; +import org.powermock.reflect.Whitebox; +import org.springframework.cloud.context.config.annotation.RefreshScope; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import io.mosip.kernel.core.exception.BaseCheckedException; +import io.mosip.registration.processor.core.constant.JsonConstant; +import io.mosip.registration.processor.packet.storage.exception.ParsingException; + +/** + * The Class PacketValidatorStageTest. + */ +@RefreshScope +@RunWith(PowerMockRunner.class) +@PowerMockIgnore({ "javax.management.*", "javax.net.ssl.*", "com.sun.org.apache.xerces.*", + "javax.xml.*", "org.xml.*" }) +public class ExceptionBiometricsTagGeneratorTest { + + private static String tagName = "EXCEPTION_BIOMETRICS"; + + private static String notAvailableTagValue = "--TAG_VALUE_NOT_AVAILABLE--"; + + @InjectMocks + private ExceptionBiometricsTagGenerator exceptionBiometricsTagGenerator; + + @Spy + private ObjectMapper mapper = new ObjectMapper(); + + Map metamap = new HashMap<>(); + + @Before + public void setup() throws Exception { + Whitebox.setInternalState(exceptionBiometricsTagGenerator, "tagName", tagName); + Map bioValueMapping = new LinkedHashMap<>(); + bioValueMapping.put("leftLittle", "LL"); + bioValueMapping.put("leftRing", "LR"); + bioValueMapping.put("leftMiddle", "LM"); + bioValueMapping.put("leftIndex", "LI"); + bioValueMapping.put("leftThumb", "LT"); + bioValueMapping.put("rightLittle", "RL"); + bioValueMapping.put("rightRing", "RR"); + bioValueMapping.put("rightMiddle", "RM"); + bioValueMapping.put("rightIndex", "RI"); + bioValueMapping.put("rightThumb", "RT"); + bioValueMapping.put("leftEye", "LE"); + bioValueMapping.put("rightEye", "RE"); + Whitebox.setInternalState(exceptionBiometricsTagGenerator, "bioValueMapping", bioValueMapping); + Whitebox.setInternalState(exceptionBiometricsTagGenerator, "notAvailableTagValue", + notAvailableTagValue); + List regClientVersionsBeforeExceptionbiometrics = new ArrayList(); + regClientVersionsBeforeExceptionbiometrics.add("1.1.3"); + regClientVersionsBeforeExceptionbiometrics.add("1.1.4"); + Whitebox.setInternalState(exceptionBiometricsTagGenerator, "regClientVersionsBeforeExceptionMetaInfoChange", + regClientVersionsBeforeExceptionbiometrics); + + } + + @Test + public void testGenerateTagsForExceptionBiometricsAvailable() + throws BaseCheckedException, JsonMappingException, JsonProcessingException { + Map metaInfoMap = new HashMap<>(); + metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, + "{\"individualBiometrics\" : {\"leftEye\" : {\"type\" : \"iris\", \"missingBiometric\" : \"leftEye\",\"reason\" : \"Missing biometrics\",\"exceptionType\" : \"Permanent\",\"individualType\" : \"INDIVIDUAL\"}}}"); + metaInfoMap.put(JsonConstant.METADATA, + "[ {\n \"label\" : \"registrationId\",\n \"value\" : \"1234\"\n},{\n \"label\" : \"Registration Client Version Number\",\n \"value\" : \"1.2.0.1\"\n} ]"); + Map tags = + exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, metaInfoMap, 0); + assertEquals("LE", tags.get(tagName)); + } + + @Test + public void testGenerateTagsForExceptionBiometricsAvailableForAllModalites() + throws BaseCheckedException { + Map metaInfoMap = new HashMap<>(); + metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, + "{\"individualBiometrics\" : {\n \"leftEye\" : {\n \"type\" : \"Iris\",\n \"missingBiometric\" : \"leftEye\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightEye\" : {\n \"type\" : \"Iris\",\n \"missingBiometric\" : \"rightEye\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightIndex\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightIndex\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightLittle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightLittle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightRing\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightRing\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightMiddle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightMiddle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftIndex\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftIndex\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftLittle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftLittle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftRing\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftRing\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftMiddle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftMiddle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftThumb\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftThumb\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightThumb\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightThumb\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n }\n }\n}"); + metaInfoMap.put(JsonConstant.METADATA, + "[ {\n \"label\" : \"registrationId\",\n \"value\" : \"1234\"\n},{\n \"label\" : \"Registration Client Version Number\",\n \"value\" : \"1.2.0.1\"\n} ]"); + Map tags = + exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, metaInfoMap, 0); + assertEquals("LL,LR,LM,LI,LT,RL,RR,RM,RI,RT,LE,RE", tags.get(tagName)); + } + + @Test + public void testGenerateTagsForExceptionBiometricsNotAvailable() throws BaseCheckedException { + Map metaInfoMap = new HashMap<>(); + metaInfoMap.put(JsonConstant.METADATA, + "[ {\n \"label\" : \"registrationId\",\n \"value\" : \"1234\"\n},{\n \"label\" : \"Registration Client Version Number\",\n \"value\" : \"1.2.0.1\"\n} ]"); + metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, "{\"individualBiometrics\" : {}}"); + Map tags = + exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, metaInfoMap, 0); + assertEquals("", tags.get(tagName)); + } + + @Test + public void testGenerateTagsForExceptionBiometricsApplicantNotAvailable() throws BaseCheckedException { + Map metaInfoMap = new HashMap<>(); + metaInfoMap.put(JsonConstant.METADATA, + "[ {\n \"label\" : \"registrationId\",\n \"value\" : \"1234\"\n},{\n \"label\" : \"Registration Client Version Number\",\n \"value\" : \"1.2.0.1\"\n} ]"); + metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, "{}"); + Map tags = + exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, metaInfoMap, 0); + assertEquals(notAvailableTagValue, tags.get(tagName)); + } + + @Test(expected = ParsingException.class) + public void testGenerateTagsForMetaInfoMapExceptionBiometricsContainingInvalidJSON() + throws BaseCheckedException { + Map metaInfoMap = new HashMap<>(); + metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, + "\"type\" : \"iris\", \"missingBiometric\" : \"leftEye\",\"reason\" : \"Missing biometrics\",\"exceptionType\" : \"Permanent\",\"individualType\" : \"INDIVIDUAL\"}]"); + exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, metaInfoMap, 0); + } + + @Test + public void testGenerateTagsForMetaInfoMapDoesNotContainExceptionBiometrics() + throws BaseCheckedException { + Map metaInfoMap = new HashMap<>(); + Map tags = + exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, metaInfoMap, 0); + assertEquals(notAvailableTagValue, tags.get(tagName)); + } + + @Test + public void getRequiredIdObjectFieldNamesTest() throws Exception { + List result = exceptionBiometricsTagGenerator.getRequiredIdObjectFieldNames(); + assertEquals(result, null); + } + + @Test + public void testGenerateTagsForExceptionBiometricsAvailableWithBCTest() + throws BaseCheckedException, JsonMappingException, JsonProcessingException { + Map metaInfoMap = new HashMap<>(); + metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, + "{\"applicant\" : {\"leftEye\" : {\"type\" : \"iris\", \"missingBiometric\" : \"leftEye\",\"reason\" : \"Missing biometrics\",\"exceptionType\" : \"Permanent\",\"individualType\" : \"INDIVIDUAL\"}}}"); + metaInfoMap.put(JsonConstant.METADATA, + "[ {\n \"label\" : \"registrationId\",\n \"value\" : \"1234\"\n},{\n \"label\" : \"Registration Client Version Number\",\n \"value\" : \"1.1.4\"\n} ]"); + + Map tags = exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, + metaInfoMap, 0); + assertEquals("LE", tags.get(tagName)); + } + + @Test + public void testGenerateTagsForExceptionBiometricsAvailableWithoutversion() + throws BaseCheckedException, JsonMappingException, JsonProcessingException { + Map metaInfoMap = new HashMap<>(); + metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, + "{\"applicant\" : {\"leftEye\" : {\"type\" : \"iris\", \"missingBiometric\" : \"leftEye\",\"reason\" : \"Missing biometrics\",\"exceptionType\" : \"Permanent\",\"individualType\" : \"INDIVIDUAL\"}}}"); + metaInfoMap.put(JsonConstant.METADATA, + "[ {\n \"label\" : \"registrationId\",\n \"value\" : \"1234\"\n} ]"); + Map tags = exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, + metaInfoMap, 0); + assertEquals("LE", tags.get(tagName)); + } + + @Test + public void testGenerateTagsForExceptionBiometricsNotAvailableWithBCTest() + throws BaseCheckedException, JsonMappingException, JsonProcessingException { + Map metaInfoMap = new HashMap<>(); + metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, "{\"applicant\" : {}}"); + metaInfoMap.put(JsonConstant.METADATA, + "[ {\n \"label\" : \"registrationId\",\n \"value\" : \"1234\"\n},{\n \"label\" : \"Registration Client Version Number\",\n \"value\" : \"1.1.4\"\n} ]"); + Map tags = exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, + metaInfoMap, 0); + assertEquals("", tags.get(tagName)); + } + + @Test + public void testGenerateTagsForExceptionBiometricsApplicantNotAvailableWithBCTest() + throws BaseCheckedException, JsonMappingException, JsonProcessingException { + Map metaInfoMap = new HashMap<>(); + metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, "{}"); + metaInfoMap.put(JsonConstant.METADATA, + "[ {\n \"label\" : \"registrationId\",\n \"value\" : \"1234\"\n},{\n \"label\" : \"Registration Client Version Number\",\n \"value\" : \"1.1.4\"\n} ]"); + Map tags = + exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, metaInfoMap, 0); + assertEquals(notAvailableTagValue, tags.get(tagName)); + } + + @Test + public void testGenerateTagsForExceptionBiometricsAvailableWithLatestversionBCTest() + throws BaseCheckedException, JsonMappingException, JsonProcessingException { + Map metaInfoMap = new HashMap<>(); + metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, + "{\"applicant\" : {\"leftEye\" : {\"type\" : \"iris\", \"missingBiometric\" : \"leftEye\",\"reason\" : \"Missing biometrics\",\"exceptionType\" : \"Permanent\",\"individualType\" : \"INDIVIDUAL\"}}}"); + metaInfoMap.put(JsonConstant.METADATA, + "[ {\n \"label\" : \"registrationId\",\n \"value\" : \"1234\"\n},{\n \"label\" : \"Registration Client Version Number\",\n \"value\" : \"1.2.0.1\"\n} ]"); + + Map tags = exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, + metaInfoMap, 0); + assertEquals(notAvailableTagValue, tags.get(tagName)); + } + + @Test + public void testGenerateTagsForExceptionBiometricsAndVersionBothNotAvailabel() throws BaseCheckedException { + Map metaInfoMap = new HashMap<>(); + metaInfoMap.put(JsonConstant.METADATA, + "[ {\n \"label\" : \"registrationId\",\n \"value\" : \"1234\"\n} ]"); + metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, "{}"); + Map tags = exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, + metaInfoMap, 0); + assertEquals(notAvailableTagValue, tags.get(tagName)); + } + + @Test + public void testGenerateTagsForExceptionBiometricsAvailableWithoutVersion() throws BaseCheckedException { + Map metaInfoMap = new HashMap<>(); + metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, + "{\"individualBiometrics\" : {\n \"leftEye\" : {\n \"type\" : \"Iris\",\n \"missingBiometric\" : \"leftEye\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightEye\" : {\n \"type\" : \"Iris\",\n \"missingBiometric\" : \"rightEye\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightIndex\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightIndex\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightLittle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightLittle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightRing\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightRing\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightMiddle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightMiddle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftIndex\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftIndex\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftLittle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftLittle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftRing\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftRing\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftMiddle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftMiddle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftThumb\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftThumb\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightThumb\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightThumb\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n }\n }\n}"); + metaInfoMap.put(JsonConstant.METADATA, + "[ {\n \"label\" : \"registrationId\",\n \"value\" : \"1234\"\n}]"); + Map tags = exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, + metaInfoMap, 0); + assertEquals(notAvailableTagValue, tags.get(tagName)); + } + + @Test + public void testGenerateTagsForExceptionBiometricsAvailableWithOldVersion() throws BaseCheckedException { + Map metaInfoMap = new HashMap<>(); + metaInfoMap.put(JsonConstant.EXCEPTIONBIOMETRICS, + "{\"individualBiometrics\" : {\n \"leftEye\" : {\n \"type\" : \"Iris\",\n \"missingBiometric\" : \"leftEye\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightEye\" : {\n \"type\" : \"Iris\",\n \"missingBiometric\" : \"rightEye\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightIndex\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightIndex\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightLittle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightLittle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightRing\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightRing\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightMiddle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightMiddle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftIndex\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftIndex\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftLittle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftLittle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftRing\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftRing\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftMiddle\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftMiddle\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"leftThumb\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"leftThumb\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n },\n \"rightThumb\" : {\n \"type\" : \"Finger\",\n \"missingBiometric\" : \"rightThumb\",\n \"reason\" : \"Temporary\",\n \"exceptionType\" : \"Temporary\",\n \"individualType\" : \"applicant\"\n }\n }\n}"); + metaInfoMap.put(JsonConstant.METADATA, + "[ {\n \"label\" : \"registrationId\",\n \"value\" : \"1234\"\n},{\n \"label\" : \"Registration Client Version Number\",\n \"value\" : \"1.1.4\"\n} ]"); + Map tags = exceptionBiometricsTagGenerator.generateTags("12345", "1234", "NEW", null, + metaInfoMap, 0); + assertEquals(notAvailableTagValue, tags.get(tagName)); + } +} diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/constant/JsonConstant.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/constant/JsonConstant.java index 66981f00ff4..9feff0a12a4 100644 --- a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/constant/JsonConstant.java +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/constant/JsonConstant.java @@ -1,268 +1,270 @@ -package io.mosip.registration.processor.core.constant; - -/** - * The Class JsonConstant. - * - * @author Nagalakshmi - */ -public class JsonConstant { - - /** - * Instantiates a new json constant. - */ - private JsonConstant() { - - } - - /** The Constant APPLICANTTYPE. */ - public static final String APPLICANTTYPE = "APPLICANTTYPE"; - - /** The Constant REGISTRATIONTYPE. */ - public static final String REGISTRATIONTYPE = "REGISTRATIONTYPE"; - - /** The Constant ISVERIFIED. */ - public static final String ISVERIFIED = "ISVERIFIED"; - - /** The Constant VERIFIED. */ - public static final String VERIFIED = "VERIFIED"; - - /** The Constant LEFTTHUMB. */ - public static final String LEFTTHUMB = "LEFTTHUMB"; - - /** The Constant LEFTINDEX. */ - public static final String LEFTINDEX = "LEFTINDEX"; - - /** The Constant LEFTMIDDLE. */ - public static final String LEFTMIDDLE = "LEFTMIDDLE"; - - /** The Constant LEFTLITTLE. */ - public static final String LEFTLITTLE = "LEFTLITTLE"; - - /** The Constant LEFTRING. */ - public static final String LEFTRING = "LEFTRING"; - - /** The Constant RIGHTTHUMB. */ - public static final String RIGHTTHUMB = "RIGHTTHUMB"; - - /** The Constant RIGHTINDEX. */ - public static final String RIGHTINDEX = "RIGHTINDEX"; - - /** The Constant RIGHTMIDDLE. */ - public static final String RIGHTMIDDLE = "RIGHTMIDDLE"; - - /** The Constant RIGHTLITTLE. */ - public static final String RIGHTLITTLE = "RIGHTLITTLE"; - - /** The Constant RIGHTRING. */ - public static final String RIGHTRING = "RIGHTRING"; - - /** The Constant REGISTRATIONID. */ - public static final String REGISTRATIONID = "registrationId"; - - /** The Constant PREREGISTRATIONID. */ - public static final String PREREGISTRATIONID = "preRegistrationId"; - - /** The Constant INTRODUCERRID. */ - public static final String INTRODUCERRID = "INTRODUCERRID"; - - /** The Constant INTRODUCERUIN. */ - public static final String INTRODUCERUIN = "INTRODUCERUIN"; - - /** The Constant INTRODUCERTYPE. */ - public static final String INTRODUCERTYPE = "INTRODUCERTYPE"; - - /** The Constant INTRODUCERFINGERPRINTTYPE. */ - public static final String INTRODUCERFINGERPRINTTYPE = "INTRODUCERFINGERPRINTTYPE"; - - /** The Constant INTRODUCERIRISTYPE. */ - public static final String INTRODUCERIRISTYPE = "INTRODUCERIRISTYPE"; - - /** The Constant SUPERVISORFINGERPRINTTYPE. */ - public static final String SUPERVISORFINGERPRINTTYPE = "SUPERVISORFINGERPRINTTYPE"; - - /** The Constant OFFICERFINGERPRINTTYPE. */ - public static final String OFFICERFINGERPRINTTYPE = "OFFICERFINGERPRINTTYPE"; - - /** The Constant SUPERVISORIRISTYPE. */ - public static final String SUPERVISORIRISTYPE = "SUPERVISORIRISTYPE"; - - /** The Constant OFFICERIRISTYPE. */ - public static final String OFFICERIRISTYPE = "OFFICERIRISTYPE"; - - /** The Constant OFFICERPIN. */ - public static final String OFFICERPIN = "officerPIN"; - - /** The Constant OFFICERFINGERPRINTIMAGE. */ - public static final String OFFICERFINGERPRINTIMAGE = "OFFICERFINGERPRINTIMAGE"; - - /** The Constant OFFICERID. */ - public static final String OFFICERID = "officerId"; - - /** The Constant OFFICERIRISIMAGE. */ - public static final String OFFICERIRISIMAGE = "OFFICERIRISIMAGE"; - - /** The Constant SUPERVISORFINGERPRINTIMAGE. */ - public static final String SUPERVISORFINGERPRINTIMAGE = "SUPERVISORFINGERPRINTIMAGE"; - - /** The Constant SUPERVISORIRISIMAGE. */ - public static final String SUPERVISORIRISIMAGE = "SUPERVISORIRISIMAGE"; - - /** The Constant SUPERVISORID. */ - public static final String SUPERVISORID = "supervisorId"; - - /** The Constant OFFICERAUTHENTICATIONIMAGE. */ - public static final String OFFICERAUTHENTICATIONIMAGE = "OFFICERAUTHENTICATIONIMAGE"; - - /** The Constant OFFICERPWR. */ - public static final String OFFICERPWR = "officerPassword"; - - /** The Constant SUPERVISORAUTHENTICATIONIMAGE. */ - public static final String SUPERVISORAUTHENTICATIONIMAGE = "SUPERVISORAUTHENTICATIONIMAGE"; - - /** The Constant SUPERVISORPWR. */ - public static final String SUPERVISORPWR = "supervisorPassword"; - - /** The Constant SUPERVISORPIN. */ - public static final String SUPERVISORPIN = "SUPERVISORPIN"; - - /** The Constant GEOLOCLATITUDE. */ - public static final String GEOLOCLATITUDE = "geoLocLatitude"; - - /** The Constant GEOLOCLONGITUDE. */ - public static final String GEOLOCLONGITUDE = "geoLoclongitude"; - - /** The Constant CENTERID. */ - public static final String CENTERID = "centerId"; - - /** The Constant MACHINEID. */ - public static final String MACHINEID = "machineId"; - - /** The Constant CREATIONDATE. */ - public static final String CREATIONDATE = "creationDate"; - - /** The Constant INTRODUCERBIOMETRICSEQUENCE. */ - public static final String INTRODUCERBIOMETRICSEQUENCE = "INTRODUCERBIOMETRICSEQUENCE"; - - /** The Constant APPLICANTBIOMETRICSEQUENCE. */ - public static final String APPLICANTBIOMETRICSEQUENCE = "APPLICANTBIOMETRICSEQUENCE"; - - /** officer Authentication. */ - public static final String OFFICEROTPAUTHENTICATION = "officerOTPAuthentication"; - - /** OSI DTO instance field constants. */ - - /** The reg id. */ - public static final String REGID = "REGID"; - - /** The prereg id. */ - public static final String PREREGID = "PREREGID"; - - /** The officer iris image name. */ - public static final String OFFICERIRISIMAGENAME = "OFFICERIRISIMAGENAME"; - - /** The officerfinger type. */ - public static final String OFFICERFINGERTYPE = "OFFICERFINGERTYPE"; - - /** The officer photo name. */ - public static final String OFFICERPHOTONAME = "OFFICERFACEIMAGE"; - - /** The officer hashed pin. */ - public static final String OFFICERHASHEDPIN = "OFFICERHASHEDPIN"; - - /** The officer hashed pwd. */ - public static final String OFFICERHASHEDPWD = "OFFICERHASHEDPWD"; - - /** The officer fingerp image name. */ - public static final String OFFICERFINGERPIMAGENAME = "OFFICERFINGERPIMAGENAME"; - - /** The supervisor fingerp image name. */ - public static final String SUPERVISORFINGERPIMAGENAME = "SUPERVISORFINGERPIMAGENAME"; - - /** The supervisor iris image name. */ - public static final String SUPERVISORIRISIMAGENAME = "SUPERVISORIRISIMAGENAME"; - - /** The supervisor finger type. */ - public static final String SUPERVISORFINGERTYPE = "SUPERVISORFINGERTYPE"; - - /** The supervisor hashed pwd. */ - public static final String SUPERVISORHASHEDPWD = "SUPERVISORHASHEDPWD"; - - /** The supervisor hashed pin. */ - public static final String SUPERVISORHASHEDPIN = "SUPERVISORHASHEDPIN"; - - /** The supervisor photo name. */ - public static final String SUPERVISORPHOTONAME = "SUPERVISORPHOTONAME"; - - /** The introducer id. */ - public static final String INTRODUCERID = "INTRODUCERID"; - - /** The introducer typ. */ - public static final String INTRODUCERTYP = "INTRODUCERTYP"; - - /** The introducer reg id. */ - public static final String INTRODUCERREGID = "INTRODUCERREGID"; - - /** The introducer iris image name. */ - public static final String INTRODUCERIRISIMAGENAME = "INTRODUCERIRISIMAGENAME"; - - /** The introducer fingerp type. */ - public static final String INTRODUCERFINGERPTYPE = "INTRODUCERFINGERPTYPE"; - - /** The introducer fingerp image name. */ - public static final String INTRODUCERFINGERPIMAGENAME = "INTRODUCERFINGERPIMAGENAME"; - - /** The introducer photo name. */ - public static final String INTRODUCERPHOTONAME = "INTRODUCERPHOTONAME"; - - public static final String VID = "VID"; - - public static final String CARDTYPE = "CARDTYPE"; - - public static final String OPERATIONSDATA = "operationsData"; - public static final String METADATA = "metaData"; - public static final String CAPTUREDREGISTEREDDEVICES = "capturedRegisteredDevices"; - - public static final String ID = "id"; - - public static final String EXCEPTIONBIOMETRICS = "exceptionBiometrics"; - - public static final String DIGITALID = "digitalId"; - - public static final String DIGITALIDTYPE = "type"; - - public static final String DIGITALIDMAKE = "make"; - - public static final String DIGITALIDMODEL = "model"; - - public static final String DIGITALIDSERIALNO = "serialNo"; - - public static final String EXCEPTIONBIOMETRICSAPPLICANT = "applicant"; - - public static final String RID = "rid"; - - public static final String REGTYPE = "reg_type"; - - public static final String ITERATION = "iteration"; - - public static final String SOURCE = "source"; - - public static final String PAUSE_FOR = "PAUSE_FOR"; - - public static final String ADDITIONAL_INFO_PROCESS = "ADDITIONAL_INFO_PROCESS"; - - public static final String WORKFLOW_INSTANCE_ID = "workflowInstanceId"; - - /** The Constant for registration client version label. */ - public static final String REGCLIENTVERSION = "Registration Client Version Number"; - - /** The Constant for exception key in others attribute of biometric xml files. */ - public static final String BIOMETRICRECORDEXCEPTION = "EXCEPTION"; - - /** The Constant for RETRIES key in others attribute of biometric xml files. */ - public static final String RETRY_COUNT = "RETRIES"; - - /** The Constant for PAYLOAD key in others attribute of biometric xml files. */ - public static final String PAYLOAD = "PAYLOAD"; - - public static final String PAUSERULEIMMUNITYRULEIDS = "PAUSE_IMMUNITY_RULE_IDS"; -} +package io.mosip.registration.processor.core.constant; + +/** + * The Class JsonConstant. + * + * @author Nagalakshmi + */ +public class JsonConstant { + + /** + * Instantiates a new json constant. + */ + private JsonConstant() { + + } + + /** The Constant APPLICANTTYPE. */ + public static final String APPLICANTTYPE = "APPLICANTTYPE"; + + /** The Constant REGISTRATIONTYPE. */ + public static final String REGISTRATIONTYPE = "REGISTRATIONTYPE"; + + /** The Constant ISVERIFIED. */ + public static final String ISVERIFIED = "ISVERIFIED"; + + /** The Constant VERIFIED. */ + public static final String VERIFIED = "VERIFIED"; + + /** The Constant LEFTTHUMB. */ + public static final String LEFTTHUMB = "LEFTTHUMB"; + + /** The Constant LEFTINDEX. */ + public static final String LEFTINDEX = "LEFTINDEX"; + + /** The Constant LEFTMIDDLE. */ + public static final String LEFTMIDDLE = "LEFTMIDDLE"; + + /** The Constant LEFTLITTLE. */ + public static final String LEFTLITTLE = "LEFTLITTLE"; + + /** The Constant LEFTRING. */ + public static final String LEFTRING = "LEFTRING"; + + /** The Constant RIGHTTHUMB. */ + public static final String RIGHTTHUMB = "RIGHTTHUMB"; + + /** The Constant RIGHTINDEX. */ + public static final String RIGHTINDEX = "RIGHTINDEX"; + + /** The Constant RIGHTMIDDLE. */ + public static final String RIGHTMIDDLE = "RIGHTMIDDLE"; + + /** The Constant RIGHTLITTLE. */ + public static final String RIGHTLITTLE = "RIGHTLITTLE"; + + /** The Constant RIGHTRING. */ + public static final String RIGHTRING = "RIGHTRING"; + + /** The Constant REGISTRATIONID. */ + public static final String REGISTRATIONID = "registrationId"; + + /** The Constant PREREGISTRATIONID. */ + public static final String PREREGISTRATIONID = "preRegistrationId"; + + /** The Constant INTRODUCERRID. */ + public static final String INTRODUCERRID = "INTRODUCERRID"; + + /** The Constant INTRODUCERUIN. */ + public static final String INTRODUCERUIN = "INTRODUCERUIN"; + + /** The Constant INTRODUCERTYPE. */ + public static final String INTRODUCERTYPE = "INTRODUCERTYPE"; + + /** The Constant INTRODUCERFINGERPRINTTYPE. */ + public static final String INTRODUCERFINGERPRINTTYPE = "INTRODUCERFINGERPRINTTYPE"; + + /** The Constant INTRODUCERIRISTYPE. */ + public static final String INTRODUCERIRISTYPE = "INTRODUCERIRISTYPE"; + + /** The Constant SUPERVISORFINGERPRINTTYPE. */ + public static final String SUPERVISORFINGERPRINTTYPE = "SUPERVISORFINGERPRINTTYPE"; + + /** The Constant OFFICERFINGERPRINTTYPE. */ + public static final String OFFICERFINGERPRINTTYPE = "OFFICERFINGERPRINTTYPE"; + + /** The Constant SUPERVISORIRISTYPE. */ + public static final String SUPERVISORIRISTYPE = "SUPERVISORIRISTYPE"; + + /** The Constant OFFICERIRISTYPE. */ + public static final String OFFICERIRISTYPE = "OFFICERIRISTYPE"; + + /** The Constant OFFICERPIN. */ + public static final String OFFICERPIN = "officerPIN"; + + /** The Constant OFFICERFINGERPRINTIMAGE. */ + public static final String OFFICERFINGERPRINTIMAGE = "OFFICERFINGERPRINTIMAGE"; + + /** The Constant OFFICERID. */ + public static final String OFFICERID = "officerId"; + + /** The Constant OFFICERIRISIMAGE. */ + public static final String OFFICERIRISIMAGE = "OFFICERIRISIMAGE"; + + /** The Constant SUPERVISORFINGERPRINTIMAGE. */ + public static final String SUPERVISORFINGERPRINTIMAGE = "SUPERVISORFINGERPRINTIMAGE"; + + /** The Constant SUPERVISORIRISIMAGE. */ + public static final String SUPERVISORIRISIMAGE = "SUPERVISORIRISIMAGE"; + + /** The Constant SUPERVISORID. */ + public static final String SUPERVISORID = "supervisorId"; + + /** The Constant OFFICERAUTHENTICATIONIMAGE. */ + public static final String OFFICERAUTHENTICATIONIMAGE = "OFFICERAUTHENTICATIONIMAGE"; + + /** The Constant OFFICERPWR. */ + public static final String OFFICERPWR = "officerPassword"; + + /** The Constant SUPERVISORAUTHENTICATIONIMAGE. */ + public static final String SUPERVISORAUTHENTICATIONIMAGE = "SUPERVISORAUTHENTICATIONIMAGE"; + + /** The Constant SUPERVISORPWR. */ + public static final String SUPERVISORPWR = "supervisorPassword"; + + /** The Constant SUPERVISORPIN. */ + public static final String SUPERVISORPIN = "SUPERVISORPIN"; + + /** The Constant GEOLOCLATITUDE. */ + public static final String GEOLOCLATITUDE = "geoLocLatitude"; + + /** The Constant GEOLOCLONGITUDE. */ + public static final String GEOLOCLONGITUDE = "geoLoclongitude"; + + /** The Constant CENTERID. */ + public static final String CENTERID = "centerId"; + + /** The Constant MACHINEID. */ + public static final String MACHINEID = "machineId"; + + /** The Constant CREATIONDATE. */ + public static final String CREATIONDATE = "creationDate"; + + /** The Constant INTRODUCERBIOMETRICSEQUENCE. */ + public static final String INTRODUCERBIOMETRICSEQUENCE = "INTRODUCERBIOMETRICSEQUENCE"; + + /** The Constant APPLICANTBIOMETRICSEQUENCE. */ + public static final String APPLICANTBIOMETRICSEQUENCE = "APPLICANTBIOMETRICSEQUENCE"; + + /** officer Authentication. */ + public static final String OFFICEROTPAUTHENTICATION = "officerOTPAuthentication"; + + /** OSI DTO instance field constants. */ + + /** The reg id. */ + public static final String REGID = "REGID"; + + /** The prereg id. */ + public static final String PREREGID = "PREREGID"; + + /** The officer iris image name. */ + public static final String OFFICERIRISIMAGENAME = "OFFICERIRISIMAGENAME"; + + /** The officerfinger type. */ + public static final String OFFICERFINGERTYPE = "OFFICERFINGERTYPE"; + + /** The officer photo name. */ + public static final String OFFICERPHOTONAME = "OFFICERFACEIMAGE"; + + /** The officer hashed pin. */ + public static final String OFFICERHASHEDPIN = "OFFICERHASHEDPIN"; + + /** The officer hashed pwd. */ + public static final String OFFICERHASHEDPWD = "OFFICERHASHEDPWD"; + + /** The officer fingerp image name. */ + public static final String OFFICERFINGERPIMAGENAME = "OFFICERFINGERPIMAGENAME"; + + /** The supervisor fingerp image name. */ + public static final String SUPERVISORFINGERPIMAGENAME = "SUPERVISORFINGERPIMAGENAME"; + + /** The supervisor iris image name. */ + public static final String SUPERVISORIRISIMAGENAME = "SUPERVISORIRISIMAGENAME"; + + /** The supervisor finger type. */ + public static final String SUPERVISORFINGERTYPE = "SUPERVISORFINGERTYPE"; + + /** The supervisor hashed pwd. */ + public static final String SUPERVISORHASHEDPWD = "SUPERVISORHASHEDPWD"; + + /** The supervisor hashed pin. */ + public static final String SUPERVISORHASHEDPIN = "SUPERVISORHASHEDPIN"; + + /** The supervisor photo name. */ + public static final String SUPERVISORPHOTONAME = "SUPERVISORPHOTONAME"; + + /** The introducer id. */ + public static final String INTRODUCERID = "INTRODUCERID"; + + /** The introducer typ. */ + public static final String INTRODUCERTYP = "INTRODUCERTYP"; + + /** The introducer reg id. */ + public static final String INTRODUCERREGID = "INTRODUCERREGID"; + + /** The introducer iris image name. */ + public static final String INTRODUCERIRISIMAGENAME = "INTRODUCERIRISIMAGENAME"; + + /** The introducer fingerp type. */ + public static final String INTRODUCERFINGERPTYPE = "INTRODUCERFINGERPTYPE"; + + /** The introducer fingerp image name. */ + public static final String INTRODUCERFINGERPIMAGENAME = "INTRODUCERFINGERPIMAGENAME"; + + /** The introducer photo name. */ + public static final String INTRODUCERPHOTONAME = "INTRODUCERPHOTONAME"; + + public static final String VID = "VID"; + + public static final String CARDTYPE = "CARDTYPE"; + + public static final String OPERATIONSDATA = "operationsData"; + public static final String METADATA = "metaData"; + public static final String CAPTUREDREGISTEREDDEVICES = "capturedRegisteredDevices"; + + public static final String ID = "id"; + + public static final String EXCEPTIONBIOMETRICS = "exceptionBiometrics"; + + public static final String DIGITALID = "digitalId"; + + public static final String DIGITALIDTYPE = "type"; + + public static final String DIGITALIDMAKE = "make"; + + public static final String DIGITALIDMODEL = "model"; + + public static final String DIGITALIDSERIALNO = "serialNo"; + + public static final String EXCEPTIONBIOMETRICSAPPLICANT = "applicant"; + + public static final String RID = "rid"; + + public static final String REGTYPE = "reg_type"; + + public static final String ITERATION = "iteration"; + + public static final String SOURCE = "source"; + + public static final String PAUSE_FOR = "PAUSE_FOR"; + + public static final String ADDITIONAL_INFO_PROCESS = "ADDITIONAL_INFO_PROCESS"; + + public static final String WORKFLOW_INSTANCE_ID = "workflowInstanceId"; + + /** The Constant for registration client version label. */ + public static final String REGCLIENTVERSION = "Registration Client Version Number"; + + /** The Constant for exception key in others attribute of biometric xml files. */ + public static final String BIOMETRICRECORDEXCEPTION = "EXCEPTION"; + + /** The Constant for RETRIES key in others attribute of biometric xml files. */ + public static final String RETRY_COUNT = "RETRIES"; + + /** The Constant for PAYLOAD key in others attribute of biometric xml files. */ + public static final String PAYLOAD = "PAYLOAD"; + + public static final String PAUSERULEIMMUNITYRULEIDS = "PAUSE_IMMUNITY_RULE_IDS"; + + public static final String INDIVIDUAL_BIOMETRICS = "individualBiometrics"; +}