Package ca.uhn.hl7v2.conf.spec

Examples of ca.uhn.hl7v2.conf.spec.RuntimeProfile


    int bytesRead;
    while ((bytesRead = stream.read(buffer)) > 0) {
      profileString.append(new String(buffer, 0, bytesRead));
    }

    RuntimeProfile profile = new RuntimeProfile();
    Document doc = parseIntoDOM(profileString.toString());

    Element root = doc.getDocumentElement();
    profile.setHL7Version(root.getAttribute("HL7Version"));

    // get static definition
    NodeList nl = root.getElementsByTagName("HL7v2xStaticDef");
    Element staticDef = (Element) nl.item(0);
    StaticDef sd = parseStaticProfile(staticDef);
    profile.setMessage(sd);
    return profile;
  }
View Full Code Here


  /**
   * Parses an XML profile string into a RuntimeProfile object.
   */
  public RuntimeProfile parse(String profileString) throws ProfileException {
    RuntimeProfile profile = new RuntimeProfile();
    Document doc = parseIntoDOM(profileString);

    Element root = doc.getDocumentElement();
    profile.setHL7Version(root.getAttribute("HL7Version"));

    NodeList metadataList = root.getElementsByTagName("MetaData");
    if (metadataList.getLength() > 0) {
      Element metadata = (Element) metadataList.item(0);
      String name = metadata.getAttribute("Name");
      profile.setName(name);
    }

    // get static definition
    NodeList nl = root.getElementsByTagName("HL7v2xStaticDef");
    Element staticDef = (Element) nl.item(0);
    StaticDef sd = parseStaticProfile(staticDef);
    profile.setMessage(sd);
    return profile;
  }
View Full Code Here

        DefaultValidator val = new DefaultValidator();
        try {
            String profileString = ProfileStoreFactory.getProfileStore().getProfile(id);
            if (profileString != null) {
                ProfileParser profParser = new ProfileParser(true);
                RuntimeProfile profile = profParser.parse(profileString);
               
                exceptions = val.validate(message, profile.getMessage());
            } else {
                throw new ProfileException("Unable to find the profile " + id);
            }
        } catch (IOException e) {
            throw new ProfileException("Error retreiving profile " + id, e);
View Full Code Here

        + "PID|1||29^^CAISI_1-2^PI~\"\"||Test300^Leticia^^^^^L||19770202|M||||||||||||||||||||||";
    Message validMessage = new PipeParser().parse(validMessageString);

    // Load a conformance profile
    ProfileParser profileParser = new ProfileParser(false);
    RuntimeProfile profile = profileParser.parseClasspath("ca/uhn/hl7v2/examples/profiles/ADT_A31.xml");

    // Create a conformance validator, and validate
    DefaultValidator validator = new DefaultValidator();
    HL7Exception[] exceptions = validator.validate(validMessage, profile.getMessage());
   
    System.out.println("Found " + exceptions.length + " problems");
    for (int i = 0; i < exceptions.length; i++) {
      HL7Exception exception = exceptions[i];
      System.out.println(" * " + exception.getClass().getSimpleName() + " - " + exception.getMessage());
View Full Code Here

        + "PID|1||29^^CAISI_1-2^PI~\"\"||Test300^Leticia^^^^^L||19770202|M||||||||||||||||||||||";
    Message validMessage = new PipeParser().parse(validMessageString);

    // Load a conformance profile
    ProfileParser profileParser = new ProfileParser(false);
    RuntimeProfile profile = profileParser.parseClasspath("ca/uhn/hl7v2/examples/profiles/ADT_A31.xml");

    // Create a conformance validator, and validate
    DefaultValidator validator = new DefaultValidator();
    HL7Exception[] exceptions = validator.validate(validMessage, profile.getMessage());
   
    System.out.println("Found " + exceptions.length + " problems");
    for (int i = 0; i < exceptions.length; i++) {
      HL7Exception exception = exceptions[i];
      System.out.println(" * " + exception.getClass().getSimpleName() + " - " + exception.getMessage());
View Full Code Here

            Parser parser = new GenericParser();
            Message message = parser.parse(msgString);
           
            String profileString = loadFile(args[1]);
            ProfileParser profParser = new ProfileParser(true);
            RuntimeProfile profile = profParser.parse(profileString);
           
            HL7Exception[] exceptions = val.validate(message, profile.getMessage());
           
            System.out.println("Exceptions: ");
            for (int i = 0; i < exceptions.length; i++) {
                System.out.println((i + 1) + ". " + exceptions[i].getMessage());
            }
View Full Code Here

            Parser parser = new GenericParser();
            Message message = parser.parse(msgString);
           
            String profileString = loadFile(args[1]);
            ProfileParser profParser = new ProfileParser(true);
            RuntimeProfile profile = profParser.parse(profileString);
           
            HL7Exception[] exceptions = val.validate(message, profile.getMessage());
           
            System.out.println("Exceptions: ");
            for (int i = 0; i < exceptions.length; i++) {
                System.out.println((i + 1) + ". " + exceptions[i].getMessage());
            }
View Full Code Here

    int bytesRead;
    while ((bytesRead = stream.read(buffer)) > 0) {
      profileString.append(new String(buffer, 0, bytesRead));
    }

    RuntimeProfile profile = new RuntimeProfile();
    Document doc = parseIntoDOM(profileString.toString());

    Element root = doc.getDocumentElement();
    profile.setHL7Version(root.getAttribute("HL7Version"));

    // get static definition
    NodeList nl = root.getElementsByTagName("HL7v2xStaticDef");
    Element staticDef = (Element) nl.item(0);
    StaticDef sd = parseStaticProfile(staticDef);
    profile.setMessage(sd);
    return profile;
  }
View Full Code Here

  /**
   * Parses an XML profile string into a RuntimeProfile object.
   */
  public RuntimeProfile parse(String profileString) throws ProfileException {
    RuntimeProfile profile = new RuntimeProfile();
    Document doc = parseIntoDOM(profileString);

    Element root = doc.getDocumentElement();
    profile.setHL7Version(root.getAttribute("HL7Version"));

    NodeList metadataList = root.getElementsByTagName("MetaData");
    if (metadataList.getLength() > 0) {
      Element metadata = (Element) metadataList.item(0);
      String name = metadata.getAttribute("Name");
      profile.setName(name);
    }
   
    // get static definition
    NodeList nl = root.getElementsByTagName("HL7v2xStaticDef");
    Element staticDef = (Element) nl.item(0);
    StaticDef sd = parseStaticProfile(staticDef);
    profile.setMessage(sd);
    return profile;
  }
View Full Code Here

        DefaultValidator val = new DefaultValidator();
        try {
            String profileString = ProfileStoreFactory.getProfileStore().getProfile(id);
            if (profileString != null) {
                ProfileParser profParser = new ProfileParser(true);
                RuntimeProfile profile = profParser.parse(profileString);
               
                exceptions = val.validate(message, profile.getMessage());
            } else {
                throw new ProfileException("Unable to find the profile " + id);
            }
        } catch (IOException e) {
            throw new ProfileException("Error retreiving profile " + id, e);
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.conf.spec.RuntimeProfile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.