• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ValidationContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: matches

import ca.uhn.hl7v2.validation.ValidationContext; //导入依赖的package包/类
@Override
public boolean matches(Exchange exchange) {
    try {
        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);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:ValidationContextPredicate.java


示例2: createRouteBuilder

import ca.uhn.hl7v2.validation.ValidationContext; //导入依赖的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


示例3: matches

import ca.uhn.hl7v2.validation.ValidationContext; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:KingsCollegeHospital,项目名称:rassyeyanie,代码行数:11,代码来源:ValidationContextPredicate.java


示例4: ValidationContextPredicate

import ca.uhn.hl7v2.validation.ValidationContext; //导入依赖的package包/类
public ValidationContextPredicate(ValidationContext validationContext) {
    this(ExpressionBuilder.constantExpression(validationContext));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:ValidationContextPredicate.java


示例5: dynamicValidationContext

import ca.uhn.hl7v2.validation.ValidationContext; //导入依赖的package包/类
private ValidationContext dynamicValidationContext(Message message, HapiContext hapiContext) {
    return hapiContext != null
            ? hapiContext.getValidationContext()
            : message.getParser().getHapiContext().getValidationContext();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:6,代码来源:ValidationContextPredicate.java


示例6: messageConformsTo

import ca.uhn.hl7v2.validation.ValidationContext; //导入依赖的package包/类
public static Predicate messageConformsTo(ValidationContext validationContext) {
    return new ValidationContextPredicate(validationContext);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:HL7.java


示例7: translate

import ca.uhn.hl7v2.validation.ValidationContext; //导入依赖的package包/类
@Override
public AssertionsJavascriptWrapper translate() throws Exception {
	
	ANTLRInputStream input = new ANTLRInputStream(this.validatorRawContent);
	HL7MappingValidatorLexer lexer = new HL7MappingValidatorLexer(input);
	CommonTokenStream tokens = new CommonTokenStream(lexer);
	HL7MappingValidatorParser parser = new HL7MappingValidatorParser(tokens);
	ValidatorErrorListener errorListener = new ValidatorErrorListener();
	parser.addErrorListener(errorListener);
	
	ProgramContext context = parser.program();
	
	if (errorListener.getSyntaxErrrors().size() > 0) {
		StringBuffer errorMessageBuffer = new StringBuffer();
		errorMessageBuffer.append("Syntax errors found in HL7 Mapping Validator content: \n");
		for (String syntaxError : errorListener.getSyntaxErrrors()) {
			errorMessageBuffer.append("\t" + syntaxError + "\n");
		}
		throw new Exception (errorMessageBuffer.toString());
	}
	
	ParseTreeWalker walker = new ParseTreeWalker();
	JavascriptCodeGenerator listener = new JavascriptCodeGenerator(parser);
	walker.walk(listener, context);
	
	String javascriptFunctionText = listener.getGeneratedJavascript();
	
	AssertionsJavascriptWrapper javascriptWrapper = new AssertionsJavascriptWrapper(javascriptFunctionText);
	
	ValidationContext validationContext = new NoValidation();
	HapiContext hapiContext = new DefaultHapiContext(validationContext);
	Parser hapiParser = hapiContext.getGenericParser();
	
	if (this.sourceHl7Message != null && !this.sourceHl7Message.isEmpty()) {
		Message sourceHl7 = hapiParser.parse(this.sourceHl7Message);
		Terser terserSource = new Terser(sourceHl7);
		javascriptWrapper.addReferencedObject(SOURCE_TERSER_REFERENCED_OBJECT_NAME, terserSource);
	}
	
	Message targetHl7 = hapiParser.parse(this.destinationHl7Message);
	Terser terserTarget = new Terser(targetHl7);
	javascriptWrapper.addReferencedObject(DESTINATION_TERSER_REFERENCED_OBJECT_NAME, terserTarget);		
	
	return javascriptWrapper;
	
}
 
开发者ID:marcotabago,项目名称:hl7-mapping-validator,代码行数:47,代码来源:ValidatorToJavascriptTranslator.java


示例8: execute

import ca.uhn.hl7v2.validation.ValidationContext; //导入依赖的package包/类
public Result execute(Result previousResult, int nr)
{
	Result result = previousResult;
	
	try {
	  
	  String serverName = environmentSubstitute(server);
	  int portNumber = Integer.parseInt(environmentSubstitute(port));
	  String messageVariable = environmentSubstitute(messageVariableName);
     String messageTypeVariable = environmentSubstitute(messageTypeVariableName);
     String versionVariable = environmentSubstitute(versionVariableName);
     
     MLLPSocketCacheEntry entry = MLLPSocketCache.getInstance().getServerSocketStreamSource(serverName, portNumber);
     if (entry.getJobListener()!=null) {
       parentJob.addJobListener(entry.getJobListener());
     }
     MLLPTransport transport = entry.getTransport();
     
     // Get the next value...
     //
     synchronized(transport) {
       Transportable transportable = transport.doReceive();
 	    String message = transportable.getMessage();
 	    
 	    logDetailed("Received message: "+message);
 	    
 	    parentJob.setVariable(messageVariable, message);
    
 	    //  Parse the message and extract the control ID.
       //
       Parser parser = new GenericParser();
       ValidationContext validationContext = new NoValidation();
       parser.setValidationContext(validationContext);
       Message msg = parser.parse(message);
       Structure structure = msg.get("MSH");
       String messageType = null;
       String version = msg.getVersion();
       
       if (structure instanceof ca.uhn.hl7v2.model.v21.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v21.segment.MSH)structure).getMESSAGETYPE().encode();
       } else if (structure instanceof ca.uhn.hl7v2.model.v22.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v22.segment.MSH)structure).getMessageType().encode();
       } else if (structure instanceof ca.uhn.hl7v2.model.v23.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v23.segment.MSH)structure).getMessageType().encode();
       } else if (structure instanceof ca.uhn.hl7v2.model.v231.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v231.segment.MSH)structure).getMessageType().getMessageStructure().getValue();
       } else if (structure instanceof ca.uhn.hl7v2.model.v24.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v24.segment.MSH)structure).getMessageType().getMessageStructure().getValue();
       } else if (structure instanceof ca.uhn.hl7v2.model.v25.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v25.segment.MSH)structure).getMessageType().getMessageStructure().getValue();
       } else if (structure instanceof ca.uhn.hl7v2.model.v251.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v251.segment.MSH)structure).getMessageType().getMessageStructure().getValue();
       } else if (structure instanceof ca.uhn.hl7v2.model.v26.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v26.segment.MSH)structure).getMessageType().getMessageStructure().getValue();
       } else {
         logError("This job entry does not support the HL7 dialect used. Found MSH class: "+structure.getClass().getName());
       }
       
       if (!Const.isEmpty(messageTypeVariable)) parentJob.setVariable(messageTypeVariable, messageType);
       if (!Const.isEmpty(versionVariable)) parentJob.setVariable(versionVariable, version);
     }
     
		// All went well..
		//
		result.setNrErrors(0);
		result.setResult(true);
		
	} catch(Exception e) {
		log.logError(BaseMessages.getString(PKG, "HL7MLLPInput.Exception.UnexpectedError"), e);
		result.setNrErrors(1);
		result.setResult(false);
	} 
	
	return result;
}
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:76,代码来源:HL7MLLPInput.java


示例9: messageConformsTo

import ca.uhn.hl7v2.validation.ValidationContext; //导入依赖的package包/类
public static Predicate messageConformsTo(
        ValidationContext validationContext) {
    return new ValidationContextPredicate(validationContext);
}
 
开发者ID:KingsCollegeHospital,项目名称:rassyeyanie,代码行数:5,代码来源:HL7.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DateTimeFormatter类代码示例发布时间:2022-05-23
下一篇:
Java ODataApplicationException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap