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