use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView in project miso-lims by miso-lims.
the class PoolImplTest method addElement.
private void addElement(PoolImpl pool, Index index1, Index index2) {
ListLibraryAliquotView ldi = new ListLibraryAliquotView();
ldi.setParentLibrary(new ParentLibrary());
ldi.getParentLibrary().setIndex1(index1);
ldi.getParentLibrary().setIndex2(index2);
PoolElement element = new PoolElement(pool, ldi);
pool.getPoolContents().add(element);
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView in project miso-lims by miso-lims.
the class Dtos method to.
public static Pool to(@Nonnull PoolDto dto) {
PoolImpl to = new PoolImpl();
setLong(to::setId, dto.getId(), false);
to.setAlias(dto.getAlias());
setBigDecimal(to::setConcentration, dto.getConcentration());
to.setConcentrationUnits(dto.getConcentrationUnits());
setInteger(to::setDnaSize, dto.getDnaSize(), true);
to.setCreationDate(parseDate(dto.getCreationDate()));
to.setDescription(dto.getDescription());
to.setIdentificationBarcode(dto.getIdentificationBarcode());
to.setDiscarded(dto.isDiscarded());
setBigDecimal(to::setVolume, dto.getVolume());
to.setVolumeUnits(dto.getVolumeUnits());
setObject(to::setPlatformType, dto.getPlatformType(), pt -> PlatformType.valueOf(pt));
if (dto.getPooledElements() != null) {
to.setPoolElements(dto.getPooledElements().stream().map(aliquot -> {
ListLibraryAliquotView view = new ListLibraryAliquotView();
view.setId(aliquot.getId());
view.setName(aliquot.getName());
setBigDecimal(view::setVolumeUsed, aliquot.getVolumeUsed());
PoolElement link = new PoolElement(to, view);
if (aliquot.getProportion() != null) {
link.setProportion(aliquot.getProportion());
}
return link;
}).collect(Collectors.toSet()));
}
to.setQcPassed(dto.getQcPassed());
to.setBoxPosition((PoolBoxPosition) makeBoxablePosition(dto, to));
if (dto.isMergeChild())
to.makeMergeChild();
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView in project miso-lims by miso-lims.
the class HibernatePoolDaoIT method testAddAliquot.
@Test
public void testAddAliquot() throws IOException {
Pool pool = dao.get(1L);
int originalSize = pool.getPoolContents().size();
ListLibraryAliquotView ldi = (ListLibraryAliquotView) sessionFactory.getCurrentSession().get(ListLibraryAliquotView.class, 14L);
PoolElement element = new PoolElement(pool, ldi);
pool.getPoolContents().add(element);
dao.save(pool);
sessionFactory.getCurrentSession().flush();
sessionFactory.getCurrentSession().clear();
Pool saved = dao.get(1L);
int savedSize = saved.getPoolContents().size();
assertEquals("LDI14 should present in saved collection", originalSize + 1, savedSize);
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView in project miso-lims by miso-lims.
the class DefaultPoolService method loadPoolElements.
private void loadPoolElements(Pool source, Pool target) throws IOException {
Set<ListLibraryAliquotView> removals = target.getPoolContents().stream().filter(notInOther(source.getPoolContents())).map(PoolElement::getAliquot).collect(Collectors.toSet());
for (ListLibraryAliquotView aliquot : removals) {
runPartitionAliquotService.deleteForPoolAliquot(target, aliquot.getId());
}
loadPoolElements(source.getPoolContents(), target);
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ListLibraryAliquotView in project miso-lims by miso-lims.
the class DefaultPoolService method loadPoolElements.
private void loadPoolElements(Collection<PoolElement> source, Pool target) throws IOException {
Set<PoolElement> targetAliquots = target.getPoolContents();
targetAliquots.removeIf(notInOther(source));
Set<PoolElement> additions = source.stream().filter(notInOther(targetAliquots)).collect(Collectors.toSet());
for (PoolElement sourcePd : additions) {
ListLibraryAliquotView v = listLibraryAliquotViewService.get(sourcePd.getAliquot().getId());
if (v == null) {
throw new IllegalStateException("Pool contains an unsaved library aliquot");
}
targetAliquots.add(new PoolElement(target, v, sourcePd.getProportion()));
}
for (PoolElement targetPd : targetAliquots) {
PoolElement sourcePd = source.stream().filter(spd -> spd.getAliquot().getId() == targetPd.getAliquot().getId()).findFirst().orElse(null);
if (sourcePd != null) {
targetPd.setProportion(sourcePd.getProportion());
}
}
}
Aggregations