Skip to content

Commit

Permalink
feat: Recupero riferimenti
Browse files Browse the repository at this point in the history
  • Loading branch information
vincenzo-ingenito committed Oct 9, 2024
1 parent 4ee4bf3 commit 8a63c18
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public class IniClient implements IIniClient {

private SSLContext sslContext;


private XDSDeletetWS deletePort;


private DocumentRegistryPortType documentRegistryPort;

private DocumentRegistryPortType recuperoRiferimentoPort;


@PostConstruct
Expand All @@ -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())) {
Expand All @@ -117,6 +125,11 @@ void initialize() {
List<Handler> handlerChainDelete = ((BindingProvider) deletePort).getBinding().getHandlerChain();
handlerChainDelete.add(new SOAPLoggingHandler());
((BindingProvider) deletePort).getBinding().setHandlerChain(handlerChainDelete);


List<Handler> handlerChainRecuperoRiferimento = ((BindingProvider) recuperoRiferimentoPort).getBinding().getHandlerChain();
handlerChainRecuperoRiferimento.add(new SOAPLoggingHandler());
((BindingProvider) recuperoRiferimentoPort).getBinding().setHandlerChain(handlerChainRecuperoRiferimento);
}

} catch(Exception ex) {
Expand Down Expand Up @@ -203,11 +216,21 @@ public AdhocQueryResponse getReferenceMetadata(String uuid, String tipoRicerca,
JWTTokenDTO reconfiguredToken = RequestUtility.configureReadTokenPerAction(jwtToken, actionEnumType);
List<Header> 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())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8a63c18

Please sign in to comment.