use of org.openforis.collect.io.metadata.codelist.CodeListBatchImportJob in project collect by openforis.
the class CodeListsVM method jobFailed.
@GlobalCommand
public void jobFailed(@BindingParam("job") Job job) {
closeJobStatusPopUp();
if (job instanceof CodeListBatchImportJob && job.getCurrentTask() != null) {
CodeListImportTask lastTask = (CodeListImportTask) ((CodeListBatchImportJob) job).getCurrentTask();
dataImportErrorPopUp = ReferenceDataImportErrorPopUpVM.showPopUp(lastTask.getErrors(), Labels.getLabel("survey.code_list.import_data.error_popup.title", new String[] { lastTask.getEntryName() }));
} else {
String errorMessageKey = job.getErrorMessage();
String errorMessage = StringUtils.defaultIfBlank(Labels.getLabel(errorMessageKey), errorMessageKey);
MessageUtil.showError("global.job_status.failed.message", errorMessage);
}
clearJob(job);
}
use of org.openforis.collect.io.metadata.codelist.CodeListBatchImportJob in project collect by openforis.
the class CodeListsVM method batchImportFileUploaded.
@Command
public void batchImportFileUploaded(@ContextParam(ContextType.TRIGGER_EVENT) UploadEvent event) {
Media media = event.getMedia();
String fileName = media.getName();
String extension = FilenameUtils.getExtension(fileName);
File tempFile = OpenForisIOUtils.copyToTempFile(media.getStreamData(), extension);
batchImportJob = new CodeListBatchImportJob();
batchImportJob.setJobManager(jobManager);
batchImportJob.setCodeListManager(codeListManager);
batchImportJob.setSurvey(survey);
batchImportJob.setOverwriteData(true);
batchImportJob.setFile(tempFile);
jobManager.start(batchImportJob);
jobStatusPopUp = JobStatusPopUpVM.openPopUp(Labels.getLabel("survey.code_list.batch_import"), batchImportJob, true);
}
Aggregations