private void visitActionFieldValue(final ActionFieldValue afv) { if (afv.getNature() != FieldNatureType.TYPE_TEMPLATE) { hasNonTemplateOutput = true; } }
public static void refreshActionValueEditorsDropDownData(final Map<ActionFieldValue, ActionValueEditor> actionValueEditors, final ActionFieldValue modifiedField) { for (Map.Entry<ActionFieldValue, ActionValueEditor> e : actionValueEditors.entrySet()) { final ActionFieldValue afv = e.getKey(); if (afv.getNature() == FieldNatureType.TYPE_LITERAL || afv.getNature() == FieldNatureType.TYPE_ENUM) { if (!afv.equals(modifiedField)) { e.getValue().refresh(); } } } }
public static void refreshActionValueEditorsDropDownData(final Map<ActionFieldValue, ActionValueEditor> actionValueEditors, final ActionFieldValue modifiedField) { for (Map.Entry<ActionFieldValue, ActionValueEditor> e : actionValueEditors.entrySet()) { final ActionFieldValue afv = e.getKey(); if (afv.getNature() == FieldNatureType.TYPE_LITERAL || afv.getNature() == FieldNatureType.TYPE_ENUM) { if (!afv.equals(modifiedField)) { e.getValue().refresh(); } } } }
@Override protected void generateSetMethodCall(final String variableName, final ActionFieldValue fieldValue) { if (fieldValue.getNature() == FieldNatureType.TYPE_TEMPLATE) { buf.append("@if{" + fieldValue.getValue() + " != empty}"); super.generateSetMethodCall(variableName, fieldValue); buf.append("@end{}"); } else { super.generateSetMethodCall(variableName, fieldValue); } }
@Override protected void generateModifyMethodCall(final RHSGeneratorContext gctx, final ActionFieldValue fieldValue) { if (fieldValue.getNature() == FieldNatureType.TYPE_TEMPLATE) { buf.append("@if{" + fieldValue.getValue() + " != empty}"); super.generateModifyMethodCall(gctx, fieldValue); buf.append("@end{}"); } else { super.generateModifyMethodCall(gctx, fieldValue); } }
protected boolean isValidFieldConstraint(final ActionFieldValue fieldValue) { if (fieldValue.getNature() == FieldNatureType.TYPE_TEMPLATE) { return !StringUtils.isEmpty(rowDataProvider.getTemplateKeyValue(fieldValue.getValue())); } return true; }
private void visitActionFieldList(ActionInsertFact afl) { String factType = afl.getFactType(); 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 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()); } } }
@Override protected void preGenerateSetMethodCallParameterValue(final RHSGeneratorContext gctx, final ActionFieldValue fieldValue) { if (fieldValue.getNature() == FieldNatureType.TYPE_TEMPLATE) { buf.append("@if{" + fieldValue.getValue() + " != empty}"); buf.append("@code{hasRHSOutput" + gctx.getDepth() + "_" + gctx.getOffset() + " = true}"); super.preGenerateSetMethodCallParameterValue(gctx, fieldValue); buf.append("@end{}"); } else { buf.append("@code{hasRHSOutput" + gctx.getDepth() + "_" + gctx.getOffset() + " = true}"); super.preGenerateSetMethodCallParameterValue(gctx, fieldValue); } }
private void visitActionFieldList(ActionUpdateField 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()); } } }
@Test public void testActionValueEditorRefreshPredicateNotRefreshed() throws Exception { final ActionFieldValue valueOne = mock(ActionFieldValue.class); final ActionFieldValue valueTwo = mock(ActionFieldValue.class); final ActionValueEditor editorOne = mock(ActionValueEditor.class); final ActionValueEditor editorTwo = mock(ActionValueEditor.class); final Map<ActionFieldValue, ActionValueEditor> editors = new HashMap<>(); editors.put(valueOne, editorOne); editors.put(valueTwo, editorTwo); doReturn(FieldNatureType.TYPE_LITERAL).when(valueOne).getNature(); doReturn(FieldNatureType.TYPE_PREDICATE).when(valueTwo).getNature(); RefreshUtil.refreshActionValueEditorsDropDownData(editors, mock(ActionFieldValue.class)); verify(editorOne).refresh(); verify(editorTwo, never()).refresh(); }
private void visitActionFieldList(final ActionInsertFact afl) { String factType = afl.getFactType(); for (ActionFieldValue afv : afl.getFieldValues()) { InterpolationVariable var = new InterpolationVariable(afv.getValue(), afv.getType(), factType, afv.getField()); if (afv.getNature() == FieldNatureType.TYPE_TEMPLATE && !vars.contains(var)) { vars.add(var); } else { hasNonTemplateOutput = true; } } }
@Test public void testActionValueEditorRefreshPredicateNotRefreshed() throws Exception { final ActionFieldValue valueOne = mock(ActionFieldValue.class); final ActionFieldValue valueTwo = mock(ActionFieldValue.class); final ActionValueEditor editorOne = mock(ActionValueEditor.class); final ActionValueEditor editorTwo = mock(ActionValueEditor.class); final Map<ActionFieldValue, ActionValueEditor> editors = new HashMap<>(); editors.put(valueOne, editorOne); editors.put(valueTwo, editorTwo); doReturn(FieldNatureType.TYPE_LITERAL).when(valueOne).getNature(); doReturn(FieldNatureType.TYPE_PREDICATE).when(valueTwo).getNature(); RefreshUtil.refreshActionValueEditorsDropDownData(editors, mock(ActionFieldValue.class)); verify(editorOne).refresh(); verify(editorTwo, never()).refresh(); }
@Test public void testActionValueEditorRefreshMultipleEditors() throws Exception { final ActionFieldValue valueOne = mock(ActionFieldValue.class); final ActionFieldValue valueTwo = mock(ActionFieldValue.class); final ActionValueEditor editorOne = mock(ActionValueEditor.class); final ActionValueEditor editorTwo = mock(ActionValueEditor.class); final Map<ActionFieldValue, ActionValueEditor> editors = new HashMap<>(); editors.put(valueOne, editorOne); editors.put(valueTwo, editorTwo); doReturn(FieldNatureType.TYPE_LITERAL).when(valueOne).getNature(); doReturn(FieldNatureType.TYPE_LITERAL).when(valueTwo).getNature(); RefreshUtil.refreshActionValueEditorsDropDownData(editors, mock(ActionFieldValue.class)); verify(editorOne).refresh(); verify(editorTwo).refresh(); } }
private void visitActionFieldList(final ActionUpdateField 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.contains(var)) { vars.add(var); } else { hasNonTemplateOutput = true; } } }
private void visitActionFieldList(final 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.contains(var)) { vars.add(var); } else { hasNonTemplateOutput = true; } } }
private ActionFieldValue cloneActionFieldValue(ActionFieldValue afv) { ActionFieldValue clone = new ActionFieldValue(); clone.setField(afv.getField()); clone.setNature(afv.getNature()); clone.setType(afv.getType()); clone.setValue(afv.getValue()); return clone; }
private ActionFieldValue cloneActionFieldValue(ActionFieldValue afv) { ActionFieldValue clone = new ActionFieldValue(); clone.setField(afv.getField()); clone.setNature(afv.getNature()); clone.setType(afv.getType()); clone.setValue(afv.getValue()); return clone; }
private ActionInsertFact visitActionFieldList(ActionInsertFact afl) { ActionInsertFact clone = new ActionInsertFact(); clone.setFactType(afl.getFactType()); clone.setBoundName(afl.getBoundName()); for (ActionFieldValue afv : afl.getFieldValues()) { ActionFieldValue afvClone = new ActionFieldValue(); afvClone.setField(afv.getField()); afvClone.setNature(afv.getNature()); afvClone.setType(afv.getType()); afvClone.setValue(afv.getValue()); clone.addFieldValue(afvClone); } return clone; }
private ActionInsertFact visitActionFieldList(ActionInsertFact afl) { ActionInsertFact clone = new ActionInsertFact(); clone.setFactType(afl.getFactType()); clone.setBoundName(afl.getBoundName()); for (ActionFieldValue afv : afl.getFieldValues()) { ActionFieldValue afvClone = new ActionFieldValue(); afvClone.setField(afv.getField()); afvClone.setNature(afv.getNature()); afvClone.setType(afv.getType()); afvClone.setValue(afv.getValue()); clone.addFieldValue(afvClone); } return clone; }