Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion .github/workflows/push-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ on:
- master
- 1.*
- develop*
- MOSIP*

jobs:
build-maven-registration:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import io.mosip.registration.processor.status.dao.RegistrationStatusDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -40,17 +37,14 @@ public class DemoDedupe {
@Autowired
private PacketInfoDao packetInfoDao;

@Autowired
private RegistrationStatusDao registrationStatusDao;

/**
* Perform dedupe.
*
* @param refId
* the ref id
* @return the list
*/
/*public List<DemographicInfoDto> performDedupe(String refId) {
public List<DemographicInfoDto> performDedupe(String refId) {
regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REFERENCEID.toString(), refId,
"DemoDedupe::performDedupe()::entry");

Expand All @@ -65,37 +59,19 @@ public class DemoDedupe {
regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REFERENCEID.toString(), refId,
"DemoDedupe::performDedupe()::exit");
return demographicInfoDtos;
}*/
public List<DemographicInfoDto> performDedupe(String refId) {
regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REFERENCEID.toString(), refId,
"DemoDedupe::performDedupe()::entry");

List<DemographicInfoDto> applicantDemoDto = packetInfoDao.findDemoById(refId);

// Collect all unique parameter sets
List<PacketInfoDao.NameGenderDobLangCode> params = applicantDemoDto.stream()
.map(dto -> new PacketInfoDao.NameGenderDobLangCode(dto.getName(), dto.getGenderCode(), dto.getDob(), dto.getLangCode()))
.distinct()
.collect(Collectors.toList());

// Batch query for all demographic infos matching any of the parameter sets
List<DemographicInfoDto> infoDtos = packetInfoDao.getAllDemographicInfoDtosBatch(params);
}

List<DemographicInfoDto> demographicInfoDtos = getAllDemographicInfoDtosWithUin(infoDtos);
private List<DemographicInfoDto> getAllDemographicInfoDtosWithUin(
List<DemographicInfoDto> duplicateDemographicDtos) {
List<DemographicInfoDto> demographicInfoDtosWithUin = new ArrayList<>();
for (DemographicInfoDto demographicDto : duplicateDemographicDtos) {
if (registrationStatusService.checkUinAvailabilityForRid(demographicDto.getRegId())) {
demographicInfoDtosWithUin.add(demographicDto);
}

regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REFERENCEID.toString(), refId,
"DemoDedupe::performDedupe()::exit");
return demographicInfoDtos;
}
return demographicInfoDtosWithUin;
}

private List<DemographicInfoDto> getAllDemographicInfoDtosWithUin(List<DemographicInfoDto> duplicateDemographicDtos) {
List<String> regIds = duplicateDemographicDtos.stream()
.map(DemographicInfoDto::getRegId)
.collect(Collectors.toList());
List<String> availableUins = registrationStatusDao.getProcessedRegIds(regIds); // new batch method
return duplicateDemographicDtos.stream()
.filter(dto -> availableUins.contains(dto.getRegId()))
.collect(Collectors.toList());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -579,41 +579,41 @@ private boolean saveDuplicateDtoList(List<DemographicInfoDto> duplicateDtos,
String moduleId = PlatformSuccessMessages.RPR_PKR_DEMO_DE_DUP.getCode();

String moduleName = ModuleName.DEMO_DEDUPE.toString();

duplicateDtos.parallelStream().forEach(demographicInfoDto -> {
InternalRegistrationStatusDto potentialMatchRegistrationDto = registrationStatusService
.getRegistrationStatus(demographicInfoDto.getRegId(),
registrationStatusDto.getRegistrationType(), registrationStatusDto.getIteration(), registrationStatusDto.getWorkflowInstanceId());
if (potentialMatchRegistrationDto.getLatestTransactionStatusCode()
.equalsIgnoreCase(RegistrationTransactionStatusCode.REPROCESS.toString())
|| potentialMatchRegistrationDto.getLatestTransactionStatusCode()
.equalsIgnoreCase(AbisConstant.RE_REGISTER)) {
regProcLogger.info(LoggerFileConstant.SESSIONID.toString(),
LoggerFileConstant.REGISTRATIONID.toString(), registrationStatusDto.getRegistrationId(),
DemoDedupeConstants.REJECTED_OR_REREGISTER);
} else if (potentialMatchRegistrationDto.getLatestTransactionStatusCode()
.equalsIgnoreCase(RegistrationTransactionStatusCode.IN_PROGRESS.toString())
|| potentialMatchRegistrationDto.getLatestTransactionStatusCode()
.equalsIgnoreCase(RegistrationTransactionStatusCode.PROCESSED.toString())) {
String latestTransactionId = getLatestTransactionId(registrationStatusDto.getRegistrationId(),
for (DemographicInfoDto demographicInfoDto : duplicateDtos) {
InternalRegistrationStatusDto potentialMatchRegistrationDto = registrationStatusService
.getRegistrationStatus(demographicInfoDto.getRegId(),
registrationStatusDto.getRegistrationType(), registrationStatusDto.getIteration(), registrationStatusDto.getWorkflowInstanceId());
RegDemoDedupeListDto regDemoDedupeListDto = new RegDemoDedupeListDto();
regDemoDedupeListDto.setRegId(registrationStatusDto.getRegistrationId());
regDemoDedupeListDto.setMatchedRegId(demographicInfoDto.getRegId());
regDemoDedupeListDto.setRegtrnId(latestTransactionId);
regDemoDedupeListDto.setIsDeleted(Boolean.FALSE);
regDemoDedupeListDto.setCrBy(DemoDedupeConstants.CREATED_BY);
packetInfoManager.saveDemoDedupePotentialData(regDemoDedupeListDto, moduleId, moduleName);
// You may need to handle isDataSaved and numberOfProcessedPackets in a thread-safe way
} else {
regProcLogger.info(LoggerFileConstant.SESSIONID.toString(),
LoggerFileConstant.REGISTRATIONID.toString(), registrationStatusDto.getRegistrationId(),
"The packet status is something different");
}
});
if (potentialMatchRegistrationDto.getLatestTransactionStatusCode()
.equalsIgnoreCase(RegistrationTransactionStatusCode.REPROCESS.toString())
|| potentialMatchRegistrationDto.getLatestTransactionStatusCode()
.equalsIgnoreCase(AbisConstant.RE_REGISTER)) {
regProcLogger.info(LoggerFileConstant.SESSIONID.toString(),
LoggerFileConstant.REGISTRATIONID.toString(), registrationStatusDto.getRegistrationId(),
DemoDedupeConstants.REJECTED_OR_REREGISTER);
} else if (potentialMatchRegistrationDto.getLatestTransactionStatusCode()
.equalsIgnoreCase(RegistrationTransactionStatusCode.IN_PROGRESS.toString())
|| potentialMatchRegistrationDto.getLatestTransactionStatusCode()
.equalsIgnoreCase(RegistrationTransactionStatusCode.PROCESSED.toString())) {
String latestTransactionId = getLatestTransactionId(registrationStatusDto.getRegistrationId(),
registrationStatusDto.getRegistrationType(), registrationStatusDto.getIteration(), registrationStatusDto.getWorkflowInstanceId());
RegDemoDedupeListDto regDemoDedupeListDto = new RegDemoDedupeListDto();
regDemoDedupeListDto.setRegId(registrationStatusDto.getRegistrationId());
regDemoDedupeListDto.setMatchedRegId(demographicInfoDto.getRegId());
regDemoDedupeListDto.setRegtrnId(latestTransactionId);
regDemoDedupeListDto.setIsDeleted(Boolean.FALSE);
regDemoDedupeListDto.setCrBy(DemoDedupeConstants.CREATED_BY);
packetInfoManager.saveDemoDedupePotentialData(regDemoDedupeListDto, moduleId, moduleName);
isDataSaved = true;
numberOfProcessedPackets++;
} else {
regProcLogger.info(LoggerFileConstant.SESSIONID.toString(),
LoggerFileConstant.REGISTRATIONID.toString(), registrationStatusDto.getRegistrationId(),
"The packet status is something different");
}
if (numberOfProcessedPackets == 0) {
object.setIsValid(Boolean.TRUE);
}
}
return isDataSaved;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import org.apache.commons.io.IOUtils;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
Expand Down Expand Up @@ -120,7 +119,6 @@ public void setUp() throws Exception {
/**
* Test dedupe duplicate found.
*/
@Ignore
@Test
public void testDedupeDuplicateFound() {
String regId = "1234567890";
Expand All @@ -142,7 +140,6 @@ public void testDedupeDuplicateFound() {
/**
* Test demodedupe empty.
*/
@Ignore
@Test
public void testDemodedupeEmpty() {

Expand Down
2 changes: 1 addition & 1 deletion registration-processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
<kernel.qrcodegenerator.zxing.version>1.3.0-SNAPSHOT</kernel.qrcodegenerator.zxing.version>
<kernel.logger.logback.version>1.3.0-SNAPSHOT</kernel.logger.logback.version>
<kernel.idvalidator.vid.version>1.3.0-SNAPSHOT</kernel.idvalidator.vid.version>
<object.store.khazana.version>1.2.1-SNAPSHOT</object.store.khazana.version>
<object.store.khazana.version>1.3.0-SNAPSHOT</object.store.khazana.version>
<kernel.biometrics.api.version>1.3.0-SNAPSHOT</kernel.biometrics.api.version>
<kernel-keymanager-service.version>1.3.0-SNAPSHOT</kernel-keymanager-service.version>
<kernel.websubclient.version>1.3.0-SNAPSHOT</kernel.websubclient.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ RUN find target/ -regextype posix-extended -regex '.*registration-processor-comm
USER ${container_user_uid}:${container_user_gid}

CMD wget "${iam_adapter_url_env}" -O "${loader_path_env}"/kernel-auth-adapter.jar; \
java -XX:+ExplicitGCInvokesConcurrent -XX:+UseZGC -XX:+ZGenerational -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseCompressedOops -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -Dregistration.processor.zone="${zone_env}" -jar registration-processor-common-camel-bridge.jar ; \
java -XX:-UseG1GC -XX:+ExplicitGCInvokesConcurrent -XX:-UseParallelGC -XX:+UseZGC -XX:+ZGenerational -XX:-UseShenandoahGC -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseCompressedOops -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -Dregistration.processor.zone="${zone_env}" -jar registration-processor-common-camel-bridge.jar ; \
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import io.mosip.registration.processor.status.entity.RegistrationStatusEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

Expand Down Expand Up @@ -212,53 +209,6 @@ private List<IndividualDemographicDedupeEntity> getAllDemographicEntities(String
params.put("isActive", IS_ACTIVE_TRUE);
return demographicDedupeRepository.createQuerySelect(query.toString(), params);
}
public List<DemographicInfoDto> getAllDemographicInfoDtosBatch(List<NameGenderDobLangCode> params) {
if (params == null || params.isEmpty()) {
return List.of();
}

// Build JPQL query with OR blocks for each param set
StringBuilder query = new StringBuilder();
query.append("SELECT e FROM IndividualDemographicDedupeEntity e WHERE e.isActive = true AND (");

Map<String, Object> paramMap = new HashMap<>();
for (int i = 0; i < params.size(); i++) {
NameGenderDobLangCode p = params.get(i);
query.append("(e.name = :name").append(i)
.append(" AND e.gender = :gender").append(i)
.append(" AND e.dob = :dob").append(i)
.append(" AND e.id.langCode = :langCode").append(i).append(")");
if (i < params.size() - 1) query.append(" OR ");

paramMap.put("name" + i, p.getName());
paramMap.put("gender" + i, p.getGenderCode());
paramMap.put("dob" + i, p.getDob());
paramMap.put("langCode" + i, p.getLangCode());
}
query.append(")");

List<IndividualDemographicDedupeEntity> entities =
demographicDedupeRepository.createQuerySelect(query.toString(), paramMap);

// Convert entities to DTOs
return entities.stream().map(this::convertEntityToDemographicDto).collect(Collectors.toList());
}

@Data
@NoArgsConstructor
public static class NameGenderDobLangCode {
private String name;
private String genderCode;
private String dob;
private String langCode;

public NameGenderDobLangCode(String name, String genderCode, String dob, String langCode) {
this.name = name;
this.genderCode = genderCode;
this.dob = dob;
this.langCode = langCode;
}
}

/**
* Gets the all demographic info dtos.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ RUN chown -R ${container_user}:${container_user} /home/${container_user}
USER ${container_user_uid}:${container_user_gid}

CMD wget "${iam_adapter_url_env}" -O "${loader_path_env}"/kernel-auth-adapter.jar; \
java -XX:+ExplicitGCInvokesConcurrent -XX:+UseZGC -XX:+ZGenerational -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseCompressedOops -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -jar registration-processor-landing-zone.jar; \
java -XX:-UseG1GC -XX:+ExplicitGCInvokesConcurrent -XX:-UseParallelGC -XX:+UseZGC -XX:+ZGenerational -XX:-UseShenandoahGC -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseCompressedOops -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -jar registration-processor-landing-zone.jar; \
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,6 @@ public Boolean checkUinAvailabilityForRid(String rid) {

}

public List<String> getProcessedRegIds(List<String> regIds) {
return registrationStatusRepositary.findProcessedRegIds(regIds, RegistrationStatusCode.PROCESSED.toString());
}

/**
* Gets the by ids.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public List<String> getProcessedOrProcessingRegIds(@Param("regIds") List<String>

@Query("SELECT registration FROM RegistrationStatusEntity registration WHERE registration.regId = :regId AND registration.statusCode = :statusCode ")
public List<RegistrationStatusEntity> findByRegIdANDByStatusCode(@Param("regId") String regId,@Param("statusCode") String statusCode);

@Query("SELECT registration FROM RegistrationStatusEntity registration WHERE registration.id.workflowInstanceId = :workflowInstanceId AND registration.isDeleted =false AND registration.isActive=true")
public List<RegistrationStatusEntity> findByWorkflowInstanceId(@Param("workflowInstanceId") String workflowInstanceId);

Expand All @@ -61,8 +61,5 @@ public List<String> getProcessedOrProcessingRegIds(@Param("regIds") List<String>

@Query(value ="SELECT * FROM registration r WHERE r.status_code =:statusCode order by r.upd_dtimes LIMIT :fetchSize ", nativeQuery = true)
public List<RegistrationStatusEntity> getResumablePackets(@Param("statusCode") String statusCode,@Param("fetchSize") Integer fetchSize);

@Query("SELECT r.regId FROM RegistrationStatusEntity r WHERE r.regId IN :rids AND r.statusCode = :statusCode")
List<String> findProcessedRegIds(@Param("rids") List<String> rids, @Param("statusCode") String statusCode);
}

Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ USER ${container_user_uid}:${container_user_gid}

CMD wget "${iam_adapter_url_env}" -O "${loader_path_env}"/kernel-auth-adapter.jar; \
wget --no-parent "${artifactory_url_env}"/"${regproc_jars_env}" --directory-prefix "${loader_path_env}"/ ; \
java -XX:+UseZGC -XX:+ZGenerational -XX:+ExplicitGCInvokesConcurrent -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseCompressedOops -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -Dstage-group-name=${group_name} -jar ${group_name}.jar ; \
java -XX:-UseG1GC -XX:+ExplicitGCInvokesConcurrent -XX:-UseParallelGC -XX:+UseZGC -XX:+ZGenerational -XX:-UseShenandoahGC -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseCompressedOops -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -Dstage-group-name=${group_name} -jar ${group_name}.jar ; \
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ USER ${container_user_uid}:${container_user_gid}
ENTRYPOINT [ "./configure_start.sh" ]

CMD wget "${iam_adapter_url_env}" -O "${loader_path_env}"/kernel-auth-adapter.jar; \
java -XX:+UseZGC -XX:+ZGenerational -XX:+ExplicitGCInvokesConcurrent -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseCompressedOops -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -Dstage-group-name=${group_name} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.stream=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.time.LocalDate=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime=ALL-UNNAMED --add-opens java.base/java.io.Reader=ALL-UNNAMED --add-opens java.base/java.util.Optional=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime.date=ALL-UNNAMED -jar ${group_name}.jar ; \
java -XX:-UseG1GC -XX:+ExplicitGCInvokesConcurrent -XX:-UseParallelGC -XX:+UseZGC -XX:+ZGenerational -XX:-UseShenandoahGC -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseCompressedOops -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -Dstage-group-name=${group_name} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.stream=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.time.LocalDate=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime=ALL-UNNAMED --add-opens java.base/java.io.Reader=ALL-UNNAMED --add-opens java.base/java.util.Optional=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime.date=ALL-UNNAMED -jar ${group_name}.jar ; \
Loading