use of uk.ac.bbsrc.tgac.miso.core.data.impl.RunPurpose in project miso-lims by miso-lims.
the class Dtos method to.
public static RunPurpose to(@Nonnull RunPurposeDto from) {
RunPurpose to = new RunPurpose();
setLong(to::setId, from.getId(), false);
setString(to::setAlias, from.getAlias());
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.RunPurpose in project miso-lims by miso-lims.
the class Dtos method to.
public static SequencingOrder to(@Nonnull SequencingOrderDto from) {
SequencingOrder to = new SequencingOrderImpl();
if (from.getId() != null)
to.setId(from.getId());
to.setPool(to(from.getPool()));
setObject(to::setContainerModel, SequencingContainerModel::new, from.getContainerModelId());
to.setSequencingParameters(to(from.getParameters()));
to.setPartitions(from.getPartitions());
to.setDescription(from.getDescription());
setObject(to::setPurpose, RunPurpose::new, from.getPurposeId());
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.RunPurpose in project miso-lims by miso-lims.
the class Dtos method to.
public static PoolOrder to(@Nonnull PoolOrderDto from) {
PoolOrder to = new PoolOrder();
setLong(to::setId, from.getId(), false);
setString(to::setAlias, from.getAlias());
setString(to::setDescription, from.getDescription());
setObject(to::setPurpose, RunPurpose::new, from.getPurposeId());
setInteger(to::setPartitions, from.getPartitions(), true);
setObject(to::setContainerModel, SequencingContainerModel::new, from.getContainerModelId());
setObject(to::setParameters, SequencingParameters::new, from.getParametersId());
setBoolean(to::setDraft, from.isDraft(), false);
if (from.getOrderAliquots() != null) {
to.setOrderLibraryAliquots(from.getOrderAliquots().stream().map(libDto -> {
OrderLibraryAliquot lib = Dtos.to(libDto);
lib.setPoolOrder(to);
return lib;
}).collect(Collectors.toSet()));
}
setObject(to::setPool, PoolImpl::new, from.getPoolId());
setObject(to::setSequencingOrder, SequencingOrderImpl::new, from.getSequencingOrderId());
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.RunPurpose in project miso-lims by miso-lims.
the class HibernateRunPartitionAliquotDaoIT method testSaveUpdate.
@Test
public void testSaveUpdate() throws Exception {
Run run = (Run) currentSession().get(Run.class, 1L);
Partition partition = (Partition) currentSession().get(PartitionImpl.class, 1L);
LibraryAliquot aliquot = (LibraryAliquot) currentSession().get(LibraryAliquot.class, 1L);
RunPartitionAliquotId id = new RunPartitionAliquotId(run, partition, aliquot);
RunPartitionAliquot existing = (RunPartitionAliquot) currentSession().get(RunPartitionAliquot.class, id);
assertNotNull(existing);
assertNull(existing.getPurpose());
RunPurpose purpose = (RunPurpose) currentSession().get(RunPurpose.class, 1L);
assertNull(existing.getPurpose());
existing.setPurpose(purpose);
sut.save(existing);
clearSession();
RunPartitionAliquot saved = (RunPartitionAliquot) currentSession().get(RunPartitionAliquot.class, id);
assertNotNull(saved.getPurpose());
assertEquals(purpose.getId(), saved.getPurpose().getId());
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.RunPurpose in project miso-lims by miso-lims.
the class HibernateRunPartitionDaoIT method testCreate.
@Test
public void testCreate() throws Exception {
long runId = 2L;
long partitionId = 2L;
PartitionQCType type = (PartitionQCType) currentSession().get(PartitionQCType.class, 1L);
RunPurpose purpose = (RunPurpose) currentSession().get(RunPurpose.class, 1L);
RunPartition qc = new RunPartition();
User user = (User) currentSession().get(UserImpl.class, 1L);
qc.setRunId(runId);
qc.setPartitionId(partitionId);
qc.setQcType(type);
qc.setPurpose(purpose);
qc.setLastModifier(user);
dao.create(qc);
RunPartition fetchedQc = dao.get(runId, partitionId);
assertNotNull(fetchedQc);
assertEquals(qc.getQcType().getId(), fetchedQc.getQcType().getId());
assertEquals(qc.getNotes(), fetchedQc.getNotes());
}
Aggregations