gov.nist.hl7.ws.messagegeneration
Interface HL7MessageGenerationInterface


public interface HL7MessageGenerationInterface

NIST HL7 V2 Message Generation Web Service

This service provides an interface for generation of HL7 version 2 (V2) message instances for given a message profile. The message can be populated with specific data values via a generation context. The interface is designed for use in a web-service environment. The methods are intended to be simple and in many cases atomic calls. Parameters and return values are intentionally made to be simple objects. This provides for a flexible interface for building a user specific interface.

This service supports generation of messages for HL7 Version 2.3.1, 2.4, 2.5, and 2.5.1. The version that is used for message generation is dictated by the message profile.

Version:
1.0
Author:
Robert Snelick (NIST)

Method Summary
 boolean generate()
          Perform the message generation.
 java.lang.String getLastExceptionMessage()
          Get the web service error message of the last exception caught.
 java.lang.String getMessage()
          Retrieve the message.
 boolean getServiceStatus()
          Get the status of the service.
 boolean loadProfile(java.lang.String xmlProfile)
          Load an HL7 version 2 message profile.
 boolean loadResource(java.lang.String xmlResource, java.lang.String resourceType)
          The loadResource method allows a user to load additional resources that can be used in the generation process.
 boolean setGenerationContext(java.lang.String simpleGenerationContext)
          The generation context describes the location and values used for creating messages.
 boolean useHandle(java.lang.String OID)
          Use the handle identified by the OID.
 boolean useProfile(java.lang.String OID)
          Use the profile identified by the OID.
 boolean useResource(java.lang.String OID)
          The useResource method allows a user to access a resource that can be used in the generation process.
 

Method Detail

useHandle

boolean useHandle(java.lang.String OID)
                  throws java.lang.Exception
Use the handle identified by the OID. A handle represents a package of resources (e.g., a profile and a table file). The repository is searched using the OID, if the handle is located all of the artifacts linked with handle are used when performing message generation.

Parameters:
OID - referencing a handle

Returns:
true if handle was located in the repository and processed successfully; false otherwise.
Throws:
java.lang.Exception

loadProfile

boolean loadProfile(java.lang.String xmlProfile)
                    throws java.lang.Exception
Load an HL7 version 2 message profile. The profile is an XML document that follows the rules given in the HL7 version 2 profile schema.

Parameters:
xmlProfile - an HL7 version 2 message profile.

Returns:
true if profile was loaded and processed successfully; false otherwise.
Throws:
java.lang.Exception

useProfile

boolean useProfile(java.lang.String OID)
                   throws java.lang.Exception
Use the profile identified by the OID. The repository is searched using the OID, if the profile is located it is use for performing message generation.

Parameters:
OID - referencing an HL7 version message profile.

Returns:
true if profile was located in the repository and processed successfully; false otherwise.
Throws:
java.lang.Exception

loadResource

boolean loadResource(java.lang.String xmlResource,
                     java.lang.String resourceType)
                     throws java.lang.Exception
The loadResource method allows a user to load additional resources that can be used in the generation process. This may be a table that specifies local codes. Each resource type defines the format of the given resource. More than one resource can be associated to a generation process.

TBD-what are the resource types and their formats.

Parameters:
xmlResource - a resource that is used in the generation process.

resourceType - a document that describes the type of the xmlResource; for example, an XML schema.

Returns:
true if the resource has been successfully loaded and processed; false otherwise.
Throws:
java.lang.Exception

useResource

boolean useResource(java.lang.String OID)
                    throws java.lang.Exception
The useResource method allows a user to access a resource that can be used in the generation process. This may be a table that specifies local codes. More than one resource can be associated to a generation process. Resource files are stored in the repository.

TBD-what are the resource types and their formats.

Parameters:
OID - an object identifier to reference the resource

Returns:
true if the resource was located in the repository and processed successfully; false otherwise.
Throws:
java.lang.Exception

setGenerationContext

boolean setGenerationContext(java.lang.String simpleGenerationContext)
                             throws java.lang.Exception
The generation context describes the location and values used for creating messages. The validation context is encoded in an XML document that adheres to the generation context schema. For details of the format see...

Parameters:
simpleGenerationContext - the message generation context describes the location and values used for creating messages.

Returns:
true is the validation context has been successfully loaded and processed; false otherwise.
Throws:
java.lang.Exception

generate

boolean generate()
                 throws java.lang.Exception
Perform the message generation.

Returns:
true if the message was successfully generated; false otherwise.
Throws:
java.lang.Exception
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
gov.nist.hl7.core.NoXmlObjectMatchFoundException
gov.nist.hl7.core.data.DataException
MalformedMessageException
javax.xml.transform.TransformerException
java.sql.SQLException
javax.xml.transform.TransformerFactoryConfigurationError
java.io.IOException
org.apache.xmlbeans.XmlException
java.lang.Exception

getServiceStatus

boolean getServiceStatus()
Get the status of the service.

Returns:
true if the service is available; false if the service unavailable (e.g., running but too busy).

getMessage

java.lang.String getMessage()
                            throws java.lang.Exception
Retrieve the message. The message can be returned in XML or ER7 encoding.

Parameters:
encoding - - the encoding of the message; valid values are "XML" or "ER7;
Returns:
an XML document with a detailed of the message validation results.
Throws:
java.lang.Exception
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
gov.nist.hl7.core.data.DataException
java.sql.SQLException
MalformedMessageException
java.io.IOException
java.lang.IllegalArgumentException

getLastExceptionMessage

java.lang.String getLastExceptionMessage()
Get the web service error message of the last exception caught.

Returns:
a description of the last exception.