Search in sources :

Example 1 with ApplicationInfo

use of org.openforis.collect.model.ApplicationInfo in project collect by openforis.

the class ApplicationInfoDao method load.

public ApplicationInfo load() {
    DSLContext dsl = dsl();
    if (dsl.select().from(OFC_APPLICATION_INFO).fetchOne() != null) {
        ApplicationInfo i = new ApplicationInfo();
        String version = dsl.select().from(OFC_APPLICATION_INFO).fetchOne().getValue(OFC_APPLICATION_INFO.VERSION);
        i.setVersion(version);
        return i;
    } else {
        return null;
    }
}
Also used : ApplicationInfo(org.openforis.collect.model.ApplicationInfo) DSLContext(org.jooq.DSLContext)

Example 2 with ApplicationInfo

use of org.openforis.collect.model.ApplicationInfo in project collect by openforis.

the class DatabaseVersionManager method checkIsVersionCompatible.

public void checkIsVersionCompatible() throws DatabaseVersionNotCompatibleException {
    ApplicationInfo info = applicationInfoDao.load();
    Version schemaVersion = null;
    if (info != null && StringUtils.isNotBlank(info.getVersion())) {
        schemaVersion = new Version(info.getVersion());
    }
    Version appVersion = Collect.VERSION;
    if (!isVersionCompatible(appVersion, schemaVersion)) {
        throw new DatabaseVersionNotCompatibleException("Database version (" + (schemaVersion != null ? schemaVersion : "not specified") + ") is not compatible with Application version: " + appVersion);
    }
}
Also used : Version(org.openforis.commons.versioning.Version) ApplicationInfo(org.openforis.collect.model.ApplicationInfo)

Aggregations

ApplicationInfo (org.openforis.collect.model.ApplicationInfo)2 DSLContext (org.jooq.DSLContext)1 Version (org.openforis.commons.versioning.Version)1