Package ca.uhn.hl7v2.conf.spec

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


        Validator validator = context.getConformanceValidator();
        try {
            ProfileStore profileStore = context.getProfileStore();
            String profileString = profileStore.getProfile(id);
            if (profileString != null) {
                RuntimeProfile profile = PARSER.parse(profileString);              
                exceptions = validator.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


    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

      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"));

    // 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

      in.read(cbuf, 0, (int) f.length());
      String xml = String.valueOf(cbuf);
      // System.out.println(xml);

      ProfileParser pp = new ProfileParser(true);
      RuntimeProfile spec = pp.parse(xml);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
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

      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

        }
        return declaredProfiles.toArray(new String[declaredProfiles.size()]);
    }

    private synchronized RuntimeProfile getProfile(String profileString) throws ProfileException {
        RuntimeProfile profile = PROFILE_CACHE.get(profileString);
        if (profile == null) {
            profile = PARSER.parse(profileString);
            if (enableCaching) PROFILE_CACHE.put(profileString, profile);
        }
        return profile;
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.