return importOptions.isParallel() ? parallelImporter : serialImporter;
}
private Form<?> initFileUpload(final ImportOptions importOptions) {
final FileUploadField scriptFile = new FileUploadField("scriptFile");
final Form<?> form = new Form<Void>("form") {
@Override
protected void onSubmit() {
}
};
form.setMaxSize(Bytes.megabytes(conf.queryImport.maxFileSizeMb));
add(form);
form.add(scriptFile);
form.add(new AjaxButton("ajaxSubmit") {
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
LOG.info("Got error on import upload: {}", form);
sendJsResponse(target, ErrorCodes.FILE_SIZE_LIMIT.name());
}
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
FileUpload upload = scriptFile.getFileUpload();
if (upload == null) {
return;
}
executeImport(target, importOptions, upload);
}