@Test public void testSerializeVariablesWithTags() { Map<String, String> mapDataTypeDisplayNamesToNames = new HashMap<String, String>(); mapDataTypeDisplayNamesToNames.put("String", "String"); mapDataTypeDisplayNamesToNames.put("Integer", "Integer"); mapDataTypeDisplayNamesToNames.put("Potato [org.veg]", "org.veg.Potato"); variablesEditor.mapDataTypeDisplayNamesToNames = mapDataTypeDisplayNamesToNames; List<VariableRow> variableRows = new ArrayList<VariableRow>(); variableRows.add(new VariableRow(Variable.VariableType.PROCESS, "var1", "String", null, Arrays.asList("internal"))); variableRows.add(new VariableRow(Variable.VariableType.PROCESS, "var2", "Integer", null, Arrays.asList("input" ))); variableRows.add(new VariableRow(Variable.VariableType.PROCESS, "var3", "org.veg.Potato", null, Arrays.asList("input", "output"))); variableRows.add(new VariableRow(Variable.VariableType.PROCESS, "var4", "myCustomTag", null, null)); variableRows.add(new VariableRow(Variable.VariableType.INPUT, "var5", "myCustomTag2", "myType", Arrays.asList("thisTagShouldNotBeWritten"))); variableRows.add(new VariableRow(Variable.VariableType.PROCESS, "var6", null, null, Arrays.asList("thisTagShouldBeWritten"))); String s = variablesEditor.serializeVariables(variableRows); assertEquals("var1:String:internal,var2:Integer:input,var3:org.veg.Potato:input;output,var4:myCustomTag:,var5:myType:,var6::thisTagShouldBeWritten", s); }
@Override public String serializeVariables(final List<VariableRow> variableRows) { List<Variable> variables = new ArrayList<>(); for (VariableRow row : variableRows) { if (row.getName() != null && row.getName().length() > 0) { String dataType = getRowDataType(row); variables.add(new Variable(row.getName(), row.getVariableType(), dataType, row.getCustomDataType(), row.getTags())); } } return StringUtils.getStringForList(variables); }
VariablesEditorFieldRenderer extends FieldRenderer<VariablesEditorFieldDefinition, DefaultFormGroup> implements VariablesEditorWidgetView.Presenter { @Override public String serializeVariables(final List<VariableRow> variableRows) { List<Variable> variables = new ArrayList<>(); for (VariableRow row : variableRows) { if (row.getName() != null && row.getName().length() > 0) { String dataType = getRowDataType(row); variables.add(new Variable(row.getName(), row.getVariableType(), dataType, row.getCustomDataType(), row.getTags())); } } return StringUtils.getStringForList(variables); } }
VariablesEditorFieldRenderer extends FieldRenderer<VariablesEditorFieldDefinition, DefaultFormGroup> implements VariablesEditorWidgetView.Presenter { @Override public String serializeVariables(final List<VariableRow> variableRows) { List<Variable> variables = new ArrayList<>(); for (VariableRow row : variableRows) { if (row.getName() != null && row.getName().length() > 0) { String dataType = getRowDataType(row); variables.add(new Variable(row.getName(), row.getVariableType(), dataType, row.getCustomDataType(), row.getTags())); } } return StringUtils.getStringForList(variables); } @Inject  VariablesEditorFieldRenderer(final VariablesEditorWidgetView variablesEditor,
                                        final SessionManager sessionManager,
                                        final ErrorPopupPresenter errorPopupPresenter); }
VariablesEditorFieldRenderer extends FieldRenderer<VariablesEditorFieldDefinition, DefaultFormGroup> implements VariablesEditorWidgetView.Presenter { @Override public String serializeVariables(final List<VariableRow> variableRows) { List<Variable> variables = new ArrayList<>(); for (VariableRow row : variableRows) { if (row.getName() != null && row.getName().length() > 0) { String dataType = getRowDataType(row); variables.add(new Variable(row.getName(), row.getVariableType(), dataType, row.getCustomDataType(), row.getTags())); } } return StringUtils.getStringForList(variables); } @Inject  VariablesEditorFieldRenderer(final VariablesEditorWidgetView variablesEditor,
                                        final SessionManager sessionManager,
                                        final ErrorPopupPresenter errorPopupPresenter); @Override String getName(); @Override void doSave(); @Override void addVariable(); @Override void setDataTypes(final List<String> dataTypes,
                             final List<String> dataTypeDisplayNames); @Override void notifyModelChanged(); @Override List<VariableRow> deserializeVariables(final String s); @Override String serializeVariables(final List<VariableRow> variableRows); @Override boolean isDuplicateName(final String name); @Override boolean isBoundToNodes(String name); @Override void removeVariable(final VariableRow variableRow); @Override ListBoxValues.ValueTester dataTypesTester(); @Override Path getDiagramPath(); void setLastOverlayOpened(final Button overlayCloseButton); Button getLastOverlayOpened(); void closeLastOverlay(); static Set<String> getDefaultTagsSet(); }
VariablesEditorFieldRenderer extends FieldRenderer<VariablesEditorFieldDefinition, DefaultFormGroup> implements VariablesEditorWidgetView.Presenter { @Override public String serializeVariables(final List<VariableRow> variableRows) { List<Variable> variables = new ArrayList<>(); for (VariableRow row : variableRows) { if (row.getName() != null && row.getName().length() > 0) { String dataType = getRowDataType(row); variables.add(new Variable(row.getName(), row.getVariableType(), dataType, row.getCustomDataType(), row.getTags())); } } return StringUtils.getStringForList(variables); } @Inject  VariablesEditorFieldRenderer(final VariablesEditorWidgetView variablesEditor,
                                        final SessionManager sessionManager,
                                        final ErrorPopupPresenter errorPopupPresenter); @Override String getName(); @Override void doSave(); @Override void addVariable(); @Override void setDataTypes(final List<String> dataTypes,
                             final List<String> dataTypeDisplayNames); @Override void notifyModelChanged(); @Override List<VariableRow> deserializeVariables(final String s); @Override String serializeVariables(final List<VariableRow> variableRows); @Override boolean isDuplicateName(final String name); @Override boolean isBoundToNodes(String name); @Override void removeVariable(final VariableRow variableRow); @Override ListBoxValues.ValueTester dataTypesTester(); @Override Path getDiagramPath(); void setLastOverlayOpened(final Button overlayCloseButton); Button getLastOverlayOpened(); void closeLastOverlay(); static Set<String> getDefaultTagsSet();  }