use of uk.ac.bbsrc.tgac.miso.dto.DetailedLibraryDto in project miso-lims by miso-lims.
the class EditLibraryController method receiveBulkLibraries.
@PostMapping(value = "/bulk/receive")
public ModelAndView receiveBulkLibraries(@RequestParam Map<String, String> form, ModelMap model) throws IOException {
Integer quantity = getIntegerInput("quantity", form, true);
Long aliquotClassId = getLongInput("sampleClassId", form, isDetailedSampleEnabled());
Long projectId = getLongInput("projectId", form, false);
Long boxId = getLongInput("boxId", form, false);
LibraryDto libDto = null;
Project project = null;
if (projectId != null) {
project = projectService.get(projectId);
if (project == null)
throw new ClientErrorException("No project found for ID " + projectId);
}
SampleClass aliquotClass = null;
if (isDetailedSampleEnabled()) {
aliquotClass = sampleClassService.get(aliquotClassId);
if (aliquotClass == null)
throw new ClientErrorException("No sample class found for ID " + aliquotClassId);
DetailedLibraryDto detailedDto = new DetailedLibraryDto();
libDto = detailedDto;
SampleAliquotDto samDto = null;
if (SampleAliquotSingleCell.SUBCATEGORY_NAME.equals(aliquotClass.getSampleSubcategory())) {
samDto = new SampleAliquotSingleCellDto();
} else if (SampleAliquotRna.SUBCATEGORY_NAME.equals(aliquotClass.getSampleSubcategory())) {
samDto = new SampleAliquotRnaDto();
} else {
samDto = new SampleAliquotDto();
}
detailedDto.setSample(samDto);
samDto.setSampleClassId(aliquotClassId);
detailedDto.setParentSampleClassId(aliquotClassId);
} else {
libDto = new LibraryDto();
libDto.setSample(new SampleDto());
}
if (boxId != null) {
libDto.setBox(Dtos.asDto(boxService.get(boxId), true));
}
Set<Group> recipientGroups = authorizationManager.getCurrentUser().getGroups();
return new BulkReceiveLibraryBackend(libDto, quantity, project, aliquotClass, defaultSciName, libraryTemplateService, recipientGroups).create(model);
}
Aggregations