Search in sources :

Example 1 with Workset

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

the class WorksetPageIT method testCreate.

@Test
public void testCreate() {
    WorksetPage page = getWorksetPage(null);
    Map<Field, String> fields = new HashMap<>();
    fields.put(Field.ALIAS, "Test Set");
    fields.put(Field.DESCRIPTION, "Test description");
    page.setFields(fields);
    assertEquals("", page.getField(Field.ID));
    assertFieldValues("changes pre-save", fields, page);
    WorksetPage savedPage = page.clickSave();
    assertNotNull("Workset should save successfully", savedPage);
    assertFieldValues("changes post-save", fields, savedPage);
    Workset workset = (Workset) getSession().get(Workset.class, Long.valueOf(savedPage.getField(Field.ID)));
    assertEquals(fields.get(Field.ALIAS), workset.getAlias());
    assertEquals(fields.get(Field.DESCRIPTION), workset.getDescription());
}
Also used : Field(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.WorksetPage.Field) Workset(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.Workset) HashMap(java.util.HashMap) WorksetPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.WorksetPage) Test(org.junit.Test)

Example 2 with Workset

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

the class DefaultLibraryService method beforeDelete.

@Override
public void beforeDelete(Library object) throws IOException {
    List<Workset> worksets = worksetService.listByLibrary(object.getId());
    for (Workset workset : worksets) {
        worksetService.removeLibraries(workset, Collections.singleton(object));
    }
    Box box = object.getBox();
    if (box != null) {
        box.getBoxPositions().remove(object.getBoxPosition());
        boxService.save(box);
    }
    fileAttachmentService.beforeDelete(object);
}
Also used : Workset(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.Workset) Box(uk.ac.bbsrc.tgac.miso.core.data.Box)

Example 3 with Workset

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

the class DefaultWorksetService method update.

@Override
public long update(Workset workset) throws IOException {
    Workset managed = worksetStore.get(workset.getId());
    validateChange(workset, managed);
    applyChanges(workset, managed);
    managed.setChangeDetails(authorizationManager.getCurrentUser());
    return worksetStore.save(managed);
}
Also used : Workset(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.Workset)

Example 4 with Workset

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

the class DefaultSampleService method beforeDelete.

@Override
public void beforeDelete(Sample object) throws IOException {
    List<Workset> worksets = worksetService.listBySample(object.getId());
    for (Workset workset : worksets) {
        worksetService.removeSamples(workset, Collections.singleton(object));
    }
    Box box = object.getBox();
    if (box != null) {
        box.getBoxPositions().remove(object.getBoxPosition());
        boxService.save(box);
    }
    fileAttachmentService.beforeDelete(object);
}
Also used : Workset(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.Workset) Box(uk.ac.bbsrc.tgac.miso.core.data.Box)

Example 5 with Workset

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

the class Dtos method to.

public static Workset to(@Nonnull WorksetDto from) {
    Workset workset = new Workset();
    setLong(workset::setId, from.getId(), false);
    setString(workset::setAlias, from.getAlias());
    setString(workset::setDescription, from.getDescription());
    setObject(workset::setCategory, WorksetCategory::new, from.getCategoryId());
    setObject(workset::setStage, WorksetStage::new, from.getStageId());
    setWorksetItems(workset::setWorksetSamples, from.getSampleIds(), WorksetSample::new, SampleImpl::new);
    setWorksetItems(workset::setWorksetLibraries, from.getLibraryIds(), WorksetLibrary::new, LibraryImpl::new);
    setWorksetItems(workset::setWorksetLibraryAliquots, from.getLibraryAliquotIds(), WorksetLibraryAliquot::new, LibraryAliquot::new);
    return workset;
}
Also used : WorksetStage(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetStage) WorksetSample(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetSample) Workset(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.Workset) WorksetLibrary(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibrary) WorksetLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibraryAliquot) WorksetCategory(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetCategory) LibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl) DetailedLibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryImpl) TransferLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibraryAliquot) WorksetLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibraryAliquot) OrderLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.OrderLibraryAliquot) DetailedLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryAliquot) LibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot) SampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl) DetailedSampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedSampleImpl)

Aggregations

Workset (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.Workset)26 Test (org.junit.Test)10 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)8 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)7 WorksetSample (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetSample)7 PostMapping (org.springframework.web.bind.annotation.PostMapping)5 WorksetLibrary (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibrary)4 WorksetLibraryAliquot (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibraryAliquot)4 DeleteMapping (org.springframework.web.bind.annotation.DeleteMapping)3 Box (uk.ac.bbsrc.tgac.miso.core.data.Box)3 Sample (uk.ac.bbsrc.tgac.miso.core.data.Sample)3 LibraryAliquot (uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot)3 WorksetPage (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.WorksetPage)3 Field (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.WorksetPage.Field)3 HashMap (java.util.HashMap)2 NotFoundException (org.springframework.security.acls.model.NotFoundException)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 ModelAndView (org.springframework.web.servlet.ModelAndView)2 Library (uk.ac.bbsrc.tgac.miso.core.data.Library)2