Search in sources :

Example 1 with BoxUse

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

the class Dtos method to.

public static Box to(@Nonnull BoxDto from) {
    Box to = new BoxImpl();
    setLong(to::setId, from.getId(), false);
    setString(to::setAlias, from.getAlias());
    setString(to::setDescription, from.getDescription());
    setString(to::setIdentificationBarcode, from.getIdentificationBarcode());
    setString(to::setLocationBarcode, from.getLocationBarcode());
    setObject(to::setUse, BoxUse::new, from.getUseId());
    setObject(to::setSize, BoxSize::new, from.getSizeId());
    setObject(to::setStorageLocation, StorageLocation::new, from.getStorageLocationId());
    if (!isStringEmptyOrNull(from.getStorageLocationBarcode())) {
        if (to.getStorageLocation() == null) {
            to.setStorageLocation(new StorageLocation());
        }
        StorageLocation storageLocation = to.getStorageLocation();
        setString(storageLocation::setIdentificationBarcode, from.getStorageLocationBarcode());
    }
    return to;
}
Also used : BoxImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.BoxImpl) Box(uk.ac.bbsrc.tgac.miso.core.data.Box) IonTorrentRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto) QcHierarchyNodeDto(uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto) RunPositionDto(uk.ac.bbsrc.tgac.miso.dto.run.RunPositionDto) PacBioRunDto(uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto) Ls454RunDto(uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto) IlluminaNotificationDto(ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto) OxfordNanoporeRunDto(uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto) IlluminaRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto) NotificationDto(ca.on.oicr.gsi.runscanner.dto.NotificationDto) OxfordNanoporeNotificationDto(ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto) RunDto(uk.ac.bbsrc.tgac.miso.dto.run.RunDto) SolidRunDto(uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto) OrderAliquotDto(uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto) BoxSize(uk.ac.bbsrc.tgac.miso.core.data.BoxSize) StorageLocation(uk.ac.bbsrc.tgac.miso.core.data.impl.StorageLocation) BoxUse(uk.ac.bbsrc.tgac.miso.core.data.BoxUse)

Example 2 with BoxUse

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

the class ListBoxesController method listBoxes.

@RequestMapping("/boxes")
public ModelAndView listBoxes(ModelMap model) throws Exception {
    List<BoxUse> uses = boxUseService.list();
    BoxUse all = new BoxUse();
    all.setAlias(ALL_TAB);
    uses.add(0, all);
    return new TabbedListBoxPage("box", "boxUse", uses.stream(), TAB_SORTER, BoxUse::getAlias, BoxUse::getId).list(model);
}
Also used : BoxUse(uk.ac.bbsrc.tgac.miso.core.data.BoxUse) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with BoxUse

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

the class HibernateBoxUseDaoIT method testUpdate.

@Test
public void testUpdate() throws IOException {
    long id = 1L;
    String alias = "New Alias";
    BoxUse boxUse = (BoxUse) getSessionFactory().getCurrentSession().get(BoxUse.class, id);
    assertNotEquals(alias, boxUse.getAlias());
    boxUse.setAlias(alias);
    sut.update(boxUse);
    clearSession();
    BoxUse saved = (BoxUse) getSessionFactory().getCurrentSession().get(BoxUse.class, id);
    assertEquals(alias, saved.getAlias());
}
Also used : BoxUse(uk.ac.bbsrc.tgac.miso.core.data.BoxUse) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Example 4 with BoxUse

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

the class HibernateBoxDaoIT method testSave.

@Test
public void testSave() throws Exception {
    Box box = new BoxImpl();
    UserImpl user = new UserImpl();
    user.setId(1l);
    Date now = new Date();
    box.setCreator(user);
    box.setCreationTime(now);
    box.setLastModifier(user);
    box.setLastModified(now);
    box.setDescription("newboxdescription");
    box.setAlias("newboxalias");
    box.setName("newbox");
    box.setLocationBarcode("newlocationbarcode");
    BoxSize boxSize = new BoxSize();
    boxSize.setColumns(2);
    boxSize.setRows(3);
    boxSize.setId(1l);
    box.setSize(boxSize);
    BoxUse boxuse = (BoxUse) sessionFactory.getCurrentSession().get(BoxUse.class, 1L);
    box.setUse(boxuse);
    long boxId = dao.save(box);
    Box retrieved = dao.get(boxId);
    assertEquals(box.getDescription(), retrieved.getDescription());
    assertEquals(box.getAlias(), retrieved.getAlias());
    assertEquals(box.getSize().getId(), retrieved.getSize().getId());
    assertEquals(box.getName(), retrieved.getName());
}
Also used : BoxImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.BoxImpl) UserImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.UserImpl) Box(uk.ac.bbsrc.tgac.miso.core.data.Box) BoxSize(uk.ac.bbsrc.tgac.miso.core.data.BoxSize) Date(java.util.Date) BoxUse(uk.ac.bbsrc.tgac.miso.core.data.BoxUse) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Example 5 with BoxUse

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

the class DefaultBoxUseService method update.

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

Aggregations

BoxUse (uk.ac.bbsrc.tgac.miso.core.data.BoxUse)11 Test (org.junit.Test)6 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)6 Box (uk.ac.bbsrc.tgac.miso.core.data.Box)3 BoxSize (uk.ac.bbsrc.tgac.miso.core.data.BoxSize)3 BoxImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.BoxImpl)3 IlluminaNotificationDto (ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto)2 NotificationDto (ca.on.oicr.gsi.runscanner.dto.NotificationDto)2 OxfordNanoporeNotificationDto (ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto)2 UserImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.UserImpl)2 OrderAliquotDto (uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto)2 QcHierarchyNodeDto (uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto)2 IlluminaRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto)2 IonTorrentRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto)2 Ls454RunDto (uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto)2 OxfordNanoporeRunDto (uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto)2 PacBioRunDto (uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto)2 RunDto (uk.ac.bbsrc.tgac.miso.dto.run.RunDto)2 RunPositionDto (uk.ac.bbsrc.tgac.miso.dto.run.RunPositionDto)2 SolidRunDto (uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto)2