public class DefaultValidator extends Object implements Validator
| Constructor and Description |
|---|
DefaultValidator()
Creates a new instance of DefaultValidator
|
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args) |
void |
setCodeStore(CodeStore theCodeStore)
Provides a code store to use to provide the code tables which will be
used to validate coded value types.
|
void |
setValidateChildren(boolean validateChildren)
If set to false (default is true), each testXX and validateXX method will only
test the direct object it is responsible for, not its children.
|
protected HL7Exception |
testCardinality(int reps,
int min,
int max,
String usage,
String name)
Checks cardinality and creates an appropriate exception if out
of bounds.
|
HL7Exception[] |
testComponent(Type type,
Component profile,
String profileID) |
HL7Exception[] |
testField(Type type,
Field profile,
boolean escape,
String profileID) |
HL7Exception[] |
testGroup(Group group,
AbstractSegmentContainer profile,
String profileID)
Tests a group against a group section of a profile.
|
HL7Exception |
testLength(Type type,
int maxLength)
Tests whether the given type falls within a maximum length.
|
HL7Exception[] |
testSegment(Segment segment,
Seg profile,
String profileID)
Tests a segment against a segment section of a profile.
|
HL7Exception[] |
testStructure(Structure s,
ProfileStructure profile,
String profileID)
Tests a structure (segment or group) against the corresponding part of a profile.
|
HL7Exception[] |
testType(Type type,
AbstractComponent profile,
String encoded,
String profileID)
Tests a Type against the corresponding section of a profile.
|
HL7Exception[] |
validate(Message message,
StaticDef profile)
Validates the given message against the given static definition from
a conformance profile.
|
public DefaultValidator()
public void setValidateChildren(boolean validateChildren)
public void setCodeStore(CodeStore theCodeStore)
Provides a code store to use to provide the code tables which will be
used to validate coded value types. If a code store has not been set (which
is the default), ProfileStoreFactory will be checked for an
appropriate code store, and if none is found then coded values will not
be validated.
public HL7Exception[] validate(Message message, StaticDef profile) throws ProfileException, HL7Exception
Validatorvalidate in interface ValidatorProfileException - if a problem is encountered that interferes with evaluationHL7ExceptionValidator.validate(ca.uhn.hl7v2.model.Message, ca.uhn.hl7v2.conf.spec.message.StaticDef)public HL7Exception[] testGroup(Group group, AbstractSegmentContainer profile, String profileID) throws ProfileException
ProfileExceptionprotected HL7Exception testCardinality(int reps, int min, int max, String usage, String name)
reps - the number of repsmin - the minimum number of repsmax - the maximum number of reps (-1 means *)usage - the usage codename - the name of the repeating structure (used in exception msg)public HL7Exception[] testStructure(Structure s, ProfileStructure profile, String profileID) throws ProfileException
ProfileExceptionpublic HL7Exception[] testSegment(Segment segment, Seg profile, String profileID) throws ProfileException
ProfileExceptionpublic HL7Exception[] testType(Type type, AbstractComponent profile, String encoded, String profileID)
encoded - optional encoded form of type (if you want to specify this -- if null,
default pipe-encoded form is used to check length and constant val)public HL7Exception testLength(Type type, int maxLength)
public HL7Exception[] testField(Type type, Field profile, boolean escape, String profileID) throws ProfileException
ProfileExceptionpublic HL7Exception[] testComponent(Type type, Component profile, String profileID) throws ProfileException
ProfileExceptionCopyright © 2001-2012 University Health Network. All Rights Reserved.