Search in sources :

Example 1 with QcType

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

the class Dtos method to.

public static QC to(@Nonnull QcDto dto) {
    QC to;
    switch(dto.getQcTarget()) {
        case "Library":
            LibraryQC newLibraryQc = new LibraryQC();
            Library ownerLibrary = new LibraryImpl();
            ownerLibrary.setId(dto.getEntityId());
            newLibraryQc.setLibrary(ownerLibrary);
            to = newLibraryQc;
            break;
        case "Sample":
            SampleQC newSampleQc = new SampleQC();
            Sample ownerSample = new SampleImpl();
            ownerSample.setId(dto.getEntityId());
            newSampleQc.setSample(ownerSample);
            to = newSampleQc;
            break;
        case "Pool":
            PoolQC newPoolQc = new PoolQC();
            Pool ownerPool = new PoolImpl();
            ownerPool.setId(dto.getEntityId());
            newPoolQc.setPool(ownerPool);
            to = newPoolQc;
            break;
        case "Container":
            ContainerQC newContainerQc = new ContainerQC();
            SequencerPartitionContainer ownerContainer = new SequencerPartitionContainerImpl();
            ownerContainer.setId(dto.getEntityId());
            newContainerQc.setContainer(ownerContainer);
            to = newContainerQc;
            break;
        case "Requisition":
            RequisitionQC newRequisitionQc = new RequisitionQC();
            Requisition ownerRequisition = new Requisition();
            ownerRequisition.setId(dto.getEntityId());
            newRequisitionQc.setRequisition(ownerRequisition);
            to = newRequisitionQc;
            break;
        default:
            throw new IllegalArgumentException("No such QC target: " + dto.getQcTarget());
    }
    if (dto.getId() != null) {
        to.setId(dto.getId());
    }
    to.setDate(parseDate(dto.getDate()));
    setBigDecimal(to::setResults, dto.getResults());
    setObject(to::setType, QcType::new, dto.getQcTypeId());
    to.setDescription(dto.getDescription());
    setObject(to::setInstrument, InstrumentImpl::new, dto.getInstrumentId());
    setObject(to::setKit, KitDescriptor::new, dto.getKitDescriptorId());
    setString(to::setKitLot, dto.getKitLot());
    addQcControlRuns(dto.getControls(), to, QcTarget.valueOf(dto.getQcTarget()));
    return to;
}
Also used : SequencerPartitionContainer(uk.ac.bbsrc.tgac.miso.core.data.SequencerPartitionContainer) InstrumentImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.InstrumentImpl) ParentSample(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentSample) DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) Sample(uk.ac.bbsrc.tgac.miso.core.data.Sample) WorksetSample(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetSample) GrandparentSample(uk.ac.bbsrc.tgac.miso.core.data.impl.view.GrandparentSample) TransferSample(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferSample) SampleQC(uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQC) RequisitionQC(uk.ac.bbsrc.tgac.miso.core.data.qc.RequisitionQC) LibraryQC(uk.ac.bbsrc.tgac.miso.core.data.qc.LibraryQC) PoolImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.PoolImpl) LibraryQC(uk.ac.bbsrc.tgac.miso.core.data.qc.LibraryQC) PoolQC(uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQC) QC(uk.ac.bbsrc.tgac.miso.core.data.qc.QC) SampleQC(uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQC) ContainerQC(uk.ac.bbsrc.tgac.miso.core.data.qc.ContainerQC) RequisitionQC(uk.ac.bbsrc.tgac.miso.core.data.qc.RequisitionQC) KitDescriptor(uk.ac.bbsrc.tgac.miso.core.data.impl.kit.KitDescriptor) LibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl) DetailedLibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedLibraryImpl) SequencerPartitionContainerImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SequencerPartitionContainerImpl) TransferPool(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferPool) Pool(uk.ac.bbsrc.tgac.miso.core.data.Pool) InstrumentStatusPositionRunPool(uk.ac.bbsrc.tgac.miso.core.data.impl.view.instrumentstatus.InstrumentStatusPositionRunPool) ContainerQC(uk.ac.bbsrc.tgac.miso.core.data.qc.ContainerQC) TransferLibrary(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibrary) ParentLibrary(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentLibrary) DetailedLibrary(uk.ac.bbsrc.tgac.miso.core.data.DetailedLibrary) WorksetLibrary(uk.ac.bbsrc.tgac.miso.core.data.impl.workset.WorksetLibrary) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) 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) PoolQC(uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQC) Requisition(uk.ac.bbsrc.tgac.miso.core.data.impl.Requisition) SampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl) DetailedSampleImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.DetailedSampleImpl) QcType(uk.ac.bbsrc.tgac.miso.core.data.type.QcType)

Example 2 with QcType

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

the class HibernateQcTypeDao method list.

@Override
public List<QcType> list() throws IOException {
    Criteria criteria = currentSession().createCriteria(QcType.class);
    @SuppressWarnings("unchecked") List<QcType> records = criteria.list();
    return records;
}
Also used : Criteria(org.hibernate.Criteria) QcType(uk.ac.bbsrc.tgac.miso.core.data.type.QcType)

Example 3 with QcType

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

the class HibernateQcTypeDaoIT method testCreateControl.

@Test
public void testCreateControl() throws Exception {
    QcControl control = new QcControl();
    control.setAlias("Shiny New Control");
    QcType qcType = (QcType) currentSession().get(QcType.class, 1L);
    control.setQcType(qcType);
    long savedId = dao.createControl(control);
    clearSession();
    QcControl saved = (QcControl) currentSession().get(QcControl.class, savedId);
    assertNotNull(saved);
    assertEquals(control.getAlias(), saved.getAlias());
    QcType savedQcType = (QcType) currentSession().get(QcType.class, 1L);
    assertNotNull(savedQcType);
    assertEquals(1, savedQcType.getControls().size());
    assertEquals(control.getAlias(), savedQcType.getControls().iterator().next().getAlias());
}
Also used : QcControl(uk.ac.bbsrc.tgac.miso.core.data.qc.QcControl) QcType(uk.ac.bbsrc.tgac.miso.core.data.type.QcType) Test(org.junit.Test) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest)

Example 4 with QcType

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

the class HibernateQcTypeDaoIT method testGet.

@Test
public void testGet() throws IOException {
    QcType qcType = dao.get(3L);
    assertNotNull(qcType);
    assertEquals("Bioanalyser", qcType.getName());
    assertEquals(QcTarget.Sample, qcType.getQcTarget());
}
Also used : QcType(uk.ac.bbsrc.tgac.miso.core.data.type.QcType) Test(org.junit.Test) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest)

Example 5 with QcType

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

the class HibernateQcTypeDaoIT method testListByNameAndTarget.

@Test
public void testListByNameAndTarget() throws Exception {
    String name = "QuBit";
    QcTarget target = QcTarget.Library;
    List<QcType> qcTypes = dao.listByNameAndTarget(name, target);
    assertNotNull(qcTypes);
    assertEquals(1, qcTypes.size());
    assertEquals(name, qcTypes.get(0).getName());
    assertEquals(target, qcTypes.get(0).getQcTarget());
}
Also used : QcTarget(uk.ac.bbsrc.tgac.miso.core.data.qc.QcTarget) QcType(uk.ac.bbsrc.tgac.miso.core.data.type.QcType) Test(org.junit.Test) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest)

Aggregations

QcType (uk.ac.bbsrc.tgac.miso.core.data.type.QcType)17 Test (org.junit.Test)9 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)8 KitDescriptor (uk.ac.bbsrc.tgac.miso.core.data.impl.kit.KitDescriptor)3 QcControl (uk.ac.bbsrc.tgac.miso.core.data.qc.QcControl)3 IlluminaNotificationDto (ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto)2 NotificationDto (ca.on.oicr.gsi.runscanner.dto.NotificationDto)2 OxfordNanoporeNotificationDto (ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto)2 GetMapping (org.springframework.web.bind.annotation.GetMapping)2 OrderAliquotDto (uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto)2 User (com.eaglegenomics.simlims.core.User)1 IOException (java.io.IOException)1 BigDecimal (java.math.BigDecimal)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Criteria (org.hibernate.Criteria)1