Search in sources :

Example 1 with OfcConfigRecord

use of org.openforis.collect.persistence.jooq.tables.records.OfcConfigRecord in project collect by openforis.

the class ConfigurationDao method load.

public Configuration load() {
    Configuration c = new Configuration();
    CollectDSLContext dsl = dsl();
    Result<OfcConfigRecord> result = dsl.selectFrom(OFC_CONFIG).fetch();
    for (OfcConfigRecord record : result) {
        String key = record.getValue(OFC_CONFIG.NAME);
        String value = record.getValue(OFC_CONFIG.VALUE);
        ConfigurationItem configurationItem = ConfigurationItem.fromKey(key);
        c.put(configurationItem, value);
    }
    return c;
}
Also used : ConfigurationItem(org.openforis.collect.model.Configuration.ConfigurationItem) Configuration(org.openforis.collect.model.Configuration) CollectDSLContext(org.openforis.collect.persistence.jooq.CollectDSLContext) OfcConfigRecord(org.openforis.collect.persistence.jooq.tables.records.OfcConfigRecord)

Aggregations

Configuration (org.openforis.collect.model.Configuration)1 ConfigurationItem (org.openforis.collect.model.Configuration.ConfigurationItem)1 CollectDSLContext (org.openforis.collect.persistence.jooq.CollectDSLContext)1 OfcConfigRecord (org.openforis.collect.persistence.jooq.tables.records.OfcConfigRecord)1