Class ConvenienceCommunication

java.lang.Object
org.projecthusky.communication.CamelService
org.projecthusky.communication.ConvenienceCommunication
All Implemented Interfaces:
org.apache.camel.CamelContextAware
Direct Known Subclasses:
ConvenienceCommunicationAt, ConvenienceCommunicationCh

@Component public class ConvenienceCommunication extends CamelService
The ConvenienceCommunication class provides a convenience API for transactions to different destinations such as registries and repositories over media.

It implements the following IHE actors:
  • IHE ITI Document Consumer
  • IHE ITI Document Source
  • IHE ITI Portable Media Creator
  • IHE ITI Portable Media Importer

It implements the following IHE transactions:
  • [ITI-18] Registry Stored Query
  • [ITI-32] Distribute Document Set on Media
  • [ITI-41] Provide and Register Document Set – b
  • [ITI-43] Retrieve Document Set
  • Constructor Details

    • ConvenienceCommunication

      public ConvenienceCommunication()
      Instantiates a new convenience communication without affinity domain set-up. ATNA audit is disabled (unsecure)
    • ConvenienceCommunication

      public ConvenienceCommunication(AffinityDomain affinityDomain)
      Instantiates a new convenience communication with the given affinity domain set-up. ATNA audit is disabled (unsecure)
      Parameters:
      affinityDomain - the affinity domain configuration
    • ConvenienceCommunication

      public ConvenienceCommunication(AffinityDomain affinityDomain, AtnaConfig.AtnaConfigMode atnaConfigMode, DocumentMetadata.DocumentMetadataExtractionMode documentMetadataExtractionMode, SubmissionSetMetadata.SubmissionSetMetadataExtractionMode submissionSetMetadataExtractionMode)
      Instantiates a new convenience communication with the given affinity domain set-up.
      Parameters:
      affinityDomain - the affinity domain configuration
      atnaConfigMode - the ATNA config mode (secure or unsecure)
      documentMetadataExtractionMode - determines, if and how document metadata should be extracted automatically. Extracted metadata attributes will not overwrite attributes that have been set, manually.
      submissionSetMetadataExtractionMode - determines, if and how submission set metadata should be extracted, automatically. Extracted metadata attributes will not overwrite attributes that have been set, manually.
  • Method Details

    • addDocument

      public DocumentMetadata addDocument(DocumentDescriptor desc, InputStream inputStream)
      Adds a document to the XDS Submission set.
      Parameters:
      desc - the document descriptor (which kind of document do you want to transfer? e.g. PDF, CDA,...)
      inputStream - The input stream to the document
      Returns:
      the document metadata (which have to be completed)
    • addDocument

      public DocumentMetadata addDocument(DocumentDescriptor desc, InputStream inputStream, InputStream inputStream4Metadata)
      Adds a document to the XDS Submission set.
      Parameters:
      desc - the document descriptor (which kind of document do you want to transfer? e.g. PDF, CDA,...)
      inputStream - The input stream to the document
      inputStream4Metadata - the input stream that is only used to get the metadata from (it's texts will be ascii conform for registry purposes)
      Returns:
      the document metadata (which have to be completed)
    • convertNonAsciiText2Unicode

      protected InputStream convertNonAsciiText2Unicode(InputStream inputStream)
      Escapes all non java character in the inputsream that is expected as XML.
      Parameters:
      inputStream - the input stream to be escaped
      Returns:
      the input stream
    • convertNonAsciiText2Unicode

      protected void convertNonAsciiText2Unicode(Node node)
      Escapes all non java character in the node text.
      Parameters:
      node - the node to be escaped
    • addDocument

      public DocumentMetadata addDocument(DocumentDescriptor desc, String filePath) throws IOException
      Adds a document to the XDS Submission set.
      Parameters:
      desc - the document descriptor (which kind of document do you want to transfer? e.g. PDF, CDA,...)
      filePath - the file path
      Returns:
      the document metadata (which have to be completed)
      Throws:
      IOException
    • addDocument

      public DocumentMetadata addDocument(DocumentDescriptor desc, String filePath, String filePathMetadata) throws IOException
      Adds a document to the XDS Submission set.
      Parameters:
      desc - the document descriptor (which kind of document do you want to transfer? e.g. PDF, CDA,...)
      filePath - the file path
      filePathMetadata - the file path metadata
      Returns:
      the document metadata (which have to be completed)
      Throws:
      IOException
    • addDocumentToFolder

      public void addDocumentToFolder(String documentEntryUUID, String folderEntryUUID)
      Add a document to a folder by theirs ids
      Parameters:
      documentEntryUUID - the entry uuid of the document
      folderEntryUUID - the entry uuid of the folder
    • addFolder

      public FolderMetadata addFolder(Code submissionSetContentType)
      Adds a xds folder.
      Parameters:
      submissionSetContentType - the content type code for submission set
      Returns:
      the metadata of the new folder
    • addXdsDocument

      protected DocumentMetadata addXdsDocument(org.openehealth.ipf.commons.ihe.xds.core.metadata.Document doc, DocumentDescriptor desc)
      Adds an XDSDocument to the Transaction data
      Parameters:
      doc - the document
      desc - the Document descriptor
      Returns:
      the DocumentMetadata
    • addXdsDocument

      protected DocumentMetadata addXdsDocument(org.openehealth.ipf.commons.ihe.xds.core.metadata.Document doc, DocumentDescriptor desc, org.openehealth.ipf.commons.ihe.xds.core.metadata.Document metadataDoc)
      Adds an XDSDocument to the Transaction data.
      Parameters:
      doc - the document
      desc - the Document descriptor
      metadataDoc - the metadata doc
      Returns:
      the doc to get the metadata from
    • clearDocuments

      public void clearDocuments()
      Resets the transaction data (SubmissionSet and DocumentMetadata)
    • createXdmContents

      public XdmContents createXdmContents(OutputStream outputStream)
      creates an XDM volume with default values. You have to add a document to this class first.
      Parameters:
      outputStream - The outputStream object where the contents will be written to.
      Returns:
      the XdmContents object
    • createXdmContents

      public XdmContents createXdmContents(OutputStream outputStream, XdmContents xdmContents)
      creates an XDM volume with a given XdmContents object. This method will be used, if you want to create your own INDEX.HTM and README.TXT for your XDM volume. You have to add a document to this class first.
      Parameters:
      outputStream - The outputStream object where the contents will be written to.
      xdmContents - The xdmContents object containing your own INDEX.HTM and README.TXT
      Returns:
      the XdmContents object
    • createXdmContents

      public XdmContents createXdmContents(String filePath)
      creates an XDM volume with default values. You have to add a document to this class first.
      Parameters:
      filePath - The filePath where the contents will be written to.
      Returns:
      the XdmContents object
    • createXdmContents

      public XdmContents createXdmContents(String filePath, XdmContents xdmContents)
      creates an XDM volume with default values. You have to add a document to this class first.
      Parameters:
      filePath - The filePath where the contents will be written to.
      xdmContents - The xdmContents object containing your own INDEX.HTM and README.TXT
      Returns:
      the XdmContents object
    • createXdmContents

      public XdmContents createXdmContents(SubmissionSetMetadata submissionSetMetadata, OutputStream outputStream)
      creates an XDM volume with the given submission set metadata. You have to add a document to this class first.
      Parameters:
      submissionSetMetadata - The metadata of the submission set
      outputStream - The outputStream object where the contents will be written to.
      Returns:
      the XdmContents object
    • generateDefaultSubmissionSetAttributes

      public org.openehealth.ipf.commons.ihe.xds.core.metadata.SubmissionSet generateDefaultSubmissionSetAttributes()
      Generate missing Submission Set attributes.
      Returns:
      the submission set
    • setGeneralSubSetDetails

      protected void setGeneralSubSetDetails(org.openehealth.ipf.commons.ihe.xds.core.metadata.SubmissionSet subSet, org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable patientId)
    • getSourceId

      protected String getSourceId(org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable patientId)
    • getAffinityDomain

      public AffinityDomain getAffinityDomain()
      Returns the current affinity domain
      Returns:
      the affinity domain
    • setAffinityDomain

      public void setAffinityDomain(AffinityDomain affinityDomain)
      Sets the affinity domain set-up
      Parameters:
      affinityDomain - the affinity domain set-up
    • getAutomaticExtractionEnabled

      public DocumentMetadata.DocumentMetadataExtractionMode getAutomaticExtractionEnabled()
      Gets the status of the automatic metadata extraction
      Returns:
      true, if metadata will be extracted as far as possible) automatically, false otherwise
    • setAutomaticExtractionEnabled

      public void setAutomaticExtractionEnabled(DocumentMetadata.DocumentMetadataExtractionMode automaticExtractionEnabled)
      Sets the status of the automatic metadata extraction
      Parameters:
      automaticExtractionEnabled - true, if metadata will be extracted as far as possible) automatically, false otherwise
    • setAutomaticExtractionEnabled

      public void setAutomaticExtractionEnabled(SubmissionSetMetadata.SubmissionSetMetadataExtractionMode automaticExtractionEnabled)
      Sets the status of the automatic metadata extraction
      Parameters:
      automaticExtractionEnabled - true, if metadata will be extracted as far as possible) automatically, false otherwise
    • getTxnData

      public org.openehealth.ipf.commons.ihe.xds.core.requests.ProvideAndRegisterDocumentSet getTxnData()
      Gets the IPF transaction data (SubmissionSet and DocumentMetadata)
      Returns:
      the transaction data object
    • getXdmContents

      public XdmContents getXdmContents(String filePath)
      Returns the contents of an existing XDM volume.
      Parameters:
      filePath - the XDM volume as ZipFile
      Returns:
      the XDMContents
    • getXdmContents

      public XdmContents getXdmContents(ZipFile zipFile)
      Returns the contents of an existing XDM volume.
      Parameters:
      zipFile - the XDM volume as ZipFile
      Returns:
      the XDMContents
    • queryDocumentReferencesOnly

      public org.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponse queryDocumentReferencesOnly(AbstractStoredQuery queryParameter, SecurityHeaderElement securityHeader, String messageId) throws Exception
      Queries the document registry of the affinity domain for documents, using a find documents query. This is useful if the number of results is limited in the registry and your query would exceed this limit. In this case, precise your query or do a query for references first, choose the possible matches (e.g. the last 10 results) and then query for metadata.
      Parameters:
      queryParameter - a findDocumentsQuery object filled with your query parameters
      securityHeader - a security header element for example an assertion
      Returns:
      the IPF QueryResponse containing references instead of the complete document metadata
      Throws:
      Exception
    • queryDocuments

      public org.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponse queryDocuments(AbstractStoredQuery queryParameter, SecurityHeaderElement securityHeader, String messageId) throws Exception
      Queries the document registry of the affinity domain for documents, using a find documents query.
      Parameters:
      queryParameter - a findDocumentsQuery object filled with your query parameters
      securityHeader - a security header element for example an assertion
      Returns:
      the IPF QueryResponse containing full document metadata
      Throws:
      Exception
    • queryDocumentQuery

      protected org.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponse queryDocumentQuery(AbstractStoredQuery query, SecurityHeaderElement securityHeader, org.openehealth.ipf.commons.ihe.xds.core.requests.query.QueryReturnType returnType, String messageId) throws Exception
      Queries the registry of the affinity domain for all documents satisfying the given query parameters.
      Parameters:
      query - one of the given queries (@see org.projecthusky.communication.storedquery and org.projecthusky.communication.storedquery.ch)
      securityHeader - a security header element for example an assertion
      returnType - return type for XDS query
      Returns:
      the IPF QueryResponse containing full document metadata
      Throws:
      Exception
    • queryFolders

      public org.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponse queryFolders(FindFoldersStoredQuery queryParameter, SecurityHeaderElement security, String messageId) throws Exception
      Queries the document registry of the affinity domain for documents, using a find documents query.
      Parameters:
      queryParameter - a findFoldersQuery object filled with your query parameters
      security - a security header element for example an assertion
      Returns:
      the IPF QueryResponse containing full folder metadata
      Throws:
      Exception
    • retrieveDocument

      public org.openehealth.ipf.commons.ihe.xds.core.responses.RetrievedDocumentSet retrieveDocument(DocumentRequest docReq, SecurityHeaderElement security, String messageId) throws Exception
      Retrieves a document from a Repository
      Parameters:
      docReq - the document request
      security - a security header element for example an assertion
      Returns:
      the IPF RetrievedDocumentSet
      Throws:
      Exception
    • retrieveDocuments

      public org.openehealth.ipf.commons.ihe.xds.core.responses.RetrievedDocumentSet retrieveDocuments(DocumentRequest[] docReq, SecurityHeaderElement security, String messageId) throws Exception
      Retrieves multiple documents from one or more Repositories
      Parameters:
      docReq - an array of document requests
      security - a security header element for example an assertion
      Returns:
      the IPF RetrievedDocumentSet
      Throws:
      Exception
    • setAtnaConfig

      public void setAtnaConfig(AtnaConfig.AtnaConfigMode atnaConfigMode)
      Sets the atna config
      Parameters:
      atnaConfigMode - secure or unsecure config
    • submit

      public org.openehealth.ipf.commons.ihe.xds.core.responses.Response submit(SecurityHeaderElement security, String messageId) throws Exception
      Submission of the previously prepared document(s) to the repository
      IHE [ITI-41] Provide and Register Document Set – b in the role of the IHE ITI Document Source actor
      Parameters:
      security - a security header element for example an assertion
      Returns:
      the IPF Response
      Throws:
      Exception - if the transfer is not successful
    • submit

      public org.openehealth.ipf.commons.ihe.xds.core.responses.Response submit(SubmissionSetMetadata submissionSetMetadata, SecurityHeaderElement security, String messageId) throws Exception
      Submission of the previously prepared document(s) to the repository
      IHE [ITI-41] Provide and Register Document Set – b in the role of the IHE ITI Document Source actor
      Parameters:
      submissionSetMetadata - The information in this object will be used to create comprehensive meta data about this submission (e.g. with AuthorRole, AuthorInstitution, ContentType and Title). Although, some of this information can be derived automatically, some may be required in your country (e.g. AuthorRole in Switzerland)
      security - a security header element for example an assertion
      Returns:
      the IPF Response
      Throws:
      Exception - if the transfer is not successful
    • submitReplacement

      public org.openehealth.ipf.commons.ihe.xds.core.responses.Response submitReplacement(SubmissionSetMetadata submissionSetMetadata, String idOfOriginDocument, SecurityHeaderElement security, String messageId) throws Exception
      Submission of the previously prepared document(s) to the repository to replace another document. The restriction of this method is that only one document could be replaced
      IHE [ITI-41] Provide and Register Document Set – b in the role of the IHE ITI Document Source actor
      Parameters:
      submissionSetMetadata - The information in this object will be used to create comprehensive meta data about this submission (e.g. with AuthorRole, AuthorInstitution, ContentType and Title). Although, some of this information can be derived automatically, some may be required in your country (e.g. AuthorRole in Switzerland)
      idOfOriginDocument - ID of the document, which should be replaced
      security - a security header element for example an assertion
      Returns:
      the IPF Response
      Throws:
      Exception - if the transfer is not successful