Search in sources :

Example 1 with VolumeUnit

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

the class Dtos method to.

public static LibraryTemplate to(@Nonnull LibraryTemplateDto from) {
    LibraryTemplate to = null;
    if (from instanceof DetailedLibraryTemplateDto) {
        to = toDetailedLibraryTemplate((DetailedLibraryTemplateDto) from);
    } else {
        to = new LibraryTemplate();
    }
    if (from.getId() != null)
        to.setId(from.getId());
    to.setAlias(from.getAlias());
    setObject(to::setPlatformType, from.getPlatformType(), PlatformType::valueOf);
    setBigDecimal(to::setDefaultVolume, from.getDefaultVolume());
    setObject(to::setVolumeUnits, from.getVolumeUnits(), VolumeUnit::valueOf);
    if (from.getProjectIds() != null) {
        List<Project> projects = new ArrayList<>();
        from.getProjectIds().stream().forEach(id -> {
            Project project = new ProjectImpl();
            project.setId(id);
            projects.add(project);
        });
        to.getProjects().addAll(projects);
    }
    if (from.getLibraryTypeId() != null) {
        LibraryType libraryType = new LibraryType();
        libraryType.setId(from.getLibraryTypeId());
        to.setLibraryType(libraryType);
    }
    setObject(to::setLibrarySelectionType, LibrarySelectionType::new, from.getSelectionId());
    if (from.getStrategyId() != null) {
        LibraryStrategyType libraryStrategyType = new LibraryStrategyType();
        libraryStrategyType.setId(from.getStrategyId());
        to.setLibraryStrategyType(libraryStrategyType);
    }
    if (from.getKitDescriptorId() != null) {
        KitDescriptor kitDescriptor = new KitDescriptor();
        kitDescriptor.setId(from.getKitDescriptorId());
        to.setKitDescriptor(kitDescriptor);
    }
    if (from.getIndexFamilyId() != null) {
        IndexFamily indexFamily = new IndexFamily();
        indexFamily.setId(from.getIndexFamilyId());
        to.setIndexFamily(indexFamily);
    }
    if (from.getIndexOneIds() != null) {
        to.getIndexOnes().putAll(from.getIndexOneIds().entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> {
            Index index = new Index();
            index.setId(entry.getValue());
            return index;
        })));
    }
    if (from.getIndexTwoIds() != null) {
        to.getIndexTwos().putAll(from.getIndexTwoIds().entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey(), entry -> {
            Index index = new Index();
            index.setId(entry.getValue());
            return index;
        })));
    }
    return to;
}
Also used : LibraryStrategyType(uk.ac.bbsrc.tgac.miso.core.data.type.LibraryStrategyType) SampleNumberPerProjectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleNumberPerProjectImpl) ProjectImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectImpl) LibrarySelectionType(uk.ac.bbsrc.tgac.miso.core.data.type.LibrarySelectionType) LibraryType(uk.ac.bbsrc.tgac.miso.core.data.type.LibraryType) ArrayList(java.util.ArrayList) Index(uk.ac.bbsrc.tgac.miso.core.data.Index) SampleNumberPerProject(uk.ac.bbsrc.tgac.miso.core.data.SampleNumberPerProject) Project(uk.ac.bbsrc.tgac.miso.core.data.Project) KitDescriptor(uk.ac.bbsrc.tgac.miso.core.data.impl.kit.KitDescriptor) IndexFamily(uk.ac.bbsrc.tgac.miso.core.data.IndexFamily) VolumeUnit(uk.ac.bbsrc.tgac.miso.core.data.VolumeUnit) IonTorrentRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto) QcHierarchyNodeDto(uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto) RunPositionDto(uk.ac.bbsrc.tgac.miso.dto.run.RunPositionDto) PacBioRunDto(uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto) Ls454RunDto(uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto) IlluminaNotificationDto(ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto) OxfordNanoporeRunDto(uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto) IlluminaRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto) NotificationDto(ca.on.oicr.gsi.runscanner.dto.NotificationDto) OxfordNanoporeNotificationDto(ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto) RunDto(uk.ac.bbsrc.tgac.miso.dto.run.RunDto) SolidRunDto(uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto) OrderAliquotDto(uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto) LibraryTemplate(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate) DetailedLibraryTemplate(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryTemplate) PlatformType(uk.ac.bbsrc.tgac.miso.core.data.type.PlatformType)

Aggregations

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 Project (uk.ac.bbsrc.tgac.miso.core.data.Project)1 SampleNumberPerProject (uk.ac.bbsrc.tgac.miso.core.data.SampleNumberPerProject)1 VolumeUnit (uk.ac.bbsrc.tgac.miso.core.data.VolumeUnit)1 DetailedLibraryTemplate (uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryTemplate)1 LibraryTemplate (uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryTemplate)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 OrderAliquotDto (uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto)1 QcHierarchyNodeDto (uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto)1