public void addFieldValue(final ActionFieldValue val) { if (val instanceof ActionFieldFunction) { super.addFieldValue(val); } else { throw new IllegalArgumentException( "Cannot assign field values of types other than ActionFieldFunction."); } }
private ActionSetField visitActionFieldList(ActionSetField afl) { ActionSetField clone = new ActionSetField(); clone.setVariable(afl.getVariable()); for (ActionFieldValue afv : afl.getFieldValues()) { clone.addFieldValue(cloneActionFieldValue(afv)); } return clone; }
private ActionSetField visitActionFieldList(ActionSetField afl) { ActionSetField clone = new ActionSetField(); clone.setVariable(afl.getVariable()); for (ActionFieldValue afv : afl.getFieldValues()) { clone.addFieldValue(cloneActionFieldValue(afv)); } return clone; }
public void onChange(ChangeEvent event) { String fieldName = box.getItemText(box.getSelectedIndex()); String fieldType = oracle.getFieldType(variableClass, fieldName); model.addFieldValue(new ActionFieldValue(fieldName, "", fieldType)); setModified(true); getModeller().refreshWidget(); popup.hide(); } });
public void onChange(ChangeEvent event) { String fieldName = box.getItemText(box.getSelectedIndex()); String fieldType = oracle.getFieldType(variableClass, fieldName); model.addFieldValue(new ActionFieldValue(fieldName, "", fieldType)); setModified(true); getModeller().refreshWidget(); popup.hide(); } });
sf.getWorkItemResultParameterName(), sf.getParameterClassName()); asf.addFieldValue(val);
private void doAction(List<LabelledAction> actions, ActionSetFieldCol52 sf, String cell) { LabelledAction a = findByLabelledAction(actions, sf.getBoundName(), sf.isUpdate()); if (a == null) { a = new LabelledAction(); a.boundName = sf.getBoundName(); a.isUpdate = sf.isUpdate(); if (!sf.isUpdate()) { a.action = new ActionSetField(sf.getBoundName()); } else { a.action = new ActionUpdateField(sf.getBoundName()); } actions.add(a); } else if (sf.isUpdate() && !(a.action instanceof ActionUpdateField)) { // lets swap it out for an update as the user has asked for it. ActionSetField old = (ActionSetField) a.action; ActionUpdateField update = new ActionUpdateField(sf.getBoundName()); update.setFieldValues(old.getFieldValues()); a.action = update; } ActionSetField asf = (ActionSetField) a.action; ActionFieldValue val = new ActionFieldValue(sf.getFactField(), cell, sf.getType()); asf.addFieldValue(val); }
@Test public void testActionUpdateFactFirstValue() { TemplateModel m = new TemplateModel(); m.name = "r1"; FactPattern fp = new FactPattern("Person"); fp.setBoundName("$p"); m.addLhsItem(fp); ActionSetField asf = new ActionSetField("$p"); ActionFieldValue afv0 = new ActionFieldValue(); afv0.setNature(FieldNatureType.TYPE_TEMPLATE); afv0.setField("field1"); afv0.setValue("$f1"); asf.addFieldValue(afv0); ActionFieldValue afv1 = new ActionFieldValue(); afv1.setNature(FieldNatureType.TYPE_TEMPLATE); afv1.setField("field2"); afv1.setValue("$f2"); asf.addFieldValue(afv1); m.addRhsItem(asf); String expected = "rule \"r1_0\"\n" + "dialect \"mvel\"\n" + "when\n" + "$p : Person()\n" + "then\n" + "$p.setField1(\"foo\");\n" + "end"; m.addRow(new String[]{"foo", null}); checkMarshall(expected, m); }
@Test public void testActionUpdateFactZeroValues() { TemplateModel m = new TemplateModel(); m.name = "r1"; FactPattern fp = new FactPattern("Person"); fp.setBoundName("$p"); m.addLhsItem(fp); ActionSetField asf = new ActionSetField("$p"); ActionFieldValue afv0 = new ActionFieldValue(); afv0.setNature(FieldNatureType.TYPE_TEMPLATE); afv0.setField("field1"); afv0.setValue("$f1"); asf.addFieldValue(afv0); ActionFieldValue afv1 = new ActionFieldValue(); afv1.setNature(FieldNatureType.TYPE_TEMPLATE); afv1.setField("field2"); afv1.setValue("$f2"); asf.addFieldValue(afv1); m.addRhsItem(asf); String expected = "rule \"r1_0\"\n" + "dialect \"mvel\"\n" + "when\n" + "$p : Person()\n" + "then\n" + "end"; m.addRow(new String[]{null, null}); checkMarshall(expected, m); }
asf.addFieldValue(new ActionFieldValue("age", "33", DataType.TYPE_NUMERIC_INTEGER)); asf.addFieldValue(new ActionFieldValue("amount", "10000", DataType.TYPE_NUMERIC_INTEGER));
asf.addFieldValue(new ActionFieldValue("age", "33", DataType.TYPE_NUMERIC_INTEGER)); asf.addFieldValue(new ActionFieldValue("amount", "10000", DataType.TYPE_NUMERIC_INTEGER));
@Test public void testActionUpdateFactSecondValue() { TemplateModel m = new TemplateModel(); m.name = "r1"; FactPattern fp = new FactPattern("Person"); fp.setBoundName("$p"); m.addLhsItem(fp); ActionSetField asf = new ActionSetField("$p"); ActionFieldValue afv0 = new ActionFieldValue(); afv0.setNature(FieldNatureType.TYPE_TEMPLATE); afv0.setField("field1"); afv0.setValue("$f1"); asf.addFieldValue(afv0); ActionFieldValue afv1 = new ActionFieldValue(); afv1.setNature(FieldNatureType.TYPE_TEMPLATE); afv1.setField("field2"); afv1.setValue("$f2"); asf.addFieldValue(afv1); m.addRhsItem(asf); String expected = "rule \"r1_0\"\n" + "dialect \"mvel\"\n" + "when\n" + "$p : Person()\n" + "then\n" + "$p.setField2(\"bar\");\n" + "end"; m.addRow(new String[]{null, "bar"}); checkMarshall(expected, m); }
afv0.setField("field1"); afv0.setValue("$f1"); asf.addFieldValue(afv0); ActionFieldValue afv1 = new ActionFieldValue(); afv1.setNature(FieldNatureType.TYPE_TEMPLATE); afv1.setField("field2"); afv1.setValue("$f2"); asf.addFieldValue(afv1);
asf.addFieldValue(new ActionFieldValue("age", "33", DataType.TYPE_NUMERIC_INTEGER)); asf.addFieldValue(new ActionFieldValue("amount", "10000", DataType.TYPE_NUMERIC_INTEGER));
afv0.setField("field1"); afv0.setValue("$asf1"); asf.addFieldValue(afv0); m.addRhsItem(asf);
asf.addFieldValue( buildActionFieldValue() ); asf.addFieldValue( buildActionFieldValue() ); model.addRhsItem( asf );