public void execute() { ActionGlobalCollectionAdd gca = new ActionGlobalCollectionAdd(); gca.setGlobalName(glob); gca.setFactName(var); model.addRhsItem(gca, Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex()))); hide(); } });
private ActionGlobalCollectionAdd visitActionGlobalCollectionAdd(ActionGlobalCollectionAdd agca) { ActionGlobalCollectionAdd clone = new ActionGlobalCollectionAdd(); clone.setFactName(agca.getFactName()); clone.setGlobalName(agca.getGlobalName()); return clone; }
public void visitActionGlobalCollectionAdd(final ActionGlobalCollectionAdd add) { buf.append(indentation); if (isDSLEnhanced) { buf.append(">"); } buf.append(add.getGlobalName() + ".add( " + add.getFactName() + " );\n"); }
eventBus ); this.isFactTypeKnown = modeller.getDataModelOracle().isFactTypeRecognized( modeller.getModel().getLHSBindingType( action.getFactName() ) ); if ( readOnly == null ) { this.readOnly = !this.isFactTypeKnown; sp.add( new SmallLabel( " " + GuidedRuleEditorResources.CONSTANTS.AddXToListY( gca.getFactName(), gca.getGlobalName() ) ) );
public void execute() { ActionGlobalCollectionAdd gca = new ActionGlobalCollectionAdd(); gca.setGlobalName(glob); gca.setFactName(var); model.addRhsItem(gca, Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex()))); hide(); } });
private ActionGlobalCollectionAdd visitActionGlobalCollectionAdd(ActionGlobalCollectionAdd agca) { ActionGlobalCollectionAdd clone = new ActionGlobalCollectionAdd(); clone.setFactName(agca.getFactName()); clone.setGlobalName(agca.getGlobalName()); return clone; }
eventBus ); this.isFactTypeKnown = modeller.getDataModelOracle().isFactTypeRecognized( modeller.getModel().getLHSBindingType( action.getFactName() ) ); if ( readOnly == null ) { this.readOnly = !this.isFactTypeKnown; sp.add( new SmallLabel( " " + GuidedRuleEditorResources.CONSTANTS.AddXToListY( gca.getFactName(), gca.getGlobalName() ) ) );
String factName = line.substring(argStart + 1, line.lastIndexOf(')')).trim(); ActionGlobalCollectionAdd actionGlobalCollectionAdd = new ActionGlobalCollectionAdd(); actionGlobalCollectionAdd.setGlobalName(variable); actionGlobalCollectionAdd.setFactName(factName); m.addRhsItem(actionGlobalCollectionAdd); } else {
@Test public void testBasics() { final RuleTemplateModelPersistence p = RuleTemplateModelXMLPersistenceImpl.getInstance(); final TemplateModel m = new TemplateModel(); m.addLhsItem(new FactPattern("Person")); m.addLhsItem(new FactPattern("Accident")); m.addAttribute(new RuleAttribute("no-loop", "true")); m.addRhsItem(new ActionInsertFact("Report")); ActionGlobalCollectionAdd ag = new ActionGlobalCollectionAdd(); ag.setFactName("x"); ag.setGlobalName("g"); m.addRhsItem(ag); m.name = "my rule"; final String xml = p.marshal(m); System.out.println(xml); assertTrue(xml.indexOf("Person") > -1); assertTrue(xml.indexOf("Accident") > -1); assertTrue(xml.indexOf("no-loop") > -1); assertTrue(xml.indexOf("org.kie") == -1); assertTrue(xml.indexOf("addToGlobal") > -1); RuleModel rm_ = RuleTemplateModelXMLPersistenceImpl.getInstance().unmarshal(xml); assertEquals(2, rm_.rhs.length); }
model.addLhsItem( buildDslSentence() ); ActionGlobalCollectionAdd addGlobal = new ActionGlobalCollectionAdd(); addGlobal.setFactName( "MyFact" ); addGlobal.setGlobalName( "glist" ); model.addRhsItem( addGlobal );