public void visitActionSetField(final ActionSetField action) { if (action instanceof ActionCallMethod) { this.generateSetMethodCallsMethod((ActionCallMethod) action, action.getFieldValues()); } else { this.generateSetMethodCalls(action.getVariable(), action.getFieldValues()); } }
private ActionSetField visitActionFieldList(ActionSetField afl) { ActionSetField clone = new ActionSetField(); clone.setVariable(afl.getVariable()); for (ActionFieldValue afv : afl.getFieldValues()) { clone.addFieldValue(cloneActionFieldValue(afv)); } return clone; }
(asf instanceof ActionUpdateField))); } else { final List<ActionFieldValue> existingActionFieldValue = new ArrayList<ActionFieldValue>(Arrays.asList(afw.getAction().getFieldValues())); for (ActionFieldValue afv : asf.getFieldValues()) { existingActionFieldValue.add(afv); afw.getAction().setFieldValues(existingActionFieldValue.toArray(temp));
ifc2.addFieldValue(afv2); final ActionSetField asf = new ActionSetField(); asf.setVariable("$a"); asf.addFieldValue(new ActionFieldValue("age", "33", DataType.TYPE_NUMERIC_INTEGER)); asf.setVariable("$m"); asf.addFieldValue(new ActionFieldValue("amount", "10000", DataType.TYPE_NUMERIC_INTEGER));
private ActionSetField clone(final ActionSetField action) { if (action instanceof ActionUpdateField) { final ActionUpdateField auf = (ActionUpdateField) action; final ActionUpdateField clone = new ActionUpdateField(auf.getVariable()); clone.setFieldValues(auf.getFieldValues()); return clone; } else if (action instanceof ActionCallMethod) { final ActionCallMethod acm = (ActionCallMethod) action; final ActionCallMethod clone = new ActionCallMethod(acm.getVariable()); clone.setState(acm.getState()); clone.setMethodName(acm.getMethodName()); clone.setFieldValues(acm.getFieldValues()); return clone; } else if (action instanceof ActionSetField) { final ActionSetField clone = new ActionSetField(action.getVariable()); clone.setFieldValues(action.getFieldValues()); return clone; } else { return action; } } }
a.boundName = sf.getBoundName(); if (!sf.isUpdate()) { a.action = new ActionSetField(sf.getBoundName()); } else { a.action = new ActionUpdateField(sf.getBoundName()); update.setFieldValues(old.getFieldValues()); a.action = update; sf.getWorkItemResultParameterName(), sf.getParameterClassName()); 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); }
private ActionSetFieldWrapper findExistingAction(final ActionSetField asf, final List<IAction> actions) { for (IAction action : actions) { if (action instanceof ActionSetFieldWrapper) { final ActionSetFieldWrapper afw = (ActionSetFieldWrapper) action; if (asf.getVariable().equals(afw.getAction().getVariable()) && (asf instanceof ActionUpdateField) == afw.isUpdate()) { return afw; } } } return null; }
private void visitActionFieldList(final String fullyQualifiedClassName, final ActionSetField afl) { for (ActionFieldValue afv : afl.getFieldValues()) { visit(fullyQualifiedClassName, afv); } }
private void addActionSetField(String itemText, int position) { this.model.addRhsItem(new ActionSetField(itemText), position); }
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."); } }
ifc2.addFieldValue(afv2); final ActionSetField asf = new ActionSetField(); asf.setVariable("$a"); asf.addFieldValue(new ActionFieldValue("age", "33", DataType.TYPE_NUMERIC_INTEGER)); asf.setVariable("$m"); asf.addFieldValue(new ActionFieldValue("amount", "10000", DataType.TYPE_NUMERIC_INTEGER));
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 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); }
private Optional<String> getType(final RuleModel ruleModel, final ActionFieldList actionFieldList) { if (actionFieldList instanceof ActionInsertFact) { return Optional.of(((ActionInsertFact) actionFieldList).getFactType()); } else if (actionFieldList instanceof ActionSetField) { final String var = ((ActionSetField) actionFieldList).getVariable(); return Optional.ofNullable(ruleModel.getLHSBindingType(var)); } return Optional.empty(); } }
private void visitActionFieldList(final String fullyQualifiedClassName, final ActionSetField afl) { for (ActionFieldValue afv : afl.getFieldValues()) { visit(fullyQualifiedClassName, afv); } }
private void addActionSetField(String itemText, int position) { this.model.addRhsItem(new ActionSetField(itemText), position); }
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(); } });
private void visitActionFieldList(ActionSetField afl) { String factType = model.getLHSBindingType(afl.getVariable()); for (ActionFieldValue afv : afl.getFieldValues()) { InterpolationVariable var = new InterpolationVariable(afv.getValue(), afv.getType(), factType, afv.getField()); if (afv.getNature() == FieldNatureType.TYPE_TEMPLATE && !vars.containsKey(var)) { vars.put(var, vars.size()); } } }
private ActionSetField visitActionFieldList(ActionSetField afl) { ActionSetField clone = new ActionSetField(); clone.setVariable(afl.getVariable()); for (ActionFieldValue afv : afl.getFieldValues()) { clone.addFieldValue(cloneActionFieldValue(afv)); } return clone; }