use of uk.ac.bbsrc.tgac.miso.core.data.impl.LabImpl 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.LabImpl in project miso-lims by miso-lims.
the class Dtos method toReceiptTransfer.
private static <T extends Boxable, R extends TransferItem<T>> R toReceiptTransfer(@Nonnull ReceivableDto<T, R> from, @Nonnull T item) {
if (isStringEmptyOrNull(from.getReceivedTime())) {
return null;
}
R transferItem = from.makeTransferItem();
transferItem.setItem(item);
setBoolean(transferItem::setReceived, from.isReceived(), true);
setBoolean(transferItem::setQcPassed, from.isReceiptQcPassed(), true);
setString(transferItem::setQcNote, from.getReceiptQcNote());
Transfer transfer = new Transfer();
transferItem.setTransfer(transfer);
from.getTransferItemsFunction().apply(transfer).add(transferItem);
setDateTime(transfer::setTransferTime, from.getReceivedTime());
setObject(transfer::setSenderLab, LabImpl::new, from.getSenderLabId());
setObject(transfer::setRecipientGroup, Group::new, from.getRecipientGroupId());
return transferItem;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.LabImpl in project miso-lims by miso-lims.
the class Dtos method to.
public static Lab to(@Nonnull LabDto from) {
Lab to = new LabImpl();
setLong(to::setId, from.getId(), false);
setString(to::setAlias, from.getAlias());
setBoolean(to::setArchived, from.getArchived(), false);
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.LabImpl in project miso-lims by miso-lims.
the class HibernateLabDaoIT method testAddLab.
@Test
public void testAddLab() {
Lab l = new LabImpl();
l.setAlias("NewLab");
User user = new UserImpl();
user.setId(1L);
l.setCreator(user);
l.setLastModifier(user);
Date now = new Date();
l.setCreationTime(now);
l.setLastModified(now);
final long newId = dao.create(l);
Lab saved = dao.get(newId);
assertNotNull(saved);
assertEquals(l.getAlias(), saved.getAlias());
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.LabImpl in project miso-lims by miso-lims.
the class Dtos method toTissueSample.
private static SampleTissue toTissueSample(@Nonnull SampleTissueDto from) {
SampleTissue to = new SampleTissueImpl();
to.setPassageNumber(from.getPassageNumber());
to.setTimesReceived(from.getTimesReceived());
to.setTubeNumber(from.getTubeNumber());
to.setRegion(nullifyStringIfBlank(from.getRegion()));
to.setSecondaryIdentifier(from.getSecondaryIdentifier());
if (from.getTissueOriginId() != null) {
TissueOrigin tissueOrigin = new TissueOriginImpl();
tissueOrigin.setId(from.getTissueOriginId());
to.setTissueOrigin(tissueOrigin);
}
if (from.getTissueTypeId() != null) {
TissueType tissueType = new TissueTypeImpl();
tissueType.setId(from.getTissueTypeId());
to.setTissueType(tissueType);
}
if (from.getTissueMaterialId() != null) {
TissueMaterial tissueMaterial = new TissueMaterialImpl();
tissueMaterial.setId(from.getTissueMaterialId());
to.setTissueMaterial(tissueMaterial);
}
if (from.getLabId() != null) {
Lab lab = new LabImpl();
lab.setId(from.getLabId());
to.setLab(lab);
}
setString(to::setTimepoint, from.getTimepoint());
return to;
}
Aggregations