Export Scenario to DBRF
This task exports the contents of the selected scenario to a GZIP archive, in DBRF format.
@Bean
public ScriptedTaskDescription dbrfExportTask() {
ScriptedTaskDescription task = new ScriptedTaskDescription("DbrfExportTask", "Export scenario to DBRF");
task.setDescription("Export the contents of the selected scenario to a GZIP archive, in DBRF format");
setI18nKeys(task, "DBPF_EXPORT");
var scenario = VariableAccessExpression.ofScenario();
var baseFileName = VariableAccessExpression.of("base file name");
var filter = VariableAccessExpression.ofFilter();
task.getScript()
.addStatement(AskInputStatement.ofVariable(scenario, true, JobInputType.SCENARIO_ID))
.addStatement(AskInputStatement.ofVariable(baseFileName, true, ParameterTypes.TEXT, "Name of the file to export to. Warning: a '.gz' extension will be appended."))
.addStatement(AskInputStatement.ofVariable(filter, false, JobInputType.ENTITIES, "Select the tables to export"))
.addStatement(SetTaskOutputStatement.of("DBRF file",
FileExpression.of(
StringExpression.concat(baseFileName, StringExpression.of(".gz")),
BlobExpression.of(
ScenarioDataExpression.of(scenario)
.withFormat(ScenarioDataFormat.DBRF)
.onlyTables(filter)),
StringExpression.of("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
)));
return task;
}