Search in sources :

Example 6 with Instrument

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

the class DefaultInstrumentService method update.

@Override
public long update(Instrument instrument) throws IOException {
    authorizationManager.throwIfNonAdmin();
    Instrument managed = get(instrument.getId());
    loadChildEntities(instrument);
    validateChange(instrument, managed);
    applyChanges(managed, instrument);
    return save(managed);
}
Also used : Instrument(uk.ac.bbsrc.tgac.miso.core.data.Instrument)

Example 7 with Instrument

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

the class HibernateInstrumentDao method getByUpgradedInstrument.

@Override
public Instrument getByUpgradedInstrument(long id) {
    Criteria criteria = currentSession().createCriteria(InstrumentImpl.class);
    criteria.add(Restrictions.eq("upgradedInstrument.id", id));
    return (Instrument) criteria.uniqueResult();
}
Also used : Instrument(uk.ac.bbsrc.tgac.miso.core.data.Instrument) Criteria(org.hibernate.Criteria)

Example 8 with Instrument

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

the class HibernateInstrumentDaoIT method testGetByUpgradedInstrument.

@Test
public void testGetByUpgradedInstrument() throws Exception {
    Instrument upgraded = dao.getByUpgradedInstrument(2L);
    assertNotNull(upgraded);
    assertEquals(6L, upgraded.getId());
}
Also used : Instrument(uk.ac.bbsrc.tgac.miso.core.data.Instrument) Test(org.junit.Test) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest)

Example 9 with Instrument

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

the class HibernateInstrumentDaoIT method testGetByName.

@Test
public void testGetByName() throws Exception {
    String name = "old hiseq";
    Instrument instrument = dao.getByName(name);
    assertNotNull(instrument);
    assertEquals(name, instrument.getName());
}
Also used : Instrument(uk.ac.bbsrc.tgac.miso.core.data.Instrument) Test(org.junit.Test) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest)

Example 10 with Instrument

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

the class HibernateInstrumentDaoIT method testGetUsageByArrayRuns.

@Test
public void testGetUsageByArrayRuns() throws Exception {
    Instrument instrument = (Instrument) currentSession().get(InstrumentImpl.class, 3L);
    assertEquals(1L, dao.getUsageByArrayRuns(instrument));
}
Also used : InstrumentImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.InstrumentImpl) Instrument(uk.ac.bbsrc.tgac.miso.core.data.Instrument) Test(org.junit.Test) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest)

Aggregations

Instrument (uk.ac.bbsrc.tgac.miso.core.data.Instrument)28 Test (org.junit.Test)14 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)12 InstrumentImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.InstrumentImpl)11 Run (uk.ac.bbsrc.tgac.miso.core.data.Run)5 User (com.eaglegenomics.simlims.core.User)4 GetMapping (org.springframework.web.bind.annotation.GetMapping)4 ServiceRecord (uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord)4 NotFoundException (org.springframework.security.acls.model.NotFoundException)3 InstrumentModel (uk.ac.bbsrc.tgac.miso.core.data.InstrumentModel)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 Date (java.util.Date)2 List (java.util.List)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2