Search in sources :

Example 1 with QcControl

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

the class AbstractHibernateQcDaoTest method testCreateControlRun.

@Test
public void testCreateControlRun() throws Exception {
    T qc = qcClass.cast(currentSession().get(qcClass, qcWithControlId));
    QcControlRun controlRun = makeControlRun(qc);
    QcControl control = (QcControl) currentSession().get(QcControl.class, controlTypeId);
    controlRun.setControl(control);
    String lot = "TESTLOT";
    controlRun.setLot(lot);
    controlRun.setQcPassed(true);
    long savedId = dao.createControlRun(controlRun);
    clearSession();
    QcControlRun saved = (QcControlRun) currentSession().get(controlRunClass, savedId);
    assertNotNull(saved);
    assertEquals(lot, saved.getLot());
}
Also used : QcControl(uk.ac.bbsrc.tgac.miso.core.data.qc.QcControl) QcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.QcControlRun) Test(org.junit.Test)

Example 2 with QcControl

use of uk.ac.bbsrc.tgac.miso.core.data.qc.QcControl 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 3 with QcControl

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

the class HibernateQcTypeDaoIT method testGetControl.

@Test
public void testGetControl() throws Exception {
    QcControl control = dao.getControl(1L);
    assertNotNull(control);
    assertEquals("Control 1", control.getAlias());
}
Also used : QcControl(uk.ac.bbsrc.tgac.miso.core.data.qc.QcControl) Test(org.junit.Test) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest)

Example 4 with QcControl

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

the class DefaultQcTypeService method loadChildEntities.

private void loadChildEntities(QcType qcType) throws IOException {
    if (qcType.getInstrumentModel() != null) {
        qcType.setInstrumentModel(instrumentModelService.get(qcType.getInstrumentModel().getId()));
    }
    Set<KitDescriptor> managedKits = new HashSet<>();
    for (KitDescriptor kit : qcType.getKitDescriptors()) {
        KitDescriptor managedKit = kitDescriptorService.get(kit.getId());
        if (managedKit == null) {
            throw new ValidationException("No kit descriptor found with ID: " + kit.getId());
        }
        managedKits.add(managedKit);
    }
    qcType.getKitDescriptors().clear();
    qcType.getKitDescriptors().addAll(managedKits);
    Set<QcControl> managedControls = new HashSet<>();
    for (QcControl control : qcType.getControls()) {
        if (control.isSaved()) {
            QcControl managedControl = qcTypeStore.getControl(control.getId());
            if (managedControl == null) {
                throw new ValidationException("No control found with ID: " + control.getId());
            }
            managedControls.add(managedControl);
        } else {
            managedControls.add(control);
        }
    }
    qcType.getControls().clear();
    qcType.getControls().addAll(managedControls);
}
Also used : QcControl(uk.ac.bbsrc.tgac.miso.core.data.qc.QcControl) KitDescriptor(uk.ac.bbsrc.tgac.miso.core.data.impl.kit.KitDescriptor) ValidationException(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationException) HashSet(java.util.HashSet)

Example 5 with QcControl

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

the class DefaultQcTypeService method saveControls.

private void saveControls(long savedId, QcType from) throws IOException {
    QcType to = get(savedId);
    Set<QcControl> toDelete = getControlsToDelete(from, to);
    for (QcControl control : toDelete) {
        qcTypeStore.deleteControl(control);
    }
    for (QcControl fromControl : from.getControls()) {
        if (!fromControl.isSaved()) {
            fromControl.setQcType(to);
            qcTypeStore.createControl(fromControl);
        }
    }
}
Also used : QcControl(uk.ac.bbsrc.tgac.miso.core.data.qc.QcControl) QcType(uk.ac.bbsrc.tgac.miso.core.data.type.QcType)

Aggregations

QcControl (uk.ac.bbsrc.tgac.miso.core.data.qc.QcControl)10 Test (org.junit.Test)5 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)4 QcType (uk.ac.bbsrc.tgac.miso.core.data.type.QcType)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 HashSet (java.util.HashSet)2 KitDescriptor (uk.ac.bbsrc.tgac.miso.core.data.impl.kit.KitDescriptor)2 QcControlRun (uk.ac.bbsrc.tgac.miso.core.data.qc.QcControlRun)2 ValidationException (uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationException)2 OrderAliquotDto (uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto)2 QcHierarchyNodeDto (uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto)2 IlluminaRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto)2 IonTorrentRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto)2 Ls454RunDto (uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto)2 OxfordNanoporeRunDto (uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto)2 PacBioRunDto (uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto)2 RunDto (uk.ac.bbsrc.tgac.miso.dto.run.RunDto)2 RunPositionDto (uk.ac.bbsrc.tgac.miso.dto.run.RunPositionDto)2