Search in sources :

Example 1 with ArrayRun

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;
}
Also used : Array(uk.ac.bbsrc.tgac.miso.core.data.Array) InstrumentImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.InstrumentImpl) ArrayRun(uk.ac.bbsrc.tgac.miso.core.data.ArrayRun)

Example 2 with ArrayRun

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);
}
Also used : ArrayRun(uk.ac.bbsrc.tgac.miso.core.data.ArrayRun)

Example 3 with ArrayRun

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);
}
Also used : ArrayRun(uk.ac.bbsrc.tgac.miso.core.data.ArrayRun) ModelAndView(org.springframework.web.servlet.ModelAndView) NotFoundException(org.springframework.security.acls.model.NotFoundException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with ArrayRun

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());
}
Also used : ArrayRun(uk.ac.bbsrc.tgac.miso.core.data.ArrayRun) Test(org.junit.Test) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest)

Example 5 with ArrayRun

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;
}
Also used : ArrayRun(uk.ac.bbsrc.tgac.miso.core.data.ArrayRun) Criteria(org.hibernate.Criteria)

Aggregations

ArrayRun (uk.ac.bbsrc.tgac.miso.core.data.ArrayRun)12 Criteria (org.hibernate.Criteria)4 Test (org.junit.Test)4 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)4 InstrumentImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.InstrumentImpl)2 User (com.eaglegenomics.simlims.core.User)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 NotFoundException (org.springframework.security.acls.model.NotFoundException)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1 Array (uk.ac.bbsrc.tgac.miso.core.data.Array)1 Instrument (uk.ac.bbsrc.tgac.miso.core.data.Instrument)1 UserImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.UserImpl)1 ValidationError (uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError)1 ValidationException (uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationException)1