Search in sources :

Example 1 with org.molgenis.emx2

use of org.molgenis.emx2 in project molgenis-emx2 by molgenis.

the class Schema method getSchemaMetadata.

public SchemaMetadata getSchemaMetadata() {
    SchemaMetadata s = new SchemaMetadata();
    s.setSettings(this.settings);
    for (Table t : this.tables) {
        TableMetadata tm = s.create(table(t.getName()));
        tm.setInherit(t.getInherit());
        tm.setSettings(t.getSettings());
        tm.setOldName(t.getOldName());
        if (t.getDrop())
            tm.drop();
        tm.setSemantics(t.getSemantics());
        tm.setDescription(t.getDescription());
        for (Column c : t.getColumns()) {
            int i = 1;
            if (!c.isInherited()) {
                // we remove clearly inherited columns here
                org.molgenis.emx2.Column cm = c.getColumnMetadata(tm);
                tm.add(cm);
            }
        }
        tm.setTableType(t.getTableType());
    }
    return s;
}
Also used : TableMetadata(org.molgenis.emx2.TableMetadata) SchemaMetadata(org.molgenis.emx2.SchemaMetadata)

Example 2 with org.molgenis.emx2

use of org.molgenis.emx2 in project molgenis-emx2 by molgenis.

the class RunMolgenisEmx2 method main.

public static void main(String[] args) {
    logger.info("Starting MOLGENIS EMX2 Software Version=" + Version.getVersion());
    Integer port = (Integer) EnvironmentProperty.getParameter(Constants.MOLGENIS_HTTP_PORT, "8080", INT);
    logger.info("with " + org.molgenis.emx2.Constants.MOLGENIS_HTTP_PORT + "=" + port + " (change either via java properties or via ENV variables)");
    // setup database
    Database db = new SqlDatabase(true);
    if (db.getSchema("pet store") == null) {
        Schema schema = db.createSchema("pet store");
        PetStoreExample.create(schema.getMetadata());
        PetStoreExample.populate(schema);
    }
    // start
    MolgenisWebservice.start(port);
}
Also used : SqlDatabase(org.molgenis.emx2.sql.SqlDatabase) SqlDatabase(org.molgenis.emx2.sql.SqlDatabase)

Aggregations

SchemaMetadata (org.molgenis.emx2.SchemaMetadata)1 TableMetadata (org.molgenis.emx2.TableMetadata)1 SqlDatabase (org.molgenis.emx2.sql.SqlDatabase)1