use of uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl in project miso-lims by miso-lims.
the class DefaultExperimentServiceTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
Mockito.when(namingSchemeHolder.getPrimary()).thenReturn(namingScheme);
Mockito.when(namingScheme.validateName(Matchers.anyString())).thenReturn(ValidationResult.success());
experiment.setInstrumentModel(new InstrumentModel());
experiment.getInstrumentModel().setId(2L);
experiment.setLibrary(new LibraryImpl());
experiment.getLibrary().setId(3L);
experiment.setStudy(new StudyImpl());
experiment.getStudy().setId(5L);
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl 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.LibraryImpl in project miso-lims by miso-lims.
the class Dtos method to.
public static QC to(@Nonnull QcDto dto) {
QC to;
switch(dto.getQcTarget()) {
case "Library":
LibraryQC newLibraryQc = new LibraryQC();
Library ownerLibrary = new LibraryImpl();
ownerLibrary.setId(dto.getEntityId());
newLibraryQc.setLibrary(ownerLibrary);
to = newLibraryQc;
break;
case "Sample":
SampleQC newSampleQc = new SampleQC();
Sample ownerSample = new SampleImpl();
ownerSample.setId(dto.getEntityId());
newSampleQc.setSample(ownerSample);
to = newSampleQc;
break;
case "Pool":
PoolQC newPoolQc = new PoolQC();
Pool ownerPool = new PoolImpl();
ownerPool.setId(dto.getEntityId());
newPoolQc.setPool(ownerPool);
to = newPoolQc;
break;
case "Container":
ContainerQC newContainerQc = new ContainerQC();
SequencerPartitionContainer ownerContainer = new SequencerPartitionContainerImpl();
ownerContainer.setId(dto.getEntityId());
newContainerQc.setContainer(ownerContainer);
to = newContainerQc;
break;
case "Requisition":
RequisitionQC newRequisitionQc = new RequisitionQC();
Requisition ownerRequisition = new Requisition();
ownerRequisition.setId(dto.getEntityId());
newRequisitionQc.setRequisition(ownerRequisition);
to = newRequisitionQc;
break;
default:
throw new IllegalArgumentException("No such QC target: " + dto.getQcTarget());
}
if (dto.getId() != null) {
to.setId(dto.getId());
}
to.setDate(parseDate(dto.getDate()));
setBigDecimal(to::setResults, dto.getResults());
setObject(to::setType, QcType::new, dto.getQcTypeId());
to.setDescription(dto.getDescription());
setObject(to::setInstrument, InstrumentImpl::new, dto.getInstrumentId());
setObject(to::setKit, KitDescriptor::new, dto.getKitDescriptorId());
setString(to::setKitLot, dto.getKitLot());
addQcControlRuns(dto.getControls(), to, QcTarget.valueOf(dto.getQcTarget()));
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl in project miso-lims by miso-lims.
the class Dtos method to.
public static Workset to(@Nonnull WorksetDto from) {
Workset workset = new Workset();
setLong(workset::setId, from.getId(), false);
setString(workset::setAlias, from.getAlias());
setString(workset::setDescription, from.getDescription());
setObject(workset::setCategory, WorksetCategory::new, from.getCategoryId());
setObject(workset::setStage, WorksetStage::new, from.getStageId());
setWorksetItems(workset::setWorksetSamples, from.getSampleIds(), WorksetSample::new, SampleImpl::new);
setWorksetItems(workset::setWorksetLibraries, from.getLibraryIds(), WorksetLibrary::new, LibraryImpl::new);
setWorksetItems(workset::setWorksetLibraryAliquots, from.getLibraryAliquotIds(), WorksetLibraryAliquot::new, LibraryAliquot::new);
return workset;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl in project miso-lims by miso-lims.
the class HibernateLibraryAliquotDaoIT method testSaveNew.
@Test
public void testSaveNew() throws IOException {
final LibraryAliquot ld = new LibraryAliquot();
final Library lib = new LibraryImpl();
UserImpl user = new UserImpl();
user.setId(1L);
user.setFullName("moi");
lib.setId(1L);
ld.setCreator(user);
ld.setLastModifier(user);
ld.setLibrary(lib);
ld.setConcentration(new BigDecimal("12.5"));
ld.setCreationDate(new Date());
ld.setCreationTime(new Date());
ld.setName("nom de plume");
ld.setAlias("TEST");
Long newId = dao.save(ld);
final LibraryAliquot saved = dao.get(newId);
assertNotNull(saved);
assertEquals(new BigDecimal("12.5"), saved.getConcentration());
}
Aggregations