Package org.drools.template.parser

Examples of org.drools.template.parser.DecisionTableParseException


            int count = 0;
            for( ActionType at: actionTypeMap.values() ){
                if( at.getCode() == code ) count++;
            }
            if( count >= code.getMaxCount() ){
                throw new DecisionTableParseException( "Maximum number of " +
                        code.getColHeader() + "/" + code.getColShort() + " columns is " +
                        code.getMaxCount() + ", in cell " + RuleSheetParserUtil.rc2name(row, column) );
            }
            actionTypeMap.put( new Integer( column ), new ActionType( code ) );
        } else {
            throw new DecisionTableParseException(
                    "Invalid column header: " + value + ", should be CONDITION, ACTION or attribute, " +
                    "in cell " + RuleSheetParserUtil.rc2name(row, column) );
        }
    }
View Full Code Here


    /**
     * This is where a code snippet template is added.
     */
    public void addTemplate(int row, int column, String content) {
        if( this.sourceBuilder == null ){
            throw new DecisionTableParseException(
                    "Unexpected content \"" + content + "\" in cell " +
                    RuleSheetParserUtil.rc2name(row, column) + ", leave this cell blank" );
        }
        this.sourceBuilder.addTemplate( row, column, content );
    }
View Full Code Here

                                  _listeners.get( sheetName ) );

                }
            }
        } catch ( BiffException e ) {
            throw new DecisionTableParseException( "An error occurred opening the workbook. It is possible that the encoding of the document did not match the encoding of the reader.",
                                                   e );

        } catch ( IOException e ) {
            throw new DecisionTableParseException( "Failed to open Excel stream, " + "please check that the content is xls97 format.",
                                                   e );
        }

    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.drools.decisiontable.parser.RuleSheetListener#getRuleSet()
     */
    public Package getRuleSet() {
        if ( this._ruleList.isEmpty() ) {
            throw new DecisionTableParseException( "No RuleTable's were found in spreadsheet." );
        }
        final Package ruleset = buildRuleSet();
        return ruleset;
    }
View Full Code Here

    private void objectTypeRow(final int row,
                               final int column,
                               final String value,
                               final int mergedColStart) {
        if ( value.indexOf( "$param" ) > -1 || value.indexOf( "$1" ) > -1 ) {
            throw new DecisionTableParseException( "It looks like you have snippets in the row that is " + "meant for column declarations." + " Please insert an additional row before the snippets." + " Row number: " + (row + 1) );
        }
        ActionType action = getActionForColumn( row,
                                                column );
        if ( mergedColStart == RuleSheetListener.NON_MERGED ) {
            if ( action.type == ActionType.CONDITION ) {
View Full Code Here

                actionType.setSourceBuilder( new LhsBuilder( null ) );
                this.sourceBuilders.add( actionType.getSourceBuilder() );
            }
        }
        if ( value.trim().equals( "" ) && (actionType.type == ActionType.ACTION || actionType.type == ActionType.CONDITION) ) {
            throw new DecisionTableParseException( "Code description - row:" + (row + 1) + " cell number:" + (column + 1) + " - does not contain any code specification. It should !" );
        }

        actionType.addTemplate( column,
                                value );
    }
View Full Code Here

    private ActionType getActionForColumn(final int row,
                                          final int column) {
        final ActionType actionType = this._actions.get( new Integer( column ) );

        if ( actionType == null ) {
            throw new DecisionTableParseException( "Code description - row number:" + (row + 1) + " cell number:" + (column + 1) + " - does not have an 'ACTION' or 'CONDITION' column header." );
        }

        return actionType;
    }
View Full Code Here

                return new SingleParameterValueBuilder( template,
                                                        parameterUtilities );
            case SINGLE:
                return new LiteralValueBuilder( template );
        }
        throw new DecisionTableParseException( "SnippetBuilder.SnippetType '" + type.toString() + "' is not supported. The column will not be added." );
    }
View Full Code Here

                return new SingleParameterValueBuilder( template,
                                                        parameterUtilities );
            case SINGLE:
                return new LiteralValueBuilder( template );
        }
        throw new DecisionTableParseException( "SnippetBuilder.SnippetType '" + type.toString() + "' is not supported. The column will not be added." );
    }
View Full Code Here

        try {
            startSheet();
            processRows(reader);
            finishSheet();
        } catch (final IOException e) {
            throw new DecisionTableParseException(
                    "An error occurred reading the CSV data.", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.drools.template.parser.DecisionTableParseException

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.