org.eclipse.ohf.ihe.xds.source
Class SubmitTransactionData

java.lang.Object
  extended by org.eclipse.ohf.ihe.xds.source.SubmitTransactionData

public class SubmitTransactionData
extends java.lang.Object

This object represents the transaction payload for ITI-15: Provide and Register Document Set Transaction. It is strongly recommended that the user be familiar with this transaction as documented by IHE (see link below). The transaction is comprised of two key componets:

  • A list of Documents to submit
  • XDS metadata for the transaction ProvideAndRegisterDocumentSetType
  • XDS Metadata has 3 parts: DocumentEntry, SubmissionSet, Folder. Each document added to the transaction payload must be accompanied by a corresponding DocumentEntry. Each transaction payload must have exactly one SubmissionSet. The use of Folder is optional.
    NOTES:
  • It is strongly recommended that the user let this API generate entryUUIDs for the various pieces of metadata, rather than setting this information manually.
  • Author:
    Sarah Knoop
    See Also:
    IHE Technical Framework

    Constructor Summary
    SubmitTransactionData()
              Constructor.
     
    Method Summary
     java.lang.String addDocument(Document document)
              Add the given document to the Document Submission Set.
     void addDocumentToFolder(java.lang.String documentEntryUUID, java.lang.String folderEntryUUID)
              Adds the documentEntryUUID reference to the specified folder's list of associated documents.
     void addExistingDocument(java.lang.String documentEntryUUID)
              Add document that already exists in the XDS Registry to the Document Submission Set.
     void addExistingFolder(java.lang.String folderEntryUUID)
              Add folder that already exists in the XDS Registry to the Document Submission Set.
     java.lang.String addFolder()
              Create and Add a folder to the submission set
     void deleteDocument(java.lang.String documentEntryUUID)
              Removes the document and its associated metadata.
     void deleteDocumentFromFolder(java.lang.String documentEntryUUID, java.lang.String folderEntryUUID)
              Removes (deletes) the documentEntryUUID reference to the specified folder's list of associated documents.
     void deleteFolder(java.lang.String folderEntryUUID)
              Remove(delete) the folder to the submission set with the corresponding folderEntryUUID
     java.util.List getDocList()
               
     Document getDocument(java.lang.String documentEntryUUID)
              Returns the Document object associated with the specified documentEntryUUID.
     DocumentEntryType getDocumentEntry(java.lang.String documentEntryUUID)
              Returns the DocumentEntryType metadata object for the specified documentEntryUUID.
     FolderType getFolder(java.lang.String folderEntryUUID)
              Returns the FolderType metadata object for the specified folderEntryUUID.
     ProvideAndRegisterDocumentSetType getMetadata()
               
     SubmissionSetType getSubmissionSet()
              Returns a reference to this Submission Set's metadata
     boolean isDocumentAdded(Document document)
              Checks to see if the specified document object has been added to the Source
     java.lang.String loadDocumentWithEbXMLMetadata(Document document, ExtrinsicObjectType docData, AssociationType1 parentData)
              Loads the DocumentEntry metadata from the ebXML objects specified, INCLUDING the entryUUID of the document entry, if present.
     java.lang.String loadDocumentWithEbXMLMetadata(Document document, java.io.InputStream metadata)
              Loads the DocumentEntry metadata from the ebXML file specified, INCLUDING the entryUUID of the document entry, if present.
     java.lang.String loadDocumentWithMetadata(Document document, java.io.InputStream metadata)
              Loads the DocumentEntry metadata from the file specified, INCLUDING the entryUUID of the document entry, if present.
     java.lang.String loadEbXMLFolder(java.io.InputStream folderStream)
              Loads Folder metadata from the file specified, INCLUDING the entryUUID of the folder, if present.
     java.lang.String loadEbXMLFolder(RegistryPackageType folData)
              Loads Folder metadata from the file specified, INCLUDING the entryUUID of the folder, if present.
     void loadEbXMLSubmissionSet(java.io.InputStream submissionSetStream)
              Replaces the current SubmissionSet metadata with values from the EbXML v2.1 file specified, INCLUDING the entryUUID of the submission, if present.
     void loadEbXMLSubmissionSet(RegistryPackageType setData)
              Replaces the current SubmissionSet metadata with values from the EbXML v2.1 RegistryPackage object specified, INCLUDING the entryUUID of the submission, if present.
     java.lang.String loadFolder(java.io.InputStream folderStream)
              Loads Folder metadata from the file specified, INCLUDING the entryUUID of the folder, if present.
     void loadSubmissionSet(java.io.InputStream submissionSetStream)
              Replaces the current SubmissionSet metadata from the file specified, INCLUDING the entryUUID of the submission, if present.
     void saveMetadataToFile(java.lang.String path)
              Returns a file containing the current state of all metadata set in this submission
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    SubmitTransactionData

    public SubmitTransactionData()
    Constructor. Initializes document and metadata. Generates a UUID for this submission set.

    Method Detail

    getDocList

    public java.util.List getDocList()
    Returns:
    the docList

    addDocument

    public java.lang.String addDocument(Document document)
                                 throws MetadataExtractionException,
                                        SubmitTransactionCompositionException
    Add the given document to the Document Submission Set.
    Note: Each document may appear only once per submission set. If the same document object is added more than once, it will still appear only once in the document set. The DocumentEntry.entryUUID returned will be the same object instance for each addition of the same document. Will automatically extract metadata from the document if a MetadataExtractor for the Document's DocumentDescriptor has been loaded.

    Parameters:
    document - Document to add (@see com.ibm.ihii.xdssource.Document), must not be null
    Returns:
    a reference (the DocumentEntry.entryUUID) to the document entry metadata created for this document
    Throws:
    MetadataExtractionException - if an error occurred extracting the XDS metadata from the document.
    SubmitTransactionCompositionException - if an error occurred in composing the submit transaction data

    loadDocumentWithMetadata

    public java.lang.String loadDocumentWithMetadata(Document document,
                                                     java.io.InputStream metadata)
                                              throws MetadataExtractionException,
                                                     SubmitTransactionCompositionException
    Loads the DocumentEntry metadata from the file specified, INCLUDING the entryUUID of the document entry, if present. It is advisible not to include this element in the file unless there are special circumstances. The DocumentEntry.entryUUID will be generated, if not present in the file. File format is to be conform to stipulations outlined in InputStreamDocumentEntryExtractor Also, the document will be added. Note: Each document may appear only once per submission set. If the same document object is attempted to be added more than once, it will not be added to the document set. The DocumentEntry.entryUUID returned will be the existing object instance this document.

    Parameters:
    metadata - InputStream containing metadata.xsd compliant metadata metadata
    Returns:
    the current entryUUID of this document entry metadata
    Throws:
    MetadataExtractionException - if an error occurred extracting the XDS metadata from the document.
    SubmitTransactionCompositionException - if an error occurred in composing the submit transaction data

    loadDocumentWithEbXMLMetadata

    public java.lang.String loadDocumentWithEbXMLMetadata(Document document,
                                                          java.io.InputStream metadata)
                                                   throws MetadataExtractionException,
                                                          SubmitTransactionCompositionException
    Loads the DocumentEntry metadata from the ebXML file specified, INCLUDING the entryUUID of the document entry, if present. It is advisible to set the id attribute in the ebXML file to the empty string, rather than replace the entryUUID assigned by this object, unless special circumstances exist. The DocumentEntry.entryUUID will be generated, if not present in the file. File format is to be conform to stipulations outlined in EbXML_2_1InputStreamDocumentEntryExtractor Also, the document will be added. Note: Each document may appear only once per submission set. If the same document object is attempted to be added more than once, it will not be added to the document set. The DocumentEntry.entryUUID returned will be the existing object instance this document.

    Parameters:
    metadata - InputStream containing ebXML compliant metadata metadata
    Returns:
    the current entryUUID of this document entry metadata
    Throws:
    MetadataExtractionException - if an error occurred extracting the XDS metadata from the document.
    SubmitTransactionCompositionException - if an error occurred in composing the submit transaction data

    loadDocumentWithEbXMLMetadata

    public java.lang.String loadDocumentWithEbXMLMetadata(Document document,
                                                          ExtrinsicObjectType docData,
                                                          AssociationType1 parentData)
                                                   throws MetadataExtractionException,
                                                          SubmitTransactionCompositionException
    Loads the DocumentEntry metadata from the ebXML objects specified, INCLUDING the entryUUID of the document entry, if present. It is advisible to set the id attribute in the ExtrinsicObject to the empty string, rather than replace the entryUUID assigned by this object, unless special circumstances exist. The DocumentEntry.entryUUID will be generated, if not present in the file. Also, the document will be added. Note: Each document may appear only once per submission set. If the same document object is attempted to be added more than once, it will not be added to the document set. The DocumentEntry.entryUUID returned will be the existing object instance this document.

    Parameters:
    docData - ebXML object containg metadata for the document, cannot be null
    parentData - ebXML object containing metadata for a parent document, if applicable. may be set to null if no parent document exists.
    Returns:
    the current entryUUID of this document entry metadata
    Throws:
    MetadataExtractionException - if an error occurred extracting the XDS metadata from the document.
    SubmitTransactionCompositionException - if an error occurred in composing the submit transaction data
    See Also:
    EbXML_2_1DocumentEntryExtractor

    addExistingDocument

    public void addExistingDocument(java.lang.String documentEntryUUID)
                             throws MetadataExtractionException
    Add document that already exists in the XDS Registry to the Document Submission Set.
    Note: Each document may appear only once per submission set. If the same document object is added more than once, it will still appear only once in the document set. The DocumentEntry.entryUUID returned will be the same object instance for each addition of the same document.

    Parameters:
    documentEntryUUID - the DocumentEntry.entryUUID for the existing document
    Throws:
    MetadataExtractionException

    deleteDocument

    public void deleteDocument(java.lang.String documentEntryUUID)
    Removes the document and its associated metadata. Removes any references to the document from folders. If the document does not exist in the set, nothing is done.

    Parameters:
    documentEntryUUID - Reference to the DocumentEntryType object corresponding to the Document to remove

    getDocumentEntry

    public DocumentEntryType getDocumentEntry(java.lang.String documentEntryUUID)
    Returns the DocumentEntryType metadata object for the specified documentEntryUUID. If the corresponding document has not been added to the submission set, then null is returned.

    Parameters:
    documentEntryUUID -
    Returns:
    DocumentEntryType object for the specified document, or null if the document is not in the submission set.

    getDocument

    public Document getDocument(java.lang.String documentEntryUUID)
    Returns the Document object associated with the specified documentEntryUUID. If no such Document exists, null is returned.

    Parameters:
    documentEntryUUID -
    Returns:
    Associate Document or null

    isDocumentAdded

    public boolean isDocumentAdded(Document document)
    Checks to see if the specified document object has been added to the Source

    Parameters:
    document - document object to look for
    Returns:
    true if the document was found, false otherwise

    addFolder

    public java.lang.String addFolder()
    Create and Add a folder to the submission set

    Returns:
    Returns the entryUUID of the FolderType created

    loadFolder

    public java.lang.String loadFolder(java.io.InputStream folderStream)
                                throws MetadataExtractionException
    Loads Folder metadata from the file specified, INCLUDING the entryUUID of the folder, if present. It is advisible not to include this element in the file unless there are special circumstances. Subsequantly, adds the folder to this object. File format is to be conform to stipulations outlined in InputStreamFolderExtractor

    Parameters:
    folderStream - InputStream contiaing a metadata.xsd compliant folder
    Returns:
    the current entryUUID of the folder added
    Throws:
    MetadataExtractionException

    loadEbXMLFolder

    public java.lang.String loadEbXMLFolder(java.io.InputStream folderStream)
                                     throws MetadataExtractionException
    Loads Folder metadata from the file specified, INCLUDING the entryUUID of the folder, if present. It is advisible to set the id attribute in the ebXML file to the empty string, rather than replace the entryUUID assigned by this object, unless special circumstances exist. Subsequantly, adds the folder to this object. File format is to be conform to stipulations outlined in EbXML_2_1InputStreamFolderExtractor

    Parameters:
    folderStream - InputStream contiaing a ebXML compliant folder
    Returns:
    the current entryUUID of the folder added
    Throws:
    MetadataExtractionException

    loadEbXMLFolder

    public java.lang.String loadEbXMLFolder(RegistryPackageType folData)
                                     throws MetadataExtractionException
    Loads Folder metadata from the file specified, INCLUDING the entryUUID of the folder, if present. It is advisible to set the id attribute in the RegistryPackage to the empty string, rather than replace the entryUUID assigned by this object, unless special circumstances exist. Subsequantly, adds the folder to this object.

    Parameters:
    folData - ebXML object containg metadata for this folder, cannot be null
    Returns:
    the current entryUUID of the folder added
    Throws:
    MetadataExtractionException
    See Also:
    EbXML_2_1FolderExtractor

    addExistingFolder

    public void addExistingFolder(java.lang.String folderEntryUUID)
                           throws MetadataExtractionException
    Add folder that already exists in the XDS Registry to the Document Submission Set.

    Parameters:
    folderEntryUUID - the Folder.entryUUID for the existing folder
    Throws:
    MetadataExtractionException

    deleteFolder

    public void deleteFolder(java.lang.String folderEntryUUID)
    Remove(delete) the folder to the submission set with the corresponding folderEntryUUID

    Parameters:
    folderEntryUUID - of the folder to remove (delete)

    getFolder

    public FolderType getFolder(java.lang.String folderEntryUUID)
    Returns the FolderType metadata object for the specified folderEntryUUID. If the corresponding folder has not been added to the submission set, then null is returned.


    addDocumentToFolder

    public void addDocumentToFolder(java.lang.String documentEntryUUID,
                                    java.lang.String folderEntryUUID)
    Adds the documentEntryUUID reference to the specified folder's list of associated documents. If the folder does not exist, the reference is not added. If the document is already in the folder, the reference is not added.


    deleteDocumentFromFolder

    public void deleteDocumentFromFolder(java.lang.String documentEntryUUID,
                                         java.lang.String folderEntryUUID)
    Removes (deletes) the documentEntryUUID reference to the specified folder's list of associated documents. If the folder does not exist, the referecnce is not deleted.


    getSubmissionSet

    public SubmissionSetType getSubmissionSet()
    Returns a reference to this Submission Set's metadata

    Returns:
    SubmissionSetType object holding the metadata for the transaction

    loadSubmissionSet

    public void loadSubmissionSet(java.io.InputStream submissionSetStream)
                           throws MetadataExtractionException
    Replaces the current SubmissionSet metadata from the file specified, INCLUDING the entryUUID of the submission, if present. It is advisible not to include this element in the file unless there are special circumstances.

    Parameters:
    submissionSetStream - InputStream contiaing a metadata.xsd compliant folder
    Throws:
    MetadataExtractionException
    See Also:
    InputStreamSubmissionSetExtractor

    loadEbXMLSubmissionSet

    public void loadEbXMLSubmissionSet(java.io.InputStream submissionSetStream)
                                throws MetadataExtractionException
    Replaces the current SubmissionSet metadata with values from the EbXML v2.1 file specified, INCLUDING the entryUUID of the submission, if present. It is advisible to set the id attribute in the ebXML file to the empty string, rather than replace the entryUUID assigned by this object, unless special circumstances exist. File format is to be conform to stipulations outlined in EbXML_2_1InputStreamSubmissionSetExtractor

    Parameters:
    submissionSetStream - InputStream contiaing a ebXML compliant folder
    Throws:
    MetadataExtractionException

    loadEbXMLSubmissionSet

    public void loadEbXMLSubmissionSet(RegistryPackageType setData)
                                throws MetadataExtractionException
    Replaces the current SubmissionSet metadata with values from the EbXML v2.1 RegistryPackage object specified, INCLUDING the entryUUID of the submission, if present. It is advisible to set the id attribute in the RegistryPackage to the empty string, rather than replace the entryUUID assigned by this object, unless special circumstances exist.

    Parameters:
    setData - ebXML object containg metadata for the submission set, cannot be null
    Throws:
    MetadataExtractionException
    See Also:
    EbXML_2_1SubmissionSetExtractor

    getMetadata

    public ProvideAndRegisterDocumentSetType getMetadata()
    Returns:
    the metadata

    saveMetadataToFile

    public void saveMetadataToFile(java.lang.String path)
                            throws MetadataTransformationException
    Returns a file containing the current state of all metadata set in this submission

    Parameters:
    path - path to output file
    Throws:
    MetadataTransformationException