eu.ihe.validator
Class ValidationAPI

java.lang.Object
  extended by eu.ihe.validator.ValidationAPI

public class ValidationAPI
extends java.lang.Object

Class for the validation and the parsing

Author:
Jo�la Francisco used HAPI and Message Maker source code

Field Summary
 ca.uhn.hl7v2.HL7Exception[] errs
           
 boolean isparsing
           
private static ca.uhn.log.HapiLog log
           
private  java.util.Vector vct
           
 
Constructor Summary
ValidationAPI()
           
 
Method Summary
private  java.lang.String createErrorFile(java.lang.String path)
           
private  java.lang.String createErrorPath(java.lang.String path, java.lang.String extension)
          Generate default path from the in-file message
 ca.uhn.hl7v2.model.Message getMessageModel(java.lang.String[] es)
          Used HAPI to parse .hl7 en .xml TO instatiate a message class ca.uhn.hl7v2.model.vxx.message.MsgStructID
private  java.lang.String loadFile(java.lang.String path)
          To load any message file I should use
private static java.lang.String loadProfile(java.lang.String path)
          loads a profile file
 void loadTable(java.io.File table_path)
           
static void main(java.lang.String[] args)
          the usage of the class always the message in first and the profile message after
 void P2X2P(java.lang.String[] es)
          Parse an ER7 message to XML and The XML one in ER7
 java.lang.String parsefileextension(java.lang.String infilepath)
          Create the path of the parsing file by default
 java.lang.String parsefileextension(java.lang.String infilepath, java.lang.String encode)
           
 void parsers(java.lang.String[] args)
          To parse an ER7 or HL7 message
 void validation(java.lang.String[] args)
          Validate an ER7 or HL7 messsage against an profil of message XML
 boolean validMessageAgainstProfile(java.lang.String[] es)
          validate a message against a profile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errs

public ca.uhn.hl7v2.HL7Exception[] errs

vct

private java.util.Vector vct

isparsing

public boolean isparsing

log

private static final ca.uhn.log.HapiLog log
Constructor Detail

ValidationAPI

public ValidationAPI()
Method Detail

P2X2P

public void P2X2P(java.lang.String[] es)
           throws java.lang.Exception
Parse an ER7 message to XML and The XML one in ER7

Parameters:
path - to the in and out file
Throws:
java.lang.Exception

getMessageModel

public ca.uhn.hl7v2.model.Message getMessageModel(java.lang.String[] es)
                                           throws java.lang.Exception
Used HAPI to parse .hl7 en .xml TO instatiate a message class ca.uhn.hl7v2.model.vxx.message.MsgStructID

Parameters:
es - : String[2] path to (.hl7)file and path to the output file (.xml)
Returns:
ca.uhn.hl7v2.model.vxx.message.MsgStructID
Throws:
java.lang.Exception - java.io.Exception

loadFile

private java.lang.String loadFile(java.lang.String path)
                           throws java.io.IOException
To load any message file I should use

Parameters:
String - :filePath
Returns:
String : message
Throws:
java.io.IOException

parsefileextension

public java.lang.String parsefileextension(java.lang.String infilepath)
Create the path of the parsing file by default

Parameters:
ou - : the in-file path

parsefileextension

public java.lang.String parsefileextension(java.lang.String infilepath,
                                           java.lang.String encode)

loadTable

public void loadTable(java.io.File table_path)

validMessageAgainstProfile

public boolean validMessageAgainstProfile(java.lang.String[] es)
validate a message against a profile

Parameters:
es - : path to the in out and log path message in first (.hl7/.xml) and profil(.xml)
Returns:
boolean: the result of the validation

createErrorPath

private java.lang.String createErrorPath(java.lang.String path,
                                         java.lang.String extension)
                                  throws java.lang.Exception
Generate default path from the in-file message

Parameters:
ou - : in-message file path
Returns:
String : out path
Throws:
java.lang.Exception - :file not found exception

createErrorFile

private java.lang.String createErrorFile(java.lang.String path)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

validation

public void validation(java.lang.String[] args)
                throws java.lang.Exception
Validate an ER7 or HL7 messsage against an profil of message XML

Parameters:
args - : path for the in and out file
Throws:
java.lang.Exception

parsers

public void parsers(java.lang.String[] args)
             throws java.lang.Exception
To parse an ER7 or HL7 message

Parameters:
the - in and out file path
Throws:
java.lang.Exception

loadProfile

private static java.lang.String loadProfile(java.lang.String path)
                                     throws java.io.IOException
loads a profile file

Parameters:
String - path
Returns:
String profile
Throws:
java.io.IOException
See Also:
can load any file

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
the usage of the class always the message in first and the profile message after

Parameters:
args[2]: - path to message in (.hl7 or .xml) and profil(.xml)
Throws:
java.lang.Exception - File not found