public void execute() { ActionGlobalCollectionAdd gca = new ActionGlobalCollectionAdd(); gca.setGlobalName( glob ); gca.setFactName( var ); model.addRhsItem( gca, Integer.parseInt( positionCbo.getValue( positionCbo.getSelectedIndex() ) ) ); hide(); } } );
public void visitActionGlobalCollectionAdd( final ActionGlobalCollectionAdd add ) { buf.append( indentation ); if ( isDSLEnhanced ) { buf.append( ">" ); } buf.append( add.getGlobalName() + ".add( " + add.getFactName() + " );\n" ); }
} else if ( methodName.equals( "add" ) && expandedDRLInfo.hasGlobal( variable ) ) { String factName = line.substring( argStart + 1, line.lastIndexOf( ')' ) ).trim(); ActionGlobalCollectionAdd actionGlobalCollectionAdd = new ActionGlobalCollectionAdd(); actionGlobalCollectionAdd.setGlobalName( variable ); actionGlobalCollectionAdd.setFactName( factName ); m.addRhsItem( actionGlobalCollectionAdd ); } else {
eventBus ); this.isFactTypeKnown = modeller.getSuggestionCompletions().isFactTypeRecognized( modeller.getModel().getLHSBindingType( action.getFactName() ) ); if ( readOnly == null ) { this.readOnly = !this.isFactTypeKnown; SimplePanel sp = new SimplePanel(); sp.setStyleName( "model-builderInner-Background" ); //NON-NLS sp.add( new SmallLabel( " " + Constants.INSTANCE.AddXToListY( gca.getFactName(), gca.getGlobalName() ) ) );
@Test public void testAddGlobal() { String expected = "rule \"my rule\"\n\tno-loop true\n\tdialect \"mvel\"\n\twhen\n\t\tPerson( )\n" + "\t\tAccident( )\n\tthen\n\t\tinsert( new Report() );\n\t\tresults.add(f);\nend\n"; final RuleModel m = new RuleModel(); m.addLhsItem( new FactPattern( "Person" ) ); m.addLhsItem( new FactPattern( "Accident" ) ); m.addAttribute( new RuleAttribute( "no-loop", "true" ) ); m.addRhsItem( new ActionInsertFact( "Report" ) ); ActionGlobalCollectionAdd add = new ActionGlobalCollectionAdd(); add.setGlobalName( "results" ); add.setFactName( "f" ); m.addRhsItem( add ); m.name = "my rule"; checkMarshallUnmarshall( expected, m ); }
a.getGlobalName() ); assertEquals( "$a", a.getFactName() );