Package ca.uhn.hl7v2.validation

Examples of ca.uhn.hl7v2.validation.MessageValidator.validate()


            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


    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

    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

            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

            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

        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

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

            Message message = exchange.getIn().getBody(Message.class);
            ValidationContext context = validatorExpression != null
                    ? validatorExpression.evaluate(exchange, ValidationContext.class)
                    : dynamicValidationContext(message, exchange.getIn().getHeader(HL7Constants.HL7_CONTEXT, HapiContext.class));
            MessageValidator validator = new MessageValidator(context, false);
            return validator.validate(message);
        } catch (HL7Exception e) {
            throw ObjectHelper.wrapRuntimeCamelException(e);
        }
    }
View Full Code Here

    @Override
    public boolean matches(Exchange exchange) {
        try {
            ValidationContext context = validatorExpression.evaluate(exchange, ValidationContext.class);
            MessageValidator validator = new MessageValidator(context, false);
            return validator.validate(exchange.getIn().getBody(Message.class));
        } catch (HL7Exception e) {
            throw ObjectHelper.wrapRuntimeCamelException(e);
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.