Examples of ExpressionMethod


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

                final List<MethodInfo> mis = dmo.getProjectMethodInformation().get( previousClassName );
                boolean isMethod = false;
                if ( mis != null ) {
                    for ( MethodInfo mi : mis ) {
                        if ( mi.getName().equals( expressionPart ) ) {
                            expression.appendPart( new ExpressionMethod( mi.getName(),
                                                                         mi.getReturnClassType(),
                                                                         mi.getGenericType(),
                                                                         mi.getParametricReturnType() ) );
                            isMethod = true;
                            break;
View Full Code Here

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

        return listBox;
    }

    private void onCollectionChange( String value ) {
        if ( "size".contains( value ) ) {
            expression.appendPart( new ExpressionMethod( "size",
                                                         "int",
                                                         DataType.TYPE_NUMERIC_INTEGER ) );
        } else if ( "isEmpty".equals( value ) ) {
            expression.appendPart( new ExpressionMethod( "isEmpty",
                                                         "boolean",
                                                         DataType.TYPE_BOOLEAN ) );
        } else {
            ExpressionCollectionIndex collectionIndex;
            String factName = getDataModelOracle().getFactNameFromType( getCurrentParametricType() );
            if ( getCurrentParametricType() != null && factName != null ) {
                collectionIndex = new ExpressionCollectionIndex( "get",
                                                                 getCurrentParametricType(),
                                                                 factName );
            } else {
                collectionIndex = new ExpressionCollectionIndex( "get",
                                                                 "java.lang.Object",
                                                                 DataType.TYPE_OBJECT );
            }
            if ( "first".equals( value ) ) {
                collectionIndex.putParam( "index",
                                          new ExpressionFormLine( new ExpressionText( "0" ) ) );
                expression.appendPart( collectionIndex );
            } else if ( "last".equals( value ) ) {
                ExpressionFormLine index = new ExpressionFormLine( expression );
                index.appendPart( new ExpressionMethod( "size",
                                                        "int",
                                                        DataType.TYPE_NUMERIC_INTEGER ) );
                index.appendPart( new ExpressionText( "-1" ) );

                collectionIndex.putParam( "index",
View Full Code Here

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

        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",
                      em.getClassType() );
        assertEquals( DataType.TYPE_COLLECTION,
                      em.getGenericType() );
        assertTrue( efl.getParts().get( 2 ) instanceof ExpressionText );
        ExpressionText et = (ExpressionText) efl.getParts().get( 2 );
        assertEquals( "get(\"APES-01\")",
                      et.getName() );
        assertEquals( "java.lang.String",
View Full Code Here

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

        final ExpressionUnboundFact expPart0 = (ExpressionUnboundFact) exp.getExpressionLeftSide().getParts().get( 0 );
        assertEquals( "Number",
                      expPart0.getFact().getFactType() );

        assertTrue( exp.getExpressionLeftSide().getParts().get( 1 ) instanceof ExpressionMethod );
        final ExpressionMethod expPart1 = (ExpressionMethod) exp.getExpressionLeftSide().getParts().get( 1 );
        assertEquals( "intValue",
                      expPart1.getName() );
    }
View Full Code Here

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

        final ExpressionField expPart1 = (ExpressionField) exp.getExpressionLeftSide().getParts().get( 1 );
        assertEquals( "this",
                      expPart1.getName() );

        assertTrue( exp.getExpressionLeftSide().getParts().get( 2 ) instanceof ExpressionMethod );
        final ExpressionMethod expPart2 = (ExpressionMethod) exp.getExpressionLeftSide().getParts().get( 2 );
        assertEquals( "intValue",
                      expPart2.getName() );
    }
View Full Code Here

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

        final ExpressionUnboundFact expPart0 = (ExpressionUnboundFact) exp.getExpressionLeftSide().getParts().get( 0 );
        assertEquals( "Parent",
                      expPart0.getFact().getFactType() );

        assertTrue( exp.getExpressionLeftSide().getParts().get( 1 ) instanceof ExpressionMethod );
        final ExpressionMethod expPart1 = (ExpressionMethod) exp.getExpressionLeftSide().getParts().get( 1 );
        assertEquals( "methodToGetChild1",
                      expPart1.getName() );

        assertTrue( exp.getExpressionLeftSide().getParts().get( 2 ) instanceof ExpressionMethod );
        final ExpressionMethod expPart2 = (ExpressionMethod) exp.getExpressionLeftSide().getParts().get( 2 );
        assertEquals( "methodToGetChild2",
                      expPart2.getName() );

        assertTrue( exp.getExpressionLeftSide().getParts().get( 3 ) instanceof ExpressionField );
        final ExpressionField expPart3 = (ExpressionField) exp.getExpressionLeftSide().getParts().get( 3 );
        assertEquals( "field1",
                      expPart3.getName() );
View Full Code Here

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

        return lb;
    }

    private void onCollectionChange( String value ) {
        if ( "size".contains( value ) ) {
            expression.appendPart( new ExpressionMethod( "size",
                                                         "int",
                                                         DataType.TYPE_NUMERIC_INTEGER ) );
        } else if ( "isEmpty".equals( value ) ) {
            expression.appendPart( new ExpressionMethod( "isEmpty",
                                                         "boolean",
                                                         DataType.TYPE_BOOLEAN ) );
        } else {
            ExpressionCollectionIndex collectionIndex;
            String factName = getDataModelOracle().getFactNameFromType( getCurrentParametricType() );
            if ( getCurrentParametricType() != null && factName != null ) {
                collectionIndex = new ExpressionCollectionIndex( "get",
                                                                 getCurrentParametricType(),
                                                                 factName );
            } else {
                collectionIndex = new ExpressionCollectionIndex( "get",
                                                                 "java.lang.Object",
                                                                 DataType.TYPE_OBJECT );
            }
            if ( "first".equals( value ) ) {
                collectionIndex.putParam( "index",
                                          new ExpressionFormLine( new ExpressionText( "0" ) ) );
                expression.appendPart( collectionIndex );
            } else if ( "last".equals( value ) ) {
                ExpressionFormLine index = new ExpressionFormLine( expression );
                index.appendPart( new ExpressionMethod( "size",
                                                        "int",
                                                        DataType.TYPE_NUMERIC_INTEGER ) );
                index.appendPart( new ExpressionText( "-1" ) );

                collectionIndex.putParam( "index",
View Full Code Here

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

            onCollectionChange( value );
            onChangeSelectionUpdateExpressionWidget( oldType );

        } else if ( DataType.TYPE_STRING.equals( getCurrentGenericType() ) ) {
            if ( "size".equals( value ) ) {
                expression.appendPart( new ExpressionMethod( "size",
                                                             "int",
                                                             DataType.TYPE_NUMERIC_INTEGER ) );
            } else if ( "isEmpty".equals( value ) ) {
                expression.appendPart( new ExpressionText( ".size() == 0",
                                                           "",
View Full Code Here

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

                                          callback.callback( new ExpressionCollection( methodName,
                                                                                       mi.getReturnClassType(),
                                                                                       mi.getGenericType(),
                                                                                       mi.getParametricReturnType() ) );
                                      } else {
                                          callback.callback( new ExpressionMethod( mi.getName(),
                                                                                   mi.getReturnClassType(),
                                                                                   mi.getGenericType() ) );
                                      }
                                  }
                              } );
View Full Code Here

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

            } else if ( this.readOnly ) {
                container.add( new Label( expressionPart.getName() ) );
            } else if ( expressionPart instanceof ExpressionMethod ) {
                container.add( new Label( expressionPart.getName() ) );
                container.add( new Label( "(" ) );
                final ExpressionMethod em = (ExpressionMethod) expressionPart;
                final List<ExpressionFormLine> emParams = em.getOrderedParams();
                for ( int index = 0; index < emParams.size(); index++ ) {
                    final ExpressionFormLine paramValueHolder = emParams.get( index );
                    final String paramDataType = em.getParameterDataType( paramValueHolder );
                    final ExpressionMethodParameter paramValue = ( (ExpressionMethodParameter) paramValueHolder.getRootExpression() );
                    final TextBox paramValueEditor = TextBoxFactory.getTextBox( paramDataType );
                    paramValueEditor.addValueChangeHandler( new ValueChangeHandler<String>() {
                        @Override
                        public void onValueChange( ValueChangeEvent<String> event ) {
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.