|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectca.uhn.hl7v2.model.AbstractGroup
ca.uhn.hl7v2.model.AbstractMessage
public abstract class AbstractMessage
A default implementation of Message.
Constructor Summary | |
---|---|
AbstractMessage(ModelClassFactory theFactory)
|
Method Summary | |
---|---|
java.lang.String |
encode()
Encodes this message using the parser returned by Message.getParser() |
Message |
generateACK()
Generates and returns an ACK message which would be used to acknowledge this message successfully, with an MSA-1 code of "AA". |
Message |
generateACK(java.lang.String theAcknowledgementCode,
HL7Exception theException)
Generates and returns an ACK message which would be used to acknowledge this message successfully. |
java.lang.String |
getEncodingCharactersValue()
Convenience method which retrieves the encoding characters value from the second field of the first segment. |
java.lang.Character |
getFieldSeparatorValue()
Convenience method which retrieves the field separator value from the first field of the first segment. |
Message |
getMessage()
Returns this Message object - this is an implementation of the abstract method in AbstractGroup. |
Parser |
getParser()
Returns the parser to be used when parse/encode methods are called on this Message, as well as its children. |
ValidationContext |
getValidationContext()
|
java.lang.String |
getVersion()
Returns the version number. |
void |
parse(java.lang.String string)
Parses the string into this message using the parser returned by Message.getParser() |
void |
setParser(Parser parser)
Sets the parser to be used when parse/encode methods are called on this Message, as well as its children. |
void |
setValidationContext(ValidationContext theContext)
|
Methods inherited from class ca.uhn.hl7v2.model.AbstractGroup |
---|
add, add, addNonstandardSegment, addNonstandardSegment, clear, currentReps, get, get, getAll, getClass, getModelClassFactory, getName, getNames, getParent, insertRepetition, insertRepetition, isRepeating, isRequired, removeRepetition |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface ca.uhn.hl7v2.model.Group |
---|
addNonstandardSegment, addNonstandardSegment, get, get, getAll, getClass, getNames, isRepeating, isRequired |
Methods inherited from interface ca.uhn.hl7v2.model.Structure |
---|
getName, getParent |
Constructor Detail |
---|
public AbstractMessage(ModelClassFactory theFactory)
theFactory
- factory for model classes (e.g. group, segment) for this messageMethod Detail |
---|
public Message getMessage()
getMessage
in interface Structure
getMessage
in class AbstractGroup
public java.lang.String getVersion()
getVersion
in interface Message
Message.getVersion()
public ValidationContext getValidationContext()
getValidationContext
in interface Message
public void setValidationContext(ValidationContext theContext)
setValidationContext
in interface Message
theContext
- the set of validation rules that are to apply to this messagepublic java.lang.Character getFieldSeparatorValue() throws HL7Exception
getFieldSeparatorValue
in interface Message
HL7Exception
- If an error occurspublic java.lang.String getEncodingCharactersValue() throws HL7Exception
getEncodingCharactersValue
in interface Message
HL7Exception
- If an error occurspublic void setParser(Parser parser)
Sets the parser to be used when parse/encode methods are called on this Message, as well as its children. It is recommended that if these methods are going to be called, a parser be supplied with the validation context wanted. Where possible, the parser should be reused for best performance, unless thread safety is an issue.
Note that not all parsers can be used. As of version 1.0, only PipeParser
supports this functionality
Serialization note: The message parser is marked as transient, so it will not survive serialization.
setParser
in interface Message
public Parser getParser()
Returns the parser to be used when parse/encode methods are called on this
Message, as well as its children. The default value is a new PipeParser
.
Serialization note: The message parser is marked as transient, so it will not survive serialization.
getParser
in interface Message
public void parse(java.lang.String string) throws HL7Exception
Message.getParser()
parse
in interface Message
HL7Exception
public java.lang.String encode() throws HL7Exception
Message.getParser()
encode
in interface Message
HL7Exception
public Message generateACK() throws HL7Exception, java.io.IOException
Generates and returns an ACK message which would be used to acknowledge this message successfully, with an MSA-1 code of "AA". The ACK generated will be of the same version as the value of MSH-12 in this message (as opposed to the version of the message class instance, if they are different)
Note that this method will fail if it is not possible to generate an ACK for any reason, such as
generateACK
in interface Message
HL7Exception
- If the message can not be constructed
java.io.IOException
- If a failure occurs in generating a control ID for the messagepublic Message generateACK(java.lang.String theAcknowledgementCode, HL7Exception theException) throws HL7Exception, java.io.IOException
Generates and returns an ACK message which would be used to acknowledge this message successfully. The ACK generated will be of the same version as the value of MSH-12 in this message (as opposed to the version of the message class instance, if they are different)
Note that this method will fail if it is not possible to generate an ACK for any reason, such as
generateACK
in interface Message
theAcknowledgementCode
- The acknowledement code (MSA-1) to supply. If null, defaults to "AA". To generate a typical NAK, use "AE"theException
- The exceptions used to populate the ERR segment (if any)
HL7Exception
- If the message can not be constructed
java.io.IOException
- If a failure occurs in generating a control ID for the message
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |