use of uk.ac.bbsrc.tgac.miso.core.data.ArrayRun in project miso-lims by miso-lims.
the class Dtos method to.
public static final ArrayRun to(@Nonnull ArrayRunDto from) {
ArrayRun run = new ArrayRun();
if (from.getId() != null) {
run.setId(from.getId());
}
run.setAlias(from.getAlias());
run.setDescription(nullifyStringIfBlank(from.getDescription()));
run.setFilePath(nullifyStringIfBlank(from.getFilePath()));
setObject(run::setInstrument, InstrumentImpl::new, from.getInstrumentId());
setObject(run::setArray, Array::new, from.getArrayId());
run.setHealth(HealthType.get(from.getStatus()));
setDate(run::setStartDate, from.getStartDate());
setDate(run::setCompletionDate, from.getCompletionDate());
setDate(run::setLastModified, from.getLastModified());
return run;
}
use of uk.ac.bbsrc.tgac.miso.core.data.ArrayRun in project miso-lims by miso-lims.
the class DefaultArrayRunService method update.
@Override
public long update(ArrayRun arrayRun) throws IOException {
loadChildEntities(arrayRun);
ArrayRun managed = get(arrayRun.getId());
validateChange(arrayRun, managed);
applyChanges(arrayRun, managed);
managed.setChangeDetails(authorizationManager.getCurrentUser());
return arrayRunStore.save(managed);
}
use of uk.ac.bbsrc.tgac.miso.core.data.ArrayRun in project miso-lims by miso-lims.
the class EditArrayRunController method setupForm.
@RequestMapping("/{arrayRunId}")
public ModelAndView setupForm(@PathVariable(name = "arrayRunId", required = true) long arrayRunId, ModelMap model) throws IOException {
ArrayRun run = arrayRunService.get(arrayRunId);
if (run == null) {
throw new NotFoundException("Array Run not found");
}
model.addAttribute(MODEL_ATTR_TITLE, "Array Run " + arrayRunId);
model.addAttribute(PageMode.PROPERTY, PageMode.EDIT.getLabel());
ObjectMapper mapper = new ObjectMapper();
model.addAttribute(MODEL_ATTR_JSON, mapper.writer().writeValueAsString(Dtos.asDto(run)));
model.addAttribute(MODEL_ATTR_RUN, run);
return new ModelAndView(JSP, model);
}
use of uk.ac.bbsrc.tgac.miso.core.data.ArrayRun in project miso-lims by miso-lims.
the class HibernateArrayRunDaoIT method testGet.
@Test
public void testGet() throws Exception {
ArrayRun run = sut.get(1L);
assertNotNull(run);
assertEquals(1L, run.getId());
assertEquals("ArrayRun_1", run.getAlias());
assertNotNull(run.getInstrument());
assertEquals("iScan_1", run.getInstrument().getName());
assertNotNull(run.getArray());
assertEquals("Array_1", run.getArray().getAlias());
assertEquals(HealthType.Running, run.getHealth());
assertEquals(LimsUtils.parseDate("2018-02-02"), run.getStartDate());
}
use of uk.ac.bbsrc.tgac.miso.core.data.ArrayRun in project miso-lims by miso-lims.
the class HibernateArrayRunDao method listBySampleId.
@Override
public List<ArrayRun> listBySampleId(long sampleId) throws IOException {
Criteria criteria = currentSession().createCriteria(ArrayRun.class);
criteria.createAlias("array.samples", "sample");
criteria.add(Restrictions.eq("sample.id", sampleId));
@SuppressWarnings("unchecked") List<ArrayRun> list = criteria.list();
return list;
}
Aggregations