use of uk.ac.bbsrc.tgac.miso.core.service.RunPurposeService 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.service.RunPurposeService in project miso-lims by miso-lims.
the class SequencingOrderRestController method search.
@GetMapping(value = "/sequencingorders/search")
@ResponseBody
public List<SequencingOrderDto> search(@RequestParam long poolId, @RequestParam long purposeId, @RequestParam(required = false) Long containerModelId, @RequestParam long parametersId, @RequestParam int partitions) throws IOException {
Pool pool = getOrThrow(poolService, poolId, "Pool");
RunPurpose purpose = getOrThrow(runPurposeService, purposeId, "Run purpose");
SequencingContainerModel containerModel = containerModelId == null ? null : getOrThrow(containerModelService, containerModelId, "Container model");
SequencingParameters parameters = getOrThrow(sequencingParametersService, parametersId, "Sequencing parameters");
List<SequencingOrder> results = sequencingOrderService.listByAttributes(pool, purpose, containerModel, parameters, partitions);
return results.stream().map(so -> Dtos.asDto(so, indexChecker)).collect(Collectors.toList());
}
Aggregations