diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/client/impl/StatusCheckClient.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/client/impl/StatusCheckClient.java index cbc0cac..c8f10db 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/client/impl/StatusCheckClient.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/client/impl/StatusCheckClient.java @@ -21,6 +21,8 @@ import it.finanze.sanita.fse2.ms.gtw.dispatcher.config.MicroservicesURLCFG; import it.finanze.sanita.fse2.ms.gtw.dispatcher.dto.response.ErrorResponseDTO; import it.finanze.sanita.fse2.ms.gtw.dispatcher.dto.response.TransactionInspectResDTO; +import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.ErrorInstanceEnum; +import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.RestExecutionResultEnum; import it.finanze.sanita.fse2.ms.gtw.dispatcher.exceptions.BusinessException; import it.finanze.sanita.fse2.ms.gtw.dispatcher.exceptions.NoRecordFoundException; import lombok.extern.slf4j.Slf4j; @@ -89,7 +91,11 @@ private void errorHandler(final HttpStatusCodeException e1) { // 404 Not found. if (HttpStatus.NOT_FOUND.equals(e1.getStatusCode())) { - ErrorResponseDTO error = ErrorResponseDTO.builder().detail("No Record Found").build(); + ErrorResponseDTO error = ErrorResponseDTO.builder(). + type(RestExecutionResultEnum.RECORD_NOT_FOUND.getType()). + title(RestExecutionResultEnum.RECORD_NOT_FOUND.getTitle()). + instance(ErrorInstanceEnum.RECORD_NOT_FOUND.getInstance()). + detail("No Record Found").build(); throw new NoRecordFoundException(error); } diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/controller/handler/ControllerExceptionHandler.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/controller/handler/ControllerExceptionHandler.java index 8e3dd63..0ffd529 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/controller/handler/ControllerExceptionHandler.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/controller/handler/ControllerExceptionHandler.java @@ -199,15 +199,15 @@ protected ResponseEntity handleServerResponseException(ServerR protected ResponseEntity handleRecordNotFoundException(NoRecordFoundException ex, final WebRequest request) { log.error("" , ex); Integer status = 404; - + LogTraceInfoDTO traceInfoDto = getLogTraceInfo(); String detail = ExceptionUtils.getMessage(ex); - if(ex.getError()!=null) { - detail = ex.getError().getDetail(); - } - ErrorResponseDTO out = new ErrorResponseDTO(getLogTraceInfo(), RestExecutionResultEnum.RECORD_NOT_FOUND.getType(), RestExecutionResultEnum.RECORD_NOT_FOUND.getTitle(), detail , status, ErrorInstanceEnum.RECORD_NOT_FOUND.getInstance()); + ErrorResponseDTO out = new ErrorResponseDTO(traceInfoDto, RestExecutionResultEnum.RECORD_NOT_FOUND.getType(), RestExecutionResultEnum.RECORD_NOT_FOUND.getTitle(), detail , status, ErrorInstanceEnum.RECORD_NOT_FOUND.getInstance()); if(ex.getError()!=null) { out = ex.getError(); + detail = ex.getError().getDetail(); } + out.setSpanID(traceInfoDto.getSpanID()); + out.setTraceID(traceInfoDto.getTraceID()); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_PROBLEM_JSON); diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/service/impl/AccreditamentoSimulationSRV.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/service/impl/AccreditamentoSimulationSRV.java index 3bfe7c5..dfe0508 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/service/impl/AccreditamentoSimulationSRV.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/service/impl/AccreditamentoSimulationSRV.java @@ -58,7 +58,7 @@ public class AccreditamentoSimulationSRV implements IAccreditamentoSimulationSRV public AccreditamentoSimulationDTO runSimulation(final String idDocumento, final byte[] pdf, final EventTypeEnum eventType) { AccreditamentoSimulationDTO output = null; - if(EventTypeEnum.REPLACE.equals(eventType)) { + if(EventTypeEnum.REPLACE.equals(eventType) && !idDocumento.equals("TRIAL_ID_SKIP_ACCREDITATIONCHECK")) { statusCheckClient.callSearchEventByIdDocumento(idDocumento); } diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/service/impl/FhirSRV.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/service/impl/FhirSRV.java index 3d79845..25486ed 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/service/impl/FhirSRV.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/service/impl/FhirSRV.java @@ -139,7 +139,12 @@ private SubmissionSetEntryDTO createSubmissionSetEntry(final org.jsoup.nodes.Doc sse.setAuthorInstitution(authorSlotDTO.getAuthorInstitution()); sse.setAuthorRole(authorSlotDTO.getAuthorRole()); sse.setPatientId(buildPatient(docCDA)); - sse.setSourceId(SOURCE_ID_PREFIX+organizationId); + + String org = organizationId; + if(organizationId.startsWith("0")) { + org = organizationId.substring(1, organizationId.length()); + } + sse.setSourceId(SOURCE_ID_PREFIX+org); sse.setUniqueID(identificativoSottomissione); sse.setSubmissionTime(new SimpleDateFormat(Constants.Misc.INI_DATE_PATTERN).format(new Date())); @@ -275,4 +280,5 @@ private static AuthorSlotDTO buildAuthorSlotDTO(final String authorRole,final or return author; } + }