Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## be.fgov.ehealth.ehvalidator.core
Class EhValidator

    java.lang.Object
      be.fgov.ehealth.ehvalidator.core.EhValidator

    public class EhValidator

extends Object

# EhValidator

This library can help software makers or command-line enthusiasts to validate a file against the Sumehr standard. These standards are published by the e-Health platform on the KMEHR website. For a file to be validated, it must use the kmehr namespace (`xmlns="http://www.ehealth.fgov.be/standards/kmehr/schema/v1"`). A Sumehr is considered valid if and only if the validation report contains no lines with `Error`, `Warning` messages are allowed. Depending on the type of file, the result of the validation will be as follows :

File Type | Validation Result | Comments
Any file but a Kmehr Document | Failure | This will generate an `EhValidatorXmlValidationException` - The file will fail the basic XML checks
A Kmehr Document that does not follow the Sumehr Standard | Failure | This will produce a validation report containing at least one `Error`
A Sumehr Document | Success | This will produce a validation report containing no `Error` messages. `Warning` messages may be present.

Since:
  1.0
Author:
  Charles-Louis de Maere

Nested Class Summary
`static class` | `EhValidator.Language` allowed languages.
`static class` | `EhValidator.ValidationResult` Validation results.

Constructor Summary
`EhValidator()`

Method Summary
`static String` | `getHTMLReport(String fileName)` This method performs a validation of the file whose file name is provided as parameter.
`static String` | `getHTMLReport(String fileName, EhValidator.Language language)` This method performs a validation of the file whose file name and language are provided as parameters.
`static String` | `getHTMLReport(String fileName, EhValidator.Language language, String rules)` This method performs a validation of the file whose file name, language and set of rules are provided as parameters.
`static String` | `getHTMLView(String fileName)` This method allows to get the HTML representation of a valid Sumehr file.
`static String` | `getHTMLView(String fileName, EhValidator.Language language)` This method allows to get the HTML representation of a valid Sumehr file.
`static String` | `getHTMLView(String fileName, EhValidator.Language language, String rules)` This method allows to get the HTML representation of a valid Sumehr file.
`static String` | `getXMLReport(String fileName)` This method performs a validation of the file whose file name is provided as parameter.
`static String` | `getXMLReport(String fileName, String rules)` This method performs a validation of the file whose file name and set of rules are provided as parameter.
`static String` | `getXMLReport(String fileName, String rules, boolean flagTable)` This method is used by the GUI to display the report table.
`static void` | `main(String[] args)` This is the main method of the eHealth Validator, used when run in command-line mode.
`static EhValidator.ValidationResult` | `validate(String fileName)`
`static EhValidator.ValidationResult` | `validate(String fileName, String rules)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### EhValidator

    public EhValidator()

Method Detail

### getHTMLReport

    public static String getHTMLReport(String fileName)
                                throws SAXException

  This method performs a validation of the file whose file name is provided as parameter. The method then returns a `String` containing the validation report in HTML format.

  Parameters:
    `fileName` - Name of the file to validate.
  Returns:
    a `String` containing the HTML representation of the report.
  Throws:
    `SAXException`

### getHTMLReport

    public static String getHTMLReport(String fileName,
                                       EhValidator.Language language)
                                throws SAXException

  This method performs a validation of the file whose file name and language are provided as parameters. The method then returns a `String` containing the validation report in HTML format.

  Parameters:
    `fileName` - Name of the file to validate.
    `language` - Default language for Sumehr visualization.
    `rules` - Set of rules to use for the validation. (Sumehr only actually)
  Returns:
    a `String` containing the HTML representation of the report.
  Throws:
    `SAXException`

### getHTMLReport

    public static String getHTMLReport(String fileName,
                                       EhValidator.Language language,
                                       String rules)
                                throws SAXException

  This method performs a validation of the file whose file name, language and set of rules are provided as parameters. The method then returns a `String` containing the validation report in HTML format.

  Parameters:
    `fileName` - Name of the file to validate.
    `language` - Default language for Sumehr visualization.
    `rules` - Set of rules to use for the validation. ("Sumehr" or "GPMigration")
  Returns:
    a `String` containing the HTML representation of the report.
  Throws:
    `SAXException`

### getXMLReport

    public static String getXMLReport(String fileName)
                               throws SAXException

  This method performs a validation of the file whose file name is provided as parameter. The method then returns a `String` containing the validation report in XML format. The report uses the following format :

       <report>
            <header>
                <validationResult>
                    <errors> </errors>
                    <warnings> </warnings>
                </validationResult>
            </header>
            <messages>
                <message>
                    <type> </type>
                    <subject> </subject>
                    <description>
                        <en> </en>
                        <fr> </fr>
                        <nl> </nl>
                        <de> </de>
                    </description>
                    <line> </line>
                    <col> </col>
                    <location> </location>
                    <test> </test>
                </message>
                ...
            </messages>
       </report>

  Parameters:
    `fileName` - Name of the file to validate
  Returns:
    a `String` containing an XML representation of the report.
  Throws:
    `SAXException`

### getXMLReport

    public static String getXMLReport(String fileName,
                                      String rules)
                               throws SAXException

  This method performs a validation of the file whose file name and set of rules are provided as parameter. The method then returns a `String` containing the validation report in XML format. The report uses the following format :

       <report>
            <header>
                <validationResult>
                    <errors> </errors>
                    <warnings> </warnings>
                </validationResult>
            </header>
            <messages>
                <message>
                    <type> </type>
                    <subject> </subject>
                    <description>
                        <en> </en>
                        <fr> </fr>
                        <nl> </nl>
                        <de> </de>
                    </description>
                    <line> </line>
                    <col> </col>
                    <location> </location>
                    <test> </test>
                </message>
                ...
            </messages>
       </report>

  Parameters:
    `fileName` - Name of the file to validate.
    `rules` - Set of rules to use for the validation.
  Returns:
    a `String` containing an XML representation of the report.
  Throws:
    `SAXException`

### getXMLReport

    public static String getXMLReport(String fileName,
                                      String rules,
                                      boolean flagTable)
                               throws SAXException

  This method is used by the GUI to display the report table.

  Parameters:
    `fileName` - Name of the file to validate.
    `rules` - Set of rules to use for the validation.
    `flagTable` - Flag used by the Gui to determine if the report is for the report table. false is default use, should be turned to true if experiencing problem with accentued characters.
  Returns:
    a `String` containing an XML representation of the report.
  Throws:
    `SAXException`

### getHTMLView

    public static String getHTMLView(String fileName)
                              throws EhValidatorXmlValidationException,
                                     EhValidatorSchematronException,
                                     EhValidatorXsltTransformException

  This method allows to get the HTML representation of a valid Sumehr file. If the file is valid, and can be viewed as `HTML`, it returns a `String` representation of this `HTML` visualisation. Use english as default language for Sumehr visualization.

  Parameters:
    `fileName` - Name of the Sumehr file to view as HTML. It should be a valid Sumehr.
  Returns:
    a `String` containing an HTML representation of the Sumehr.
  Throws:
    `EhValidatorXmlValidationException` - when the file fails basic schema validation.
    `EhValidatorSchematronException` - when the file is not a valid sumehr, and there were issues with the schematron validation.
    `EhValidatorXsltTransformException` - when there was an issue producing the `HTML` view of the file.

### getHTMLView

    public static String getHTMLView(String fileName,
                                     EhValidator.Language language)
                              throws EhValidatorXmlValidationException,
                                     EhValidatorSchematronException,
                                     EhValidatorXsltTransformException

  This method allows to get the HTML representation of a valid Sumehr file. If the file is valid, and can be viewed as `HTML`, it returns a `String` representation of this `HTML` visualisation. Use Sumehr as default set of rules.

  Parameters:
    `fileName` - Name of the file to validate.
    `language` - Default language for Sumehr visualization.
  Returns:
    a `String` containing an HTML representation of the Sumehr.
  Throws:
    `EhValidatorXmlValidationException`
    `EhValidatorSchematronException`
    `EhValidatorXsltTransformException`

### getHTMLView

    public static String getHTMLView(String fileName,
                                     EhValidator.Language language,
                                     String rules)
                              throws EhValidatorXmlValidationException,
                                     EhValidatorSchematronException,
                                     EhValidatorXsltTransformException

  This method allows to get the HTML representation of a valid Sumehr file. If the file is valid, and can be viewed as `HTML`, it returns a `String` representation of this `HTML` visualisation.

  Parameters:
    `fileName` - Name of the Sumehr file to view as HTML. It should be a valid Sumehr.
    `language` - Default language for Sumehr visualization.
    `rules` - Set of rules to use for the validation. ("Sumehr" or "GPMigration")
  Returns:
    a `String` containing an HTML representation of the Sumehr.
  Throws:
    `EhValidatorXmlValidationException` - when the file fails basic schema validation.
    `EhValidatorSchematronException` - when the file is not a valid sumehr, and there were issues with the schematron validation.
    `EhValidatorXsltTransformException` - when there was an issue producing the `HTML` view of the file.

### validate

    public static EhValidator.ValidationResult validate(String fileName,
                                                        String rules)
                                                 throws EhValidatorXmlValidationException,
                                                        EhValidatorSchematronException

  Parameters:
    `fileName` - Name of the Sumehr file to validate. It should be a valid Kmehr.
    `rules` - Set of rules to use for the validation. ("Sumehr" or "GPMigration")
  Returns:
    a `boolean` containing true if the input file is a correct Sumehr, false otherwise.
  Throws:
    `EhValidatorXmlValidationException` - when the file fails basic schema validation.
    `EhValidatorSchematronException` - when the file is not a valid sumehr, and there were issues with the schematron validation.

### validate

    public static EhValidator.ValidationResult validate(String fileName)
                                                 throws EhValidatorXmlValidationException,
                                                        EhValidatorSchematronException

  Parameters:
    `fileName` - Name of the Sumehr file to validate.
  Returns:
    The validation result.
  Throws:
    `EhValidatorXmlValidationException`
    `EhValidatorSchematronException`

### main

    public static void main(String[] args)

  This is the main method of the eHealth Validator, used when run in command-line mode. In this mode, the tool can be used as follows :

  > `ehvalidator-core-0.1.0.jar [option] [choice] [inputfile]`

  #### Options:

  -v|--version : Show version info and halt
  -h|--help|-? : Show usage
  -r|--request : Execute validation

  #### Choices:

  validation : Get Validation Result
  xmlreport : Get Report as XML
  htmlreport : Get Report as HTML
  htmlview : Get View as HTML (default language : english)
  htmlviewen : Get View as HTML with english as default language
  htmlviewfr : Get View as HTML with french as default language
  htmlviewnl : Get View as HTML with dutch as default language
  htmlviewde : Get View as HTML with german as default language

  #### Example:

  > `ehvalidator-core-0.1.0.jar -request xmlreport sumehrdocument.xml`

  Parameters:
    `args` - The arguments as defined above.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

eHealth Validator Master project 1.2.0 API
Copyright © 2011 Smals. All Rights Reserved.