private ActionInsertFactCol52 makeNewColumn(ActionInsertFactCol c) { ActionInsertFactCol52 nc = new ActionInsertFactCol52(); nc.setBoundName( c.boundName ); nc.setDefaultValue( new DTCellValue52( c.defaultValue ) ); nc.setFactField( c.factField ); nc.setFactType( c.factType ); nc.setHeader( c.header ); nc.setHideColumn( c.hideColumn ); nc.setType( c.type ); nc.setValueList( c.valueList ); nc.setWidth( c.width ); return nc; }
private void doAction(List<LabelledAction> actions, ActionInsertFactCol52 ac, String cell) { LabelledAction a = findByLabelledAction( actions, ac.getBoundName() ); if ( a == null ) { a = new LabelledAction(); a.boundName = ac.getBoundName(); if ( !ac.isInsertLogical() ) { ActionInsertFact ins = new ActionInsertFact( ac.getFactType() ); ins.setBoundName( ac.getBoundName() ); a.action = ins; } else { ActionInsertLogicalFact ins = new ActionInsertLogicalFact( ac.getFactType() ); ins.setBoundName( ac.getBoundName() ); a.action = ins; } actions.add( a ); } ActionInsertFact ins = (ActionInsertFact) a.action; ActionFieldValue val = new ActionFieldValue( ac.getFactField(), cell, ac.getType() ); ins.addFieldValue( val ); }
public ActionInsertFactColumnDetails(final ActionInsertFactCol52 column) { super( column ); this.factType = column.getFactType(); this.factField = column.getFactField(); }
private ActionInsertFactCol52ActionInsertFactAdaptor(ActionInsertFactCol52 action) { if ( action == null ) { throw new NullPointerException( "action cannot be null" ); } this.action = action; this.factType = action.getFactType(); ActionFieldValue afv = new ActionFieldValue(); afv.field = action.getFactField(); afv.nature = BaseSingleFieldConstraint.TYPE_LITERAL; afv.type = action.getType(); super.addFieldValue( afv ); }
@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( SuggestionCompletionEngine.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" ) ); }
dt.getActionCols().add( asf ); ActionInsertFactCol52 ins = new ActionInsertFactCol52(); ins.setBoundName( "x" ); ins.setFactField( "rating" ); ins.setFactType( "Person" ); dt.getActionCols().add( ins ); ActionInsertFactCol52 ins_ = new ActionInsertFactCol52(); ins_.setBoundName( "x" ); ins_.setFactField( "rating" ); ins_.setFactType( "Person" ); ins_.setValueList( "one,two,three" ); dt.getActionCols().add( ins_ ); assertTrue( sce.hasEnums( ins.getFactType(), ins.getFactField() ) ); assertFalse( dt.hasValueList( ins ) ); r = sce.getEnums( ins.getFactType(), ins.getFactField(), currentValueMap ).fixedList; assertEquals( 2, assertTrue( sce.hasEnums( ins_.getFactType(), ins_.getFactField() ) ); assertTrue( dt.hasValueList( ins_ ) ); r = dt.getValueList( ins_ );
@Override public String getBoundName() { return action.getBoundName(); }
@Override public ActionInsertFact getRHSBoundFact(String var) { for ( ActionCol52 col : dtable.getActionCols() ) { if ( col instanceof ActionInsertFactCol52 ) { ActionInsertFactCol52 action = (ActionInsertFactCol52) col; if ( action.getBoundName().equals( var ) ) { if ( action.isInsertLogical() ) { return new ActionInsertFactCol52ActionInsertLogicalFactAdaptor( action ); } return new ActionInsertFactCol52ActionInsertFactAdaptor( action ); } } else if ( col instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) col; for ( IAction a : brl.getDefinition() ) { if ( a instanceof ActionInsertFact ) { ActionInsertFact action = (ActionInsertFact) a; if ( action.isBound() ) { if ( action.getBoundName().equals( var ) ) { return action; } } } } } } return super.getRHSBoundFact( var ); }
dt.getActionCols().add( new ActionInsertFactCol52() ); ActionSetFieldCol52 set = new ActionSetFieldCol52(); set.setFactField( "foo" );
cols.add( ret ); ActionInsertFactCol52 ins1 = new ActionInsertFactCol52(); ins1.setBoundName( "ins" ); ins1.setFactType( "Cheese" ); ins1.setFactField( "price" ); ins1.setType( SuggestionCompletionEngine.TYPE_NUMERIC_INTEGER ); cols.add( ins1 ); ActionInsertFactCol52 ins2 = new ActionInsertFactCol52(); ins2.setBoundName( "ins" ); ins2.setFactType( "Cheese" ); ins2.setFactField( "type" ); ins2.setType( SuggestionCompletionEngine.TYPE_NUMERIC_INTEGER ); cols.add( ins2 );
private ActionInsertFactCol52ActionInsertLogicalFactAdaptor(ActionInsertFactCol52 action) { if ( action == null ) { throw new NullPointerException( "action cannot be null" ); } this.action = action; this.factType = action.getFactType(); ActionFieldValue afv = new ActionFieldValue(); afv.field = action.getFactField(); afv.nature = BaseSingleFieldConstraint.TYPE_LITERAL; afv.type = action.getType(); super.addFieldValue( afv ); }
public ActionInsertFactColumnDetails(final ActionInsertFactCol52 column) { super( column ); this.factType = column.getFactType(); this.factField = column.getFactField(); }
@Override public String getBoundName() { return action.getBoundName(); }
@Override public ActionInsertFact getRHSBoundFact(String var) { for ( ActionCol52 col : dtable.getActionCols() ) { if ( col instanceof ActionInsertFactCol52 ) { ActionInsertFactCol52 action = (ActionInsertFactCol52) col; if ( action.getBoundName().equals( var ) ) { if ( action.isInsertLogical() ) { return new ActionInsertFactCol52ActionInsertLogicalFactAdaptor( action ); } return new ActionInsertFactCol52ActionInsertFactAdaptor( action ); } } else if ( col instanceof BRLActionColumn ) { BRLActionColumn brl = (BRLActionColumn) col; for ( IAction a : brl.getDefinition() ) { if ( a instanceof ActionInsertFact ) { ActionInsertFact action = (ActionInsertFact) a; if ( action.isBound() ) { if ( action.getBoundName().equals( var ) ) { return action; } } } } } } return super.getRHSBoundFact( var ); }
dt.getConditions().add( brlCondition ); ActionInsertFactCol52 ins = new ActionInsertFactCol52(); ins.setBoundName( "$ins" ); ins.setFactField( "rating" ); ins.setFactType( "Person" ); ins.setType( SuggestionCompletionEngine.TYPE_STRING ); dt.getActionCols().add( ins );
private ActionInsertFactCol52 makeNewColumn(ActionInsertFactCol c) { ActionInsertFactCol52 nc = new ActionInsertFactCol52(); nc.setBoundName( c.boundName ); nc.setDefaultValue( new DTCellValue52( c.defaultValue ) ); nc.setFactField( c.factField ); nc.setFactType( c.factType ); nc.setHeader( c.header ); nc.setHideColumn( c.hideColumn ); nc.setType( c.type ); nc.setValueList( c.valueList ); nc.setWidth( c.width ); return nc; }
private void doAction(List<LabelledAction> actions, ActionInsertFactCol52 ac, String cell) { LabelledAction a = findByLabelledAction( actions, ac.getBoundName() ); if ( a == null ) { a = new LabelledAction(); a.boundName = ac.getBoundName(); if ( !ac.isInsertLogical() ) { ActionInsertFact ins = new ActionInsertFact( ac.getFactType() ); ins.setBoundName( ac.getBoundName() ); a.action = ins; } else { ActionInsertLogicalFact ins = new ActionInsertLogicalFact( ac.getFactType() ); ins.setBoundName( ac.getBoundName() ); a.action = ins; } actions.add( a ); } ActionInsertFact ins = (ActionInsertFact) a.action; ActionFieldValue val = new ActionFieldValue( ac.getFactField(), cell, ac.getType() ); ins.addFieldValue( val ); }
private ActionInsertFactCol52ActionInsertFactAdaptor(ActionInsertFactCol52 action) { if ( action == null ) { throw new NullPointerException( "action cannot be null" ); } this.action = action; this.factType = action.getFactType(); ActionFieldValue afv = new ActionFieldValue(); afv.field = action.getFactField(); afv.nature = BaseSingleFieldConstraint.TYPE_LITERAL; afv.type = action.getType(); super.addFieldValue( afv ); }
private String getType(ActionInsertFactCol52 col, SuggestionCompletionEngine sce) { // Columns with "Value Lists" etc are always Text (for now) if ( hasValueList( col ) ) { return SuggestionCompletionEngine.TYPE_STRING; } //Otherwise lookup from SuggestionCompletionEngine final String factType = col.getFactType(); final String fieldName = col.getFactField(); return getTypeFromSCE( factType, fieldName, sce ); }
@Override public String getBoundName() { return action.getBoundName(); }