Search in sources :

Example 1 with LibraryTemplate

use of uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate in project miso-lims by miso-lims.

the class DefaultProjectService method beforeDelete.

@Override
public void beforeDelete(Project object) throws IOException {
    fileAttachmentService.beforeDelete(object);
    List<LibraryTemplate> templates = libraryTemplateService.listByProject(object.getId());
    for (LibraryTemplate template : templates) {
        template.getProjects().removeIf(templateProject -> templateProject.getId() == object.getId());
        libraryTemplateService.update(template);
    }
    SampleNumberPerProject sampleNumberPerProject = sampleNumberPerProjectService.getByProject(object);
    if (sampleNumberPerProject != null) {
        sampleNumberPerProjectService.delete(sampleNumberPerProject);
    }
}
Also used : LibraryTemplate(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate) SampleNumberPerProject(uk.ac.bbsrc.tgac.miso.core.data.SampleNumberPerProject)

Example 2 with LibraryTemplate

use of uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate in project miso-lims by miso-lims.

the class LibraryTemplateRestController method makeTemplateDtosForIndexUpdate.

private List<LibraryTemplateDto> makeTemplateDtosForIndexUpdate(long templateId, List<LibraryTemplateIndexDto> dtos) throws IOException {
    LibraryTemplate template = RestUtils.retrieve(TYPE_LABEL, templateId, libraryTemplateService);
    LibraryTemplateDto templateDto = Dtos.asDto(template);
    for (LibraryTemplateIndexDto index : dtos) {
        setIndex(index.getBoxPosition(), index.getIndex1Id(), templateDto.getIndexOneIds());
        setIndex(index.getBoxPosition(), index.getIndex2Id(), templateDto.getIndexTwoIds());
    }
    return Collections.singletonList(templateDto);
}
Also used : LibraryTemplate(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate)

Example 3 with LibraryTemplate

use of uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate in project miso-lims by miso-lims.

the class EditLibraryTemplateController method edit.

@GetMapping("/{templateId}")
public ModelAndView edit(@PathVariable long templateId, ModelMap model) throws IOException {
    LibraryTemplate template = getTemplate(templateId);
    model.put(PageMode.PROPERTY, PageMode.EDIT.getLabel());
    model.put("title", "Library Template " + templateId);
    return libraryTemplatePage(template, model);
}
Also used : DetailedLibraryTemplate(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryTemplate) LibraryTemplate(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate)

Example 4 with LibraryTemplate

use of uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate in project miso-lims by miso-lims.

the class EditLibraryTemplateController method create.

@GetMapping("/new")
public ModelAndView create(@RequestParam(name = "projectId", required = false) Long projectId, ModelMap model) throws IOException {
    LibraryTemplate template = isDetailedSampleEnabled() ? new DetailedLibraryTemplate() : new LibraryTemplate();
    if (projectId != null) {
        Project project = projectService.get(projectId);
        if (project == null) {
            throw new ClientErrorException("No project found with ID: " + projectId);
        }
        template.getProjects().add(project);
    }
    model.put(PageMode.PROPERTY, PageMode.CREATE.getLabel());
    model.put("title", "New Library Template");
    return libraryTemplatePage(template, model);
}
Also used : Project(uk.ac.bbsrc.tgac.miso.core.data.Project) DetailedLibraryTemplate(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryTemplate) ClientErrorException(uk.ac.bbsrc.tgac.miso.webapp.controller.component.ClientErrorException) DetailedLibraryTemplate(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryTemplate) LibraryTemplate(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate)

Example 5 with LibraryTemplate

use of uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate in project miso-lims by miso-lims.

the class HibernateLibraryTemplateDaoIT method testUpdate.

@Test
public void testUpdate() throws Exception {
    long id = 2L;
    String newAlias = "asdf";
    LibraryTemplate before = (LibraryTemplate) currentSession().get(LibraryTemplate.class, id);
    assertNotEquals(newAlias, before.getAlias());
    before.setAlias(newAlias);
    sut.update(before);
    clearSession();
    LibraryTemplate after = (LibraryTemplate) currentSession().get(LibraryTemplate.class, id);
    assertEquals(newAlias, after.getAlias());
}
Also used : LibraryTemplate(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Aggregations

LibraryTemplate (uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate)8 Test (org.junit.Test)3 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)3 DetailedLibraryTemplate (uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryTemplate)3 Project (uk.ac.bbsrc.tgac.miso.core.data.Project)2 SampleNumberPerProject (uk.ac.bbsrc.tgac.miso.core.data.SampleNumberPerProject)2 IlluminaNotificationDto (ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto)1 NotificationDto (ca.on.oicr.gsi.runscanner.dto.NotificationDto)1 OxfordNanoporeNotificationDto (ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto)1 ArrayList (java.util.ArrayList)1 Index (uk.ac.bbsrc.tgac.miso.core.data.Index)1 IndexFamily (uk.ac.bbsrc.tgac.miso.core.data.IndexFamily)1 VolumeUnit (uk.ac.bbsrc.tgac.miso.core.data.VolumeUnit)1 ProjectImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectImpl)1 SampleNumberPerProjectImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleNumberPerProjectImpl)1 KitDescriptor (uk.ac.bbsrc.tgac.miso.core.data.impl.kit.KitDescriptor)1 LibrarySelectionType (uk.ac.bbsrc.tgac.miso.core.data.type.LibrarySelectionType)1 LibraryStrategyType (uk.ac.bbsrc.tgac.miso.core.data.type.LibraryStrategyType)1 LibraryType (uk.ac.bbsrc.tgac.miso.core.data.type.LibraryType)1 PlatformType (uk.ac.bbsrc.tgac.miso.core.data.type.PlatformType)1