@Test public void testReadBasicForm() { FormReader reader = new FormReader(); FormInstance form = reader.readFromStream(this.getClass().getResourceAsStream("/hiring-taskform.json")); assertThat(form).isNotNull(); assertThat(form.getId()).isEqualTo("011ebd63-f9b5-4057-b5ff-999c1c7e5080"); assertThat(form.getName()).isEqualTo("hiring-taskform.frm"); assertThat(form.getFields()).hasSize(1); FormField field = form.getFields().get(0); assertField(field, "field_2225717094101704E12", "name", "TextBox", "Candidate Name", 100, "name", "Enter your name", "java.lang.String", false, false); FormLayout layout = form.getLayout(); assertThat(layout).isNotNull(); assertThat(layout.getRows()).hasSize(1); LayoutRow row = layout.getRows().get(0); assertThat(row.getColumns()).hasSize(1); LayoutColumn column = row.getColumns().get(0); assertColumn(column, "12", 1, "011ebd63-f9b5-4057-b5ff-999c1c7e5080", "field_2225717094101704E12"); }
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);  }