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 Instrument to(@Nonnull InstrumentDto dto) {
Instrument to = new InstrumentImpl();
setLong(to::setId, dto.getId(), false);
setDate(to::setDateCommissioned, dto.getDateCommissioned());
setDate(to::setDateDecommissioned, dto.getDateDecommissioned());
setString(to::setName, dto.getName());
setObject(to::setInstrumentModel, InstrumentModel::new, dto.getInstrumentModelId());
setString(to::setSerialNumber, dto.getSerialNumber());
setObject(to::setUpgradedInstrument, InstrumentImpl::new, dto.getUpgradedInstrumentId());
setObject(to::setDefaultRunPurpose, RunPurpose::new, dto.getDefaultRunPurposeId());
setString(to::setIdentificationBarcode, dto.getIdentificationBarcode());
setObject(to::setWorkstation, Workstation::new, dto.getWorkstationId());
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 RunPartitionAliquot to(@Nonnull RunPartitionAliquotDto from) {
RunPartitionAliquot to = new RunPartitionAliquot();
PlatformType platform = PlatformType.valueOf(from.getPlatformType());
setObject(to::setRun, platform::createRun, from.getRunId());
setObject(to::setPartition, PartitionImpl::new, from.getPartitionId());
setObject(to::setAliquot, LibraryAliquot::new, from.getAliquotId());
setObject(to::setPurpose, RunPurpose::new, from.getRunPurposeId());
setObject(to::setQcStatus, RunLibraryQcStatus::new, from.getQcStatusId());
setString(to::setQcNote, from.getQcNote());
setBoolean(to::setDataReview, from.getDataReview(), true);
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.RunPurpose in project miso-lims by miso-lims.
the class RunRestController method setPartitionPurposes.
@PutMapping("/{runId}/partition-purposes")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void setPartitionPurposes(@PathVariable long runId, @RequestBody RunPartitionPurposeRequest request) throws IOException {
Run run = RestUtils.retrieve("Run", runId, runService);
RunPurpose purpose = RestUtils.retrieve("Run purpose", request.getRunPurposeId(), runPurposeService);
List<Partition> partitions = run.getSequencerPartitionContainers().stream().flatMap(container -> container.getPartitions().stream()).filter(partition -> request.getPartitionIds().contains(partition.getId())).collect(Collectors.toList());
for (Partition partition : partitions) {
RunPartition runPartition = runPartitionService.get(run, partition);
if (runPartition == null) {
runPartition = new RunPartition();
runPartition.setRunId(run.getId());
runPartition.setPartitionId(partition.getId());
}
runPartition.setPurpose(purpose);
runPartitionService.save(runPartition);
}
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.RunPurpose in project miso-lims by miso-lims.
the class HibernateRunPurposeDaoIT method getCreateItem.
@Override
public RunPurpose getCreateItem() {
RunPurpose purpose = new RunPurpose();
purpose.setAlias("New Purpose");
return purpose;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.RunPurpose in project miso-lims by miso-lims.
the class HibernatePoolOrderDaoIT method testCreate.
@Test
public void testCreate() throws IOException {
String alias = "New Category";
PoolOrder order = new PoolOrder();
order.setAlias(alias);
Date now = new Date();
order.setCreationTime(now);
order.setLastModified(now);
User user = (User) currentSession().get(UserImpl.class, 1L);
order.setCreator(user);
order.setLastModifier(user);
RunPurpose purpose = (RunPurpose) currentSession().get(RunPurpose.class, 1L);
order.setPurpose(purpose);
long savedId = sut.create(order);
clearSession();
PoolOrder saved = (PoolOrder) getSessionFactory().getCurrentSession().get(PoolOrder.class, savedId);
assertEquals(alias, saved.getAlias());
}
Aggregations