Package org.drools.workbench.models.commons.shared.rule

Examples of org.drools.workbench.models.commons.shared.rule.SingleFieldConstraintEBLeftSide


        private SingleFieldConstraintEBLeftSide createSingleFieldConstraintEBLeftSide( FactPattern factPattern,
                                                                                       String fieldName,
                                                                                       String operator,
                                                                                       String value ) {
            SingleFieldConstraintEBLeftSide con = new SingleFieldConstraintEBLeftSide();

            fieldName = setFieldBindingOnContraint( fieldName, con );
            String classType = getFQFactType( factPattern.getFactType() );
            con.getExpressionLeftSide().appendPart( new ExpressionUnboundFact( factPattern, classType ) );

            String type = setOperatorAndValueOnConstraint( operator, value, con );

            parseExpression(classType, fieldName, type, con.getExpressionLeftSide());

            return con;
        }
View Full Code Here


        this.readOnly = readOnly;

        this.panel = new SimplePanel();

        if ( con instanceof SingleFieldConstraintEBLeftSide ) {
            SingleFieldConstraintEBLeftSide sfexp = (SingleFieldConstraintEBLeftSide) con;
            this.factType = sfexp.getExpressionLeftSide().getPreviousGenericType();
            if ( this.factType == null ) {
                this.factType = sfexp.getExpressionLeftSide().getGenericType();
            }
            this.fieldName = sfexp.getExpressionLeftSide().getFieldName();
            this.fieldType = sfexp.getExpressionLeftSide().getGenericType();

        } else if ( con instanceof ConnectiveConstraint) {
            ConnectiveConstraint cc = (ConnectiveConstraint) con;
            this.factType = cc.getFactType();
            this.fieldName = cc.getFieldName();
View Full Code Here

        //Expressions' fieldName and hence fieldType can change without creating a new ConstraintValueEditor.
        //SingleFieldConstraints and their ConnectiveConstraints cannot have the fieldName or fieldType changed
        //without first deleting and re-creating.
        if ( this.constraint instanceof SingleFieldConstraintEBLeftSide ) {
            SingleFieldConstraintEBLeftSide sfexp = (SingleFieldConstraintEBLeftSide) this.constraint;
            this.factType = sfexp.getExpressionLeftSide().getPreviousGenericType();
            if ( this.factType == null ) {
                this.factType = sfexp.getExpressionLeftSide().getGenericType();
            }
            this.fieldName = sfexp.getExpressionLeftSide().getFieldName();
            this.fieldType = sfexp.getExpressionLeftSide().getGenericType();
        }

        //Initialise drop-down data
        getDropDownData();
View Full Code Here

            String fieldName;
            String factType;

            //Connectives Operators are handled in class Connectives
            if ( c instanceof SingleFieldConstraintEBLeftSide ) {
                SingleFieldConstraintEBLeftSide sfexp = (SingleFieldConstraintEBLeftSide) c;
                factType = sfexp.getExpressionLeftSide().getPreviousGenericType();
                if ( factType == null ) {
                    factType = sfexp.getExpressionLeftSide().getGenericType();
                }
                fieldName = sfexp.getExpressionLeftSide().getFieldName();

            } else {
                factType = c.getFactType();
                fieldName = c.getFieldName();
            }
View Full Code Here

        popup.addRow( new SmallLabel( "<i>" + Constants.INSTANCE.AdvancedOptionsColon() + "</i>" ) );
        Button ebBtn = new Button( Constants.INSTANCE.ExpressionEditor() );

        ebBtn.addClickHandler( new ClickHandler() {
            public void onClick( ClickEvent event ) {
                SingleFieldConstraintEBLeftSide con = new SingleFieldConstraintEBLeftSide();
                con.setConstraintValueType( SingleFieldConstraint.TYPE_UNDEFINED );
                con.setExpressionLeftSide( new ExpressionFormLine( new ExpressionUnboundFact( pattern ) ) );
                hasConstraints.addConstraint( con );
                modeller.refreshWidget();
                popup.hide();
            }
        } );
View Full Code Here

            Button ebBtn = new Button( Constants.INSTANCE.ExpressionEditor() );

            ebBtn.addClickHandler( new ClickHandler() {
                public void onClick( ClickEvent event ) {
                    SingleFieldConstraintEBLeftSide con = new SingleFieldConstraintEBLeftSide();
                    con.setConstraintValueType( SingleFieldConstraint.TYPE_UNDEFINED );
                    fp.addConstraint( con );
                    con.setExpressionLeftSide( new ExpressionFormLine( new ExpressionUnboundFact( pattern ) ) );
                    modeller.refreshWidget();
                    popup.hide();
                }
            } );
            popup.addAttribute( Constants.INSTANCE.ExpressionEditor(),
View Full Code Here

                            variables.add( fp.getBoundName() );
                        }

                        for ( FieldConstraint fc : fp.getFieldConstraints() ) {
                            if ( fc instanceof SingleFieldConstraintEBLeftSide ) {
                                final SingleFieldConstraintEBLeftSide exp = (SingleFieldConstraintEBLeftSide) fc;
                                if ( exp.getExpressionLeftSide() != null && exp.getExpressionLeftSide().isBound() ) {
                                    variables.add( exp.getExpressionLeftSide().getBinding() );
                                }
                            } else if ( fc instanceof SingleFieldConstraint ) {
                                final SingleFieldConstraint sfc = (SingleFieldConstraint) fc;
                                if ( sfc.isBound() ) {
                                    variables.add( sfc.getFieldBinding() );
View Full Code Here

                    HasParameterizedOperator hop = constr;
                    parameters = hop.getParameters();
                }

                if ( constr instanceof SingleFieldConstraintEBLeftSide ) {
                    SingleFieldConstraintEBLeftSide sfexp = (SingleFieldConstraintEBLeftSide) constr;
                    addFieldRestriction( buf,
                                         sfexp.getConstraintValueType(),
                                         sfexp.getExpressionLeftSide().getGenericType(),
                                         sfexp.getOperator(),
                                         parameters,
                                         sfexp.getValue(),
                                         sfexp.getExpressionValue() );
                } else {
                    addFieldRestriction( buf,
                                         constr.getConstraintValueType(),
                                         constr.getFieldType(),
                                         constr.getOperator(),
View Full Code Here

    public void testLHSExpressionNestedDate() {

        RuleModel m = new RuleModel();
        m.name = "test expressionsNestedDate";
        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraintEBLeftSide con = new SingleFieldConstraintEBLeftSide();
        con.getExpressionLeftSide().appendPart( new ExpressionUnboundFact( p ) );
        con.getExpressionLeftSide().appendPart( new ExpressionField( "favouriteCheese",
                                                                     "Cheese",
                                                                     DataType.TYPE_OBJECT ) );
        con.getExpressionLeftSide().appendPart( new ExpressionField( "dateBrought",
                                                                     "java.util.Date",
                                                                     DataType.TYPE_DATE ) );
        con.setOperator( "==" );
        con.setValue( "27-Jun-2011" );
        con.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
        p.addConstraint( con );

        m.addLhsItem( p );

        String expected = "rule \"test expressionsNestedDate\""
View Full Code Here

    public void testLHSExpressionNestedJavaEnum() {

        RuleModel m = new RuleModel();
        m.name = "test expressionsNestedJavaEnum";
        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraintEBLeftSide con = new SingleFieldConstraintEBLeftSide();
        con.getExpressionLeftSide().appendPart( new ExpressionUnboundFact( p ) );
        con.getExpressionLeftSide().appendPart( new ExpressionField( "favouriteCheese",
                                                                     "Cheese",
                                                                     DataType.TYPE_OBJECT ) );
        con.getExpressionLeftSide().appendPart( new ExpressionField( "genericName",
                                                                     "CHEESE",
                                                                     DataType.TYPE_COMPARABLE ) );
        con.setOperator( "==" );
        con.setValue( "CHEESE.Cheddar" );
        con.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
        p.addConstraint( con );

        m.addLhsItem( p );

        String expected = "rule \"test expressionsNestedJavaEnum\""
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.commons.shared.rule.SingleFieldConstraintEBLeftSide

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.