use of uk.ac.bbsrc.tgac.miso.core.data.impl.AssayMetric in project miso-lims by miso-lims.
the class DefaultAssayService method loadChildEntities.
@Override
protected void loadChildEntities(Assay object) throws IOException {
for (AssayMetric metric : object.getAssayMetrics()) {
loadChildEntity(metric.getMetric(), metric::setMetric, metricService);
metric.setAssay(object);
}
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.AssayMetric in project miso-lims by miso-lims.
the class AssayMetricDto method to.
public AssayMetric to() {
AssayMetric to = new AssayMetric();
setObject(to::setMetric, Metric::new, getId());
setBigDecimal(to::setMinimumThreshold, getMinimumThreshold());
setBigDecimal(to::setMaximumThreshold, getMaximumThreshold());
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.AssayMetric in project miso-lims by miso-lims.
the class DefaultAssayService method applyMetricChanges.
private void applyMetricChanges(Set<AssayMetric> to, Set<AssayMetric> from) throws IOException {
for (Iterator<AssayMetric> iterator = to.iterator(); iterator.hasNext(); ) {
AssayMetric toItem = iterator.next();
if (from.stream().noneMatch(fromItem -> fromItem.getMetric().getId() == toItem.getMetric().getId())) {
iterator.remove();
assayDao.deleteAssayMetric(toItem);
}
}
for (AssayMetric fromItem : from) {
AssayMetric toItem = to.stream().filter(x -> x.getMetric().getId() == fromItem.getMetric().getId()).findFirst().orElse(null);
if (toItem == null) {
to.add(fromItem);
} else {
toItem.setMaximumThreshold(fromItem.getMaximumThreshold());
toItem.setMinimumThreshold(fromItem.getMinimumThreshold());
}
}
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.AssayMetric in project miso-lims by miso-lims.
the class HibernateAssayDaoIT method testDeleteAssayMetric.
@Test
public void testDeleteAssayMetric() throws Exception {
final long assayId = 2L;
final long metricId = 2L;
Assay before = (Assay) currentSession().get(Assay.class, assayId);
assertEquals(2, before.getAssayMetrics().size());
AssayMetric beforeMetric = before.getAssayMetrics().stream().filter(x -> x.getMetric().getId() == metricId).findAny().orElse(null);
before.getAssayMetrics().remove(beforeMetric);
assertNotNull(beforeMetric);
getTestSubject().deleteAssayMetric(beforeMetric);
clearSession();
Assay after = (Assay) currentSession().get(Assay.class, assayId);
assertEquals(1, after.getAssayMetrics().size());
assertTrue(after.getAssayMetrics().stream().noneMatch(x -> x.getMetric().getId() == metricId));
}
Aggregations