org.nhindirect.xd.transform.impl
Class DefaultXdmXdsTransformer

java.lang.Object
  extended by org.nhindirect.xd.transform.impl.DefaultXdmXdsTransformer
All Implemented Interfaces:
XdmXdsTransformer

public class DefaultXdmXdsTransformer
extends Object
implements XdmXdsTransformer

This class handles the transformation of XDM to XDS.

Author:
vlewis

Constructor Summary
DefaultXdmXdsTransformer()
           
 
Method Summary
protected  File fileFromDataHandler(DataHandler dh)
          Create a File object from the given DataHandler object.
protected  String getDocId(ExtrinsicObjectType extrinsicObjectType)
          Get the document ID from an EntrinsicObjectType object.
protected  String getDocId(SubmitObjectsRequest submitObjectRequest)
          Get the document ID from a SubmitObjectsRequest object.
 String getDocName(File file)
           
protected  String getDocName(SubmitObjectsRequest submitObjectRequest)
           
protected  String getSubmissionSetDirspec(String zipEntryName)
          Given a full ZipEntry filespec, extracts the name of the folder (if present) under the IHE_XDM root specified by IHE XDM.
protected  boolean matchName(String zname, String subsetDirspec, String subsetFilespec)
          Determine whether a filename matches the subset directory and file name.
protected  ByteArrayOutputStream readData(ZipFile zipFile, ZipEntry zipEntry)
          Read data the data of a zipEntry within a zipFile.
 ProvideAndRegisterDocumentSetRequestType transform(DataHandler dataHandler)
          Transform an XDM DataHandler to a ProvideAndRegisterDocumentSetRequestType object.
 ProvideAndRegisterDocumentSetRequestType transform(File file)
          Transform an XDM File to a ProvideAndRegisterDocumentSetRequestType object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultXdmXdsTransformer

public DefaultXdmXdsTransformer()
Method Detail

transform

public ProvideAndRegisterDocumentSetRequestType transform(File file)
                                                   throws TransformationException
Description copied from interface: XdmXdsTransformer
Transform an XDM File to a ProvideAndRegisterDocumentSetRequestType object.

Specified by:
transform in interface XdmXdsTransformer
Parameters:
file - The XDM File to transform.
Returns:
a ProvideAndRegisterDocumentSetRequestType object.
Throws:
TransformationException

getDocName

public String getDocName(File file)
                  throws TransformationException
Throws:
TransformationException

transform

public ProvideAndRegisterDocumentSetRequestType transform(DataHandler dataHandler)
                                                   throws TransformationException
Description copied from interface: XdmXdsTransformer
Transform an XDM DataHandler to a ProvideAndRegisterDocumentSetRequestType object.

Specified by:
transform in interface XdmXdsTransformer
Parameters:
dataHandler - The DataHandler object to transform.
Returns:
a ProvideAndRegisterDocumentSetRequestType object.
Throws:
TransformationException

getDocId

protected String getDocId(SubmitObjectsRequest submitObjectRequest)
Get the document ID from a SubmitObjectsRequest object.

Parameters:
sor - The SubmitObjectsRequest object from which to retrieve the document ID.
Returns:
a document ID.

getDocName

protected String getDocName(SubmitObjectsRequest submitObjectRequest)

getDocId

protected String getDocId(ExtrinsicObjectType extrinsicObjectType)
Get the document ID from an EntrinsicObjectType object.

Parameters:
eot - The EntrinsicObjectType object from which to retrieve the document ID.
Returns:
a document ID.

getSubmissionSetDirspec

protected String getSubmissionSetDirspec(String zipEntryName)
Given a full ZipEntry filespec, extracts the name of the folder (if present) under the IHE_XDM root specified by IHE XDM.

Parameters:
zipEntryName - The ZIP entry name.
Returns:
the name of the folder.

matchName

protected boolean matchName(String zname,
                            String subsetDirspec,
                            String subsetFilespec)
Determine whether a filename matches the subset directory and file name.

Parameters:
zname - The name to compare.
subsetDirspec - The subset directory name.
subsetFilespec - The subset file name.
Returns:
true if the names match, false otherwise.

readData

protected ByteArrayOutputStream readData(ZipFile zipFile,
                                         ZipEntry zipEntry)
                                  throws IOException
Read data the data of a zipEntry within a zipFile.

Parameters:
zipFile - The ZipFile object.
zipEntry - The ZipEntry object.
Returns:
a ByteArrayOutputStream representing the data.
Throws:
IOException

fileFromDataHandler

protected File fileFromDataHandler(DataHandler dh)
                            throws Exception
Create a File object from the given DataHandler object.

Parameters:
dh - The DataHandler object.
Returns:
a File object created from the DataHandler object.
Throws:
Exception


Copyright © 2010-2011. All Rights Reserved.