@Test void testConvertTableColumnVisibiilty() { final String json = "[{\"identifier\":\"column1\",\"visible\":false},{\"identifier\":\"column2\",\"visible\":true},{\"identifier\":\"column3\",\"visible\":true},{\"identifier\":\"column4\",\"visible\":true},{\"identifier\":\"column5\",\"visible\":false}]"; final String tableIdentifier = "tableIdentifier"; final TableColumnVisibility visibility = new JsonToModelConverter().convertTableColumnVisibility(tableIdentifier, json); assertThat(visibility.getTableIdentifier()).isEqualTo(tableIdentifier); assertThat(visibility.getInvisibleColumns()) .contains("column1", "column5") .doesNotContain("column2", "column3", "column4"); assertThat(visibility.getVisibleColumns()) .contains("column2", "column3", "column4") .doesNotContain("column1", "column5"); }
public TableColumnVisibility convertTableColumnVisibility(final String tableIdentifier, final String json) { final String[] split = this.splitColumns(json); final List<String> visibleColumns = new ArrayList<>(); final List<String> invisibleColumns = new ArrayList<>(); for (String column : split) { final String[] attribute = this.splitAttributes(column); final String identifier = attribute[0].split(":")[1]; final String visible = attribute[1].split(":")[1]; if (Boolean.parseBoolean(visible)) { visibleColumns.add(identifier); } else { invisibleColumns.add(identifier); } } return new TableColumnVisibility(tableIdentifier, visibleColumns, invisibleColumns); }
JsonToModelConverter { public TableColumnVisibility convertTableColumnVisibility(final String tableIdentifier, final String json) { final String[] split = this.splitColumns(json); final List<String> visibleColumns = new ArrayList<>(); final List<String> invisibleColumns = new ArrayList<>(); for (String column : split) { final String[] attribute = this.splitAttributes(column); final String identifier = attribute[0].split(":")[1]; final String visible = attribute[1].split(":")[1]; if (Boolean.parseBoolean(visible)) { visibleColumns.add(identifier); } else { invisibleColumns.add(identifier); } } return new TableColumnVisibility(tableIdentifier, visibleColumns, invisibleColumns); } }
JsonToModelConverter { public TableColumnVisibility convertTableColumnVisibility(final String tableIdentifier, final String json) { final String[] split = this.splitColumns(json); final List<String> visibleColumns = new ArrayList<>(); final List<String> invisibleColumns = new ArrayList<>(); for (String column : split) { final String[] attribute = this.splitAttributes(column); final String identifier = attribute[0].split(":")[1]; final String visible = attribute[1].split(":")[1]; if (Boolean.parseBoolean(visible)) { visibleColumns.add(identifier); } else { invisibleColumns.add(identifier); } } return new TableColumnVisibility(tableIdentifier, visibleColumns, invisibleColumns); }  }
JsonToModelConverter { public TableColumnVisibility convertTableColumnVisibility(final String tableIdentifier, final String json) { final String[] split = this.splitColumns(json); final List<String> visibleColumns = new ArrayList<>(); final List<String> invisibleColumns = new ArrayList<>(); for (String column : split) { final String[] attribute = this.splitAttributes(column); final String identifier = attribute[0].split(":")[1]; final String visible = attribute[1].split(":")[1]; if (Boolean.parseBoolean(visible)) { visibleColumns.add(identifier); } else { invisibleColumns.add(identifier); } } return new TableColumnVisibility(tableIdentifier, visibleColumns, invisibleColumns); }  TableColumnVisibility convertTableColumnVisibility(final String tableIdentifier, final String json); TableColumnOrdering convertTableColumnOrdering(final String tableIdentifier, final String json); }
JsonToModelConverter { public TableColumnVisibility convertTableColumnVisibility(final String tableIdentifier, final String json) { final String[] split = this.splitColumns(json); final List<String> visibleColumns = new ArrayList<>(); final List<String> invisibleColumns = new ArrayList<>(); for (String column : split) { final String[] attribute = this.splitAttributes(column); final String identifier = attribute[0].split(":")[1]; final String visible = attribute[1].split(":")[1]; if (Boolean.parseBoolean(visible)) { visibleColumns.add(identifier); } else { invisibleColumns.add(identifier); } } return new TableColumnVisibility(tableIdentifier, visibleColumns, invisibleColumns); }  TableColumnVisibility convertTableColumnVisibility(final String tableIdentifier, final String json); TableColumnOrdering convertTableColumnOrdering(final String tableIdentifier, final String json);  }