public class ReportingValidationExceptionHandler extends Object implements ValidationExceptionHandler<Boolean>, ValidationExceptionHandlerFactory<Boolean>
ValidationException
s and
optionally throws the first one wrapped in a HL7Exception
.
The mimics the behavior of the MessageValidator
of previous releases.
Constructor and Description |
---|
ReportingValidationExceptionHandler(boolean throwFirstException) |
Modifier and Type | Method and Description |
---|---|
ValidationExceptionHandler<Boolean> |
getNewInstance(HapiContext context) |
boolean |
hasFailed()
Returns a boolean flag indicating whether a validation was successful or not.
|
void |
onExceptions(ValidationException... exceptions)
Logs all exceptions
|
Boolean |
result()
If the validation failed, throws Exception or returns
false ,
depending on {link throwFirstException . |
void |
setValidationSubject(Object subject)
Does nothing
|
public ReportingValidationExceptionHandler(boolean throwFirstException)
throwFirstException
- true if first exception shall be thrownpublic void onExceptions(ValidationException... exceptions)
onExceptions
in interface ValidationExceptionHandler<Boolean>
exceptions
- the exceptions that describe the validatin errorsAbstractValidationExceptionHandler.onExceptions(ca.uhn.hl7v2.validation.ValidationException[])
public Boolean result() throws HL7Exception
false
,
depending on {link throwFirstException
.result
in interface ValidationExceptionHandler<Boolean>
HL7Exception
- if validation has failed and
throwFirstException
is trueDefaultValidationExceptionHandler.result()
public boolean hasFailed()
ValidationExceptionHandler
ValidationExceptionHandler.result()
which may return a more complex
object.hasFailed
in interface ValidationExceptionHandler<Boolean>
public ValidationExceptionHandler<Boolean> getNewInstance(HapiContext context)
getNewInstance
in interface ValidationExceptionHandlerFactory<Boolean>
context
- HAPI contextpublic void setValidationSubject(Object subject)
setValidationSubject
in interface ValidationExceptionHandler<Boolean>
subject
- subject to be validatedCopyright © 2001–2017 University Health Network. All rights reserved.