Package org.drools.template.model

Examples of org.drools.template.model.Global


        for( String variableCell: variableCells ){
            final StringTokenizer tokens = new StringTokenizer( variableCell, "," );
            while ( tokens.hasMoreTokens() ) {
                final String token = tokens.nextToken();
                final Global vars = new Global();
                final StringTokenizer paramTokens = new StringTokenizer( token, " " );
                vars.setClassName( paramTokens.nextToken() );
                if ( !paramTokens.hasMoreTokens() ) {
                    throw new DecisionTableParseException( "The format for global variables is incorrect. " + "It should be: [Class name, Class otherName]. But it was: [" + variableCell + "]" );
                }
                vars.setIdentifier( paramTokens.nextToken() );
                variableList.add( vars );
            }
        }
        return variableList;
    }
View Full Code Here


    public void testListVariables() {
        final List<Global> varList = RuleSheetParserUtil.getVariableList( "Var1 var1, Var2 var2,Var3 var3" );
        assertNotNull( varList );
        assertEquals( 3,
                      varList.size() );
        Global var = varList.get( 0 );
        assertEquals( "Var1",
                      var.getClassName() );
        var = varList.get( 2 );
        assertEquals( "Var3",
                      var.getClassName() );
        assertEquals( "var3",
                      var.getIdentifier() );
    }
View Full Code Here

        }
    }


    private void addGlobals(org.drools.template.model.Package p) {
        Global global = new Global();
        global.setClassName(DefaultGenerator.class.getName());
        global.setIdentifier("generator");
        p.addVariable(global);
    }
View Full Code Here

    for( String variableCell: variableCells ){
      final StringTokenizer tokens = new StringTokenizer( variableCell, "," );
      while ( tokens.hasMoreTokens() ) {
        final String token = tokens.nextToken();
        final Global vars = new Global();
        final StringTokenizer paramTokens = new StringTokenizer( token, " " );
        vars.setClassName( paramTokens.nextToken() );
        if ( !paramTokens.hasMoreTokens() ) {
          throw new DecisionTableParseException( "The format for global variables is incorrect. " + "It should be: [Class name, Class otherName]. But it was: [" + variableCell + "]" );
        }
        vars.setIdentifier( paramTokens.nextToken() );
        variableList.add( vars );
      }
    }
    return variableList;
  }
View Full Code Here

    }
  }


  private void addGlobals(org.drools.template.model.Package p) {
    Global global = new Global();
    global.setClassName(DefaultGenerator.class.getName());
    global.setIdentifier("generator");
    p.addVariable(global);
  }
View Full Code Here

        varCells.add( "Var1 var1, Var2 var2,Var3 var3" );
        final List<Global> varList = RuleSheetParserUtil.getVariableList( varCells );
        assertNotNull( varList );
        assertEquals( 3,
                varList.size() );
        Global var = varList.get( 0 );
        assertEquals( "Var1",
                var.getClassName() );
        var = varList.get( 2 );
        assertEquals( "Var3",
                var.getClassName() );
        assertEquals( "var3",
                var.getIdentifier() );
    }
View Full Code Here

        }
    }


    private void addGlobals(org.drools.template.model.Package p) {
        Global global = new Global();
        global.setClassName(DefaultGenerator.class.getName());
        global.setIdentifier("generator");
        p.addVariable(global);
    }
View Full Code Here

        }
    }


    private void addGlobals(org.drools.template.model.Package p) {
        Global global = new Global();
        global.setClassName(DefaultGenerator.class.getName());
        global.setIdentifier("generator");
        p.addVariable(global);
    }
View Full Code Here

        }
        final StringTokenizer tokens = new StringTokenizer( variableCell,
                                                      "," );
        while ( tokens.hasMoreTokens() ) {
            final String token = tokens.nextToken();
            final Global vars = new Global();
            final StringTokenizer paramTokens = new StringTokenizer( token,
                                                               " " );
            vars.setClassName( paramTokens.nextToken() );
            if ( !paramTokens.hasMoreTokens() ) {
                throw new DecisionTableParseException( "The format for global variables is incorrect. " + "It should be: [Class name, Class otherName]. But it was: [" + variableCell + "]" );
            }
            vars.setIdentifier( paramTokens.nextToken() );
            variableList.add( vars );
        }
        return variableList;
    }
View Full Code Here

    }
  }


  private void addGlobals(org.drools.template.model.Package p) {
    Global global = new Global();
    global.setClassName(DefaultGenerator.class.getName());
    global.setIdentifier("generator");
    p.addVariable(global);
  }
View Full Code Here

TOP

Related Classes of org.drools.template.model.Global

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.