Search in sources :

Example 1 with APIBuilder

use of org.structr.module.api.APIBuilder in project structr by structr.

the class CSVFileImportJob method runInitialChecks.

@Override
public boolean runInitialChecks() throws FrameworkException {
    final String targetType = getOrDefault(configuration.get("targetType"), null);
    final String delimiter = getOrDefault(configuration.get("delimiter"), ";");
    final String quoteChar = getOrDefault(configuration.get("quoteChar"), "\"");
    if (targetType == null || delimiter == null || quoteChar == null) {
        throw new FrameworkException(400, "Cannot import CSV, please specify target type, delimiter and quote character.");
    } else {
        final StructrModule module = StructrApp.getConfiguration().getModules().get("api-builder");
        if (module == null || !(module instanceof APIBuilder)) {
            throw new FrameworkException(400, "Cannot import CSV, API builder module is not available.");
        }
    }
    return true;
}
Also used : StructrModule(org.structr.module.StructrModule) FrameworkException(org.structr.common.error.FrameworkException) APIBuilder(org.structr.module.api.APIBuilder)

Aggregations

FrameworkException (org.structr.common.error.FrameworkException)1 StructrModule (org.structr.module.StructrModule)1 APIBuilder (org.structr.module.api.APIBuilder)1