use of uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibraryAliquot in project miso-lims by miso-lims.
the class NotificationManager method makeLibraryAliquotTable.
private static ContainerTag makeLibraryAliquotTable(Collection<TransferLibraryAliquot> transferLibraryAliquots) {
ContainerTag headerRow = tr(makeTh("Alias"), makeTh("Barcode"), makeTh("Location"), makeTh("Platform"), makeTh("Type"), makeTh("i7 Index Name"), makeTh("i7 Index"), makeTh("i5 Index Name"), makeTh("i5 Index"), makeTh("Targeted Sequencing"));
List<ContainerTag> rows = new ArrayList<>();
List<TransferLibraryAliquot> sorted = sortByAlias(transferLibraryAliquots);
for (TransferLibraryAliquot transferLibraryAliquot : sorted) {
LibraryAliquot libraryAliquot = transferLibraryAliquot.getItem();
Library library = libraryAliquot.getLibrary();
List<DomContent> cells = new ArrayList<>();
cells.add(makeTd(libraryAliquot.getAlias()));
cells.add(makeTd(libraryAliquot.getIdentificationBarcode()));
cells.add(makeTd(makeLocationLabel(transferLibraryAliquot)));
cells.add(makeTd(library.getPlatformType().getKey()));
cells.add(makeTd(library.getLibraryType().getDescription()));
cells.add(makeTd(library.getIndex1() == null ? null : library.getIndex1().getName()));
cells.add(makeTd(library.getIndex1() == null ? null : library.getIndex1().getSequence()));
cells.add(makeTd(library.getIndex2() == null ? null : library.getIndex2().getName()));
cells.add(makeTd(library.getIndex2() == null ? null : library.getIndex2().getSequence()));
rows.add(tr().with(cells));
}
return makeTable(headerRow, rows);
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibraryAliquot in project miso-lims by miso-lims.
the class Dtos method to.
public static Transfer to(@Nonnull TransferDto from) {
Transfer to = new Transfer();
setLong(to::setId, from.getId(), false);
setString(to::setTransferRequestName, from.getTransferRequestName());
setDateTime(to::setTransferTime, from.getTransferTime());
setObject(to::setSenderLab, LabImpl::new, from.getSenderLabId());
setObject(to::setSenderGroup, Group::new, from.getSenderGroupId());
setString(to::setRecipient, from.getRecipient());
setObject(to::setRecipientGroup, Group::new, from.getRecipientGroupId());
addTransferItems(to::getSampleTransfers, from.getItems(), EntityType.SAMPLE, TransferSample::new, SampleImpl::new, SampleBoxPosition::new, Sample::setBoxPosition);
addTransferItems(to::getLibraryTransfers, from.getItems(), EntityType.LIBRARY, TransferLibrary::new, LibraryImpl::new, LibraryBoxPosition::new, Library::setBoxPosition);
addTransferItems(to::getLibraryAliquotTransfers, from.getItems(), EntityType.LIBRARY_ALIQUOT, TransferLibraryAliquot::new, LibraryAliquot::new, LibraryAliquotBoxPosition::new, LibraryAliquot::setBoxPosition);
addTransferItems(to::getPoolTransfers, from.getItems(), EntityType.POOL, TransferPool::new, PoolImpl::new, PoolBoxPosition::new, Pool::setBoxPosition);
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibraryAliquot in project miso-lims by miso-lims.
the class TransferController method addBoxItems.
private <T extends Boxable, U extends TransferItem<T>> void addBoxItems(String idString, Transfer transfer) throws IOException {
if (idString == null) {
return;
}
for (Long id : LimsUtils.parseIds(idString)) {
Box box = boxService.get(id);
if (box == null) {
throw new ClientErrorException(String.format("No box found for ID: %d", id));
}
for (BoxPosition item : box.getBoxPositions().values()) {
long itemId = item.getBoxableId().getTargetId();
switch(item.getBoxableId().getTargetType()) {
case SAMPLE:
TransferSample transferSample = new TransferSample();
transferSample.setItem(sampleService.get(itemId));
transfer.getSampleTransfers().add(transferSample);
break;
case LIBRARY:
TransferLibrary transferLibrary = new TransferLibrary();
transferLibrary.setItem(libraryService.get(itemId));
transfer.getLibraryTransfers().add(transferLibrary);
break;
case LIBRARY_ALIQUOT:
TransferLibraryAliquot transferLibraryAliquot = new TransferLibraryAliquot();
transferLibraryAliquot.setItem(libraryAliquotService.get(itemId));
transfer.getLibraryAliquotTransfers().add(transferLibraryAliquot);
break;
case POOL:
TransferPool transferPool = new TransferPool();
transferPool.setItem(poolService.get(itemId));
transfer.getPoolTransfers().add(transferPool);
break;
default:
throw new IllegalArgumentException("Unexpected boxable type: " + item.getBoxableId().getTargetType());
}
}
}
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibraryAliquot in project miso-lims by miso-lims.
the class DefaultTransferService method loadChildEntities.
@Override
protected void loadChildEntities(Transfer object) throws IOException {
loadChildEntity(object.getSenderGroup(), object::setSenderGroup, groupService);
loadChildEntity(object.getSenderLab(), object::setSenderLab, labService);
loadChildEntity(object.getRecipientGroup(), object::setRecipientGroup, groupService);
for (TransferSample item : object.getSampleTransfers()) {
loadItem(item, item::setItem, sampleService, SampleBoxPosition::new, Sample::setBoxPosition);
}
for (TransferLibrary item : object.getLibraryTransfers()) {
loadItem(item, item::setItem, libraryService, LibraryBoxPosition::new, Library::setBoxPosition);
}
for (TransferLibraryAliquot item : object.getLibraryAliquotTransfers()) {
loadItem(item, item::setItem, libraryAliquotService, LibraryAliquotBoxPosition::new, LibraryAliquot::setBoxPosition);
}
for (TransferPool item : object.getPoolTransfers()) {
loadItem(item, item::setItem, poolService, PoolBoxPosition::new, Pool::setBoxPosition);
}
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibraryAliquot in project miso-lims by miso-lims.
the class TransferController method create.
@PostMapping("/new")
public ModelAndView create(@RequestParam Map<String, String> form, ModelMap model) throws IOException {
String sampleIdString = getStringInput("sampleIds", form, false);
String libraryIdString = getStringInput("libraryIds", form, false);
String libraryAliquotIdString = getStringInput("libraryAliquotIds", form, false);
String poolIdString = getStringInput("poolIds", form, false);
String boxIdString = getStringInput("boxIds", form, false);
Transfer transfer = new Transfer();
addItems("sample", sampleIdString, sampleService, TransferSample::new, transfer::getSampleTransfers);
addItems("library", libraryIdString, libraryService, TransferLibrary::new, transfer::getLibraryTransfers);
addItems("library aliquot", libraryAliquotIdString, libraryAliquotService, TransferLibraryAliquot::new, transfer::getLibraryAliquotTransfers);
addItems("pool", poolIdString, poolService, TransferPool::new, transfer::getPoolTransfers);
addBoxItems(boxIdString, transfer);
model.put("title", "New Transfer");
return setupForm(transfer, PageMode.CREATE, true, false, model);
}
Aggregations