use of uk.ac.bbsrc.tgac.miso.core.data.Library in project miso-lims by miso-lims.
the class BoxPageIT method testAddMultipleTubes.
@Test
public void testAddMultipleTubes() {
Library lib1 = (Library) getSession().get(LibraryImpl.class, 100001L);
Library lib2 = (Library) getSession().get(LibraryImpl.class, 100002L);
Library lib3 = (Library) getSession().get(LibraryImpl.class, 100003L);
BoxPage page = getBoxPage(1L);
BoxVisualization visualization = page.getVisualization();
assertNull(lib1.getBox());
assertNull(lib2.getBox());
assertNull(lib3.getBox());
assertTrue(visualization.isEmptyPosition("H10"));
assertTrue(visualization.isEmptyPosition("H11"));
assertTrue(visualization.isEmptyPosition("H12"));
Map<String, String> updates = new HashMap<>();
updates.put("H10", lib1.getName());
updates.put("H11", lib2.getName());
updates.put("H12", lib3.getName());
visualization.updatePositions(updates, false);
Box box = (Box) getSession().get(BoxImpl.class, 1L);
assertTrue(visualization.getPositionTitle("H10").contains(lib1.getAlias()));
assertEquals(new BoxableId(EntityType.LIBRARY, lib1.getId()), box.getBoxPositions().get("H10").getBoxableId());
assertTrue(visualization.getPositionTitle("H11").contains(lib2.getAlias()));
assertEquals(new BoxableId(EntityType.LIBRARY, lib2.getId()), box.getBoxPositions().get("H11").getBoxableId());
assertTrue(visualization.getPositionTitle("H12").contains(lib3.getAlias()));
assertEquals(new BoxableId(EntityType.LIBRARY, lib3.getId()), box.getBoxPositions().get("H12").getBoxableId());
}
use of uk.ac.bbsrc.tgac.miso.core.data.Library in project miso-lims by miso-lims.
the class BoxPageIT method testMoveItemWithinBox.
@Test
public void testMoveItemWithinBox() {
final String initialPosition = "F10";
final String finalPosition = "F12";
Library lib = (Library) getSession().get(LibraryImpl.class, 505L);
assertNotNull(lib);
BoxableId libBoxableId = new BoxableId(lib.getEntityType(), lib.getId());
// confirm positions pre-move
Box initial = (Box) getSession().get(BoxImpl.class, 500L);
BoxPosition itemAtInitialPosition = initial.getBoxPositions().get(initialPosition);
assertNotNull(itemAtInitialPosition);
assertNull(initial.getBoxPositions().get(finalPosition));
assertEquals(libBoxableId, itemAtInitialPosition.getBoxableId());
BoxPage page = getBoxPage(500L);
BoxVisualization visualization = page.getVisualization();
assertFalse("checking that library is in position F10", visualization.isEmptyPosition(initialPosition));
assertTrue("checking which library is in position F10", visualization.getPositionTitle(initialPosition).contains(lib.getAlias()));
assertTrue("checking that no tube is in position F12", visualization.isEmptyPosition(finalPosition));
visualization.selectPosition(finalPosition);
visualization.searchBoxables(lib.getIdentificationBarcode());
visualization.updatePosition(false);
// confirm positions post-move
Box updated = (Box) getSession().get(BoxImpl.class, 500L);
assertNull(updated.getBoxPositions().get(initialPosition));
BoxPosition updatedAtFinalPosition = updated.getBoxPositions().get(finalPosition);
assertNotNull(updatedAtFinalPosition);
assertEquals(libBoxableId, updatedAtFinalPosition.getBoxableId());
BoxPage afterSave = getBoxPage(500L);
BoxVisualization afterVisualization = afterSave.getVisualization();
assertTrue("checking that no tube is in position F10", afterVisualization.isEmptyPosition(initialPosition));
assertFalse("checking that library is in position F12", afterVisualization.isEmptyPosition(finalPosition));
assertTrue("checking which library is in position F12", afterVisualization.getPositionTitle(finalPosition).contains(lib.getAlias()));
}
use of uk.ac.bbsrc.tgac.miso.core.data.Library in project miso-lims by miso-lims.
the class BoxPageIT method replaceMultipleTubes.
@Test
public void replaceMultipleTubes() {
Library lib1 = (Library) getSession().get(LibraryImpl.class, 100001L);
Library lib2 = (Library) getSession().get(LibraryImpl.class, 100002L);
Library lib3 = (Library) getSession().get(LibraryImpl.class, 100003L);
BoxPage page = getBoxPage(1L);
BoxVisualization visualization = page.getVisualization();
assertNull(lib1.getBox());
assertNull(lib2.getBox());
assertNull(lib3.getBox());
assertFalse(visualization.isEmptyPosition("F06"));
assertFalse(visualization.isEmptyPosition("G07"));
assertFalse(visualization.isEmptyPosition("H08"));
Map<String, String> updates = new HashMap<>();
updates.put("F06", lib1.getName());
updates.put("G07", lib2.getName());
updates.put("H08", lib3.getName());
visualization.updatePositions(updates, true);
Box box = (Box) getSession().get(BoxImpl.class, 1L);
assertTrue(visualization.getPositionTitle("F06").contains(lib1.getAlias()));
assertEquals(new BoxableId(EntityType.LIBRARY, lib1.getId()), box.getBoxPositions().get("F06").getBoxableId());
assertTrue(visualization.getPositionTitle("G07").contains(lib2.getAlias()));
assertEquals(new BoxableId(EntityType.LIBRARY, lib2.getId()), box.getBoxPositions().get("G07").getBoxableId());
assertTrue(visualization.getPositionTitle("H08").contains(lib3.getAlias()));
assertEquals(new BoxableId(EntityType.LIBRARY, lib3.getId()), box.getBoxPositions().get("H08").getBoxableId());
}
use of uk.ac.bbsrc.tgac.miso.core.data.Library in project miso-lims by miso-lims.
the class HibernateLibraryDao method listAll.
@Override
public List<Library> listAll() throws IOException {
Criteria criteria = currentSession().createCriteria(LibraryImpl.class);
@SuppressWarnings("unchecked") List<Library> records = criteria.list();
return records;
}
use of uk.ac.bbsrc.tgac.miso.core.data.Library in project miso-lims by miso-lims.
the class HibernateLibraryDao method listByProjectId.
@Override
public List<Library> listByProjectId(long projectId) throws IOException {
Criteria criteria = currentSession().createCriteria(LibraryImpl.class);
criteria.createAlias("sample.project", "project");
criteria.add(Restrictions.eq("project.id", projectId));
@SuppressWarnings("unchecked") List<Library> records = criteria.list();
return records;
}
Aggregations