public void onClick( ClickEvent w ) { String[] val = pats.getValue( pats.getSelectedIndex() ).split( "\\s" ); // NON-NLS editingCol.setFactType( val[ 0 ] ); editingCol.setBoundName( val[ 1 ] ); editingCol.setFactField( null ); makeLimitedValueWidget(); makeDefaultValueWidget(); doPatternLabel(); doFieldLabel(); doValueList(); pop.hide(); } } );
@Override public void makeResult( final GuidedDecisionTable52 model ) { //Copy actions to decision table model int fi = 1; for ( Map.Entry<ActionInsertFactFieldsPattern, List<ActionInsertFactCol52>> ps : patternToActionsMap.entrySet() ) { final ActionInsertFactFieldsPattern p = ps.getKey(); if ( !getValidator().isPatternValid( p ) ) { String binding = NEW_FACT_PREFIX + ( fi++ ); p.setBoundName( binding ); while ( !getValidator().isPatternBindingUnique( p ) ) { binding = NEW_FACT_PREFIX + ( fi++ ); p.setBoundName( binding ); } } final String factType = p.getFactType(); final String boundName = p.getBoundName(); final boolean isLogicalInsert = p.isInsertedLogically(); for ( ActionInsertFactCol52 aif : ps.getValue() ) { aif.setFactType( factType ); aif.setBoundName( boundName ); aif.setInsertLogical( isLogicalInsert ); model.getActionCols().add( aif ); } } }
public void onClick( ClickEvent w ) { //Validate column configuration String ft = types.getItemText( types.getSelectedIndex() ); String fn = binding.getText(); if ( fn.equals( "" ) ) { Window.alert( Constants.INSTANCE.PleaseEnterANameForFact() ); return; } else if ( fn.equals( ft ) ) { Window.alert( Constants.INSTANCE.PleaseEnterANameThatIsNotTheSameAsTheFactType() ); return; } else if ( !isBindingUnique( fn ) ) { Window.alert( Constants.INSTANCE.PleaseEnterANameThatIsNotAlreadyUsedByAnotherPattern() ); return; } //Configure column editingCol.setBoundName( binding.getText() ); editingCol.setFactType( types.getItemText( types.getSelectedIndex() ) ); editingCol.setFactField( null ); makeLimitedValueWidget(); makeDefaultValueWidget(); doPatternLabel(); doFieldLabel(); doValueList(); pop.hide(); } } );
@Test public void testOnlyDecisionTableColumns() { GuidedDecisionTable52 dt = new GuidedDecisionTable52(); Pattern52 p1 = new Pattern52(); p1.setFactType( "Driver" ); p1.setBoundName( "$p1" ); ConditionCol52 c1 = new ConditionCol52(); c1.setFactField( "name" ); c1.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL ); c1.setBinding( "$c1" ); p1.getChildColumns().add( c1 ); dt.getConditions().add( p1 ); ActionInsertFactCol52 ins = new ActionInsertFactCol52(); ins.setBoundName( "$ins" ); ins.setFactField( "rating" ); ins.setFactType( "Person" ); ins.setType( DataType.TYPE_STRING ); dt.getActionCols().add( ins ); BRLRuleModel model = new BRLRuleModel( dt ); assertNotNull( model.getAllVariables() ); assertEquals( 3, model.getAllVariables().size() ); assertTrue( model.getAllVariables().contains( "$p1" ) ); assertTrue( model.getAllVariables().contains( "$c1" ) ); assertTrue( model.getAllVariables().contains( "$ins" ) ); }
private void populateModelColumn( final ActionInsertFactCol52 col, final ActionInsertFactCol52 editingCol ) { col.setBoundName( editingCol.getBoundName() ); col.setType( editingCol.getType() ); col.setFactField( editingCol.getFactField() ); col.setHeader( editingCol.getHeader() ); col.setValueList( editingCol.getValueList() ); col.setDefaultValue( editingCol.getDefaultValue() ); col.setHideColumn( editingCol.isHideColumn() ); col.setFactType( editingCol.getFactType() ); col.setInsertLogical( editingCol.isInsertLogical() ); if ( col instanceof LimitedEntryCol && editingCol instanceof LimitedEntryCol ) { ( (LimitedEntryCol) col ).setValue( ( (LimitedEntryCol) editingCol ).getValue() ); } }
private ActionInsertFactCol52 makeNewActionColumn( final AvailableField f ) { final GuidedDecisionTable52.TableFormat format = presenter.getTableFormat(); if ( format == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY ) { final ActionInsertFactCol52 a = new ActionInsertFactCol52(); a.setBoundName( chosenPatternsSelection.getBoundName() ); a.setFactType( chosenPatternsSelection.getFactType() ); a.setFactField( f.getName() ); a.setType( f.getType() ); return a; } else { final LimitedEntryActionInsertFactCol52 a = new LimitedEntryActionInsertFactCol52(); a.setBoundName( chosenPatternsSelection.getBoundName() ); a.setFactType( chosenPatternsSelection.getFactType() ); a.setFactField( f.getName() ); a.setType( f.getType() ); return a; } }
ins.setBoundName( "$ins" ); ins.setFactField( "rating" ); ins.setFactType( "Person" ); ins.setType( DataType.TYPE_STRING ); dt.getActionCols().add( ins );
private ActionInsertFactCol52 cloneActionInsertColumn( ActionInsertFactCol52 col ) { ActionInsertFactCol52 clone = null; if ( col instanceof LimitedEntryActionInsertFactCol52 ) { clone = new LimitedEntryActionInsertFactCol52(); DTCellValue52 dcv = cloneLimitedEntryValue( ( (LimitedEntryCol) col ).getValue() ); ( (LimitedEntryCol) clone ).setValue( dcv ); } else { clone = new ActionInsertFactCol52(); } clone.setBoundName( col.getBoundName() ); clone.setType( col.getType() ); clone.setFactField( col.getFactField() ); clone.setFactType( col.getFactType() ); clone.setHeader( col.getHeader() ); clone.setValueList( col.getValueList() ); clone.setDefaultValue( new DTCellValue52( col.getDefaultValue() ) ); clone.setHideColumn( col.isHideColumn() ); clone.setInsertLogical( col.isInsertLogical() ); return clone; }
ins.setFactType( "Cheese" ); ins.setFactField( "price" ); ins.setType( DataType.TYPE_NUMERIC_INTEGER );
ins.setFactType( "Cheese" ); ins.setFactField( "price" ); ins.setType( DataType.TYPE_NUMERIC_INTEGER );
ins.setBoundName( "$ins" ); ins.setFactField( "rating" ); ins.setFactType( "Person" ); ins.setType( DataType.TYPE_STRING ); dt.getActionCols().add( ins );
ins.setFactType( "Cheese" ); ins.setFactField( "price" ); ins.setType( DataType.TYPE_NUMERIC_INTEGER );
ins.setBoundName( "$ins" ); ins.setFactField( "rating" ); ins.setFactType( "Person" ); ins.setType( DataType.TYPE_STRING ); dt.getActionCols().add( ins );
ins.setFactType( "Driver" ); ins.setFactField( "name" ); dt.getActionCols().add( ins ); ins_.setFactType( "Driver" ); ins_.setFactField( "age" ); dt.getActionCols().add( ins_ );
ins.setBoundName( "$ins" ); ins.setFactField( "rating" ); ins.setFactType( "Person" ); ins.setType( DataType.TYPE_STRING ); dt.getActionCols().add( ins );
ins.setFactType( "Driver" ); ins.setFactField( "name" ); dt.getActionCols().add( ins ); ins_.setFactType( "Driver" ); ins_.setFactField( "age" ); dt.getActionCols().add( ins_ );
ins.setBoundName( "$ins" ); ins.setFactField( "rating" ); ins.setFactType( "Person" ); ins.setType( DataType.TYPE_STRING ); dt.getActionCols().add( ins ); ins2.setBoundName( "$ins2" ); ins2.setFactField( "rating2" ); ins2.setFactType( "Person2" ); ins2.setType( DataType.TYPE_STRING ); dt.getActionCols().add( ins2 );
aifc.setFactType( "Driver" ); aifc.setFactField( "age" );
ins.setBoundName( "$ins" ); ins.setFactField( "rating" ); ins.setFactType( "Person" ); ins.setType( DataType.TYPE_STRING ); dt.getActionCols().add( ins );
ins.setBoundName( "$ins" ); ins.setFactField( "rating" ); ins.setFactType( "Person" ); ins.setType( DataType.TYPE_STRING ); dt.getActionCols().add( ins );