use of uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot in project miso-lims by miso-lims.
the class HibernateRunPartitionAliquotDaoIT method testCreate.
@Test
public void testCreate() throws Exception {
Run run = (Run) currentSession().get(Run.class, 1L);
Partition partition = (Partition) currentSession().get(PartitionImpl.class, 2L);
LibraryAliquot aliquot = (LibraryAliquot) currentSession().get(LibraryAliquot.class, 3L);
RunPartitionAliquotId id = new RunPartitionAliquotId(run, partition, aliquot);
assertNull(currentSession().get(RunPartitionAliquot.class, id));
RunPartitionAliquot rpa = new RunPartitionAliquot(run, partition, aliquot);
User user = (User) currentSession().get(UserImpl.class, 1L);
rpa.setLastModifier(user);
RunLibraryQcStatus qc = (RunLibraryQcStatus) currentSession().get(RunLibraryQcStatus.class, 1L);
rpa.setQcStatus(qc);
rpa.setQcUser(user);
rpa.setQcDate(new Date());
sut.create(rpa);
clearSession();
RunPartitionAliquot saved = (RunPartitionAliquot) currentSession().get(RunPartitionAliquot.class, id);
assertNotNull(saved);
assertEquals(1L, saved.getRun().getId());
assertEquals(2L, saved.getPartition().getId());
assertEquals(3L, saved.getAliquot().getId());
}
use of uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot 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.RunPartitionAliquot in project miso-lims by miso-lims.
the class RunRestController method getSpreadsheet.
@PostMapping(value = "/spreadsheet")
@ResponseBody
public HttpEntity<byte[]> getSpreadsheet(@RequestBody SpreadsheetRequest request, HttpServletResponse response, UriComponentsBuilder uriBuilder) throws IOException {
// Note: not retrieving persisted run-libraries, so QC data will be missing
List<Run> runs = runService.listByIdList(request.getIds());
List<RunPartitionAliquot> runLibraries = new ArrayList<>();
for (Run run : runs) {
for (RunPosition runPosition : run.getRunPositions()) {
for (Partition partition : runPosition.getContainer().getPartitions()) {
if (partition.getPool() != null) {
for (PoolElement element : partition.getPool().getPoolContents()) {
LibraryAliquot aliquot = libraryAliquotService.get(element.getAliquot().getId());
runLibraries.add(new RunPartitionAliquot(run, partition, aliquot));
}
}
}
}
}
return MisoWebUtils.generateSpreadsheet(request, runLibraries.stream(), detailedSample, RunLibrarySpreadsheets::valueOf, response);
}
use of uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot in project miso-lims by miso-lims.
the class EditRunController method getRunAliquots.
private List<RunPartitionAliquotDto> getRunAliquots(Run run) throws IOException {
List<RunPartitionAliquot> runPartitionAliquots = runPartitionAliquotService.listByRunId(run.getId());
List<RunPartitionAliquotDto> dtos = new ArrayList<>();
for (int i = 0; i < runPartitionAliquots.size(); i++) {
RunPartitionAliquotDto dto = Dtos.asDto(runPartitionAliquots.get(i));
// Add id for DataTables
dto.setId(Long.valueOf(i));
dtos.add(dto);
}
return dtos;
}
use of uk.ac.bbsrc.tgac.miso.core.data.RunPartitionAliquot in project miso-lims by miso-lims.
the class HibernateRunPartitionAliquotDaoIT method testSaveCreate.
@Test
public void testSaveCreate() throws Exception {
Run run = (Run) currentSession().get(Run.class, 1L);
Partition partition = (Partition) currentSession().get(PartitionImpl.class, 2L);
LibraryAliquot aliquot = (LibraryAliquot) currentSession().get(LibraryAliquot.class, 3L);
RunPartitionAliquotId id = new RunPartitionAliquotId(run, partition, aliquot);
assertNull(currentSession().get(RunPartitionAliquot.class, id));
RunPartitionAliquot rpa = new RunPartitionAliquot(run, partition, aliquot);
User user = (User) currentSession().get(UserImpl.class, 1L);
rpa.setLastModifier(user);
RunLibraryQcStatus qc = (RunLibraryQcStatus) currentSession().get(RunLibraryQcStatus.class, 1L);
rpa.setQcStatus(qc);
rpa.setQcUser(user);
rpa.setQcDate(new Date());
sut.save(rpa);
clearSession();
RunPartitionAliquot saved = (RunPartitionAliquot) currentSession().get(RunPartitionAliquot.class, id);
assertNotNull(saved);
assertEquals(1L, saved.getRun().getId());
assertEquals(2L, saved.getPartition().getId());
assertEquals(3L, saved.getAliquot().getId());
}
Aggregations