use of org.molgenis.ontology.sorta.repo.SortaCsvRepository in project molgenis by molgenis.
the class SortaController method startMatchJob.
private String startMatchJob(String jobName, String ontologyIri, Model model, HttpServletRequest httpServletRequest, InputStream inputStream) throws IOException {
String sessionId = httpServletRequest.getSession().getId();
File uploadFile = fileStore.store(inputStream, sessionId + // TODO determine whether multiple match jobs during the same session results in wrong file usage
".csv");
String inputRepositoryName = idGenerator.generateId();
SortaCsvRepository inputRepository = new SortaCsvRepository(inputRepositoryName, jobName + " input", uploadFile, entityTypeFactory, attrMetaFactory);
if (!validateFileHeader(inputRepository)) {
model.addAttribute(MODEL_KEY_MESSAGE, "The Name header is missing!");
return matchTask(model);
}
if (!validateEmptyFileHeader(inputRepository)) {
model.addAttribute(MODEL_KEY_MESSAGE, "The empty header is not allowed!");
return matchTask(model);
}
if (!validateInputFileContent(inputRepository)) {
model.addAttribute(MODEL_KEY_MESSAGE, "The content of input is empty!");
return matchTask(model);
}
SortaJobExecution jobExecution = createJobExecution(inputRepository, jobName, ontologyIri);
SortaJobImpl sortaMatchJob = sortaMatchJobFactory.create(jobExecution);
taskExecutor.submit(sortaMatchJob);
return "redirect:" + getSortaServiceMenuUrl();
}
Aggregations