public class RespondingValidationExceptionHandler extends CollectingValidationExceptionHandler<Message> implements ValidationExceptionHandlerFactory<Message>
This handler (or a subclass thereof) can be used for validation if a response message must be generated upon the validation result.
Constructor and Description |
---|
RespondingValidationExceptionHandler(HapiContext context) |
Modifier and Type | Method and Description |
---|---|
protected Message |
generateResponseMessage(Object request)
Generates an empty response message.
|
AcknowledgmentCode |
getErrorAcknowledgementCode() |
ValidationExceptionHandler<Message> |
getNewInstance(HapiContext context) |
AcknowledgmentCode |
getSuccessAcknowledgementCode() |
protected void |
populateResponseMessage(Message response)
Populates the generated response based on the collected
ValidationException s. |
Message |
result()
Returns the generated response message.
|
void |
setErrorAcknowledgementCode(AcknowledgmentCode errorAcknowledgementCode)
Set acknowledgment code (AR, AE ,CR, CE) in case validation passes.
|
void |
setSuccessAcknowledgementCode(AcknowledgmentCode successAcknowledgementCode)
Set acknowledgment code (AA,CA) in case validation passes.
|
error, getExceptions, getMinimumSeverityToCollect, hasFailed, info, setMinimumSeverityToCollect, warning
getValidationSubject, onExceptions, setValidationSubject
getHapiContext, setHapiContext
public RespondingValidationExceptionHandler(HapiContext context)
context
- Hapi contextpublic final Message result() throws HL7Exception
result
in interface ValidationExceptionHandler<Message>
HL7Exception
- if no response could be generated#generateResponseMessage(Object)}
,
#populateResponseMessage(ca.uhn.hl7v2.model.Message)}
public void setSuccessAcknowledgementCode(AcknowledgmentCode successAcknowledgementCode)
successAcknowledgementCode
- (AA, CA)public void setErrorAcknowledgementCode(AcknowledgmentCode errorAcknowledgementCode)
errorAcknowledgementCode
- (AR, AE ,CR, CE)public AcknowledgmentCode getSuccessAcknowledgementCode()
public AcknowledgmentCode getErrorAcknowledgementCode()
protected Message generateResponseMessage(Object request) throws HL7Exception
getSuccessAcknowledgementCode()
.request
- request message, either a String
or a
Message
HL7Exception
protected void populateResponseMessage(Message response) throws HL7Exception
ValidationException
s. In case of exceptions, each exception will
cause an entry in one or more ERR segments.response
- response message to be populatedHL7Exception
public ValidationExceptionHandler<Message> getNewInstance(HapiContext context)
getNewInstance
in interface ValidationExceptionHandlerFactory<Message>
context
- HAPI contextCopyright © 2001–2017 University Health Network. All rights reserved.