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


Java DecisionTableParseException类代码示例

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


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

示例1: getValueBuilder

import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
private ParameterizedValueBuilder getValueBuilder(final String template) {
    final SnippetType type = SnippetBuilder.getType(template);
    switch (type) {
        case INDEXED:
            return new IndexedParametersValueBuilder(template,
                                                     parameterUtilities,
                                                     ParameterizedValueBuilder.Part.RHS);
        case PARAM:
            return new SingleParameterValueBuilder(template,
                                                   parameterUtilities,
                                                   ParameterizedValueBuilder.Part.RHS);
        case SINGLE:
            return new LiteralValueBuilder(template);
    }
    throw new DecisionTableParseException("SnippetBuilder.SnippetType '" + type.toString() + "' is not supported. The column will not be added.");
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:17,代码来源:GuidedDecisionTableRHSBuilder.java

示例2: addTemplate

import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
@Override
public void addTemplate(final int row,
                        final int column,
                        final String content) {
    //Validate column template
    if (valueBuilders.containsKey(column)) {
        final String message = "Internal error: Can't have a code snippet added twice to one spreadsheet column.";
        this.conversionResult.addMessage(message,
                                         ConversionMessageType.ERROR);
        return;
    }

    //Add new template
    final String template = content.trim();
    try {
        this.valueBuilders.put(column,
                               getValueBuilder(template));
    } catch (DecisionTableParseException pe) {
        this.conversionResult.addMessage(pe.getMessage(),
                                         ConversionMessageType.WARNING);
    }
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:23,代码来源:GuidedDecisionTableLHSBuilder.java

示例3: testInvalidTable

import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
private void testInvalidTable( Consumer<DecisionTableXLSServiceImpl> serviceConsumer ) throws IOException {
    this.service = getServiceWithValidationOverride( ( tempFile ) -> {
        // mock an invalid file
        Throwable t = new Throwable( "testing invalid xls dt creation" );
        throw new DecisionTableParseException( "DecisionTableParseException: " + t.getMessage(), t );
    } );

    mockStatic( IOUtils.class );
    when( IOUtils.copy( any( InputStream.class ), any( OutputStream.class ) ) ).thenReturn( 0 );
    try {
        serviceConsumer.accept( service );
    } catch ( RuntimeException e ) {
        // this is expected correct behavior
    }
    verify( ioService, never() ).newOutputStream( any( org.uberfire.java.nio.file.Path.class ), any( CommentedOption.class ) );
    verifyStatic( never() );
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:18,代码来源:DecisionTableXLSServiceImplTest.java

示例4: parseFile

import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
public void parseFile(File file) {
    try {
        parseFile(new FileInputStream(file));
    }
    catch (FileNotFoundException ex) {
        throw new DecisionTableParseException(ex.getMessage(), ex);
    }
}
 
开发者ID:CenturyLinkCloud,项目名称:mdw-demo,代码行数:9,代码来源:Excel2007Parser.java

示例5: addTemplate

import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
@Override
public void addTemplate(final int row,
                        final int column,
                        final String content) {
    //Validate column template
    if (valueBuilders.containsKey(column)) {
        final String message = "Internal error: Can't have a code snippet added twice to one spreadsheet column.";
        this.conversionResult.addMessage(message,
                                         ConversionMessageType.ERROR);
        return;
    }

    //Add new template
    String template = content.trim();
    if (isBoundVar()) {
        template = variable + "." + template;
    }
    if (!template.endsWith(";")) {
        template = template + ";";
    }
    try {
        this.valueBuilders.put(column,
                               getValueBuilder(template));
    } catch (DecisionTableParseException pe) {
        this.conversionResult.addMessage(pe.getMessage(),
                                         ConversionMessageType.WARNING);
    }
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:29,代码来源:GuidedDecisionTableRHSBuilder.java

示例6: testValidateFileWithInvalidContent

import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
@Test(expected = DecisionTableParseException.class)
public void testValidateFileWithInvalidContent() throws IOException {
    this.service = getServiceWithValidationOverride( null );

    File tempFile = File.createTempFile( "emptyxls", null );
    try ( FileOutputStream tempFOS = new FileOutputStream( tempFile ) ) {
        IOUtils.write( "birdplane!", tempFOS );
        tempFOS.flush();
        service.validate( tempFile );
    }
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:12,代码来源:DecisionTableXLSServiceImplTest.java

示例7: getValueBuilder

import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
private ParameterizedValueBuilder getValueBuilder(final String content) {

        // Work out the type of "template":-
        // age                     ---> SnippetType.SINGLE
        // age ==                  ---> SnippetType.SINGLE
        // age == $param           ---> SnippetType.PARAM
        // age == $1 || age == $2  ---> SnippetType.INDEXED
        // forall{age < $}{,}      ---> SnippetType.FORALL
        String template = content.trim();
        SnippetType type = SnippetBuilder.getType(template);
        if (type == SnippetType.SINGLE) {
            type = SnippetType.PARAM;
            boolean hasExplicitOperator = false;
            for (String op : operators) {
                if (template.endsWith(op)) {
                    hasExplicitOperator = true;
                    break;
                }
            }
            if (!hasExplicitOperator) {
                template = template + " ==";
            }
            template = template + " \"";
            template = template + SnippetBuilder.PARAM_STRING + "\"";
        }

        //Make a ValueBuilder for the template
        switch (type) {
            case INDEXED:
                return new IndexedParametersValueBuilder(template,
                                                         parameterUtilities,
                                                         ParameterizedValueBuilder.Part.LHS);
            case PARAM:
                return new SingleParameterValueBuilder(template,
                                                       parameterUtilities,
                                                       ParameterizedValueBuilder.Part.LHS);
            case SINGLE:
                return new LiteralValueBuilder(template);
        }
        throw new DecisionTableParseException("SnippetBuilder.SnippetType '" + type.toString() + "' is not supported. The column will not be added.");
    }
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:42,代码来源:GuidedDecisionTableLHSBuilder.java

示例8: testValidateNonexistentFile

import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
@Test(expected = DecisionTableParseException.class)
public void testValidateNonexistentFile() {
    this.service = getServiceWithValidationOverride( null );

    service.validate( new File( "" ) );
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:7,代码来源:DecisionTableXLSServiceImplTest.java

示例9: testValidateEmptyFile

import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
@Test(expected = DecisionTableParseException.class)
public void testValidateEmptyFile() throws IOException {
    this.service = getServiceWithValidationOverride( null );

    service.validate( File.createTempFile( "emptyxls", null ) );
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:7,代码来源:DecisionTableXLSServiceImplTest.java

示例10: checkConversionOfXLSWithInvalidContent

import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
@Test(expected = DecisionTableParseException.class)
public void checkConversionOfXLSWithInvalidContent() {
    final InputStream is = this.getClass().getResourceAsStream("wrong_file.xls");
    when(ioService.newInputStream(any(org.uberfire.java.nio.file.Path.class))).thenReturn(is);
    converter.convert(path);
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:7,代码来源:DecisionTableXLSToDecisionTableGuidedConverterTest.java


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