Skip to content

Commit

Permalink
feat: Aggiunta strategia eds e condizionate loggate strutturate
Browse files Browse the repository at this point in the history
  • Loading branch information
vincenzo-ingenito committed Sep 13, 2023
1 parent 1eb7fdb commit 651d447
Show file tree
Hide file tree
Showing 7 changed files with 245 additions and 224 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import it.finanze.sanita.fse2.ms.gtw.dispatcher.client.response.WhoIsResponseDTO;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.config.Constants;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.config.MicroservicesURLCFG;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.EdsStrategyEnum;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.exceptions.BusinessException;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.utility.ProfileUtility;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -83,8 +84,7 @@ public String getGatewayName() {

@Override
public String getEDSStrategy() {
String output = ""; //TODO - Set with default strategy

String output = EdsStrategyEnum.NO_EDS.name();
if(isReachable()) {
String endpoint = msUrlCFG.getConfigHost() + "/v1/config-items/props?type=GENERIC&props=eds-strategy";
output = restTemplate.getForObject(endpoint,String.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ private ValidationCreationInputDTO publicationAndReplaceValidation(final Multipa
validation.setKafkaKey(key);
} catch (final ValidationException | NoRecordFoundException ve) {
cdaSRV.consumeHash(validationInfo.getHash());
// validation.setValidationError(ve);
throw ve;
}

Expand Down Expand Up @@ -502,11 +501,7 @@ public ResponseWifDTO delete(String idDoc, HttpServletRequest request) {
kafkaSRV.sendDeleteStatus(info.getTraceID(), workflowInstanceId, idDoc, "Riferimenti trovati: " +iniReference.getUuid(), SUCCESS, jwtPayloadToken, RIFERIMENTI_INI);
}

EdsResponseDTO edsResponse = new EdsResponseDTO(
true,
"EDS Mock",
"EDS Mock"
);
EdsResponseDTO edsResponse = new EdsResponseDTO(true,"EDS Mock","EDS Mock");

if(edsStrategy.isNoFhirEds()) {
// ==============================
Expand Down Expand Up @@ -554,8 +549,7 @@ public ResponseWifDTO delete(String idDoc, HttpServletRequest request) {
kafkaSRV.sendDeleteStatus(info.getTraceID(), workflowInstanceId, idDoc, "Delete effettuata su ini", SUCCESS, jwtPayloadToken, INI_DELETE);
}

logger.info(Constants.App.LOG_TYPE_CONTROL,workflowInstanceId,String.format("Deletion of CDA completed for document with identifier %s", idDoc), OperationLogEnum.DELETE_CDA2, ResultLogEnum.OK, startOperation, MISSING_DOC_TYPE_PLACEHOLDER,
jwtPayloadToken,null);
logger.info(Constants.App.LOG_TYPE_CONTROL,workflowInstanceId,String.format("Deletion of CDA completed for document with identifier %s", idDoc), OperationLogEnum.DELETE_CDA2, ResultLogEnum.OK, startOperation, MISSING_DOC_TYPE_PLACEHOLDER, jwtPayloadToken,null);
} catch(MockEnabledException me) {
throw me;
} catch(IniException inEx) {
Expand All @@ -574,14 +568,7 @@ public ResponseWifDTO delete(String idDoc, HttpServletRequest request) {
throw e;
}

log.info("[EXIT] {}() with arguments {}={}, {}={}, {}={}",
"delete",
"traceId", info.getTraceID(),
"wif", workflowInstanceId,
"idDoc", idDoc
);


log.info("[EXIT] {}() with arguments {}={}, {}={}, {}={}", "delete", "traceId", info.getTraceID(), "wif", workflowInstanceId, "idDoc", idDoc);
return new ResponseWifDTO(workflowInstanceId, info, warning);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,37 @@
*/
package it.finanze.sanita.fse2.ms.gtw.dispatcher.controller.impl;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import it.finanze.sanita.fse2.ms.gtw.dispatcher.config.Constants;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.controller.IValidationCTL;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.dto.JWTPayloadDTO;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.dto.request.ValidationCDAReqDTO;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.dto.response.LogTraceInfoDTO;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.dto.response.ValidationResDTO;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.*;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.ActivityEnum;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.EventStatusEnum;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.EventTypeEnum;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.OperationLogEnum;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.ResultLogEnum;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.exceptions.ValidationException;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.logging.LoggerHelper;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.service.IErrorHandlerSRV;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.service.IKafkaSRV;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.utility.CdaUtility;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.utility.PDFUtility;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.utility.SignerUtility;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.utility.StringUtility;
import lombok.extern.slf4j.Slf4j;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;

/**
* Validation controller.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

public enum EdsStrategyEnum {
NO_EDS,
NO_FHIR_EDS
NO_FHIR_EDS,
NO_EDS_WITH_LOG
}
Loading

0 comments on commit 651d447

Please sign in to comment.