Search in sources :

Example 1 with WorksetLibraryAliquot

use of uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibraryAliquot 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)

Example 2 with WorksetLibraryAliquot

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

the class WorksetRestController method mergeWorksets.

@PostMapping("/merge")
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
public WorksetDto mergeWorksets(@RequestBody(required = true) MergeWorksetsRequestData data) throws IOException {
    Workset workset = new Workset();
    if (LimsUtils.isStringEmptyOrNull(data.getAlias())) {
        throw new RestException("No alias provided for new workset", Status.BAD_REQUEST);
    }
    workset.setAlias(data.getAlias());
    if (!LimsUtils.isStringEmptyOrNull(data.getDescription())) {
        workset.setDescription(data.getDescription());
    }
    for (Long id : data.getIds()) {
        Workset child = worksetService.get(id);
        if (child == null) {
            throw new RestException("No workset found with ID: " + id, Status.BAD_REQUEST);
        }
        copyWorksetItems(child.getWorksetSamples(), workset.getWorksetSamples(), WorksetSample::new);
        copyWorksetItems(child.getWorksetLibraries(), workset.getWorksetLibraries(), WorksetLibrary::new);
        copyWorksetItems(child.getWorksetLibraryAliquots(), workset.getWorksetLibraryAliquots(), WorksetLibraryAliquot::new);
    }
    worksetService.create(workset);
    return Dtos.asDto(workset);
}
Also used : 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) PostMapping(org.springframework.web.bind.annotation.PostMapping) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

Workset (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.Workset)2 WorksetLibrary (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibrary)2 WorksetLibraryAliquot (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibraryAliquot)2 WorksetSample (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetSample)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)1 DetailedLibraryAliquot (uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryAliquot)1 DetailedLibraryImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryImpl)1 DetailedSampleImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedSampleImpl)1 LibraryAliquot (uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot)1 LibraryImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl)1 OrderLibraryAliquot (uk.ac.bbsrc.tgac.miso.core.data.impl.OrderLibraryAliquot)1 SampleImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl)1 TransferLibraryAliquot (uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibraryAliquot)1 WorksetCategory (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetCategory)1 WorksetStage (uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetStage)1