@Test public void testReadMultiSubForm() { FormReader reader = new FormReader(); FormInstance form = reader.readFromStream(this.getClass().getResourceAsStream("/order-taskform.json")); assertThat(form).isNotNull(); assertThat(form.getId()).isEqualTo("d8d455cf-f40e-4b89-93d4-f26b2d7e1aff"); assertThat(form.getName()).isEqualTo("Order"); assertThat(form.getFields()).hasSize(4); FormField field = form.getFields().get(3); assertField(field, "field_180962688550559E11", "items", "MultipleSubForm", "Items", 0, "items", null, "com.myspace.form_rendering.Item", false, false); assertThat(field.getCreationForm()).isEqualTo("40e31ab4-7eb8-404c-96f1-ce131f00d49f"); assertThat(field.getEditionForm()).isEqualTo("40e31ab4-7eb8-404c-96f1-ce131f00d49f"); assertThat(field.getTableInfo()).hasSize(3); assertThat(field.getTableInfo().get(0).getLabel()).isEqualTo("Name"); assertThat(field.getTableInfo().get(0).getProperty()).isEqualTo("name"); assertThat(field.getTableInfo().get(1).getLabel()).isEqualTo("Quantity"); assertThat(field.getTableInfo().get(1).getProperty()).isEqualTo("quantity"); assertThat(field.getTableInfo().get(2).getLabel()).isEqualTo("Price"); assertThat(field.getTableInfo().get(2).getProperty()).isEqualTo("price"); FormLayout layout = form.getLayout(); assertThat(layout).isNotNull(); assertThat(layout.getRows()).hasSize(4); }
public FormInstance readFromStream(InputStream formStructure) { try { FormInstance formInstance = this.mapper.readValue(formStructure, FormInstance.class); return flatColumnData(formInstance); } catch (IOException e) { throw new RuntimeException(e); } }
FormReader { public FormInstance readFromStream(InputStream formStructure) { try { FormInstance formInstance = this.mapper.readValue(formStructure, FormInstance.class); return flatColumnData(formInstance); } catch (IOException e) { throw new RuntimeException(e); } } }
FormReader { public FormInstance readFromStream(InputStream formStructure) { try { FormInstance formInstance = this.mapper.readValue(formStructure, FormInstance.class); return flatColumnData(formInstance); } catch (IOException e) { throw new RuntimeException(e); } } FormReader(); }
FormReader { public FormInstance readFromStream(InputStream formStructure) { try { FormInstance formInstance = this.mapper.readValue(formStructure, FormInstance.class); return flatColumnData(formInstance); } catch (IOException e) { throw new RuntimeException(e); } } FormReader(); FormInstance readFromString(String formStructure); FormInstance readFromStream(InputStream formStructure); Map<String, Object> extractValues(Object data); String toJson(Object data); }
FormReader { public FormInstance readFromStream(InputStream formStructure) { try { FormInstance formInstance = this.mapper.readValue(formStructure, FormInstance.class); return flatColumnData(formInstance); } catch (IOException e) { throw new RuntimeException(e); } } FormReader(); FormInstance readFromString(String formStructure); FormInstance readFromStream(InputStream formStructure); Map<String, Object> extractValues(Object data); String toJson(Object data);  }