Examples of ExpressionVariable


Examples of org.drools.workbench.models.datamodel.rule.ExpressionVariable

        assertEquals( 2,
                      efl1.getParts().size() );
        assertTrue( efl1.getParts().get( 0 ) instanceof ExpressionVariable );
        assertTrue( efl1.getParts().get( 1 ) instanceof ExpressionField );

        ExpressionVariable eflv1 = (ExpressionVariable) efl1.getParts().get( 0 );
        assertEquals( "cc",
                      eflv1.getName() );
        assertEquals( "Counter",
                      eflv1.getClassType() );
        assertEquals( DataType.TYPE_NUMERIC,
                      eflv1.getGenericType() );

        ExpressionField eflf1 = (ExpressionField) efl1.getParts().get( 1 );
        assertEquals( "number",
                      eflf1.getName() );
        assertEquals( "java.lang.Number",
View Full Code Here

Examples of org.drools.workbench.models.datamodel.rule.ExpressionVariable

        if ( prefix.equals( VARIABLE_VALUE_PREFIX ) ) {
            FactPattern fact = getRuleModel().getLHSBoundFact( attrib );
            ExpressionPart variable;
            if ( fact != null ) {
                variable = new ExpressionVariable( fact );
            } else {
                //if the variable is not bound to a Fact Pattern then it must be bound to a Field
                String lhsBindingType = getRuleModel().getLHSBindingType( attrib );
                variable = new ExpressionFieldVariable( attrib,
                                                        lhsBindingType );
View Full Code Here

Examples of org.drools.workbench.models.datamodel.rule.ExpressionVariable

        if ( prefix.equals( VARIABLE_VALUE_PREFIX ) ) {
            FactPattern fact = getRuleModel().getLHSBoundFact( attrib );
            ExpressionPart variable;
            if ( fact != null ) {
                variable = new ExpressionVariable( fact );
            } else {
                //if the variable is not bound to a Fact Pattern then it must be bound to a Field
                String lhsBindingType = getRuleModel().getLHSBindingType( attrib );
                variable = new ExpressionFieldVariable( attrib,
                                                        lhsBindingType );
View Full Code Here

Examples of org.drools.workbench.models.datamodel.rule.ExpressionVariable

        final CompositeFactPattern cp = new CompositeFactPattern( CompositeFactPattern.COMPOSITE_TYPE_NOT );

        final FactPattern fp2 = new FactPattern( "Person" );
        final FromCompositeFactPattern ffp1 = new FromCompositeFactPattern();
        ffp1.setExpression( new ExpressionFormLine( new ExpressionVariable( fp1 ) ) );
        ffp1.setFactPattern( fp2 );
        cp.addFactPattern( ffp1 );
        m.addLhsItem( cp );

        final String actual = RuleModelDRLPersistenceImpl.getInstance().marshal( m );
View Full Code Here

Examples of org.drools.workbench.models.datamodel.rule.ExpressionVariable

        assertEquals( BaseSingleFieldConstraint.TYPE_EXPR_BUILDER_VALUE, constraint.getConstraintValueType() );
        assertEquals( "", constraint.getValue() );
        assertEquals( 2, constraint.getExpressionValue().getParts().size() );

        assertTrue( constraint.getExpressionValue().getParts().get( 0 ) instanceof ExpressionVariable );
        ExpressionVariable expressionVariable = (ExpressionVariable) constraint.getExpressionValue().getParts().get( 0 );
        assertEquals( "a", expressionVariable.getName() );
        assertEquals( "Applicant", expressionVariable.getClassType() );
        assertEquals( "this", expressionVariable.getGenericType() );
        assertEquals( constraint.getExpressionValue().getParts().get( 1 ), expressionVariable.getNext() );

        assertTrue( constraint.getExpressionValue().getParts().get( 1 ) instanceof ExpressionField );
        ExpressionField expressionField = (ExpressionField) constraint.getExpressionValue().getParts().get( 1 );
        assertEquals( "age", expressionField.getName() );
        assertEquals( "java.lang.Integer", expressionField.getClassType() );
View Full Code Here

Examples of org.drools.workbench.models.datamodel.rule.ExpressionVariable

        assertEquals( 2,
                      efl1.getParts().size() );
        assertTrue( efl1.getParts().get( 0 ) instanceof ExpressionVariable );
        assertTrue( efl1.getParts().get( 1 ) instanceof ExpressionField );

        ExpressionVariable eflv1 = (ExpressionVariable) efl1.getParts().get( 0 );
        assertEquals( "cc",
                      eflv1.getName() );
        assertEquals( "Counter",
                      eflv1.getClassType() );
        assertEquals( DataType.TYPE_NUMERIC,
                      eflv1.getGenericType() );

        ExpressionField eflf1 = (ExpressionField) efl1.getParts().get( 1 );
        assertEquals( "number",
                      eflf1.getName() );
        assertEquals( "java.lang.Number",
View Full Code Here

Examples of org.drools.workbench.models.datamodel.rule.ExpressionVariable

        assertNotNull( fp2.getExpression() );
        ExpressionFormLine efl = fp2.getExpression();
        assertEquals( 3,
                      efl.getParts().size() );
        assertTrue( efl.getParts().get( 0 ) instanceof ExpressionVariable );
        ExpressionVariable ev = (ExpressionVariable) efl.getParts().get( 0 );
        assertEquals( "$trans",
                      ev.getName() );
        assertEquals( "Transactions",
                      ev.getClassType() );
        assertTrue( efl.getParts().get( 1 ) instanceof ExpressionMethod );
        ExpressionMethod em = (ExpressionMethod) efl.getParts().get( 1 );
        assertEquals( "getRecCategorization()",
                      em.getName() );
        assertEquals( "java.util.Map",
View Full Code Here

Examples of org.springframework.binding.expression.ExpressionVariable

    if (variables == null || variables.length == 0) {
      return null;
    }
    Map variableExpressions = new HashMap(variables.length, 1);
    for (int i = 0; i < variables.length; i++) {
      ExpressionVariable var = variables[i];
      variableExpressions.put(var.getName(), parseExpression(var.getValueExpression(), var.getParserContext()));
    }
    return variableExpressions;
  }
View Full Code Here

Examples of org.springframework.binding.expression.ExpressionVariable

  }

  public void testParseTemplateExpressionWithVariables() {
    String expressionString = "#{value}#{max}";
    Expression exp = parser.parseExpression(expressionString, new FluentParserContext().template().variable(
        new ExpressionVariable("max", "maximum")));
    TestBean target = new TestBean();
    assertEquals("foo2", exp.getValue(target));
  }
View Full Code Here

Examples of org.springframework.binding.expression.ExpressionVariable

    TestBean target = new TestBean();
    assertEquals("foo2", exp.getValue(target));
  }

  public void testVariablesWithCoersion() {
    Expression exp = parser.parseExpression("max", new FluentParserContext().variable(new ExpressionVariable("max",
        "maximum", new FluentParserContext().expectResult(Long.class))));
    TestBean target = new TestBean();
    assertEquals(new Long(2), exp.getValue(target));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.