当前位置: 首页>>代码示例>>Java>>正文


Java ValidationContextFactory类代码示例

本文整理汇总了Java中ca.uhn.hl7v2.validation.impl.ValidationContextFactory的典型用法代码示例。如果您正苦于以下问题:Java ValidationContextFactory类的具体用法?Java ValidationContextFactory怎么用?Java ValidationContextFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ValidationContextFactory类属于ca.uhn.hl7v2.validation.impl包,在下文中一共展示了ValidationContextFactory类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doPreSetup

import ca.uhn.hl7v2.validation.impl.ValidationContextFactory; //导入依赖的package包/类
@Override
protected void doPreSetup() throws Exception {
    defaultValidationContext = ValidationContextFactory.defaultValidation();
    defaultContext = new DefaultHapiContext(defaultValidationContext);
    // we validate separately, not during parsing or rendering
    defaultContext.getParserConfiguration().setValidating(false);

    ValidationRuleBuilder builder = new ValidationRuleBuilder() {
        private static final long serialVersionUID = 1L;

        @Override
        protected void configure() {
            forVersion(Version.V24)
                    .message("ADT", "A01")
                    .terser("PID-8", not(empty()));
        }
    };
    customValidationContext = ValidationContextFactory.fromBuilder(builder);
    customContext = new DefaultHapiContext(customValidationContext);
    // we validate separately, not during parsing or rendering
    customContext.getParserConfiguration().setValidating(false);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:MessageValidatorTest.java

示例2: getContext

import ca.uhn.hl7v2.validation.impl.ValidationContextFactory; //导入依赖的package包/类
public static DefaultHapiContext getContext (String version) {
	DefaultHapiContext c = contexts.get(version);
	if (c == null) {
		switch (version) {
			case DEFAULT_VERSION:
				c = new DefaultHapiContext();
				break;
			case GENERIC_VERSION:
				c = new DefaultHapiContext(new GenericModelClassFactory());
				break;
			case HIGHEST_VERSION:
				c = getContext(Version.latestVersion().getVersion());
				break;
			default:
				c = new DefaultHapiContext(new CanonicalModelClassFactory(version));
				break;
		}
		c.setValidationContext(ValidationContextFactory.noValidation());
		contexts.put(version, c);
	}
	return c;
}
 
开发者ID:alexyz,项目名称:hl7,代码行数:23,代码来源:MsgUtil.java

示例3: createRouteBuilder

import ca.uhn.hl7v2.validation.impl.ValidationContextFactory; //导入依赖的package包/类
protected RouteBuilder createRouteBuilder() throws Exception {
    HapiContext hapiContext = new DefaultHapiContext();
    hapiContext.setValidationContext(new NoValidation());
    Parser p = new GenericParser(hapiContext);
    hl7 = new HL7DataFormat();
    hl7.setParser(p);
    
    /*
     * Let's start by adding a validation rule to the default validation
     * that disallows PID-2 to be empty.
     */
    ValidationRuleBuilder builder = new ValidationRuleBuilder() {
        private static final long serialVersionUID = 1L;

        @Override
        protected void configure() {
            forVersion(Version.V24)
                    .message("ADT", "*")
                    .terser("PID-2", not(empty()));
        }
    };
    ValidationContext customValidationContext = ValidationContextFactory.fromBuilder(builder);
    
    HapiContext customContext = new DefaultHapiContext(customValidationContext);
    final Parser customParser = new GenericParser(customContext);
    
    return new RouteBuilder() {
        public void configure() throws Exception {
            from("direct:unmarshalFailed").unmarshal().hl7().to("mock:unmarshal");
            from("direct:unmarshalOk").unmarshal().hl7(false).to("mock:unmarshal");
            from("direct:unmarshalOkCustom").unmarshal(hl7).to("mock:unmarshal");
            from("direct:start1").marshal().hl7(customParser).to("mock:end");
            from("direct:start2").marshal().hl7(true).to("mock:end");
            
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:38,代码来源:HL7ValidateTest.java


注:本文中的ca.uhn.hl7v2.validation.impl.ValidationContextFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。