Package ca.uhn.hl7v2.app
Class DefaultApplication
java.lang.Object
ca.uhn.hl7v2.app.DefaultApplication
- All Implemented Interfaces:
ReceivingApplication<Message>
- Direct Known Subclasses:
AcceptApplication
An Application that does nothing with the message and returns an Application
Reject message in response. To be used when there are no other Applications
that can process a given message.
- Author:
- Bryan Tripp, Christian Ohr
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNew instance which always returns an acknowledgment code ofAcknowledgmentCode.ARand a message indicating that no appropriate handler could be found.DefaultApplication(AcknowledgmentCode theAcknowledgmentCode) New instance which always uses the given acknowledgment code, and generates an appropriate message for the given code, according to the following rules:DefaultApplication(AcknowledgmentCode theAcknowledgmentCode, String theMessage) New instance which always uses the given acknowledgment code and message -
Method Summary
Modifier and TypeMethodDescriptionbooleancanProcess(Message in) Returns true.static MessageDeprecated.static MessageDeprecated.processMessage(Message theMessage, Map<String, Object> theMetadata) Uses the contents of the message for whatever purpose the application has for this message, and returns an appropriate response message.
-
Field Details
-
MSG_INTERNAL_ERROR
- See Also:
-
MSG_NO_APPROPRIATE_DEST
- See Also:
-
-
Constructor Details
-
DefaultApplication
public DefaultApplication()New instance which always returns an acknowledgment code ofAcknowledgmentCode.ARand a message indicating that no appropriate handler could be found.- See Also:
-
DefaultApplication
New instance which always uses the given acknowledgment code, and generates an appropriate message for the given code, according to the following rules:
- Parameters:
theAcknowledgmentCode- The code to always use (must not be null)
-
DefaultApplication
New instance which always uses the given acknowledgment code and message- Parameters:
theAcknowledgmentCode- The code to always use (must not be null)theMessage- The message (may be null, in which case no message will be given)
-
-
Method Details
-
canProcess
Returns true.- Specified by:
canProcessin interfaceReceivingApplication<Message>- Parameters:
in- an inbound HL7 message- Returns:
- true if this ReceivingApplication wishes to accept the message. By returning true, this Application declares itself the recipient of the message, accepts responsibility for it, and must be able to respond appropriately to the sending system.
-
makeACK
Deprecated.Creates an ACK message with the minimum required information from an inbound message. Optional fields can be filled in afterwards, before the message is returned. Please note that MSH-10, the outbound message control ID, is also set using the classca.uhn.hl7v2.util.MessageIDGenerator. Also note that the ACK messages returned is the same version as the version stated in the inbound MSH if there is a generic ACK for that version, otherwise a version 2.4 ACK is returned. MSA-1 is set to AA by default.- Parameters:
message- message the MSH segment if the inbound message- Throws:
HL7ExceptionIOException
-
makeACK
Deprecated.- Throws:
HL7ExceptionIOException
-
processMessage
public Message processMessage(Message theMessage, Map<String, Object> theMetadata) throws ReceivingApplicationExceptionDescription copied from interface:ReceivingApplicationUses the contents of the message for whatever purpose the application has for this message, and returns an appropriate response message.- Specified by:
processMessagein interfaceReceivingApplication<Message>- Parameters:
theMessage- an inbound HL7 messagetheMetadata- message metadata (which may include information about where the message comes from, etc). This is the same metadata as inTransportable.getMetadata().- Returns:
- an appropriate application response (for example an application ACK or query response). Appropriate responses to different types of incoming messages are defined by HL7.
- Throws:
ReceivingApplicationException- if there is a problem internal to the application (for example a database problem)
-
Message.generateACK()