|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object eu.ihe.validator.MessageValidator
public class MessageValidator
This class is almost the same of HAPI one, unless here we validate against Schemas and not DTD: ProfileParser profParser = new ProfileParser(false); and just add how to retrieve the warning of the validation which aren't in the HAPI one.
Field Summary | |
---|---|
private ca.uhn.hl7v2.parser.EncodingCharacters |
enc
|
private static ca.uhn.log.HapiLog |
log
|
Constructor Summary | |
---|---|
MessageValidator()
Creates a new instance of DefaultValidator |
Method Summary | |
---|---|
private void |
addTableTestResult(java.util.ArrayList exList,
java.lang.String profileID,
java.lang.String codeSystem,
java.lang.String value)
|
private void |
addToList(ca.uhn.hl7v2.HL7Exception[] exceptions,
java.util.ArrayList list)
Appends an array of HL7 exceptions to a list |
private ca.uhn.hl7v2.HL7Exception[] |
checkExtraComponents(ca.uhn.hl7v2.model.Composite comp,
int numInProfile)
Tests for extra components (ie any not defined in the profile) |
private ca.uhn.hl7v2.HL7Exception[] |
checkForExtraFields(ca.uhn.hl7v2.model.Segment segment,
java.util.ArrayList allowedFields)
Checks a segment against a list of allowed fields (ie those mentioned in the profile with usage other than X). |
private ca.uhn.hl7v2.HL7Exception[] |
checkForExtraStructures(ca.uhn.hl7v2.model.Group group,
java.util.ArrayList allowedStructures)
Checks a group's children against a list of allowed structures for the group (ie those mentioned in the profile with usage other than X). |
private boolean |
hasContent(ca.uhn.hl7v2.model.Group group)
Returns true is there is content in the given group |
private boolean |
hasContent(ca.uhn.hl7v2.model.Segment segment)
Returns true is there is content in the given segment |
private boolean |
hasContent(ca.uhn.hl7v2.model.Structure struct)
Returns true is there is content in the given structure |
private boolean |
hasContent(ca.uhn.hl7v2.model.Type type)
Returns true is there is content in the given type |
private static java.lang.String |
loadFile(java.lang.String path)
loads file at the given path |
static void |
main(java.lang.String[] args)
|
private java.lang.String |
makeTableName(java.lang.String hl7Table)
|
protected ca.uhn.hl7v2.HL7Exception |
testCardinality(int reps,
int min,
int max,
java.lang.String usage,
java.lang.String name)
Checks cardinality and creates an appropriate exception if out of bounds. |
ca.uhn.hl7v2.HL7Exception[] |
testComponent(ca.uhn.hl7v2.model.Type type,
ca.uhn.hl7v2.conf.spec.message.Component profile,
java.lang.String profileID)
|
ca.uhn.hl7v2.HL7Exception[] |
testField(ca.uhn.hl7v2.model.Type type,
ca.uhn.hl7v2.conf.spec.message.Field profile,
boolean escape,
java.lang.String profileID)
|
ca.uhn.hl7v2.HL7Exception[] |
testGroup(ca.uhn.hl7v2.model.Group group,
ca.uhn.hl7v2.conf.spec.message.AbstractSegmentContainer profile,
java.lang.String profileID)
Tests a group against a group section of a profile. |
ca.uhn.hl7v2.HL7Exception |
testLength(ca.uhn.hl7v2.model.Type type,
int maxLength)
Tests whether the given type falls within a maximum length. |
ca.uhn.hl7v2.HL7Exception[] |
testSegment(ca.uhn.hl7v2.model.Segment segment,
ca.uhn.hl7v2.conf.spec.message.Seg profile,
java.lang.String profileID)
Tests a segment against a segment section of a profile. |
ca.uhn.hl7v2.HL7Exception[] |
testStructure(ca.uhn.hl7v2.model.Structure s,
ca.uhn.hl7v2.conf.spec.message.ProfileStructure profile,
java.lang.String profileID)
Tests a structure (segment or group) against the corresponding part of a profile. |
ca.uhn.hl7v2.HL7Exception[] |
testType(ca.uhn.hl7v2.model.Type type,
ca.uhn.hl7v2.conf.spec.message.AbstractComponent profile,
java.lang.String encoded,
java.lang.String profileID)
Tests a Type against the corresponding section of a profile. |
private ca.uhn.hl7v2.HL7Exception[] |
testTypeAgainstTable(ca.uhn.hl7v2.model.Type type,
ca.uhn.hl7v2.conf.spec.message.AbstractComponent profile,
java.lang.String profileID)
Tests table values for ID, IS, and CE types. |
private ca.uhn.hl7v2.HL7Exception |
testUsage(java.lang.String encoded,
java.lang.String usage,
java.lang.String name)
Tests an element against the corresponding usage code. |
private ca.uhn.hl7v2.HL7Exception |
testValueAgainstTable(java.lang.String profileID,
java.lang.String codeSystem,
java.lang.String value)
|
private ca.uhn.hl7v2.HL7Exception[] |
toArray(java.util.ArrayList list)
Returns the HL7 exceptions in the given arraylist in an array |
ca.uhn.hl7v2.HL7Exception[] |
validate(ca.uhn.hl7v2.model.Message message,
ca.uhn.hl7v2.conf.spec.message.StaticDef profile)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private ca.uhn.hl7v2.parser.EncodingCharacters enc
private static final ca.uhn.log.HapiLog log
Constructor Detail |
---|
public MessageValidator()
Method Detail |
---|
public ca.uhn.hl7v2.HL7Exception[] validate(ca.uhn.hl7v2.model.Message message, ca.uhn.hl7v2.conf.spec.message.StaticDef profile) throws ca.uhn.hl7v2.conf.ProfileException, ca.uhn.hl7v2.HL7Exception
validate
in interface ca.uhn.hl7v2.conf.check.Validator
ca.uhn.hl7v2.conf.ProfileException
ca.uhn.hl7v2.HL7Exception
Validator.validate(ca.uhn.hl7v2.model.Message, ca.uhn.hl7v2.conf.spec.message.StaticDef)
public ca.uhn.hl7v2.HL7Exception[] testGroup(ca.uhn.hl7v2.model.Group group, ca.uhn.hl7v2.conf.spec.message.AbstractSegmentContainer profile, java.lang.String profileID) throws ca.uhn.hl7v2.conf.ProfileException
ca.uhn.hl7v2.conf.ProfileException
private ca.uhn.hl7v2.HL7Exception[] checkForExtraStructures(ca.uhn.hl7v2.model.Group group, java.util.ArrayList allowedStructures) throws ca.uhn.hl7v2.conf.ProfileException
ca.uhn.hl7v2.conf.ProfileException
protected ca.uhn.hl7v2.HL7Exception testCardinality(int reps, int min, int max, java.lang.String usage, java.lang.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 ca.uhn.hl7v2.HL7Exception[] testStructure(ca.uhn.hl7v2.model.Structure s, ca.uhn.hl7v2.conf.spec.message.ProfileStructure profile, java.lang.String profileID) throws ca.uhn.hl7v2.conf.ProfileException
ca.uhn.hl7v2.conf.ProfileException
public ca.uhn.hl7v2.HL7Exception[] testSegment(ca.uhn.hl7v2.model.Segment segment, ca.uhn.hl7v2.conf.spec.message.Seg profile, java.lang.String profileID) throws ca.uhn.hl7v2.conf.ProfileException
ca.uhn.hl7v2.conf.ProfileException
private ca.uhn.hl7v2.HL7Exception[] checkForExtraFields(ca.uhn.hl7v2.model.Segment segment, java.util.ArrayList allowedFields) throws ca.uhn.hl7v2.conf.ProfileException
allowedFields
- an array of Integers containing field #s of allowed fields
ca.uhn.hl7v2.conf.ProfileException
public ca.uhn.hl7v2.HL7Exception[] testType(ca.uhn.hl7v2.model.Type type, ca.uhn.hl7v2.conf.spec.message.AbstractComponent profile, java.lang.String encoded, java.lang.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 ca.uhn.hl7v2.HL7Exception testLength(ca.uhn.hl7v2.model.Type type, int maxLength)
private ca.uhn.hl7v2.HL7Exception testUsage(java.lang.String encoded, java.lang.String usage, java.lang.String name)
encoded
- the pipe-encoded message elementusage
- the usage code (e.g. "CE")name
- the name of the element (for use in exception messages)private ca.uhn.hl7v2.HL7Exception[] testTypeAgainstTable(ca.uhn.hl7v2.model.Type type, ca.uhn.hl7v2.conf.spec.message.AbstractComponent profile, java.lang.String profileID)
private void addTableTestResult(java.util.ArrayList exList, java.lang.String profileID, java.lang.String codeSystem, java.lang.String value)
private ca.uhn.hl7v2.HL7Exception testValueAgainstTable(java.lang.String profileID, java.lang.String codeSystem, java.lang.String value)
private java.lang.String makeTableName(java.lang.String hl7Table)
public ca.uhn.hl7v2.HL7Exception[] testField(ca.uhn.hl7v2.model.Type type, ca.uhn.hl7v2.conf.spec.message.Field profile, boolean escape, java.lang.String profileID) throws ca.uhn.hl7v2.conf.ProfileException
ca.uhn.hl7v2.conf.ProfileException
public ca.uhn.hl7v2.HL7Exception[] testComponent(ca.uhn.hl7v2.model.Type type, ca.uhn.hl7v2.conf.spec.message.Component profile, java.lang.String profileID) throws ca.uhn.hl7v2.conf.ProfileException
ca.uhn.hl7v2.conf.ProfileException
private ca.uhn.hl7v2.HL7Exception[] checkExtraComponents(ca.uhn.hl7v2.model.Composite comp, int numInProfile) throws ca.uhn.hl7v2.conf.ProfileException
ca.uhn.hl7v2.conf.ProfileException
private boolean hasContent(ca.uhn.hl7v2.model.Structure struct) throws ca.uhn.hl7v2.HL7Exception
ca.uhn.hl7v2.HL7Exception
private boolean hasContent(ca.uhn.hl7v2.model.Group group) throws ca.uhn.hl7v2.HL7Exception
ca.uhn.hl7v2.HL7Exception
private boolean hasContent(ca.uhn.hl7v2.model.Segment segment)
private boolean hasContent(ca.uhn.hl7v2.model.Type type)
private void addToList(ca.uhn.hl7v2.HL7Exception[] exceptions, java.util.ArrayList list)
private ca.uhn.hl7v2.HL7Exception[] toArray(java.util.ArrayList list)
private static java.lang.String loadFile(java.lang.String path) throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args)
args
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |