Package org.projecthusky.communication
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
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:
It implements the following IHE transactions:
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 Summary
ConstructorsConstructorDescriptionInstantiates a new convenience communication without affinity domain set-up.ConvenienceCommunication
(AffinityDomain affinityDomain) Instantiates a new convenience communication with the given affinity domain set-up.ConvenienceCommunication
(AffinityDomain affinityDomain, AtnaConfig.AtnaConfigMode atnaConfigMode, DocumentMetadata.DocumentMetadataExtractionMode documentMetadataExtractionMode, SubmissionSetMetadata.SubmissionSetMetadataExtractionMode submissionSetMetadataExtractionMode) Instantiates a new convenience communication with the given affinity domain set-up. -
Method Summary
Modifier and TypeMethodDescriptionaddDocument
(DocumentDescriptor desc, InputStream inputStream) Adds a document to the XDS Submission set.addDocument
(DocumentDescriptor desc, InputStream inputStream, InputStream inputStream4Metadata) Adds a document to the XDS Submission set.addDocument
(DocumentDescriptor desc, String filePath) Adds a document to the XDS Submission set.addDocument
(DocumentDescriptor desc, String filePath, String filePathMetadata) Adds a document to the XDS Submission set.void
addDocumentToFolder
(String documentEntryUUID, String folderEntryUUID) Add a document to a folder by theirs idsAdds a xds folder.protected DocumentMetadata
addXdsDocument
(org.openehealth.ipf.commons.ihe.xds.core.metadata.Document doc, DocumentDescriptor desc) Adds an XDSDocument to the Transaction dataprotected 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.void
Resets the transaction data (SubmissionSet and DocumentMetadata)protected InputStream
convertNonAsciiText2Unicode
(InputStream inputStream) Escapes all non java character in the inputsream that is expected as XML.protected void
Escapes all non java character in the node text.createXdmContents
(OutputStream outputStream) creates an XDM volume with default values.createXdmContents
(OutputStream outputStream, XdmContents xdmContents) creates an XDM volume with a given XdmContents object.createXdmContents
(String filePath) creates an XDM volume with default values.createXdmContents
(String filePath, XdmContents xdmContents) creates an XDM volume with default values.createXdmContents
(SubmissionSetMetadata submissionSetMetadata, OutputStream outputStream) creates an XDM volume with the given submission set metadata.org.openehealth.ipf.commons.ihe.xds.core.metadata.SubmissionSet
Generate missing Submission Set attributes.Returns the current affinity domainGets the status of the automatic metadata extractionprotected String
getSourceId
(org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable patientId) org.openehealth.ipf.commons.ihe.xds.core.requests.ProvideAndRegisterDocumentSet
Gets the IPF transaction data (SubmissionSet and DocumentMetadata)getXdmContents
(String filePath) Returns the contents of an existing XDM volume.getXdmContents
(ZipFile zipFile) Returns the contents of an existing XDM volume.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) Queries the registry of the affinity domain for all documents satisfying the given query parameters.org.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponse
queryDocumentReferencesOnly
(AbstractStoredQuery queryParameter, SecurityHeaderElement securityHeader, String messageId) Queries the document registry of the affinity domain for documents, using a find documents query.org.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponse
queryDocuments
(AbstractStoredQuery queryParameter, SecurityHeaderElement securityHeader, String messageId) Queries the document registry of the affinity domain for documents, using a find documents query.org.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponse
queryFolders
(FindFoldersStoredQuery queryParameter, SecurityHeaderElement security, String messageId) Queries the document registry of the affinity domain for documents, using a find documents query.org.openehealth.ipf.commons.ihe.xds.core.responses.RetrievedDocumentSet
retrieveDocument
(DocumentRequest docReq, SecurityHeaderElement security, String messageId) Retrieves a document from a Repositoryorg.openehealth.ipf.commons.ihe.xds.core.responses.RetrievedDocumentSet
retrieveDocuments
(DocumentRequest[] docReq, SecurityHeaderElement security, String messageId) Retrieves multiple documents from one or more Repositoriesvoid
setAffinityDomain
(AffinityDomain affinityDomain) Sets the affinity domain set-upvoid
setAtnaConfig
(AtnaConfig.AtnaConfigMode atnaConfigMode) Sets the atna configvoid
setAutomaticExtractionEnabled
(DocumentMetadata.DocumentMetadataExtractionMode automaticExtractionEnabled) Sets the status of the automatic metadata extractionvoid
setAutomaticExtractionEnabled
(SubmissionSetMetadata.SubmissionSetMetadataExtractionMode automaticExtractionEnabled) Sets the status of the automatic metadata extractionprotected void
setGeneralSubSetDetails
(org.openehealth.ipf.commons.ihe.xds.core.metadata.SubmissionSet subSet, org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable patientId) org.openehealth.ipf.commons.ihe.xds.core.responses.Response
submit
(SubmissionSetMetadata submissionSetMetadata, SecurityHeaderElement security, String messageId) 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 actororg.openehealth.ipf.commons.ihe.xds.core.responses.Response
submit
(SecurityHeaderElement security, String messageId) 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 actororg.openehealth.ipf.commons.ihe.xds.core.responses.Response
submitReplacement
(SubmissionSetMetadata submissionSetMetadata, String idOfOriginDocument, SecurityHeaderElement security, String messageId) Submission of the previously prepared document(s) to the repository to replace another document.Methods inherited from class org.projecthusky.communication.CamelService
addHttpHeader, addWssHeader, getAuditContext, getCamelContext, send, setAuditContext, setCamelContext
-
Constructor Details
-
ConvenienceCommunication
public ConvenienceCommunication()Instantiates a new convenience communication without affinity domain set-up. ATNA audit is disabled (unsecure) -
ConvenienceCommunication
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 configurationatnaConfigMode
- 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
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 documentinputStream4Metadata
- 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
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
Escapes all non java character in the node text.- Parameters:
node
- the node to be escaped
-
addDocument
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 pathfilePathMetadata
- the file path metadata- Returns:
- the document metadata (which have to be completed)
- Throws:
IOException
-
addDocumentToFolder
Add a document to a folder by theirs ids- Parameters:
documentEntryUUID
- the entry uuid of the documentfolderEntryUUID
- the entry uuid of the folder
-
addFolder
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 documentdesc
- 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 documentdesc
- the Document descriptormetadataDoc
- the metadata doc- Returns:
- the doc to get the metadata from
-
clearDocuments
public void clearDocuments()Resets the transaction data (SubmissionSet and DocumentMetadata) -
createXdmContents
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
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
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
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 setoutputStream
- 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
Returns the current affinity domain- Returns:
- the affinity domain
-
setAffinityDomain
Sets the affinity domain set-up- Parameters:
affinityDomain
- the affinity domain set-up
-
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
Returns the contents of an existing XDM volume.- Parameters:
filePath
- the XDM volume as ZipFile- Returns:
- the XDMContents
-
getXdmContents
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 parameterssecurityHeader
- 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 parameterssecurityHeader
- 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 assertionreturnType
- 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 parameterssecurity
- 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 requestsecurity
- 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 requestssecurity
- a security header element for example an assertion- Returns:
- the IPF RetrievedDocumentSet
- Throws:
Exception
-
setAtnaConfig
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 replacedsecurity
- a security header element for example an assertion- Returns:
- the IPF Response
- Throws:
Exception
- if the transfer is not successful
-