From 8c9414389f9678c7faec776451dbe241396c1d15 Mon Sep 17 00:00:00 2001 From: Sowmya Ujjappa Banakar Date: Fri, 2 Feb 2024 13:47:04 +0530 Subject: [PATCH 1/2] MOSIP-26346 Code fix for status code update Signed-off-by: Sowmya Ujjappa Banakar --- .../impl/PacketUploaderServiceImpl.java | 1172 +++++++++-------- 1 file changed, 588 insertions(+), 584 deletions(-) diff --git a/registration-processor/pre-processor/registration-processor-packet-uploader-stage/src/main/java/io/mosip/registration/processor/packet/uploader/service/impl/PacketUploaderServiceImpl.java b/registration-processor/pre-processor/registration-processor-packet-uploader-stage/src/main/java/io/mosip/registration/processor/packet/uploader/service/impl/PacketUploaderServiceImpl.java index c1eff27155d..02cb32672cd 100644 --- a/registration-processor/pre-processor/registration-processor-packet-uploader-stage/src/main/java/io/mosip/registration/processor/packet/uploader/service/impl/PacketUploaderServiceImpl.java +++ b/registration-processor/pre-processor/registration-processor-packet-uploader-stage/src/main/java/io/mosip/registration/processor/packet/uploader/service/impl/PacketUploaderServiceImpl.java @@ -1,585 +1,589 @@ -package io.mosip.registration.processor.packet.uploader.service.impl; - -import com.fasterxml.jackson.databind.ObjectMapper; -import io.mosip.commons.khazana.spi.ObjectStoreAdapter; -import io.mosip.kernel.core.exception.ExceptionUtils; -import io.mosip.kernel.core.logger.spi.Logger; -import io.mosip.kernel.core.util.HMACUtils2; -import io.mosip.kernel.core.virusscanner.exception.VirusScannerException; -import io.mosip.kernel.core.virusscanner.spi.VirusScanner; -import io.mosip.registration.processor.core.abstractverticle.MessageDTO; -import io.mosip.registration.processor.core.code.ApiName; -import io.mosip.registration.processor.core.code.EventId; -import io.mosip.registration.processor.core.code.EventName; -import io.mosip.registration.processor.core.code.EventType; -import io.mosip.registration.processor.core.code.ModuleName; -import io.mosip.registration.processor.core.code.RegistrationExceptionTypeCode; -import io.mosip.registration.processor.core.code.RegistrationTransactionStatusCode; -import io.mosip.registration.processor.core.code.RegistrationTransactionTypeCode; -import io.mosip.registration.processor.core.constant.LoggerFileConstant; -import io.mosip.registration.processor.core.constant.RegistrationType; -import io.mosip.registration.processor.core.exception.ApisResourceAccessException; -import io.mosip.registration.processor.core.exception.ObjectStoreNotAccessibleException; -import io.mosip.registration.processor.core.exception.PacketDecryptionFailureException; -import io.mosip.registration.processor.core.exception.SftpFileOperationException; -import io.mosip.registration.processor.core.exception.util.PlatformErrorMessages; -import io.mosip.registration.processor.core.exception.util.PlatformSuccessMessages; -import io.mosip.registration.processor.core.logger.LogDescription; -import io.mosip.registration.processor.core.logger.RegProcessorLogger; -import io.mosip.registration.processor.core.spi.restclient.RegistrationProcessorRestClientService; -import io.mosip.registration.processor.core.status.util.StatusUtil; -import io.mosip.registration.processor.core.status.util.TrimExceptionMessage; -import io.mosip.registration.processor.core.util.RegistrationExceptionMapperUtil; -import io.mosip.registration.processor.packet.manager.decryptor.Decryptor; -import io.mosip.registration.processor.packet.manager.utils.ZipUtils; -import io.mosip.registration.processor.packet.storage.dto.ConfigEnum; -import io.mosip.registration.processor.packet.storage.utils.Utilities; -import io.mosip.registration.processor.packet.uploader.archiver.util.PacketArchiver; -import io.mosip.registration.processor.packet.uploader.exception.PacketNotFoundException; -import io.mosip.registration.processor.packet.uploader.service.PacketUploaderService; -import io.mosip.registration.processor.rest.client.audit.builder.AuditLogRequestBuilder; -import io.mosip.registration.processor.status.code.RegistrationStatusCode; -import io.mosip.registration.processor.status.dto.InternalRegistrationStatusDto; -import io.mosip.registration.processor.status.dto.RegistrationStatusDto; -import io.mosip.registration.processor.status.dto.SyncRegistrationDto; -import io.mosip.registration.processor.status.dto.SyncResponseDto; -import io.mosip.registration.processor.status.entity.SyncRegistrationEntity; -import io.mosip.registration.processor.status.exception.TablenotAccessibleException; -import io.mosip.registration.processor.status.service.RegistrationStatusService; -import io.mosip.registration.processor.status.service.SyncRegistrationService; -import org.apache.commons.io.IOUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.cloud.context.config.annotation.RefreshScope; -import org.springframework.http.HttpStatus; -import org.springframework.stereotype.Component; -import org.springframework.web.client.HttpClientErrorException; - -import java.io.*; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -/** - * The Class PacketUploaderServiceImpl. - * - * @author Rishabh Keshari - */ -@RefreshScope -@Component -public class PacketUploaderServiceImpl implements PacketUploaderService { - - /** - * The reg proc logger. - */ - private static Logger regProcLogger = RegProcessorLogger.getLogger(PacketUploaderServiceImpl.class); - - /** - * The fillesystem manager. - */ - private static final String USER = "MOSIP_SYSTEM"; - private static final String ZIP = ".zip"; - private static final String JSON = ".json"; - - @Value("${packet.manager.account.name}") - private String packetManagerAccount; - - /** - * the packet extension(Ex - .zip) - */ - @Value("${registration.processor.packet.ext}") - private String extention; - - @Value("${mosip.commons.packetnames}") - private String packetNames; - - /** - * The max retry count. - */ - @Value("${registration.processor.max.retry}") - private int maxRetryCount; - - @Autowired - private ObjectStoreAdapter objectStoreAdapter; - - /** - * The sync registration service. - */ - @Autowired - private SyncRegistrationService syncRegistrationService; - - /** - * The registration status service. - */ - @Autowired - private RegistrationStatusService registrationStatusService; - - /** - * The core audit request builder. - */ - @Autowired - private AuditLogRequestBuilder auditLogRequestBuilder; - - /** - * The virus scanner service. - */ - @Autowired - private VirusScanner virusScannerService; - - @Autowired - private RegistrationProcessorRestClientService restClient; - - /** - * The registration status mapper util. - */ - @Autowired - private RegistrationExceptionMapperUtil registrationStatusMapperUtil; - - @Autowired - private Decryptor decryptor; - - @Autowired - private ObjectMapper mapper; - - - /** - * The is transaction successful. - */ - boolean isTransactionSuccessful = false; - - /** - * The packet archiver. - */ - @Autowired - private PacketArchiver packetArchiver; - - @Autowired - private Utilities utilities; - - /* - * java class to trim exception message - */ - private TrimExceptionMessage trimExpMessage = new TrimExceptionMessage(); - - /* - * (non-Javadoc) - * - * @see io.mosip.id.issuance.packet.handler.service.PacketUploadService# - * validatePacket( java.lang.Object) - */ - - @Override - public MessageDTO validateAndUploadPacket(String registrationId, String stageName) { - - LogDescription description = new LogDescription(); - InternalRegistrationStatusDto dto = new InternalRegistrationStatusDto(); - MessageDTO messageDTO = new MessageDTO(); - messageDTO.setInternalError(false); - messageDTO.setIsValid(false); - isTransactionSuccessful = false; - regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - registrationId, "PacketUploaderServiceImpl::validateAndUploadPacket()::entry"); - messageDTO.setRid(registrationId); - - try { - - SyncRegistrationEntity regEntity = syncRegistrationService.findByRegistrationId(registrationId); - messageDTO.setReg_type(RegistrationType.valueOf(regEntity.getRegistrationType())); - dto = registrationStatusService.getRegistrationStatus(registrationId); - - dto.setLatestTransactionTypeCode(RegistrationTransactionTypeCode.UPLOAD_PACKET.toString()); - dto.setRegistrationStageName(stageName); - - final byte[] encryptedByteArray = getPakcetFromDMZ(registrationId); - - if (encryptedByteArray != null) { - - if (validateHashCode(new ByteArrayInputStream(encryptedByteArray), regEntity, registrationId, dto, - description)) { - InputStream decryptedPacket = decryptor.decrypt(new ByteArrayInputStream(encryptedByteArray), registrationId); - final byte[] decryptedPacketBytes = IOUtils.toByteArray(decryptedPacket); - if (scanFile(encryptedByteArray, registrationId, ZipUtils.unzipAndGetFiles(new ByteArrayInputStream(decryptedPacketBytes)), dto, description)) { - int retrycount = (dto.getRetryCount() == null) ? 0 : dto.getRetryCount() + 1; - dto.setRetryCount(retrycount); - if (retrycount < getMaxRetryCount()) { - - messageDTO = uploadPacket(dto, ZipUtils.unzipAndGetFiles(new ByteArrayInputStream(decryptedPacketBytes)), messageDTO, description); - if (messageDTO.getIsValid()) { - dto.setLatestTransactionStatusCode( - RegistrationTransactionStatusCode.SUCCESS.toString()); - isTransactionSuccessful = true; - description.setMessage(PlatformSuccessMessages.RPR_PUM_PACKET_UPLOADER.getMessage()); - regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), - LoggerFileConstant.REGISTRATIONID.toString(), registrationId, - description.getMessage()); - - } - } else { - - messageDTO.setInternalError(Boolean.TRUE); - description.setMessage(PlatformErrorMessages.RPR_PUM_PACKET_UPLOAD_FAILURE.getMessage()); - description.setCode(PlatformErrorMessages.RPR_PUM_PACKET_UPLOAD_FAILURE.getCode()); - dto.setLatestTransactionStatusCode(registrationStatusMapperUtil - .getStatusCode(RegistrationExceptionTypeCode.PACKET_UPLOADER_FAILED)); - dto.setStatusCode(RegistrationStatusCode.FAILED.toString()); - dto.setStatusComment(StatusUtil.PACKET_UPLOAD_FAILED.getMessage()); - dto.setSubStatusCode(StatusUtil.PACKET_UPLOAD_FAILED.getCode()); - dto.setUpdatedBy(USER); - regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), - LoggerFileConstant.REGISTRATIONID.toString(), registrationId, - description.getMessage()); - } - } - } - } else { - messageDTO.setInternalError(Boolean.TRUE); - - dto.setLatestTransactionStatusCode(registrationStatusMapperUtil - .getStatusCode(RegistrationExceptionTypeCode.PACKET_UPLOADER_FAILED)); - dto.setStatusCode(RegistrationExceptionTypeCode.PACKET_UPLOADER_FAILED.toString()); - dto.setStatusComment(StatusUtil.PACKET_NOT_FOUND_LANDING_ZIONE.getMessage()); - dto.setSubStatusCode(StatusUtil.PACKET_NOT_FOUND_LANDING_ZIONE.getCode()); - dto.setUpdatedBy(USER); - description.setMessage(PlatformErrorMessages.RPR_PUM_PACKET_UPLOAD_FAILURE.getMessage()); - description.setCode(PlatformErrorMessages.RPR_PUM_PACKET_UPLOAD_FAILURE.getCode()); - - } - - } catch (TablenotAccessibleException e) { - dto.setLatestTransactionStatusCode(registrationStatusMapperUtil - .getStatusCode(RegistrationExceptionTypeCode.TABLE_NOT_ACCESSIBLE_EXCEPTION)); - dto.setStatusComment( - trimExpMessage.trimExceptionMessage(StatusUtil.DB_NOT_ACCESSIBLE.getMessage() + e.getMessage())); - dto.setSubStatusCode(StatusUtil.DB_NOT_ACCESSIBLE.getCode()); - messageDTO.setInternalError(true); - messageDTO.setIsValid(false); - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - registrationId, PlatformErrorMessages.RPR_RGS_REGISTRATION_TABLE_NOT_ACCESSIBLE.name() - + ExceptionUtils.getStackTrace(e)); - - description.setMessage(PlatformErrorMessages.RPR_RGS_REGISTRATION_TABLE_NOT_ACCESSIBLE.getMessage()); - description.setCode(PlatformErrorMessages.RPR_RGS_REGISTRATION_TABLE_NOT_ACCESSIBLE.getCode()); - - } catch (PacketNotFoundException ex) { - if (!isPacketAlreadyPresentInObjectStore(messageDTO.getRid(), messageDTO.getReg_type().name())) { - dto.setLatestTransactionStatusCode(registrationStatusMapperUtil - .getStatusCode(RegistrationExceptionTypeCode.PACKET_NOT_FOUND_EXCEPTION)); - dto.setStatusComment(trimExpMessage - .trimExceptionMessage(ex.getMessage())); - dto.setSubStatusCode(StatusUtil.PACKET_NOT_FOUND_PACKET_STORE.getCode()); - messageDTO.setInternalError(true); - messageDTO.setIsValid(false); - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - registrationId, - PlatformErrorMessages.RPR_PUM_PACKET_NOT_FOUND_EXCEPTION.name() + ExceptionUtils.getStackTrace(ex)); - description.setMessage(PlatformErrorMessages.RPR_PUM_PACKET_NOT_FOUND_EXCEPTION.getMessage()); - description.setCode(PlatformErrorMessages.RPR_PUM_PACKET_NOT_FOUND_EXCEPTION.getCode()); - } else { - regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), - LoggerFileConstant.REGISTRATIONID.toString(), registrationId, - "Packet is not present in LANDING_ZONE but alrady present in object store. Hence this request will be marked as success."); - messageDTO.setInternalError(false); - messageDTO.setIsValid(true); - isTransactionSuccessful = true; - dto.setStatusCode(RegistrationStatusCode.PROCESSING.toString()); - dto.setStatusComment(StatusUtil.PACKET_ALREADY_UPLOADED.getMessage()); - dto.setSubStatusCode(StatusUtil.PACKET_ALREADY_UPLOADED.getCode()); - dto.setLatestTransactionStatusCode(RegistrationTransactionStatusCode.SUCCESS.toString()); - description.setMessage(PlatformSuccessMessages.RPR_PUM_PACKET_UPLOADER_ALREADY_UPLOADED.getMessage()); - description.setCode(PlatformSuccessMessages.RPR_PUM_PACKET_UPLOADER_ALREADY_UPLOADED.getCode()); - } - - } catch (ApisResourceAccessException e) { - dto.setLatestTransactionStatusCode( - registrationStatusMapperUtil.getStatusCode(RegistrationExceptionTypeCode.NGINX_ACCESS_EXCEPTION)); - dto.setStatusComment(trimExpMessage - .trimExceptionMessage(StatusUtil.NGINX_ACCESS_EXCEPTION.getMessage() + e.getMessage())); - dto.setSubStatusCode(StatusUtil.IO_EXCEPTION.getCode()); - messageDTO.setInternalError(true); - messageDTO.setIsValid(false); - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - registrationId, - PlatformErrorMessages.RPR_PUM_NGINX_ACCESS_FAILED.name() + ExceptionUtils.getStackTrace(e)); - - description.setMessage(PlatformErrorMessages.RPR_PUM_NGINX_ACCESS_FAILED.getMessage()); - description.setCode(PlatformErrorMessages.RPR_PUM_NGINX_ACCESS_FAILED.getCode()); - } catch (IOException | NoSuchAlgorithmException e) { - dto.setLatestTransactionStatusCode( - registrationStatusMapperUtil.getStatusCode(RegistrationExceptionTypeCode.IOEXCEPTION)); - dto.setStatusComment( - trimExpMessage.trimExceptionMessage(StatusUtil.IO_EXCEPTION.getMessage() + e.getMessage())); - dto.setSubStatusCode(StatusUtil.IO_EXCEPTION.getCode()); - messageDTO.setIsValid(false); - messageDTO.setInternalError(true); - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - registrationId, - PlatformErrorMessages.RPR_SYS_IO_EXCEPTION.name() + ExceptionUtils.getStackTrace(e)); - description.setMessage(PlatformErrorMessages.RPR_SYS_IO_EXCEPTION.getMessage()); - description.setCode(PlatformErrorMessages.RPR_SYS_IO_EXCEPTION.getCode()); - - } catch (PacketDecryptionFailureException e) { - messageDTO.setInternalError(Boolean.TRUE); - dto.setStatusCode(RegistrationStatusCode.FAILED.toString()); - dto.setStatusComment(StatusUtil.PACKET_DECRYPTION_FAILED.getMessage()); - dto.setSubStatusCode(StatusUtil.PACKET_DECRYPTION_FAILED.getCode()); - dto.setLatestTransactionStatusCode(registrationStatusMapperUtil - .getStatusCode(RegistrationExceptionTypeCode.PACKET_DECRYPTION_FAILURE_EXCEPTION)); - description.setMessage(PlatformErrorMessages.RPR_PUM_PACKET_DECRYPTION_FAILED.getMessage()); - description.setCode(PlatformErrorMessages.RPR_PUM_PACKET_DECRYPTION_FAILED.getCode()); - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - registrationId, ExceptionUtils.getStackTrace(e)); - - } catch (ObjectStoreNotAccessibleException e) { - messageDTO.setInternalError(Boolean.TRUE); - dto.setStatusCode(RegistrationStatusCode.FAILED.toString()); - dto.setStatusComment(StatusUtil.OBJECT_STORE_EXCEPTION.getMessage()); - dto.setSubStatusCode(StatusUtil.OBJECT_STORE_EXCEPTION.getCode()); - dto.setLatestTransactionStatusCode(registrationStatusMapperUtil - .getStatusCode(RegistrationExceptionTypeCode.OBJECT_STORE_EXCEPTION)); - description.setMessage(PlatformErrorMessages.OBJECT_STORE_NOT_ACCESSIBLE.getMessage()); - description.setCode(PlatformErrorMessages.OBJECT_STORE_NOT_ACCESSIBLE.getCode()); - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - registrationId, PlatformErrorMessages.OBJECT_STORE_NOT_ACCESSIBLE.name() - + ExceptionUtils.getStackTrace(e)); - } catch (Exception e) { - dto.setLatestTransactionStatusCode( - registrationStatusMapperUtil.getStatusCode(RegistrationExceptionTypeCode.EXCEPTION)); - dto.setStatusComment(trimExpMessage - .trimExceptionMessage(StatusUtil.UNKNOWN_EXCEPTION_OCCURED.getMessage() + e.getMessage())); - dto.setSubStatusCode(StatusUtil.UNKNOWN_EXCEPTION_OCCURED.getCode()); - messageDTO.setInternalError(true); - messageDTO.setIsValid(false); - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - registrationId, - PlatformErrorMessages.PACKET_UPLOAD_FAILED.name() + ExceptionUtils.getStackTrace(e)); - messageDTO.setInternalError(Boolean.TRUE); - description.setMessage(PlatformErrorMessages.PACKET_UPLOAD_FAILED.getMessage()); - description.setCode(PlatformErrorMessages.PACKET_UPLOAD_FAILED.getCode()); - - } finally { - /** Module-Id can be Both Success/Error code */ - String moduleId = isTransactionSuccessful ? PlatformSuccessMessages.RPR_PUM_PACKET_UPLOADER.getCode() - : description.getCode(); - String moduleName = ModuleName.PACKET_UPLOAD.toString(); - registrationStatusService.updateRegistrationStatus(dto, moduleId, moduleName); - String eventId = ""; - String eventName = ""; - String eventType = ""; - eventId = isTransactionSuccessful ? EventId.RPR_402.toString() : EventId.RPR_405.toString(); - eventName = eventId.equalsIgnoreCase(EventId.RPR_402.toString()) ? EventName.UPDATE.toString() - : EventName.EXCEPTION.toString(); - eventType = eventId.equalsIgnoreCase(EventId.RPR_402.toString()) ? EventType.BUSINESS.toString() - : EventType.SYSTEM.toString(); - - auditLogRequestBuilder.createAuditRequestBuilder(description.getMessage(), eventId, eventName, eventType, - moduleId, moduleName, registrationId); - - } - - regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - registrationId, "PacketUploaderServiceImpl::validateAndUploadPacket()::exit"); - return messageDTO; - } - - /** - * Scan file. - * - * @param input the input stream - * @param id - * @param description - * @return true, if successful - * @throws IOException - * @throws ApisResourceAccessException - */ - private boolean scanFile(final byte[] input, String id, final Map sourcePackets, InternalRegistrationStatusDto dto, - LogDescription description) throws ApisResourceAccessException, PacketDecryptionFailureException, IOException { - boolean isInputFileClean = false; - try { - InputStream packet = new ByteArrayInputStream(input); - // scanning the top level packet - isInputFileClean = virusScannerService.scanFile(packet); - - if (isInputFileClean) { - // scanning the source packets (Like - id, evidence, optional packets). - for (final Map.Entry source : sourcePackets.entrySet()) { - if (source.getKey().endsWith(ZIP)) { - InputStream decryptedData = decryptor - .decrypt(source.getValue(), id); - isInputFileClean = virusScannerService.scanFile(decryptedData); - } else - isInputFileClean = virusScannerService.scanFile(source.getValue()); - if (!isInputFileClean) - break; - } - } - if (!isInputFileClean) { - description.setMessage(PlatformErrorMessages.RPR_PUM_PACKET_VIRUS_SCAN_FAILED.getMessage()); - description.setCode(PlatformErrorMessages.RPR_PUM_PACKET_VIRUS_SCAN_FAILED.getCode()); - dto.setStatusCode(RegistrationExceptionTypeCode.PACKET_UPLOADER_FAILED.toString()); - dto.setStatusComment(StatusUtil.VIRUS_SCANNER_FAILED_UPLOADER.getMessage()); - dto.setSubStatusCode(StatusUtil.VIRUS_SCANNER_FAILED_UPLOADER.getCode()); - dto.setLatestTransactionStatusCode(registrationStatusMapperUtil - .getStatusCode(RegistrationExceptionTypeCode.VIRUS_SCAN_FAILED_EXCEPTION)); - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), - LoggerFileConstant.REGISTRATIONID.toString(), id, - PlatformErrorMessages.RPR_PUM_PACKET_VIRUS_SCAN_FAILED.getMessage()); - } - } catch (VirusScannerException e) { - - description.setMessage(PlatformErrorMessages.RPR_PUM_PACKET_VIRUS_SCANNER_SERVICE_FAILED.getMessage()); - description.setCode(PlatformErrorMessages.RPR_PUM_PACKET_VIRUS_SCANNER_SERVICE_FAILED.getCode()); - dto.setStatusCode(RegistrationExceptionTypeCode.PACKET_UPLOADER_FAILED.toString()); - dto.setStatusComment(trimExpMessage.trimExceptionMessage( - StatusUtil.VIRUS_SCANNER_SERVICE_NOT_ACCESSIBLE.getMessage() + e.getMessage())); - dto.setSubStatusCode(StatusUtil.VIRUS_SCANNER_SERVICE_NOT_ACCESSIBLE.getCode()); - dto.setLatestTransactionStatusCode(registrationStatusMapperUtil - .getStatusCode(RegistrationExceptionTypeCode.VIRUS_SCANNER_SERVICE_FAILED)); - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - id, PlatformErrorMessages.RPR_PUM_PACKET_VIRUS_SCANNER_SERVICE_FAILED.getMessage() - + ExceptionUtils.getStackTrace(e)); - - } - return isInputFileClean; - } - - /** - * Validate hash code. - * - * @param registrationId the registration id - * @param inputStream the input stream - * @param registrationId - * @param description - * @throws IOException Signals that an I/O exception has occurred. - */ - private boolean validateHashCode(InputStream inputStream, SyncRegistrationEntity regEntity, String registrationId, - InternalRegistrationStatusDto dto, LogDescription description) throws IOException, NoSuchAlgorithmException { - boolean isValidHash = false; - byte[] isbytearray = IOUtils.toByteArray(inputStream); - String hashSequence = HMACUtils2.digestAsPlainText(isbytearray); - String packetHashSequence = regEntity.getPacketHashValue(); - if (!(MessageDigest.isEqual(packetHashSequence.getBytes(), hashSequence.getBytes()))) { - description.setMessage(PlatformErrorMessages.RPR_PKR_PACKET_HASH_NOT_EQUALS_SYNCED_HASH.getMessage()); - description.setCode(PlatformErrorMessages.RPR_PKR_PACKET_HASH_NOT_EQUALS_SYNCED_HASH.getCode()); - dto.setLatestTransactionStatusCode( - registrationStatusMapperUtil.getStatusCode(RegistrationExceptionTypeCode.PACKET_UPLOADER_FAILED)); - dto.setStatusCode(RegistrationExceptionTypeCode.PACKET_UPLOADER_FAILED.toString()); - dto.setStatusComment(StatusUtil.PACKET_HASHCODE_VALIDATION_FAILED.getMessage()); - dto.setSubStatusCode(StatusUtil.PACKET_HASHCODE_VALIDATION_FAILED.getCode()); - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - registrationId, PlatformErrorMessages.RPR_PKR_PACKET_HASH_NOT_EQUALS_SYNCED_HASH.getMessage()); - - return isValidHash; - } else { - isValidHash = true; - return isValidHash; - } - } - - /** - * Uploadpacket. - * - * @param dto the dto - * @param sourcePackets source packets - * @param object the object - * @param description - * @return the message DTO - * @throws IOException Signals that an I/O exception has occurred. - * @throws SftpFileOperationException - */ - private MessageDTO uploadPacket(InternalRegistrationStatusDto dto, final Map sourcePackets, - MessageDTO object, LogDescription description) throws ObjectStoreNotAccessibleException { - - object.setIsValid(false); - String registrationId = dto.getRegistrationId(); - // upload packets - try { - for (Map.Entry entry : sourcePackets.entrySet()) { - if (entry.getKey().endsWith(ZIP)) { - boolean result = objectStoreAdapter.putObject(packetManagerAccount, registrationId, - null, null, entry.getKey().replace(ZIP, ""), entry.getValue()); - if (!result) - throw new ObjectStoreNotAccessibleException("Failed to store packet : " + entry.getKey()); - } - } - - // upload metadata - for (Map.Entry entry : sourcePackets.entrySet()) { - if (entry.getKey().endsWith(JSON)) { - byte[] bytearray = IOUtils.toByteArray(entry.getValue()); - String jsonString = new String(bytearray); - LinkedHashMap currentIdMap = (LinkedHashMap) mapper.readValue(jsonString, LinkedHashMap.class); - objectStoreAdapter.addObjectMetaData(packetManagerAccount, registrationId, - null, null, entry.getKey().replace(JSON, ""), currentIdMap); - } - } - } catch (Exception e) { - object.setIsValid(false); - object.setInternalError(true); - throw new ObjectStoreNotAccessibleException(e.getMessage(), e); - } - - - dto.setStatusCode(RegistrationStatusCode.PROCESSING.toString()); - dto.setStatusComment(StatusUtil.PACKET_UPLOADED.getMessage()); - dto.setSubStatusCode(StatusUtil.PACKET_UPLOADED.getCode()); - dto.setUpdatedBy(USER); - object.setInternalError(false); - object.setIsValid(true); - object.setRid(registrationId); - - isTransactionSuccessful = true; - description.setMessage(PlatformErrorMessages.RPR_PUM_PACKET_DELETION_INFO.getMessage()); - description.setCode(PlatformErrorMessages.RPR_PUM_PACKET_DELETION_INFO.getCode()); - - regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), - LoggerFileConstant.REGISTRATIONID.toString(), registrationId, - PlatformErrorMessages.RPR_PUM_PACKET_DELETION_INFO.getMessage()); - - return object; - } - - /** - * Get max retry count. - * - * @return maxRetryCount - */ - public int getMaxRetryCount() { - return maxRetryCount; - } - - private byte[] getPakcetFromDMZ(String rid) throws ApisResourceAccessException { - List pathSegment = new ArrayList<>(); - pathSegment.add(rid + extention); - byte[] packet = null; - - try { - packet = (byte[]) restClient.getApi(ApiName.NGINXDMZURL, pathSegment, "", null, byte[].class); - } catch (ApisResourceAccessException e) { - if (e.getCause() instanceof HttpClientErrorException) { - HttpClientErrorException ex = (HttpClientErrorException) e.getCause(); - if (ex.getStatusCode().equals(HttpStatus.NOT_FOUND)) - throw new PacketNotFoundException(PlatformErrorMessages.RPR_PUM_PACKET_NOT_FOUND_EXCEPTION.getMessage(), ex); - } else - throw e; - } - return packet; - } - - - public boolean isPacketAlreadyPresentInObjectStore(String id, String process) { - - for (String name : packetNames.split(",")) { - boolean isPresent = objectStoreAdapter.exists(packetManagerAccount, id, utilities.getDefaultSource(process, ConfigEnum.READER), process, id+ "_" + name); - if (!isPresent) { - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - id, name + " : packet not present in object store."); - return false; - } - } - return true; - } - +package io.mosip.registration.processor.packet.uploader.service.impl; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.io.IOUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.cloud.context.config.annotation.RefreshScope; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Component; +import org.springframework.web.client.HttpClientErrorException; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import io.mosip.commons.khazana.spi.ObjectStoreAdapter; +import io.mosip.kernel.core.exception.ExceptionUtils; +import io.mosip.kernel.core.logger.spi.Logger; +import io.mosip.kernel.core.util.HMACUtils2; +import io.mosip.kernel.core.virusscanner.exception.VirusScannerException; +import io.mosip.kernel.core.virusscanner.spi.VirusScanner; +import io.mosip.registration.processor.core.abstractverticle.MessageDTO; +import io.mosip.registration.processor.core.code.ApiName; +import io.mosip.registration.processor.core.code.EventId; +import io.mosip.registration.processor.core.code.EventName; +import io.mosip.registration.processor.core.code.EventType; +import io.mosip.registration.processor.core.code.ModuleName; +import io.mosip.registration.processor.core.code.RegistrationExceptionTypeCode; +import io.mosip.registration.processor.core.code.RegistrationTransactionStatusCode; +import io.mosip.registration.processor.core.code.RegistrationTransactionTypeCode; +import io.mosip.registration.processor.core.constant.LoggerFileConstant; +import io.mosip.registration.processor.core.constant.RegistrationType; +import io.mosip.registration.processor.core.exception.ApisResourceAccessException; +import io.mosip.registration.processor.core.exception.ObjectStoreNotAccessibleException; +import io.mosip.registration.processor.core.exception.PacketDecryptionFailureException; +import io.mosip.registration.processor.core.exception.SftpFileOperationException; +import io.mosip.registration.processor.core.exception.util.PlatformErrorMessages; +import io.mosip.registration.processor.core.exception.util.PlatformSuccessMessages; +import io.mosip.registration.processor.core.logger.LogDescription; +import io.mosip.registration.processor.core.logger.RegProcessorLogger; +import io.mosip.registration.processor.core.spi.restclient.RegistrationProcessorRestClientService; +import io.mosip.registration.processor.core.status.util.StatusUtil; +import io.mosip.registration.processor.core.status.util.TrimExceptionMessage; +import io.mosip.registration.processor.core.util.RegistrationExceptionMapperUtil; +import io.mosip.registration.processor.packet.manager.decryptor.Decryptor; +import io.mosip.registration.processor.packet.manager.utils.ZipUtils; +import io.mosip.registration.processor.packet.storage.dto.ConfigEnum; +import io.mosip.registration.processor.packet.storage.utils.Utilities; +import io.mosip.registration.processor.packet.uploader.archiver.util.PacketArchiver; +import io.mosip.registration.processor.packet.uploader.exception.PacketNotFoundException; +import io.mosip.registration.processor.packet.uploader.service.PacketUploaderService; +import io.mosip.registration.processor.rest.client.audit.builder.AuditLogRequestBuilder; +import io.mosip.registration.processor.status.code.RegistrationStatusCode; +import io.mosip.registration.processor.status.dto.InternalRegistrationStatusDto; +import io.mosip.registration.processor.status.dto.RegistrationStatusDto; +import io.mosip.registration.processor.status.dto.SyncRegistrationDto; +import io.mosip.registration.processor.status.dto.SyncResponseDto; +import io.mosip.registration.processor.status.entity.SyncRegistrationEntity; +import io.mosip.registration.processor.status.exception.TablenotAccessibleException; +import io.mosip.registration.processor.status.service.RegistrationStatusService; +import io.mosip.registration.processor.status.service.SyncRegistrationService; + +/** + * The Class PacketUploaderServiceImpl. + * + * @author Rishabh Keshari + */ +@RefreshScope +@Component +public class PacketUploaderServiceImpl implements PacketUploaderService { + + /** + * The reg proc logger. + */ + private static Logger regProcLogger = RegProcessorLogger.getLogger(PacketUploaderServiceImpl.class); + + /** + * The fillesystem manager. + */ + private static final String USER = "MOSIP_SYSTEM"; + private static final String ZIP = ".zip"; + private static final String JSON = ".json"; + + @Value("${packet.manager.account.name}") + private String packetManagerAccount; + + /** + * the packet extension(Ex - .zip) + */ + @Value("${registration.processor.packet.ext}") + private String extention; + + @Value("${mosip.commons.packetnames}") + private String packetNames; + + /** + * The max retry count. + */ + @Value("${registration.processor.max.retry}") + private int maxRetryCount; + + @Autowired + private ObjectStoreAdapter objectStoreAdapter; + + /** + * The sync registration service. + */ + @Autowired + private SyncRegistrationService syncRegistrationService; + + /** + * The registration status service. + */ + @Autowired + private RegistrationStatusService registrationStatusService; + + /** + * The core audit request builder. + */ + @Autowired + private AuditLogRequestBuilder auditLogRequestBuilder; + + /** + * The virus scanner service. + */ + @Autowired + private VirusScanner virusScannerService; + + @Autowired + private RegistrationProcessorRestClientService restClient; + + /** + * The registration status mapper util. + */ + @Autowired + private RegistrationExceptionMapperUtil registrationStatusMapperUtil; + + @Autowired + private Decryptor decryptor; + + @Autowired + private ObjectMapper mapper; + + + /** + * The is transaction successful. + */ + boolean isTransactionSuccessful = false; + + /** + * The packet archiver. + */ + @Autowired + private PacketArchiver packetArchiver; + + @Autowired + private Utilities utilities; + + /* + * java class to trim exception message + */ + private TrimExceptionMessage trimExpMessage = new TrimExceptionMessage(); + + /* + * (non-Javadoc) + * + * @see io.mosip.id.issuance.packet.handler.service.PacketUploadService# + * validatePacket( java.lang.Object) + */ + + @Override + public MessageDTO validateAndUploadPacket(String registrationId, String stageName) { + + LogDescription description = new LogDescription(); + InternalRegistrationStatusDto dto = new InternalRegistrationStatusDto(); + MessageDTO messageDTO = new MessageDTO(); + messageDTO.setInternalError(false); + messageDTO.setIsValid(false); + isTransactionSuccessful = false; + regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + registrationId, "PacketUploaderServiceImpl::validateAndUploadPacket()::entry"); + messageDTO.setRid(registrationId); + + try { + + SyncRegistrationEntity regEntity = syncRegistrationService.findByRegistrationId(registrationId); + messageDTO.setReg_type(RegistrationType.valueOf(regEntity.getRegistrationType())); + dto = registrationStatusService.getRegistrationStatus(registrationId); + + dto.setLatestTransactionTypeCode(RegistrationTransactionTypeCode.UPLOAD_PACKET.toString()); + dto.setRegistrationStageName(stageName); + + final byte[] encryptedByteArray = getPakcetFromDMZ(registrationId); + + if (encryptedByteArray != null) { + + if (validateHashCode(new ByteArrayInputStream(encryptedByteArray), regEntity, registrationId, dto, + description)) { + InputStream decryptedPacket = decryptor.decrypt(new ByteArrayInputStream(encryptedByteArray), registrationId); + final byte[] decryptedPacketBytes = IOUtils.toByteArray(decryptedPacket); + if (scanFile(encryptedByteArray, registrationId, ZipUtils.unzipAndGetFiles(new ByteArrayInputStream(decryptedPacketBytes)), dto, description)) { + int retrycount = (dto.getRetryCount() == null) ? 0 : dto.getRetryCount() + 1; + dto.setRetryCount(retrycount); + if (retrycount < getMaxRetryCount()) { + + messageDTO = uploadPacket(dto, ZipUtils.unzipAndGetFiles(new ByteArrayInputStream(decryptedPacketBytes)), messageDTO, description); + if (messageDTO.getIsValid()) { + dto.setLatestTransactionStatusCode( + RegistrationTransactionStatusCode.SUCCESS.toString()); + isTransactionSuccessful = true; + description.setMessage(PlatformSuccessMessages.RPR_PUM_PACKET_UPLOADER.getMessage()); + regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), + LoggerFileConstant.REGISTRATIONID.toString(), registrationId, + description.getMessage()); + + } + } else { + + messageDTO.setInternalError(Boolean.TRUE); + description.setMessage(PlatformErrorMessages.RPR_PUM_PACKET_UPLOAD_FAILURE.getMessage()); + description.setCode(PlatformErrorMessages.RPR_PUM_PACKET_UPLOAD_FAILURE.getCode()); + dto.setLatestTransactionStatusCode(registrationStatusMapperUtil + .getStatusCode(RegistrationExceptionTypeCode.PACKET_UPLOADER_FAILED)); + dto.setStatusCode(RegistrationStatusCode.FAILED.toString()); + dto.setStatusComment(StatusUtil.PACKET_UPLOAD_FAILED.getMessage()); + dto.setSubStatusCode(StatusUtil.PACKET_UPLOAD_FAILED.getCode()); + dto.setUpdatedBy(USER); + regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), + LoggerFileConstant.REGISTRATIONID.toString(), registrationId, + description.getMessage()); + } + } + } + } else { + messageDTO.setInternalError(Boolean.TRUE); + + dto.setLatestTransactionStatusCode(registrationStatusMapperUtil + .getStatusCode(RegistrationExceptionTypeCode.PACKET_UPLOADER_FAILED)); + dto.setStatusCode(RegistrationStatusCode.FAILED.toString()); + dto.setStatusComment(StatusUtil.PACKET_NOT_FOUND_LANDING_ZIONE.getMessage()); + dto.setSubStatusCode(StatusUtil.PACKET_NOT_FOUND_LANDING_ZIONE.getCode()); + dto.setUpdatedBy(USER); + description.setMessage(PlatformErrorMessages.RPR_PUM_PACKET_UPLOAD_FAILURE.getMessage()); + description.setCode(PlatformErrorMessages.RPR_PUM_PACKET_UPLOAD_FAILURE.getCode()); + + } + + } catch (TablenotAccessibleException e) { + dto.setLatestTransactionStatusCode(registrationStatusMapperUtil + .getStatusCode(RegistrationExceptionTypeCode.TABLE_NOT_ACCESSIBLE_EXCEPTION)); + dto.setStatusComment( + trimExpMessage.trimExceptionMessage(StatusUtil.DB_NOT_ACCESSIBLE.getMessage() + e.getMessage())); + dto.setSubStatusCode(StatusUtil.DB_NOT_ACCESSIBLE.getCode()); + messageDTO.setInternalError(true); + messageDTO.setIsValid(false); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + registrationId, PlatformErrorMessages.RPR_RGS_REGISTRATION_TABLE_NOT_ACCESSIBLE.name() + + ExceptionUtils.getStackTrace(e)); + + description.setMessage(PlatformErrorMessages.RPR_RGS_REGISTRATION_TABLE_NOT_ACCESSIBLE.getMessage()); + description.setCode(PlatformErrorMessages.RPR_RGS_REGISTRATION_TABLE_NOT_ACCESSIBLE.getCode()); + + } catch (PacketNotFoundException ex) { + if (!isPacketAlreadyPresentInObjectStore(messageDTO.getRid(), messageDTO.getReg_type().name())) { + dto.setLatestTransactionStatusCode(registrationStatusMapperUtil + .getStatusCode(RegistrationExceptionTypeCode.PACKET_NOT_FOUND_EXCEPTION)); + dto.setStatusComment(trimExpMessage + .trimExceptionMessage(ex.getMessage())); + dto.setSubStatusCode(StatusUtil.PACKET_NOT_FOUND_PACKET_STORE.getCode()); + messageDTO.setInternalError(true); + messageDTO.setIsValid(false); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + registrationId, + PlatformErrorMessages.RPR_PUM_PACKET_NOT_FOUND_EXCEPTION.name() + ExceptionUtils.getStackTrace(ex)); + description.setMessage(PlatformErrorMessages.RPR_PUM_PACKET_NOT_FOUND_EXCEPTION.getMessage()); + description.setCode(PlatformErrorMessages.RPR_PUM_PACKET_NOT_FOUND_EXCEPTION.getCode()); + } else { + regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), + LoggerFileConstant.REGISTRATIONID.toString(), registrationId, + "Packet is not present in LANDING_ZONE but alrady present in object store. Hence this request will be marked as success."); + messageDTO.setInternalError(false); + messageDTO.setIsValid(true); + isTransactionSuccessful = true; + dto.setStatusCode(RegistrationStatusCode.PROCESSING.toString()); + dto.setStatusComment(StatusUtil.PACKET_ALREADY_UPLOADED.getMessage()); + dto.setSubStatusCode(StatusUtil.PACKET_ALREADY_UPLOADED.getCode()); + dto.setLatestTransactionStatusCode(RegistrationTransactionStatusCode.SUCCESS.toString()); + description.setMessage(PlatformSuccessMessages.RPR_PUM_PACKET_UPLOADER_ALREADY_UPLOADED.getMessage()); + description.setCode(PlatformSuccessMessages.RPR_PUM_PACKET_UPLOADER_ALREADY_UPLOADED.getCode()); + } + + } catch (ApisResourceAccessException e) { + dto.setLatestTransactionStatusCode( + registrationStatusMapperUtil.getStatusCode(RegistrationExceptionTypeCode.NGINX_ACCESS_EXCEPTION)); + dto.setStatusComment(trimExpMessage + .trimExceptionMessage(StatusUtil.NGINX_ACCESS_EXCEPTION.getMessage() + e.getMessage())); + dto.setSubStatusCode(StatusUtil.IO_EXCEPTION.getCode()); + messageDTO.setInternalError(true); + messageDTO.setIsValid(false); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + registrationId, + PlatformErrorMessages.RPR_PUM_NGINX_ACCESS_FAILED.name() + ExceptionUtils.getStackTrace(e)); + + description.setMessage(PlatformErrorMessages.RPR_PUM_NGINX_ACCESS_FAILED.getMessage()); + description.setCode(PlatformErrorMessages.RPR_PUM_NGINX_ACCESS_FAILED.getCode()); + } catch (IOException | NoSuchAlgorithmException e) { + dto.setLatestTransactionStatusCode( + registrationStatusMapperUtil.getStatusCode(RegistrationExceptionTypeCode.IOEXCEPTION)); + dto.setStatusComment( + trimExpMessage.trimExceptionMessage(StatusUtil.IO_EXCEPTION.getMessage() + e.getMessage())); + dto.setSubStatusCode(StatusUtil.IO_EXCEPTION.getCode()); + messageDTO.setIsValid(false); + messageDTO.setInternalError(true); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + registrationId, + PlatformErrorMessages.RPR_SYS_IO_EXCEPTION.name() + ExceptionUtils.getStackTrace(e)); + description.setMessage(PlatformErrorMessages.RPR_SYS_IO_EXCEPTION.getMessage()); + description.setCode(PlatformErrorMessages.RPR_SYS_IO_EXCEPTION.getCode()); + + } catch (PacketDecryptionFailureException e) { + messageDTO.setInternalError(Boolean.TRUE); + dto.setStatusCode(RegistrationStatusCode.FAILED.toString()); + dto.setStatusComment(StatusUtil.PACKET_DECRYPTION_FAILED.getMessage()); + dto.setSubStatusCode(StatusUtil.PACKET_DECRYPTION_FAILED.getCode()); + dto.setLatestTransactionStatusCode(registrationStatusMapperUtil + .getStatusCode(RegistrationExceptionTypeCode.PACKET_DECRYPTION_FAILURE_EXCEPTION)); + description.setMessage(PlatformErrorMessages.RPR_PUM_PACKET_DECRYPTION_FAILED.getMessage()); + description.setCode(PlatformErrorMessages.RPR_PUM_PACKET_DECRYPTION_FAILED.getCode()); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + registrationId, ExceptionUtils.getStackTrace(e)); + + } catch (ObjectStoreNotAccessibleException e) { + messageDTO.setInternalError(Boolean.TRUE); + dto.setStatusCode(RegistrationStatusCode.FAILED.toString()); + dto.setStatusComment(StatusUtil.OBJECT_STORE_EXCEPTION.getMessage()); + dto.setSubStatusCode(StatusUtil.OBJECT_STORE_EXCEPTION.getCode()); + dto.setLatestTransactionStatusCode(registrationStatusMapperUtil + .getStatusCode(RegistrationExceptionTypeCode.OBJECT_STORE_EXCEPTION)); + description.setMessage(PlatformErrorMessages.OBJECT_STORE_NOT_ACCESSIBLE.getMessage()); + description.setCode(PlatformErrorMessages.OBJECT_STORE_NOT_ACCESSIBLE.getCode()); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + registrationId, PlatformErrorMessages.OBJECT_STORE_NOT_ACCESSIBLE.name() + + ExceptionUtils.getStackTrace(e)); + } catch (Exception e) { + dto.setLatestTransactionStatusCode( + registrationStatusMapperUtil.getStatusCode(RegistrationExceptionTypeCode.EXCEPTION)); + dto.setStatusComment(trimExpMessage + .trimExceptionMessage(StatusUtil.UNKNOWN_EXCEPTION_OCCURED.getMessage() + e.getMessage())); + dto.setSubStatusCode(StatusUtil.UNKNOWN_EXCEPTION_OCCURED.getCode()); + messageDTO.setInternalError(true); + messageDTO.setIsValid(false); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + registrationId, + PlatformErrorMessages.PACKET_UPLOAD_FAILED.name() + ExceptionUtils.getStackTrace(e)); + messageDTO.setInternalError(Boolean.TRUE); + description.setMessage(PlatformErrorMessages.PACKET_UPLOAD_FAILED.getMessage()); + description.setCode(PlatformErrorMessages.PACKET_UPLOAD_FAILED.getCode()); + + } finally { + /** Module-Id can be Both Success/Error code */ + String moduleId = isTransactionSuccessful ? PlatformSuccessMessages.RPR_PUM_PACKET_UPLOADER.getCode() + : description.getCode(); + String moduleName = ModuleName.PACKET_UPLOAD.toString(); + registrationStatusService.updateRegistrationStatus(dto, moduleId, moduleName); + String eventId = ""; + String eventName = ""; + String eventType = ""; + eventId = isTransactionSuccessful ? EventId.RPR_402.toString() : EventId.RPR_405.toString(); + eventName = eventId.equalsIgnoreCase(EventId.RPR_402.toString()) ? EventName.UPDATE.toString() + : EventName.EXCEPTION.toString(); + eventType = eventId.equalsIgnoreCase(EventId.RPR_402.toString()) ? EventType.BUSINESS.toString() + : EventType.SYSTEM.toString(); + + auditLogRequestBuilder.createAuditRequestBuilder(description.getMessage(), eventId, eventName, eventType, + moduleId, moduleName, registrationId); + + } + + regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + registrationId, "PacketUploaderServiceImpl::validateAndUploadPacket()::exit"); + return messageDTO; + } + + /** + * Scan file. + * + * @param input the input stream + * @param id + * @param description + * @return true, if successful + * @throws IOException + * @throws ApisResourceAccessException + */ + private boolean scanFile(final byte[] input, String id, final Map sourcePackets, InternalRegistrationStatusDto dto, + LogDescription description) throws ApisResourceAccessException, PacketDecryptionFailureException, IOException { + boolean isInputFileClean = false; + try { + InputStream packet = new ByteArrayInputStream(input); + // scanning the top level packet + isInputFileClean = virusScannerService.scanFile(packet); + + if (isInputFileClean) { + // scanning the source packets (Like - id, evidence, optional packets). + for (final Map.Entry source : sourcePackets.entrySet()) { + if (source.getKey().endsWith(ZIP)) { + InputStream decryptedData = decryptor + .decrypt(source.getValue(), id); + isInputFileClean = virusScannerService.scanFile(decryptedData); + } else + isInputFileClean = virusScannerService.scanFile(source.getValue()); + if (!isInputFileClean) + break; + } + } + if (!isInputFileClean) { + description.setMessage(PlatformErrorMessages.RPR_PUM_PACKET_VIRUS_SCAN_FAILED.getMessage()); + description.setCode(PlatformErrorMessages.RPR_PUM_PACKET_VIRUS_SCAN_FAILED.getCode()); + dto.setStatusCode(RegistrationStatusCode.FAILED.toString()); + dto.setStatusComment(StatusUtil.VIRUS_SCANNER_FAILED_UPLOADER.getMessage()); + dto.setSubStatusCode(StatusUtil.VIRUS_SCANNER_FAILED_UPLOADER.getCode()); + dto.setLatestTransactionStatusCode(registrationStatusMapperUtil + .getStatusCode(RegistrationExceptionTypeCode.VIRUS_SCAN_FAILED_EXCEPTION)); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), + LoggerFileConstant.REGISTRATIONID.toString(), id, + PlatformErrorMessages.RPR_PUM_PACKET_VIRUS_SCAN_FAILED.getMessage()); + } + } catch (VirusScannerException e) { + + description.setMessage(PlatformErrorMessages.RPR_PUM_PACKET_VIRUS_SCANNER_SERVICE_FAILED.getMessage()); + description.setCode(PlatformErrorMessages.RPR_PUM_PACKET_VIRUS_SCANNER_SERVICE_FAILED.getCode()); + dto.setStatusCode(RegistrationStatusCode.FAILED.toString()); + dto.setStatusComment(trimExpMessage.trimExceptionMessage( + StatusUtil.VIRUS_SCANNER_SERVICE_NOT_ACCESSIBLE.getMessage() + e.getMessage())); + dto.setSubStatusCode(StatusUtil.VIRUS_SCANNER_SERVICE_NOT_ACCESSIBLE.getCode()); + dto.setLatestTransactionStatusCode(registrationStatusMapperUtil + .getStatusCode(RegistrationExceptionTypeCode.VIRUS_SCANNER_SERVICE_FAILED)); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + id, PlatformErrorMessages.RPR_PUM_PACKET_VIRUS_SCANNER_SERVICE_FAILED.getMessage() + + ExceptionUtils.getStackTrace(e)); + + } + return isInputFileClean; + } + + /** + * Validate hash code. + * + * @param registrationId the registration id + * @param inputStream the input stream + * @param registrationId + * @param description + * @throws IOException Signals that an I/O exception has occurred. + */ + private boolean validateHashCode(InputStream inputStream, SyncRegistrationEntity regEntity, String registrationId, + InternalRegistrationStatusDto dto, LogDescription description) throws IOException, NoSuchAlgorithmException { + boolean isValidHash = false; + byte[] isbytearray = IOUtils.toByteArray(inputStream); + String hashSequence = HMACUtils2.digestAsPlainText(isbytearray); + String packetHashSequence = regEntity.getPacketHashValue(); + if (!(MessageDigest.isEqual(packetHashSequence.getBytes(), hashSequence.getBytes()))) { + description.setMessage(PlatformErrorMessages.RPR_PKR_PACKET_HASH_NOT_EQUALS_SYNCED_HASH.getMessage()); + description.setCode(PlatformErrorMessages.RPR_PKR_PACKET_HASH_NOT_EQUALS_SYNCED_HASH.getCode()); + dto.setLatestTransactionStatusCode( + registrationStatusMapperUtil.getStatusCode(RegistrationExceptionTypeCode.PACKET_UPLOADER_FAILED)); + dto.setStatusCode(RegistrationStatusCode.FAILED.toString()); + dto.setStatusComment(StatusUtil.PACKET_HASHCODE_VALIDATION_FAILED.getMessage()); + dto.setSubStatusCode(StatusUtil.PACKET_HASHCODE_VALIDATION_FAILED.getCode()); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + registrationId, PlatformErrorMessages.RPR_PKR_PACKET_HASH_NOT_EQUALS_SYNCED_HASH.getMessage()); + + return isValidHash; + } else { + isValidHash = true; + return isValidHash; + } + } + + /** + * Uploadpacket. + * + * @param dto the dto + * @param sourcePackets source packets + * @param object the object + * @param description + * @return the message DTO + * @throws IOException Signals that an I/O exception has occurred. + * @throws SftpFileOperationException + */ + private MessageDTO uploadPacket(InternalRegistrationStatusDto dto, final Map sourcePackets, + MessageDTO object, LogDescription description) throws ObjectStoreNotAccessibleException { + + object.setIsValid(false); + String registrationId = dto.getRegistrationId(); + // upload packets + try { + for (Map.Entry entry : sourcePackets.entrySet()) { + if (entry.getKey().endsWith(ZIP)) { + boolean result = objectStoreAdapter.putObject(packetManagerAccount, registrationId, + null, null, entry.getKey().replace(ZIP, ""), entry.getValue()); + if (!result) + throw new ObjectStoreNotAccessibleException("Failed to store packet : " + entry.getKey()); + } + } + + // upload metadata + for (Map.Entry entry : sourcePackets.entrySet()) { + if (entry.getKey().endsWith(JSON)) { + byte[] bytearray = IOUtils.toByteArray(entry.getValue()); + String jsonString = new String(bytearray); + LinkedHashMap currentIdMap = (LinkedHashMap) mapper.readValue(jsonString, LinkedHashMap.class); + objectStoreAdapter.addObjectMetaData(packetManagerAccount, registrationId, + null, null, entry.getKey().replace(JSON, ""), currentIdMap); + } + } + } catch (Exception e) { + object.setIsValid(false); + object.setInternalError(true); + throw new ObjectStoreNotAccessibleException(e.getMessage(), e); + } + + + dto.setStatusCode(RegistrationStatusCode.PROCESSING.toString()); + dto.setStatusComment(StatusUtil.PACKET_UPLOADED.getMessage()); + dto.setSubStatusCode(StatusUtil.PACKET_UPLOADED.getCode()); + dto.setUpdatedBy(USER); + object.setInternalError(false); + object.setIsValid(true); + object.setRid(registrationId); + + isTransactionSuccessful = true; + description.setMessage(PlatformErrorMessages.RPR_PUM_PACKET_DELETION_INFO.getMessage()); + description.setCode(PlatformErrorMessages.RPR_PUM_PACKET_DELETION_INFO.getCode()); + + regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), + LoggerFileConstant.REGISTRATIONID.toString(), registrationId, + PlatformErrorMessages.RPR_PUM_PACKET_DELETION_INFO.getMessage()); + + return object; + } + + /** + * Get max retry count. + * + * @return maxRetryCount + */ + public int getMaxRetryCount() { + return maxRetryCount; + } + + private byte[] getPakcetFromDMZ(String rid) throws ApisResourceAccessException { + List pathSegment = new ArrayList<>(); + pathSegment.add(rid + extention); + byte[] packet = null; + + try { + packet = (byte[]) restClient.getApi(ApiName.NGINXDMZURL, pathSegment, "", null, byte[].class); + } catch (ApisResourceAccessException e) { + if (e.getCause() instanceof HttpClientErrorException) { + HttpClientErrorException ex = (HttpClientErrorException) e.getCause(); + if (ex.getStatusCode().equals(HttpStatus.NOT_FOUND)) + throw new PacketNotFoundException(PlatformErrorMessages.RPR_PUM_PACKET_NOT_FOUND_EXCEPTION.getMessage(), ex); + } else + throw e; + } + return packet; + } + + + public boolean isPacketAlreadyPresentInObjectStore(String id, String process) { + + for (String name : packetNames.split(",")) { + boolean isPresent = objectStoreAdapter.exists(packetManagerAccount, id, utilities.getDefaultSource(process, ConfigEnum.READER), process, id+ "_" + name); + if (!isPresent) { + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + id, name + " : packet not present in object store."); + return false; + } + } + return true; + } + } \ No newline at end of file From 97db7f2bfe4f2d8b54e4b89de5f694b6f7671dc0 Mon Sep 17 00:00:00 2001 From: Sowmya Ujjappa Banakar Date: Thu, 8 Feb 2024 18:45:17 +0530 Subject: [PATCH 2/2] Updated version Signed-off-by: Sowmya Ujjappa Banakar --- pom.xml | 2 +- registration-processor/core-processor/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../registration-processor-abis/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- registration-processor/init/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- registration-processor/pom.xml | 18 +++++++++--------- registration-processor/post-processor/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- registration-processor/pre-processor/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 6 +++--- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- registration-processor/qc-users-manger/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../registration-processor-core/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 2 +- .../pom.xml | 4 ++-- .../registration-processor-rest-client/pom.xml | 4 ++-- 38 files changed, 80 insertions(+), 80 deletions(-) diff --git a/pom.xml b/pom.xml index 4fd2bba6d63..2cd0594f45f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.mosip registration - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT pom MOSIP Registration Parent POM diff --git a/registration-processor/core-processor/pom.xml b/registration-processor/core-processor/pom.xml index 3939ba9a170..9c10e91d287 100644 --- a/registration-processor/core-processor/pom.xml +++ b/registration-processor/core-processor/pom.xml @@ -5,9 +5,9 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT core-processor core-processor diff --git a/registration-processor/core-processor/registration-processor-abis-handler-stage/pom.xml b/registration-processor/core-processor/registration-processor-abis-handler-stage/pom.xml index 626d4d28ccb..e07662ffc8a 100644 --- a/registration-processor/core-processor/registration-processor-abis-handler-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-abis-handler-stage/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-abis-handler-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/core-processor/registration-processor-abis-middleware-stage/pom.xml b/registration-processor/core-processor/registration-processor-abis-middleware-stage/pom.xml index 810c40be63e..22419e868d0 100644 --- a/registration-processor/core-processor/registration-processor-abis-middleware-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-abis-middleware-stage/pom.xml @@ -5,10 +5,10 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-abis-middleware-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/core-processor/registration-processor-abis/pom.xml b/registration-processor/core-processor/registration-processor-abis/pom.xml index 4c24f8b13a1..453f7234ae7 100644 --- a/registration-processor/core-processor/registration-processor-abis/pom.xml +++ b/registration-processor/core-processor/registration-processor-abis/pom.xml @@ -8,10 +8,10 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-abis - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-abis UTF-8 diff --git a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/pom.xml b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/pom.xml index 142c45801e4..3d4b2652cf3 100644 --- a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-bio-dedupe-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/core-processor/registration-processor-biometric-authentication-stage/pom.xml b/registration-processor/core-processor/registration-processor-biometric-authentication-stage/pom.xml index 4ac6211d5e2..6854c3c7403 100644 --- a/registration-processor/core-processor/registration-processor-biometric-authentication-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-biometric-authentication-stage/pom.xml @@ -5,10 +5,10 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-biometric-authentication-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/core-processor/registration-processor-demo-dedupe-stage/pom.xml b/registration-processor/core-processor/registration-processor-demo-dedupe-stage/pom.xml index 288136db5df..a586d703bc1 100644 --- a/registration-processor/core-processor/registration-processor-demo-dedupe-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-demo-dedupe-stage/pom.xml @@ -5,10 +5,10 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-demo-dedupe-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/core-processor/registration-processor-manual-verification-stage/pom.xml b/registration-processor/core-processor/registration-processor-manual-verification-stage/pom.xml index 21373e594cb..e0f26374843 100644 --- a/registration-processor/core-processor/registration-processor-manual-verification-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-manual-verification-stage/pom.xml @@ -8,11 +8,11 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-manual-verification-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 diff --git a/registration-processor/core-processor/registration-processor-reprocessor-stage/pom.xml b/registration-processor/core-processor/registration-processor-reprocessor-stage/pom.xml index af51c5773ab..4a89e9eaf36 100644 --- a/registration-processor/core-processor/registration-processor-reprocessor-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-reprocessor-stage/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-reprocessor-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-reprocessor-stage UTF-8 diff --git a/registration-processor/core-processor/registration-processor-uin-generator-stage/pom.xml b/registration-processor/core-processor/registration-processor-uin-generator-stage/pom.xml index 1a3482c7c1e..874fb8c8430 100644 --- a/registration-processor/core-processor/registration-processor-uin-generator-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-uin-generator-stage/pom.xml @@ -4,10 +4,10 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-uin-generator-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/init/pom.xml b/registration-processor/init/pom.xml index f83b51c97a5..062929ab83b 100644 --- a/registration-processor/init/pom.xml +++ b/registration-processor/init/pom.xml @@ -6,7 +6,7 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT init diff --git a/registration-processor/init/registration-processor-packet-receiver-stage/pom.xml b/registration-processor/init/registration-processor-packet-receiver-stage/pom.xml index a368ef256ba..0e190c91fba 100644 --- a/registration-processor/init/registration-processor-packet-receiver-stage/pom.xml +++ b/registration-processor/init/registration-processor-packet-receiver-stage/pom.xml @@ -7,11 +7,11 @@ io.mosip.registrationprocessor init - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-packet-receiver-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-packet-receiver-stage diff --git a/registration-processor/init/registration-processor-registration-status-service/pom.xml b/registration-processor/init/registration-processor-registration-status-service/pom.xml index 78228f73d00..528015c56fa 100644 --- a/registration-processor/init/registration-processor-registration-status-service/pom.xml +++ b/registration-processor/init/registration-processor-registration-status-service/pom.xml @@ -8,10 +8,10 @@ io.mosip.registrationprocessor init - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-registration-status-service - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-registration-status-service diff --git a/registration-processor/pom.xml b/registration-processor/pom.xml index 1c95c63a9b4..95f2686f999 100644 --- a/registration-processor/pom.xml +++ b/registration-processor/pom.xml @@ -5,12 +5,12 @@ io.mosip registration - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT io.mosip.registrationprocessor registration-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT pom registration-processor @@ -107,13 +107,13 @@ 0.1.55 - 1.1.5.5-P6 - 1.1.5.5-P6 - 1.1.5.5-P6 - 1.1.5.5-P6 - 1.1.5.5-P6 - 1.1.5.5-P6 - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT + 1.1.5.5-P7-SNAPSHOT + 1.1.5.5-P7-SNAPSHOT + 1.1.5.5-P7-SNAPSHOT + 1.1.5.5-P7-SNAPSHOT + 1.1.5.5-P7-SNAPSHOT + 1.1.5.5-P7-SNAPSHOT 1.1.5.5 diff --git a/registration-processor/post-processor/pom.xml b/registration-processor/post-processor/pom.xml index adca39b3e8d..b8c7000ed55 100644 --- a/registration-processor/post-processor/pom.xml +++ b/registration-processor/post-processor/pom.xml @@ -6,9 +6,9 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT post-processor post-processor diff --git a/registration-processor/post-processor/registration-processor-message-sender-stage/pom.xml b/registration-processor/post-processor/registration-processor-message-sender-stage/pom.xml index 8fad4e384a9..9ec76fd3f42 100644 --- a/registration-processor/post-processor/registration-processor-message-sender-stage/pom.xml +++ b/registration-processor/post-processor/registration-processor-message-sender-stage/pom.xml @@ -7,11 +7,11 @@ io.mosip.registrationprocessor post-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-message-sender-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/post-processor/registration-processor-printing-stage/pom.xml b/registration-processor/post-processor/registration-processor-printing-stage/pom.xml index d6c39159c0d..2730b0ac117 100644 --- a/registration-processor/post-processor/registration-processor-printing-stage/pom.xml +++ b/registration-processor/post-processor/registration-processor-printing-stage/pom.xml @@ -6,10 +6,10 @@ io.mosip.registrationprocessor post-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-printing-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/post-processor/registration-processor-registration-transaction-service/pom.xml b/registration-processor/post-processor/registration-processor-registration-transaction-service/pom.xml index ce8f528a157..223cc0786bc 100644 --- a/registration-processor/post-processor/registration-processor-registration-transaction-service/pom.xml +++ b/registration-processor/post-processor/registration-processor-registration-transaction-service/pom.xml @@ -5,10 +5,10 @@ io.mosip.registrationprocessor post-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-registration-transaction-service - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-registration-transaction-service UTF-8 diff --git a/registration-processor/pre-processor/pom.xml b/registration-processor/pre-processor/pom.xml index 06ce106287a..734374aa1d9 100644 --- a/registration-processor/pre-processor/pom.xml +++ b/registration-processor/pre-processor/pom.xml @@ -7,9 +7,9 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT pre-processor pre-processor diff --git a/registration-processor/pre-processor/registration-processor-external-integration-service/pom.xml b/registration-processor/pre-processor/registration-processor-external-integration-service/pom.xml index 6f76a255e0a..1c1a466377e 100644 --- a/registration-processor/pre-processor/registration-processor-external-integration-service/pom.xml +++ b/registration-processor/pre-processor/registration-processor-external-integration-service/pom.xml @@ -5,10 +5,10 @@ io.mosip.registrationprocessor pre-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-external-integration-service - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-external-stage/pom.xml b/registration-processor/pre-processor/registration-processor-external-stage/pom.xml index 5f54c78ffe9..235dc5a5151 100644 --- a/registration-processor/pre-processor/registration-processor-external-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-external-stage/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor pre-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-external-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-osi-validator-stage/pom.xml b/registration-processor/pre-processor/registration-processor-osi-validator-stage/pom.xml index 2790ba3d9f2..b68ed6cf98d 100644 --- a/registration-processor/pre-processor/registration-processor-osi-validator-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-osi-validator-stage/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor pre-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-osi-validator-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-packet-classifier-stage/pom.xml b/registration-processor/pre-processor/registration-processor-packet-classifier-stage/pom.xml index 8a14894c29b..159de20c05a 100644 --- a/registration-processor/pre-processor/registration-processor-packet-classifier-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-packet-classifier-stage/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor pre-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-packet-classifier-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-packet-uploader-stage/pom.xml b/registration-processor/pre-processor/registration-processor-packet-uploader-stage/pom.xml index cc76a973427..5d056f84695 100644 --- a/registration-processor/pre-processor/registration-processor-packet-uploader-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-packet-uploader-stage/pom.xml @@ -9,9 +9,9 @@ io.mosip.registrationprocessor pre-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-packet-validator-stage/pom.xml b/registration-processor/pre-processor/registration-processor-packet-validator-stage/pom.xml index 8129dcea3d6..5b7cd92b1e6 100644 --- a/registration-processor/pre-processor/registration-processor-packet-validator-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-packet-validator-stage/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor pre-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-packet-validator-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 UTF-8 @@ -112,7 +112,7 @@ io.mosip.registrationprocessor registration-processor-packet-classifier-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT diff --git a/registration-processor/pre-processor/registration-processor-quality-checker-stage/pom.xml b/registration-processor/pre-processor/registration-processor-quality-checker-stage/pom.xml index 9769f648d49..21d2d60159d 100644 --- a/registration-processor/pre-processor/registration-processor-quality-checker-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-quality-checker-stage/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor pre-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-quality-checker-stage - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-securezone-notification-stage/pom.xml b/registration-processor/pre-processor/registration-processor-securezone-notification-stage/pom.xml index cea09be641f..f4842d189f7 100644 --- a/registration-processor/pre-processor/registration-processor-securezone-notification-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-securezone-notification-stage/pom.xml @@ -5,10 +5,10 @@ pre-processor io.mosip.registrationprocessor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT 4.0.0 - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-securezone-notification-stage diff --git a/registration-processor/qc-users-manger/pom.xml b/registration-processor/qc-users-manger/pom.xml index 1ee89b5c6a3..961d0834db8 100644 --- a/registration-processor/qc-users-manger/pom.xml +++ b/registration-processor/qc-users-manger/pom.xml @@ -8,7 +8,7 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT diff --git a/registration-processor/registration-processor-bio-dedupe-service-impl/pom.xml b/registration-processor/registration-processor-bio-dedupe-service-impl/pom.xml index bbb8bed9fec..5d8db1eb58e 100644 --- a/registration-processor/registration-processor-bio-dedupe-service-impl/pom.xml +++ b/registration-processor/registration-processor-bio-dedupe-service-impl/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-bio-dedupe-service-impl - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-bio-dedupe-service-impl diff --git a/registration-processor/registration-processor-common-camel-bridge/pom.xml b/registration-processor/registration-processor-common-camel-bridge/pom.xml index 87b8e59b634..33cdf9fced4 100644 --- a/registration-processor/registration-processor-common-camel-bridge/pom.xml +++ b/registration-processor/registration-processor-common-camel-bridge/pom.xml @@ -6,10 +6,10 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-common-camel-bridge - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT jar diff --git a/registration-processor/registration-processor-core/pom.xml b/registration-processor/registration-processor-core/pom.xml index 3067cf585a0..74847a66583 100644 --- a/registration-processor/registration-processor-core/pom.xml +++ b/registration-processor/registration-processor-core/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-core - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT org.mockito diff --git a/registration-processor/registration-processor-info-storage-service/pom.xml b/registration-processor/registration-processor-info-storage-service/pom.xml index 07960dbca97..23dd6a0df9b 100644 --- a/registration-processor/registration-processor-info-storage-service/pom.xml +++ b/registration-processor/registration-processor-info-storage-service/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-info-storage-service - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-info-storage-service UTF-8 diff --git a/registration-processor/registration-processor-message-sender-impl/pom.xml b/registration-processor/registration-processor-message-sender-impl/pom.xml index 385b7df46e6..6d6200f5933 100644 --- a/registration-processor/registration-processor-message-sender-impl/pom.xml +++ b/registration-processor/registration-processor-message-sender-impl/pom.xml @@ -8,11 +8,11 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-message-sender-impl - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 diff --git a/registration-processor/registration-processor-packet-manager/pom.xml b/registration-processor/registration-processor-packet-manager/pom.xml index d0281400590..d794d1d3a4c 100644 --- a/registration-processor/registration-processor-packet-manager/pom.xml +++ b/registration-processor/registration-processor-packet-manager/pom.xml @@ -7,12 +7,12 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-packet-manager registration-processor-packet-manager - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 diff --git a/registration-processor/registration-processor-quality-checker/pom.xml b/registration-processor/registration-processor-quality-checker/pom.xml index 81dd23cbcef..344eb7e9e2e 100644 --- a/registration-processor/registration-processor-quality-checker/pom.xml +++ b/registration-processor/registration-processor-quality-checker/pom.xml @@ -8,7 +8,7 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT diff --git a/registration-processor/registration-processor-registration-status-service-impl/pom.xml b/registration-processor/registration-processor-registration-status-service-impl/pom.xml index b613de1584e..c10fe1e6b2c 100644 --- a/registration-processor/registration-processor-registration-status-service-impl/pom.xml +++ b/registration-processor/registration-processor-registration-status-service-impl/pom.xml @@ -8,10 +8,10 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-registration-status-service-impl - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8 diff --git a/registration-processor/registration-processor-rest-client/pom.xml b/registration-processor/registration-processor-rest-client/pom.xml index 35865112241..eeada198560 100644 --- a/registration-processor/registration-processor-rest-client/pom.xml +++ b/registration-processor/registration-processor-rest-client/pom.xml @@ -9,12 +9,12 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT registration-processor-rest-client registration-processor-rest-client - 1.1.5.5-P6 + 1.1.5.5-P7-SNAPSHOT UTF-8