use of org.activityinfo.model.formTree.FormTreePrettyPrinter in project activityinfo by bedatadriven.
the class SchemaCsvWriterV3Test method importSurveyForm.
@Test
public void importSurveyForm() {
PastedTable pastedTable = new PastedTable(expectedSurveyExport);
SchemaImporterV3 importer = new SchemaImporterV3(database.getId(), null, null);
assertTrue("columns found", importer.parseColumns(pastedTable));
boolean success = importer.processRows();
for (SafeHtml warning : importer.getWarnings()) {
System.out.println(warning);
}
assertTrue(success);
List<FormClass> formClasses = importer.toSave();
formClassProvider.addAll(formClasses);
FormTreeBuilder treeBuilder = new FormTreeBuilder(formClassProvider);
FormTreePrettyPrinter prettyPrinter = new FormTreePrettyPrinter();
for (FormClass formClass : formClasses) {
if (!formClass.isSubForm()) {
prettyPrinter.printTree(treeBuilder.queryTree(formClass.getId()));
}
}
}
use of org.activityinfo.model.formTree.FormTreePrettyPrinter in project activityinfo by bedatadriven.
the class FormResource method getTreePrettyPrinted.
@GET
@NoCache
@Produces(MediaType.TEXT_PLAIN)
@Path("tree/pretty")
public String getTreePrettyPrinted() {
FormTree tree = fetchTree();
StringWriter stringWriter = new StringWriter();
FormTreePrettyPrinter printer = new FormTreePrettyPrinter(new PrintWriter(stringWriter));
printer.printTree(tree);
return stringWriter.toString();
}
use of org.activityinfo.model.formTree.FormTreePrettyPrinter in project activityinfo by bedatadriven.
the class NodeMatcherTest method prettyPrintTree.
private void prettyPrintTree() {
FormTreePrettyPrinter prettyPrinter = new FormTreePrettyPrinter();
prettyPrinter.printTree(tree());
}
Aggregations