Search in sources :

Example 36 with JsonSchema

use of org.structr.schema.json.JsonSchema in project structr by structr.

the class DeployCommand method exportSchema.

private void exportSchema(final Path target) throws FrameworkException {
    logger.info("Exporting schema");
    try {
        final JsonSchema schema = StructrSchema.createFromDatabase(StructrApp.getInstance());
        try (final Writer writer = new FileWriter(target.toFile())) {
            writer.append(schema.toString());
            writer.append("\n");
            writer.flush();
        } catch (IOException ioex) {
            logger.warn("", ioex);
        }
    } catch (Throwable t) {
        t.printStackTrace();
    }
}
Also used : JsonSchema(org.structr.schema.json.JsonSchema) FileWriter(java.io.FileWriter) IOException(java.io.IOException) Writer(java.io.Writer) OutputStreamWriter(java.io.OutputStreamWriter) FileWriter(java.io.FileWriter)

Aggregations

JsonSchema (org.structr.schema.json.JsonSchema)36 Tx (org.structr.core.graph.Tx)24 Test (org.junit.Test)22 FrameworkException (org.structr.common.error.FrameworkException)19 URISyntaxException (java.net.URISyntaxException)13 JsonType (org.structr.schema.json.JsonType)13 GsonBuilder (com.google.gson.GsonBuilder)9 JsonObjectType (org.structr.schema.json.JsonObjectType)9 StructrTest (org.structr.common.StructrTest)8 InvalidSchemaException (org.structr.schema.json.InvalidSchemaException)8 Gson (com.google.gson.Gson)6 App (org.structr.core.app.App)6 StructrApp (org.structr.core.app.StructrApp)6 NodeInterface (org.structr.core.graph.NodeInterface)6 ConfigurationProvider (org.structr.schema.ConfigurationProvider)6 File (org.structr.web.entity.File)6 IOException (java.io.IOException)5 LinkedHashMap (java.util.LinkedHashMap)5 File (java.io.File)4 JsonReferenceType (org.structr.schema.json.JsonReferenceType)4