From 8a63c184022cd6ef8f76f94ee0d69b42dc781f67 Mon Sep 17 00:00:00 2001 From: Vincenzo Ingenito Date: Wed, 9 Oct 2024 11:43:20 +0200 Subject: [PATCH] feat: Recupero riferimenti --- .../ms/iniclient/client/impl/IniClient.java | 33 ++++++++++++++++--- .../fse2/ms/iniclient/config/Constants.java | 1 + .../fse2/ms/iniclient/config/IniCFG.java | 3 ++ .../ms/iniclient/enums/ActionEnumType.java | 2 +- .../service/impl/IniInvocationSRV.java | 12 +++++-- src/main/resources/application.properties | 1 + 6 files changed, 44 insertions(+), 8 deletions(-) diff --git a/src/main/java/it/finanze/sanita/fse2/ms/iniclient/client/impl/IniClient.java b/src/main/java/it/finanze/sanita/fse2/ms/iniclient/client/impl/IniClient.java index 715f615e..277485cb 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/iniclient/client/impl/IniClient.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/iniclient/client/impl/IniClient.java @@ -74,11 +74,11 @@ public class IniClient implements IIniClient { private SSLContext sslContext; - private XDSDeletetWS deletePort; - private DocumentRegistryPortType documentRegistryPort; + + private DocumentRegistryPortType recuperoRiferimentoPort; @PostConstruct @@ -103,10 +103,18 @@ void initialize() { BindingProvider bindingProvider = (BindingProvider) deletePort; bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, iniCFG.getUrlWsdlDeletetService()); } + + DocumentRegistryService recuperoRiferimentoService = new DocumentRegistryService(); + recuperoRiferimentoPort = recuperoRiferimentoService.getDocumentRegistryPortSoap12(); + if (!StringUtility.isNullOrEmpty(iniCFG.getUrlWsdlRecuperoRiferimentoService())) { + BindingProvider bindingProvider = (BindingProvider) recuperoRiferimentoPort; + bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, iniCFG.getUrlWsdlRecuperoRiferimentoService()); + } if(Boolean.TRUE.equals(iniCFG.isEnableSSL())) { ((BindingProvider) documentRegistryPort).getRequestContext().put(JAXWSProperties.SSL_SOCKET_FACTORY, sslContext.getSocketFactory()); ((BindingProvider) deletePort).getRequestContext().put(JAXWSProperties.SSL_SOCKET_FACTORY, sslContext.getSocketFactory()); + ((BindingProvider) recuperoRiferimentoPort).getRequestContext().put(JAXWSProperties.SSL_SOCKET_FACTORY, sslContext.getSocketFactory()); } if (Boolean.TRUE.equals(iniCFG.isEnableLog())) { @@ -117,6 +125,11 @@ void initialize() { List handlerChainDelete = ((BindingProvider) deletePort).getBinding().getHandlerChain(); handlerChainDelete.add(new SOAPLoggingHandler()); ((BindingProvider) deletePort).getBinding().setHandlerChain(handlerChainDelete); + + + List handlerChainRecuperoRiferimento = ((BindingProvider) recuperoRiferimentoPort).getBinding().getHandlerChain(); + handlerChainRecuperoRiferimento.add(new SOAPLoggingHandler()); + ((BindingProvider) recuperoRiferimentoPort).getBinding().setHandlerChain(handlerChainRecuperoRiferimento); } } catch(Exception ex) { @@ -203,11 +216,21 @@ public AdhocQueryResponse getReferenceMetadata(String uuid, String tipoRicerca, JWTTokenDTO reconfiguredToken = RequestUtility.configureReadTokenPerAction(jwtToken, actionEnumType); List
headers = samlHeaderBuilderUtility.buildHeader(reconfiguredToken, actionEnumType); - WSBindingProvider bp = (WSBindingProvider)documentRegistryPort; - bp.setOutboundHeaders(headers); + AdhocQueryRequest adhocQueryRequest = ReadBodyBuilderUtility.buildAdHocQueryRequest(uuid,tipoRicerca); - AdhocQueryResponse response = documentRegistryPort.documentRegistryRegistryStoredQuery(adhocQueryRequest); + + AdhocQueryResponse response = null; + if(ActionEnumType.READ_METADATA.equals(actionEnumType)) { + WSBindingProvider bp = (WSBindingProvider)documentRegistryPort; + bp.setOutboundHeaders(headers); + response = documentRegistryPort.documentRegistryRegistryStoredQuery(adhocQueryRequest); + } else { + WSBindingProvider bp = (WSBindingProvider)recuperoRiferimentoPort; + bp.setOutboundHeaders(headers); + response = recuperoRiferimentoPort.documentRegistryRegistryStoredQuery(adhocQueryRequest); + } + StringBuilder sb = new StringBuilder(); if (response.getRegistryErrorList() != null && !CollectionUtils.isEmpty(response.getRegistryErrorList().getRegistryError())) { diff --git a/src/main/java/it/finanze/sanita/fse2/ms/iniclient/config/Constants.java b/src/main/java/it/finanze/sanita/fse2/ms/iniclient/config/Constants.java index efb2a56c..1799e7f8 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/iniclient/config/Constants.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/iniclient/config/Constants.java @@ -79,6 +79,7 @@ public static final class IniClientConstants { public static final String URN_UUID = "urn:uuid:"; public static final String SOURCE_ID_PREFIX = "2.16.840.1.113883.2.9.2."; public static final String TREATMENT_PURPOSE_OF_USE = "TREATMENT"; + public static final String UPDATE_PURPOSE_OF_USE = "UPDATE"; public static final String REGISTER_DOCUMENT_SETB_ACTION = "urn:ihe:iti:2007:RegisterDocumentSet-b"; public static final String UPDATE_SETB_ACTION = "urn:ihe:iti:2010:UpdateDocumentSet"; public static final String REGISTRY_STORED_QUERY_ACTION = "urn:ihe:iti:2007:RegistryStoredQuery"; diff --git a/src/main/java/it/finanze/sanita/fse2/ms/iniclient/config/IniCFG.java b/src/main/java/it/finanze/sanita/fse2/ms/iniclient/config/IniCFG.java index b97aa77f..fa4108fd 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/iniclient/config/IniCFG.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/iniclient/config/IniCFG.java @@ -24,6 +24,9 @@ public class IniCFG { @Value("${ini.client.delete-service}") private String urlWsdlDeletetService; + + @Value("${ini.client.recupero-riferimento-service}") + private String urlWsdlRecuperoRiferimentoService; @Value("${ini.client.enable-log}") private boolean enableLog; diff --git a/src/main/java/it/finanze/sanita/fse2/ms/iniclient/enums/ActionEnumType.java b/src/main/java/it/finanze/sanita/fse2/ms/iniclient/enums/ActionEnumType.java index 4a38ca3d..0f460269 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/iniclient/enums/ActionEnumType.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/iniclient/enums/ActionEnumType.java @@ -16,7 +16,7 @@ public enum ActionEnumType { CREATE(Constants.IniClientConstants.CREATE_ACTION, Constants.IniClientConstants.TREATMENT_PURPOSE_OF_USE,Constants.IniClientConstants.REGISTER_DOCUMENT_SETB_ACTION), - READ_REFERENCE(Constants.IniClientConstants.READ_ACTION, Constants.IniClientConstants.TREATMENT_PURPOSE_OF_USE,Constants.IniClientConstants.REGISTRY_STORED_QUERY_ACTION), + READ_REFERENCE(Constants.IniClientConstants.READ_ACTION, Constants.IniClientConstants.UPDATE_PURPOSE_OF_USE,Constants.IniClientConstants.REGISTRY_STORED_QUERY_ACTION), READ_METADATA(Constants.IniClientConstants.READ_ACTION, Constants.IniClientConstants.TREATMENT_PURPOSE_OF_USE,Constants.IniClientConstants.REGISTRY_STORED_QUERY_ACTION), READ_REF_AND_METADATA(Constants.IniClientConstants.READ_ACTION, Constants.IniClientConstants.TREATMENT_PURPOSE_OF_USE,Constants.IniClientConstants.REGISTRY_STORED_QUERY_ACTION), UPDATE(Constants.IniClientConstants.UPDATE_ACTION, Constants.IniClientConstants.TREATMENT_PURPOSE_OF_USE,Constants.IniClientConstants.REGISTER_DOCUMENT_SETB_ACTION), diff --git a/src/main/java/it/finanze/sanita/fse2/ms/iniclient/service/impl/IniInvocationSRV.java b/src/main/java/it/finanze/sanita/fse2/ms/iniclient/service/impl/IniInvocationSRV.java index 388d991c..02523d07 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/iniclient/service/impl/IniInvocationSRV.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/iniclient/service/impl/IniInvocationSRV.java @@ -11,7 +11,6 @@ */ package it.finanze.sanita.fse2.ms.iniclient.service.impl; -import static it.finanze.sanita.fse2.ms.iniclient.config.Constants.IniClientConstants.*; import static it.finanze.sanita.fse2.ms.iniclient.config.Constants.IniClientConstants.SEVERITY_CODE_CONTEXT; import static it.finanze.sanita.fse2.ms.iniclient.config.Constants.IniClientConstants.SEVERITY_CODE_HEAD_ERROR_MESSAGE; import static it.finanze.sanita.fse2.ms.iniclient.config.Constants.IniClientConstants.SEVERITY_HEAD_ERROR_MESSAGE; @@ -29,7 +28,16 @@ import it.finanze.sanita.fse2.ms.iniclient.client.IIniClient; import it.finanze.sanita.fse2.ms.iniclient.config.Constants; -import it.finanze.sanita.fse2.ms.iniclient.dto.*; +import it.finanze.sanita.fse2.ms.iniclient.dto.DeleteRequestDTO; +import it.finanze.sanita.fse2.ms.iniclient.dto.DocumentEntryDTO; +import it.finanze.sanita.fse2.ms.iniclient.dto.DocumentTreeDTO; +import it.finanze.sanita.fse2.ms.iniclient.dto.GetMergedMetadatiDTO; +import it.finanze.sanita.fse2.ms.iniclient.dto.IniResponseDTO; +import it.finanze.sanita.fse2.ms.iniclient.dto.JWTPayloadDTO; +import it.finanze.sanita.fse2.ms.iniclient.dto.JWTTokenDTO; +import it.finanze.sanita.fse2.ms.iniclient.dto.MergedMetadatiRequestDTO; +import it.finanze.sanita.fse2.ms.iniclient.dto.SubmissionSetEntryDTO; +import it.finanze.sanita.fse2.ms.iniclient.dto.UpdateRequestDTO; import it.finanze.sanita.fse2.ms.iniclient.dto.response.GetReferenceResponseDTO; import it.finanze.sanita.fse2.ms.iniclient.enums.ActionEnumType; import it.finanze.sanita.fse2.ms.iniclient.enums.ProcessorOperationEnum; diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8ffc978d..7d016319 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -70,6 +70,7 @@ data.mongodb.schema-name=${MONGO_DBNAME} ####################################### ini.client.document-registry-service=https://fseservicetest.sanita.finanze.it/FSEInteroperabilitaWeb/DocumentRegistry_Service ini.client.delete-service=https://fseservicetest.sanita.finanze.it/FSEDeleteWeb/XDSDeletetWSService +ini.client.recupero-riferimento-service=https://fseservicetest.sanita.finanze.it/FSEFindDocumentReferencesWeb/DocumentRegistry_Service ini.client.enable-log=true ini.client.enable-ssl=false ini.client.mock-enable=false