Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mosip 29868 updated 1.1.5.5 #1797

Merged
merged 8 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
package io.mosip.registration.processor.abis.handler.dto;

import io.mosip.registration.processor.core.common.rest.dto.BaseRestResponseDTO;
import io.mosip.registration.processor.core.common.rest.dto.ErrorDTO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
public class DataShareResponseDto extends BaseRestResponseDTO {

private static final long serialVersionUID = 1L;


private DataShare dataShare;


private List<ErrorDTO> errors;
}
package io.mosip.registration.processor.abis.handler.dto;

import java.util.List;

import io.mosip.registration.processor.core.common.rest.dto.BaseRestResponseDTO;
import io.mosip.registration.processor.core.common.rest.dto.ErrorDTO;
import io.mosip.registration.processor.core.packet.dto.abis.DataShare;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class DataShareResponseDto extends BaseRestResponseDTO {

private static final long serialVersionUID = 1L;


private DataShare dataShare;


private List<ErrorDTO> errors;
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ private String getUUID() {
}

private String getDataShareUrl(String id, String process) throws Exception {
Map<String, List<String>> typeAndSubtypMap = abisHandlerUtil.createTypeSubtypeMapping();
Map<String, List<String>> typeAndSubtypMap = abisHandlerUtil.createBiometricTypeSubtypeMappingFromAbispolicy();
List<String> modalities=new ArrayList<>();
for(Map.Entry<String,List<String>> entry:typeAndSubtypMap.entrySet()) {
if(entry.getValue()==null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import io.mosip.kernel.core.cbeffutil.spi.CbeffUtil;
import io.mosip.kernel.core.util.JsonUtils;
import io.mosip.kernel.core.util.exception.JsonProcessingException;
import io.mosip.registration.processor.abis.handler.dto.DataShare;
import io.mosip.registration.processor.abis.handler.dto.DataShareResponseDto;
import io.mosip.registration.processor.abis.handler.stage.AbisHandlerStage;
import io.mosip.registration.processor.abis.queue.dto.AbisQueueDetails;
Expand All @@ -56,6 +55,7 @@
import io.mosip.registration.processor.core.packet.dto.abis.AbisIdentifyRequestDto;
import io.mosip.registration.processor.core.packet.dto.abis.AbisInsertRequestDto;
import io.mosip.registration.processor.core.packet.dto.abis.AbisRequestDto;
import io.mosip.registration.processor.core.packet.dto.abis.DataShare;
import io.mosip.registration.processor.core.packet.dto.abis.RegBioRefDto;
import io.mosip.registration.processor.core.packet.dto.abis.RegDemoDedupeListDto;
import io.mosip.registration.processor.core.spi.eventbus.EventHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
import io.mosip.registration.processor.status.dao.RegistrationStatusDao;
import io.mosip.registration.processor.status.dto.InternalRegistrationStatusDto;
import io.mosip.registration.processor.status.dto.RegistrationStatusDto;
import io.mosip.registration.processor.status.dto.SyncTypeDto;
import io.mosip.registration.processor.status.entity.RegistrationStatusEntity;
import io.mosip.registration.processor.status.service.RegistrationStatusService;

Expand Down Expand Up @@ -137,8 +136,11 @@ public class DemodedupeProcessor {
@Value("${registration.processor.infant.dedupe}")
private String infantDedupe;

@Value("${mosip.regproc.demo.dedupe.match.decesion}")
private String demodedupeMatchDecesion;
@Value("${mosip.regproc.demo.dedupe.invalid-biometrics-action}")
private String demodedupeInvalidBiometricAction;

@Value("${mosip.regproc.demo.dedupe.infant.invalid-biometrics-action}")
private String demodedupeInfantInvalidBiometricAction;

/**
* Process.
Expand Down Expand Up @@ -187,7 +189,8 @@ public MessageDTO process(MessageDTO object, String stageName) {
if (age < ageThreshold) {
if (infantDedupe.equalsIgnoreCase(GLOBAL_CONFIG_TRUE_VALUE)) {
isDemoDedupeSkip = false;
duplicateDtos = performDemoDedupe(registrationStatusDto, object, description,trimExceptionMessage);
duplicateDtos = performDemoDedupe(registrationStatusDto, object, description,
trimExceptionMessage, true);
if (duplicateDtos.isEmpty())
isTransactionSuccessful = true;
}
Expand All @@ -196,7 +199,7 @@ public MessageDTO process(MessageDTO object, String stageName) {
if (env.getProperty(DEMODEDUPEENABLE).trim().equalsIgnoreCase(TRUE)) {
isDemoDedupeSkip = false;
duplicateDtos = performDemoDedupe(registrationStatusDto, object, description,
trimExceptionMessage);
trimExceptionMessage, false);
if (duplicateDtos.isEmpty())
isTransactionSuccessful = true;
}
Expand Down Expand Up @@ -399,7 +402,7 @@ public MessageDTO process(MessageDTO object, String stageName) {
auditLogRequestBuilder.createAuditRequestBuilder(description.getMessage(), eventId, eventName, eventType,
moduleId, moduleName, registrationId);
}
else {
else {
regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(),
registrationId, "Duplicate request received for same latest transaction id. This will be ignored.");
object.setIsValid(false);
Expand All @@ -425,22 +428,26 @@ public MessageDTO process(MessageDTO object, String stageName) {
* @throws ApisResourceAccessException
*/
private List<DemographicInfoDto> performDemoDedupe(InternalRegistrationStatusDto registrationStatusDto,
MessageDTO object, LogDescription description, TrimExceptionMessage trimExceptionMessage)
MessageDTO object, LogDescription description, TrimExceptionMessage trimExceptionMessage, boolean isInfant)
throws ApisResourceAccessException, PacketManagerException,
JsonProcessingException, DataShareException, IOException {
String registrationId = registrationStatusDto.getRegistrationId();
// Potential Duplicate Ids after performing demo dedupe
List<DemographicInfoDto> duplicateDtos = demoDedupe.performDedupe(registrationStatusDto.getRegistrationId());
List<String> uniqueRIDs = new ArrayList<>();
List<String> matchedRidsWithoutRejected = new ArrayList<>();
List<String> matchedRegIds;
if (!duplicateDtos.isEmpty()) {
duplicateDtos.removeIf(duplicateDto -> duplicateDto.getRegId().equals(registrationId));
matchedRegIds = duplicateDtos.stream().map(DemographicInfoDto::getRegId)
.collect(Collectors.toList());
uniqueRIDs = abisHandlerUtil.getUniqueProcessedRecords(registrationStatusDto.getRegistrationId(),
SyncTypeDto.NEW.toString(), ProviderStageName.DEMO_DEDUPE, matchedRegIds);
matchedRidsWithoutRejected = abisHandlerUtil.removeRejectedIds(matchedRegIds);
for (DemographicInfoDto demographicInfoDto : new ArrayList<DemographicInfoDto>(duplicateDtos)) {
if (!matchedRidsWithoutRejected.contains(demographicInfoDto.getRegId())) {
duplicateDtos.remove(demographicInfoDto);
}
}
}
if (!duplicateDtos.isEmpty() && !uniqueRIDs.isEmpty()) {
if (!duplicateDtos.isEmpty()) {
try {
biometricValidation(registrationStatusDto);
isMatchFound = true;
Expand All @@ -455,57 +462,9 @@ private List<DemographicInfoDto> performDemoDedupe(InternalRegistrationStatusDto
regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(),
registrationStatusDto.getRegistrationId(), DemoDedupeConstants.RECORD_INSERTED_FROM_ABIS_HANDLER);
} catch (BiometricRecordValidationException e) {
if (demodedupeMatchDecesion.equalsIgnoreCase(DemoDedupeConstants.MARK_AS_DEMODEDUPE_SUCCESS)) {
object.setIsValid(Boolean.TRUE);
registrationStatusDto
.setLatestTransactionStatusCode(RegistrationTransactionStatusCode.SUCCESS.toString());
registrationStatusDto.setStatusComment(
StatusUtil.DEMO_DEDUPE_BIOMTERIC_RECORD_VALIDAITON_FAILED_AND_PACKET_SUCCESS.getMessage());
registrationStatusDto.setStatusCode(RegistrationStatusCode.PROCESSING.toString());
registrationStatusDto.setSubStatusCode(
StatusUtil.DEMO_DEDUPE_BIOMTERIC_RECORD_VALIDAITON_FAILED_AND_PACKET_SUCCESS.getCode());
description
.setCode(PlatformSuccessMessages.RPR_PKR_DEMO_DE_DUP_POTENTIAL_DUPLICATION_SUCCESS.getCode());
description
.setMessage(
PlatformSuccessMessages.RPR_PKR_DEMO_DE_DUP_POTENTIAL_DUPLICATION_SUCCESS.getMessage()
+ " -- " + registrationId);
regProcLogger.info(LoggerFileConstant.SESSIONID.toString(),
LoggerFileConstant.REGISTRATIONID.toString(), registrationStatusDto.getRegistrationId(),
DemoDedupeConstants.DEMO_SUCCESS);
} else if (demodedupeMatchDecesion.equalsIgnoreCase(DemoDedupeConstants.MARK_AS_DEMODEDUPE_FAILED)) {
isMatchFound = true;
registrationStatusDto
.setLatestTransactionStatusCode(RegistrationTransactionStatusCode.FAILED.toString());
registrationStatusDto.setStatusCode(RegistrationStatusCode.PROCESSING.toString());
registrationStatusDto.setStatusComment(trimExceptionMessage.trimExceptionMessage(
StatusUtil.DEMO_DEDUPE_BIOMTERIC_RECORD_VALIDAITON_FAILED.getMessage() + " -> "
+ e.getErrorText()));
registrationStatusDto
.setSubStatusCode(StatusUtil.DEMO_DEDUPE_BIOMTERIC_RECORD_VALIDAITON_FAILED.getCode());
description.setCode(PlatformErrorMessages.RPR_DEMO_POTENTIAL_SENDING_FOR_MANUAL.getCode());
description.setMessage(PlatformErrorMessages.RPR_DEMO_POTENTIAL_SENDING_FOR_MANUAL.getMessage());
object.setMessageBusAddress(MessageBusAddress.MANUAL_VERIFICATION_BUS_IN);
saveManualAdjudicationData(registrationStatusDto, uniqueRIDs);
regProcLogger.info(LoggerFileConstant.SESSIONID.toString(),
LoggerFileConstant.REGISTRATIONID.toString(), registrationStatusDto.getRegistrationId(),
DemoDedupeConstants.BIOMETRIC_VALIDATION_FAILED_SENDING_FOR_MANUAL);
} else if (demodedupeMatchDecesion.equalsIgnoreCase(DemoDedupeConstants.MARK_AS_DEMODEDUPE_REJECTED)) {
registrationStatusDto
.setLatestTransactionStatusCode(RegistrationTransactionStatusCode.FAILED.toString());
registrationStatusDto.setStatusCode(RegistrationStatusCode.REJECTED.toString());
registrationStatusDto.setStatusComment(trimExceptionMessage.trimExceptionMessage(
StatusUtil.DEMO_DEDUPE_BIOMTERIC_RECORD_VALIDAITON_FAILED_AND_PACKET_REJECTED.getMessage()
+ " -> " + e.getErrorText()));
registrationStatusDto
.setSubStatusCode(StatusUtil.DEMO_DEDUPE_BIOMTERIC_RECORD_VALIDAITON_FAILED_AND_PACKET_REJECTED
.getCode());
description.setCode(PlatformErrorMessages.RPR_DEMO_POTENTIAL_PACKET_REJECTED.getCode());
description.setMessage(PlatformErrorMessages.RPR_DEMO_POTENTIAL_PACKET_REJECTED.getMessage());
regProcLogger.info(LoggerFileConstant.SESSIONID.toString(),
LoggerFileConstant.REGISTRATIONID.toString(), registrationStatusDto.getRegistrationId(),
DemoDedupeConstants.BIOMETRIC_VALIDATION_FAILED_PACKET_REJECTED);
}
isMatchFound = true;
handleInvalidBiometricAction(registrationStatusDto, object, description, trimExceptionMessage,
registrationId, matchedRidsWithoutRejected, e, isInfant);

}

Expand All @@ -526,6 +485,72 @@ private List<DemographicInfoDto> performDemoDedupe(InternalRegistrationStatusDto
return duplicateDtos;
}


private void handleInvalidBiometricAction(InternalRegistrationStatusDto registrationStatusDto, MessageDTO object,
LogDescription description, TrimExceptionMessage trimExceptionMessage, String registrationId,
List<String> matchedRidsWithoutRejected, BiometricRecordValidationException e, boolean isInfant)
throws ApisResourceAccessException, IOException, JsonProcessingException, PacketManagerException {
if ((!isInfant
&& demodedupeInvalidBiometricAction.equalsIgnoreCase(DemoDedupeConstants.MARK_AS_DEMODEDUPE_SUCCESS))
|| (isInfant && demodedupeInfantInvalidBiometricAction
.equalsIgnoreCase(DemoDedupeConstants.MARK_AS_DEMODEDUPE_SUCCESS))) {
object.setIsValid(Boolean.TRUE);
registrationStatusDto
.setLatestTransactionStatusCode(RegistrationTransactionStatusCode.SUCCESS.toString());
registrationStatusDto.setStatusComment(
StatusUtil.DEMO_DEDUPE_BIOMTERIC_RECORD_VALIDAITON_FAILED_AND_PACKET_SUCCESS.getMessage());
registrationStatusDto.setStatusCode(RegistrationStatusCode.PROCESSING.toString());
registrationStatusDto.setSubStatusCode(
StatusUtil.DEMO_DEDUPE_BIOMTERIC_RECORD_VALIDAITON_FAILED_AND_PACKET_SUCCESS.getCode());
description
.setCode(PlatformSuccessMessages.RPR_PKR_DEMO_DE_DUP_POTENTIAL_DUPLICATION_SUCCESS.getCode());
description
.setMessage(
PlatformSuccessMessages.RPR_PKR_DEMO_DE_DUP_POTENTIAL_DUPLICATION_SUCCESS.getMessage()
+ " -- " + registrationId);
regProcLogger.info(LoggerFileConstant.SESSIONID.toString(),
LoggerFileConstant.REGISTRATIONID.toString(), registrationStatusDto.getRegistrationId(),
DemoDedupeConstants.DEMO_SUCCESS);
} else if ((!isInfant && demodedupeInvalidBiometricAction
.equalsIgnoreCase(DemoDedupeConstants.MARK_AS_DEMODEDUPE_FAILED))
|| (isInfant && demodedupeInfantInvalidBiometricAction
.equalsIgnoreCase(DemoDedupeConstants.MARK_AS_DEMODEDUPE_FAILED))) {
registrationStatusDto
.setLatestTransactionStatusCode(RegistrationTransactionStatusCode.FAILED.toString());
registrationStatusDto.setStatusCode(RegistrationStatusCode.PROCESSING.toString());
registrationStatusDto.setStatusComment(trimExceptionMessage.trimExceptionMessage(
StatusUtil.DEMO_DEDUPE_BIOMTERIC_RECORD_VALIDAITON_FAILED.getMessage() + " -> "
+ e.getErrorText()));
registrationStatusDto
.setSubStatusCode(StatusUtil.DEMO_DEDUPE_BIOMTERIC_RECORD_VALIDAITON_FAILED.getCode());
description.setCode(PlatformErrorMessages.RPR_DEMO_POTENTIAL_SENDING_FOR_MANUAL.getCode());
description.setMessage(PlatformErrorMessages.RPR_DEMO_POTENTIAL_SENDING_FOR_MANUAL.getMessage());
object.setMessageBusAddress(MessageBusAddress.MANUAL_VERIFICATION_BUS_IN);
saveManualAdjudicationData(registrationStatusDto, matchedRidsWithoutRejected);
regProcLogger.info(LoggerFileConstant.SESSIONID.toString(),
LoggerFileConstant.REGISTRATIONID.toString(), registrationStatusDto.getRegistrationId(),
DemoDedupeConstants.BIOMETRIC_VALIDATION_FAILED_SENDING_FOR_MANUAL);
} else if ((!isInfant && demodedupeInvalidBiometricAction
.equalsIgnoreCase(DemoDedupeConstants.MARK_AS_DEMODEDUPE_REJECTED))
|| (isInfant && demodedupeInfantInvalidBiometricAction
.equalsIgnoreCase(DemoDedupeConstants.MARK_AS_DEMODEDUPE_REJECTED))) {
registrationStatusDto
.setLatestTransactionStatusCode(RegistrationTransactionStatusCode.FAILED.toString());
registrationStatusDto.setStatusCode(RegistrationStatusCode.REJECTED.toString());
registrationStatusDto.setStatusComment(trimExceptionMessage.trimExceptionMessage(
StatusUtil.DEMO_DEDUPE_BIOMTERIC_RECORD_VALIDAITON_FAILED_AND_PACKET_REJECTED.getMessage()
+ " -> " + e.getErrorText()));
registrationStatusDto
.setSubStatusCode(StatusUtil.DEMO_DEDUPE_BIOMTERIC_RECORD_VALIDAITON_FAILED_AND_PACKET_REJECTED
.getCode());
description.setCode(PlatformErrorMessages.RPR_DEMO_POTENTIAL_PACKET_REJECTED.getCode());
description.setMessage(PlatformErrorMessages.RPR_DEMO_POTENTIAL_PACKET_REJECTED.getMessage());
regProcLogger.info(LoggerFileConstant.SESSIONID.toString(),
LoggerFileConstant.REGISTRATIONID.toString(), registrationStatusDto.getRegistrationId(),
DemoDedupeConstants.BIOMETRIC_VALIDATION_FAILED_PACKET_REJECTED);
}
}

/**
* Gets the latest transaction id.
*
Expand Down Expand Up @@ -591,7 +616,7 @@ private boolean processDemoDedupeRequesthandler(InternalRegistrationStatusDto re
if (!responsIds.isEmpty()) {
List<AbisResponseDetDto> abisResponseDetDto = packetInfoManager.getAbisResponseDetRecordsList(responsIds);
List<String> uniqueRids = abisHandlerUtil.getUniqueRegIds(registrationStatusDto.getRegistrationId(),
SyncTypeDto.NEW.toString(), ProviderStageName.DEMO_DEDUPE);
registrationStatusDto.getRegistrationType(), ProviderStageName.DEMO_DEDUPE);
vishwa-vyom marked this conversation as resolved.
Show resolved Hide resolved
if (abisResponseDetDto.isEmpty() || uniqueRids.isEmpty()) {
object.setIsValid(Boolean.TRUE);
registrationStatusDto
Expand Down Expand Up @@ -703,7 +728,7 @@ private void saveManualAdjudicationData(InternalRegistrationStatusDto registrati
private void biometricValidation(InternalRegistrationStatusDto registrationStatusDto)
throws IOException, ApisResourceAccessException, PacketManagerException, JsonProcessingException,
BiometricRecordValidationException, DataShareException {
Map<String, List<String>> typeAndSubtypMap = abisHandlerUtil.createTypeSubtypeMapping();
Map<String, List<String>> typeAndSubtypMap = abisHandlerUtil.createBiometricTypeSubtypeMappingFromAbispolicy();
List<String> segments = new ArrayList<>();
for (Map.Entry<String, List<String>> entry : typeAndSubtypMap.entrySet()) {
if (entry.getValue() == null) {
Expand Down
Loading