Package org.drools.workbench.models.guided.dtable.shared.model

Examples of org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn


        ins2.setFactField( "rating2" );
        ins2.setFactType( "Person2" );
        ins2.setType( DataType.TYPE_STRING );
        dt.getActionCols().add( ins2 );

        BRLActionColumn brlAction = new BRLActionColumn();
        ActionInsertFact aif = new ActionInsertFact( "Person" );
        aif.setBoundName( "$aif" );
        aif.addFieldValue( new ActionFieldValue( "rating",
                                                 null,
                                                 DataType.TYPE_STRING ) );
        aif.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_LITERAL );

        brlAction.getDefinition().add( aif );
        dt.getActionCols().add( brlAction );

        BRLRuleModel model = new BRLRuleModel( dt );

        assertNotNull( model.getRHSBoundFacts() );
View Full Code Here


        ins.setFactField( "rating" );
        ins.setFactType( "Person" );
        ins.setType( DataType.TYPE_STRING );
        dt.getActionCols().add( ins );

        BRLActionColumn brlAction = new BRLActionColumn();
        ActionInsertFact aif1 = new ActionInsertFact( "Person" );
        aif1.setBoundName( "$aif" );
        aif1.addFieldValue( new ActionFieldValue( "rating",
                                                  null,
                                                  DataType.TYPE_STRING ) );
        aif1.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_LITERAL );

        brlAction.getDefinition().add( aif1 );
        dt.getActionCols().add( brlAction );

        //Setup RuleModel columns (existing BRLActionColumn being edited)
        BRLRuleModel model = new BRLRuleModel( dt );
        ActionInsertFact aif2 = new ActionInsertFact( "Person" );
View Full Code Here

        ConditionCol52 c = new ConditionCol52();
        c.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        p1.getChildColumns().add( c );
        dt.getConditions().add( p1 );

        BRLActionColumn brlAction1 = new BRLActionColumn();
        ActionUpdateField auf1 = new ActionUpdateField( "x" );
        auf1.addFieldValue( new ActionFieldValue( "age",
                                                  "$age",
                                                  DataType.TYPE_NUMERIC_INTEGER ) );
        auf1.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );

        brlAction1.getDefinition().add( auf1 );
        brlAction1.getChildColumns().add( new BRLActionVariableColumn( "$age",
                                                                       DataType.TYPE_NUMERIC_INTEGER,
                                                                       "Context",
                                                                       "age" ) );
        dt.getActionCols().add( brlAction1 );

        BRLActionColumn brlAction2 = new BRLActionColumn();
        ActionUpdateField auf2 = new ActionUpdateField( "x" );
        auf2.addFieldValue( new ActionFieldValue( "name",
                                                  "$name",
                                                  DataType.TYPE_STRING ) );
        auf2.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );

        brlAction2.getDefinition().add( auf2 );
        brlAction2.getChildColumns().add( new BRLActionVariableColumn( "$name",
                                                                       DataType.TYPE_STRING,
                                                                       "Context",
                                                                       "name" ) );
        dt.getActionCols().add( brlAction2 );
View Full Code Here

        ConditionCol52 c = new ConditionCol52();
        c.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        p1.getChildColumns().add( c );
        dt.getConditions().add( p1 );

        BRLActionColumn brlAction1 = new BRLActionColumn();
        ActionUpdateField auf1 = new ActionUpdateField( "x" );
        auf1.addFieldValue( new ActionFieldValue( "f1",
                                                  "$f1",
                                                  DataType.TYPE_STRING ) );
        auf1.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );

        brlAction1.getDefinition().add( auf1 );
        brlAction1.getChildColumns().add( new BRLActionVariableColumn( "$f1",
                                                                       DataType.TYPE_STRING,
                                                                       "Context",
                                                                       "f1" ) );
        ActionUpdateField auf2 = new ActionUpdateField( "x" );
        auf2.addFieldValue( new ActionFieldValue( "f2",
                                                  "$f2",
                                                  DataType.TYPE_STRING ) );
        auf2.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );

        brlAction1.getDefinition().add( auf2 );
        brlAction1.getChildColumns().add( new BRLActionVariableColumn( "$f2",
                                                                       DataType.TYPE_STRING,
                                                                       "Context",
                                                                       "f2" ) );

        ActionUpdateField auf3 = new ActionUpdateField( "x" );
        auf3.addFieldValue( new ActionFieldValue( "f3",
                                                  "$f3",
                                                  DataType.TYPE_STRING ) );
        auf3.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );

        brlAction1.getDefinition().add( auf3 );
        brlAction1.getChildColumns().add( new BRLActionVariableColumn( "$f3",
                                                                       DataType.TYPE_STRING,
                                                                       "Context",
                                                                       "f3" ) );

        dt.getActionCols().add( brlAction1 );
View Full Code Here

        ConditionCol52 c = new ConditionCol52();
        c.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        p1.getChildColumns().add( c );
        dt.getConditions().add( p1 );

        BRLActionColumn brlAction1 = new BRLActionColumn();
        ActionUpdateField auf1 = new ActionUpdateField( "x" );
        auf1.addFieldValue( new ActionFieldValue( "f1",
                                                  "$f1",
                                                  DataType.TYPE_STRING ) );
        auf1.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );

        brlAction1.getDefinition().add( auf1 );
        brlAction1.getChildColumns().add( new BRLActionVariableColumn( "$f1",
                                                                       DataType.TYPE_STRING,
                                                                       "Context",
                                                                       "f1" ) );
        ActionUpdateField auf2 = new ActionUpdateField( "x" );
        auf2.addFieldValue( new ActionFieldValue( "f2",
                                                  "$f2",
                                                  DataType.TYPE_STRING ) );
        auf2.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );

        brlAction1.getDefinition().add( auf2 );
        brlAction1.getChildColumns().add( new BRLActionVariableColumn( "$f2",
                                                                       DataType.TYPE_STRING,
                                                                       "Context",
                                                                       "f2" ) );

        ActionUpdateField auf3 = new ActionUpdateField( "x" );
        auf3.addFieldValue( new ActionFieldValue( "f3",
                                                  "$f3",
                                                  DataType.TYPE_STRING ) );
        auf3.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );

        brlAction1.getDefinition().add( auf3 );
        brlAction1.getChildColumns().add( new BRLActionVariableColumn( "$f3",
                                                                       DataType.TYPE_STRING,
                                                                       "Context",
                                                                       "f3" ) );

        dt.getActionCols().add( brlAction1 );
View Full Code Here

        ConditionCol52 c = new ConditionCol52();
        c.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        p1.getChildColumns().add( c );
        dt.getConditions().add( p1 );

        BRLActionColumn brlAction1 = new BRLActionColumn();
        ActionUpdateField auf1 = new ActionUpdateField( "x" );
        auf1.addFieldValue( new ActionFieldValue( "f1",
                                                  "$f1",
                                                  DataType.TYPE_STRING ) );
        auf1.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );

        brlAction1.getDefinition().add( auf1 );
        brlAction1.getChildColumns().add( new BRLActionVariableColumn( "$f1",
                                                                       DataType.TYPE_STRING,
                                                                       "Context",
                                                                       "f1" ) );
        ActionUpdateField auf2 = new ActionUpdateField( "x" );
        auf2.addFieldValue( new ActionFieldValue( "f2",
                                                  "$f2",
                                                  DataType.TYPE_STRING ) );
        auf2.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );

        brlAction1.getDefinition().add( auf2 );
        brlAction1.getChildColumns().add( new BRLActionVariableColumn( "$f2",
                                                                       DataType.TYPE_STRING,
                                                                       "Context",
                                                                       "f2" ) );

        ActionUpdateField auf3 = new ActionUpdateField( "x" );
        auf3.addFieldValue( new ActionFieldValue( "f3",
                                                  "$f3",
                                                  DataType.TYPE_STRING ) );
        auf3.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );

        brlAction1.getDefinition().add( auf3 );
        brlAction1.getChildColumns().add( new BRLActionVariableColumn( "$f3",
                                                                       DataType.TYPE_STRING,
                                                                       "Context",
                                                                       "f3" ) );

        dt.getActionCols().add( brlAction1 );
View Full Code Here

        ConditionCol52 c = new ConditionCol52();
        c.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        p1.getChildColumns().add( c );
        dt.getConditions().add( p1 );

        BRLActionColumn brlAction1 = new BRLActionColumn();
        ActionUpdateField auf1 = new ActionUpdateField( "x" );
        auf1.addFieldValue( new ActionFieldValue( "f1",
                                                  "$f1",
                                                  DataType.TYPE_STRING ) );
        auf1.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );

        brlAction1.getDefinition().add( auf1 );
        brlAction1.getChildColumns().add( new BRLActionVariableColumn( "$f1",
                                                                       DataType.TYPE_STRING,
                                                                       "Context",
                                                                       "f1" ) );
        ActionUpdateField auf2 = new ActionUpdateField( "x" );
        auf2.addFieldValue( new ActionFieldValue( "f2",
                                                  "$f2",
                                                  DataType.TYPE_STRING ) );
        auf2.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );

        brlAction1.getDefinition().add( auf2 );
        brlAction1.getChildColumns().add( new BRLActionVariableColumn( "$f2",
                                                                       DataType.TYPE_STRING,
                                                                       "Context",
                                                                       "f2" ) );

        ActionUpdateField auf3 = new ActionUpdateField( "x" );
        auf3.addFieldValue( new ActionFieldValue( "f3",
                                                  "$f3",
                                                  DataType.TYPE_STRING ) );
        auf3.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );

        brlAction1.getDefinition().add( auf3 );
        brlAction1.getChildColumns().add( new BRLActionVariableColumn( "$f3",
                                                                       DataType.TYPE_STRING,
                                                                       "Context",
                                                                       "f3" ) );

        dt.getActionCols().add( brlAction1 );
View Full Code Here

                                            popup.show();
                                        }
                                    } );

        } else if ( c instanceof BRLActionColumn ) {
            final BRLActionColumn column = (BRLActionColumn) c;
            Image edit = GuidedDecisionTableImageResources508.INSTANCE.Edit();
            edit.setAltText( GuidedDecisionTableConstants.INSTANCE.EditThisActionColumnConfiguration() );
            return new ImageButton( edit,
                                    GuidedDecisionTableConstants.INSTANCE.EditThisActionColumnConfiguration(),
                                    new ClickHandler() {
View Full Code Here

                                                                                                 isReadOnly );
                        popup.show();
                    }

                    private void showActionBRLFragment() {
                        final BRLActionColumn column = makeNewActionBRLFragment();
                        switch ( model.getTableFormat() ) {
                            case EXTENDED_ENTRY:
                                BRLActionColumnViewImpl popup = new BRLActionColumnViewImpl( path,
                                                                                             model,
                                                                                             oracle,
                                                                                             ruleNameService,
                                                                                             column,
                                                                                             eventBus,
                                                                                             true,
                                                                                             isReadOnly );
                                popup.setPresenter( BRL_ACTION_PRESENTER );
                                popup.show();
                                break;
                            case LIMITED_ENTRY:
                                LimitedEntryBRLActionColumnViewImpl limtedEntryPopup = new LimitedEntryBRLActionColumnViewImpl( path,
                                                                                                                                model,
                                                                                                                                oracle,
                                                                                                                                ruleNameService,
                                                                                                                                (LimitedEntryBRLActionColumn) column,
                                                                                                                                eventBus,
                                                                                                                                true,
                                                                                                                                isReadOnly );
                                limtedEntryPopup.setPresenter( LIMITED_ENTRY_BRL_ACTION_PRESENTER );
                                limtedEntryPopup.show();
                                break;
                        }

                    }

                    private void newActionAdded( ActionCol52 column ) {
                        dtable.addColumn( column );
                        refreshActionsWidget();
                    }
                }, new Command() {
                    @Override
                    public void execute() {
                        pop.hide();
                    }
                }
                );

                //If a separator is clicked disable OK button
                choice.addClickHandler( new ClickHandler() {

                    public void onClick( ClickEvent event ) {
                        int itemIndex = choice.getSelectedIndex();
                        if ( itemIndex < 0 ) {
                            return;
                        }
                        footer.enableOkButton( !choice.getValue( itemIndex ).equals( SECTION_SEPARATOR ) );
                    }

                } );

                pop.setTitle( GuidedDecisionTableConstants.INSTANCE.AddNewColumn() );
                pop.addAttribute( GuidedDecisionTableConstants.INSTANCE.TypeOfColumn(),
                                  choice );
                pop.addAttribute( "",
                                  chkIncludeAdvancedOptions );
                pop.add( footer );
                pop.show();
            }

            private ConditionCol52 makeNewConditionColumn() {
                switch ( model.getTableFormat() ) {
                    case LIMITED_ENTRY:
                        return new LimitedEntryConditionCol52();
                    default:
                        return new ConditionCol52();
                }
            }

            private ActionInsertFactCol52 makeNewActionInsertColumn() {
                switch ( model.getTableFormat() ) {
                    case LIMITED_ENTRY:
                        return new LimitedEntryActionInsertFactCol52();
                    default:
                        return new ActionInsertFactCol52();
                }
            }

            private ActionSetFieldCol52 makeNewActionSetColumn() {
                switch ( model.getTableFormat() ) {
                    case LIMITED_ENTRY:
                        return new LimitedEntryActionSetFieldCol52();
                    default:
                        return new ActionSetFieldCol52();
                }
            }

            private ActionRetractFactCol52 makeNewActionRetractFact() {
                switch ( model.getTableFormat() ) {
                    case LIMITED_ENTRY:
                        LimitedEntryActionRetractFactCol52 ler = new LimitedEntryActionRetractFactCol52();
                        ler.setValue( new DTCellValue52( "" ) );
                        return ler;
                    default:
                        return new ActionRetractFactCol52();
                }
            }

            private ActionWorkItemCol52 makeNewActionWorkItem() {
                //WorkItems are defined within the column and always boolean (i.e. Limited Entry) in the table
                return new ActionWorkItemCol52();
            }

            private ActionWorkItemSetFieldCol52 makeNewActionWorkItemSetField() {
                //Actions setting Field Values from Work Item Result Parameters are always boolean (i.e. Limited Entry) in the table
                return new ActionWorkItemSetFieldCol52();
            }

            private ActionWorkItemInsertFactCol52 makeNewActionWorkItemInsertFact() {
                //Actions setting Field Values from Work Item Result Parameters are always boolean (i.e. Limited Entry) in the table
                return new ActionWorkItemInsertFactCol52();
            }

            private BRLActionColumn makeNewActionBRLFragment() {
                switch ( model.getTableFormat() ) {
                    case LIMITED_ENTRY:
                        return new LimitedEntryBRLActionColumn();
                    default:
                        return new BRLActionColumn();
                }
            }

            private BRLConditionColumn makeNewConditionBRLFragment() {
                switch ( model.getTableFormat() ) {
View Full Code Here

        a1.setType( DataType.TYPE_STRING );

        dtable.getActionCols().add( a1 );

        //BRL Column
        BRLActionColumn brl1 = new BRLActionColumn();

        //BRL Column definition
        List<IAction> brl1Definition = new ArrayList<IAction>();
        ActionInsertFact brl1DefinitionAction1 = new ActionInsertFact( "Smurf" );
        ActionFieldValue brl1DefinitionAction1FieldValue1 = new ActionFieldValue( "name",
                                                                                  "$name",
                                                                                  DataType.TYPE_STRING );
        brl1DefinitionAction1FieldValue1.setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );
        brl1DefinitionAction1.addFieldValue( brl1DefinitionAction1FieldValue1 );
        ActionFieldValue brl1DefinitionAction1FieldValue2 = new ActionFieldValue( "age",
                                                                                  "$age",
                                                                                  DataType.TYPE_NUMERIC_INTEGER );
        brl1DefinitionAction1FieldValue2.setNature( BaseSingleFieldConstraint.TYPE_TEMPLATE );
        brl1DefinitionAction1.addFieldValue( brl1DefinitionAction1FieldValue2 );
        brl1Definition.add( brl1DefinitionAction1 );
        brl1.setDefinition( brl1Definition );

        //Setup BRL column bindings
        BRLActionVariableColumn brl1Variable1 = new BRLActionVariableColumn( "$name",
                                                                             DataType.TYPE_STRING,
                                                                             "Person",
                                                                             "name" );
        brl1.getChildColumns().add( brl1Variable1 );
        BRLActionVariableColumn brl1Variable2 = new BRLActionVariableColumn( "$age",
                                                                             DataType.TYPE_NUMERIC_INTEGER,
                                                                             "Person",
                                                                             "age" );
        brl1.getChildColumns().add( brl1Variable2 );

        dtable.getActionCols().add( brl1 );

        //Now to test conversion
        RuleModel rm = new RuleModel();
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn

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.