Search in sources :

Example 1 with SampleAliquotSingleCellDto

use of uk.ac.bbsrc.tgac.miso.dto.SampleAliquotSingleCellDto 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);
}
Also used : Group(com.eaglegenomics.simlims.core.Group) SampleAliquotSingleCellDto(uk.ac.bbsrc.tgac.miso.dto.SampleAliquotSingleCellDto) Project(uk.ac.bbsrc.tgac.miso.core.data.Project) SampleClass(uk.ac.bbsrc.tgac.miso.core.data.SampleClass) SampleAliquotDto(uk.ac.bbsrc.tgac.miso.dto.SampleAliquotDto) LibraryDto(uk.ac.bbsrc.tgac.miso.dto.LibraryDto) DetailedLibraryDto(uk.ac.bbsrc.tgac.miso.dto.DetailedLibraryDto) ClientErrorException(uk.ac.bbsrc.tgac.miso.webapp.controller.component.ClientErrorException) SampleAliquotRnaDto(uk.ac.bbsrc.tgac.miso.dto.SampleAliquotRnaDto) DetailedLibraryDto(uk.ac.bbsrc.tgac.miso.dto.DetailedLibraryDto) SampleDto(uk.ac.bbsrc.tgac.miso.dto.SampleDto) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Aggregations

Group (com.eaglegenomics.simlims.core.Group)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1 Project (uk.ac.bbsrc.tgac.miso.core.data.Project)1 SampleClass (uk.ac.bbsrc.tgac.miso.core.data.SampleClass)1 DetailedLibraryDto (uk.ac.bbsrc.tgac.miso.dto.DetailedLibraryDto)1 LibraryDto (uk.ac.bbsrc.tgac.miso.dto.LibraryDto)1 SampleAliquotDto (uk.ac.bbsrc.tgac.miso.dto.SampleAliquotDto)1 SampleAliquotRnaDto (uk.ac.bbsrc.tgac.miso.dto.SampleAliquotRnaDto)1 SampleAliquotSingleCellDto (uk.ac.bbsrc.tgac.miso.dto.SampleAliquotSingleCellDto)1 SampleDto (uk.ac.bbsrc.tgac.miso.dto.SampleDto)1 ClientErrorException (uk.ac.bbsrc.tgac.miso.webapp.controller.component.ClientErrorException)1