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());
}
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);
}
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);
}
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);
}
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;
}
Aggregations