use of uk.ac.bbsrc.tgac.miso.dto.PoolDto in project miso-lims by miso-lims.
the class EditPoolController method setupForm.
@GetMapping(value = "/{poolId}")
public ModelAndView setupForm(@PathVariable Long poolId, ModelMap model) throws IOException {
Pool pool = null;
if (poolId == null) {
pool = new PoolImpl();
model.put("title", "New Pool");
} else {
pool = poolService.get(poolId);
model.put("title", "Pool " + poolId);
}
if (pool == null)
throw new NotFoundException("No pool found for ID " + poolId.toString());
PoolDto poolDto = Dtos.asDto(pool, true, false, indexChecker);
ObjectMapper mapper = new ObjectMapper();
model.put("pool", pool);
if (poolId == null) {
model.put("partitions", Collections.emptyList());
model.put("poolDto", "{}");
model.put("runs", Collections.emptyList());
model.put("orders", Collections.emptyList());
} else {
model.put("partitions", containerService.listPartitionsByPoolId(poolId).stream().map(partition -> Dtos.asDto(partition, indexChecker)).collect(Collectors.toList()));
model.put("poolDto", mapper.writeValueAsString(poolDto));
model.put("runs", Dtos.asRunDtos(runService.listByPoolId(poolId)));
model.put("orders", Dtos.asSequencingOrderDtos(sequencingOrderService.getByPool(pool), indexChecker));
}
model.put("poolorders", poolOrderService.getAllByPoolId(pool.getId()).stream().map(order -> Dtos.asDto(order)).collect(Collectors.toList()));
model.put("duplicateIndicesSequences", mapper.writeValueAsString(poolDto.getDuplicateIndicesSequences()));
model.put("nearDuplicateIndicesSequences", mapper.writeValueAsString(poolDto.getNearDuplicateIndicesSequences()));
model.put("poolTransfers", pool.getTransferViews().stream().map(Dtos::asDto).collect(Collectors.toList()));
return new ModelAndView("/WEB-INF/pages/editPool.jsp", model);
}
use of uk.ac.bbsrc.tgac.miso.dto.PoolDto in project miso-lims by miso-lims.
the class PoolPickerResponse method populate.
public <T> void populate(PaginatedDataSource<T> source, boolean sortOrder, String sortColumn, Integer limit, WhineyFunction<T, PoolPickerEntry> transform, PaginationFilter... filters) throws IOException {
Consumer<String> errorHandler = message -> errors.add(message);
Map<Long, List<PoolPickerEntry>> groupedByPool = source.list(errorHandler, 0, limit, sortOrder, sortColumn, filters).stream().map(WhineyFunction.rethrow(transform)).collect(Collectors.groupingBy(entry -> entry.getPool().getId()));
items = groupedByPool.values().stream().map(listOfPicks -> {
List<SequencingOrderCompletionDto> completionsByPool = listOfPicks.stream().flatMap(pick -> pick.getOrders().stream()).collect(Collectors.toList());
PoolDto pool = listOfPicks.get(0).getPool();
return new PoolPickerEntry(pool, completionsByPool);
}).collect(Collectors.toList());
numMatches = source.count(filters);
}
use of uk.ac.bbsrc.tgac.miso.dto.PoolDto in project miso-lims by miso-lims.
the class SequencingOrderRestController method orderTransform.
private PoolPickerEntry orderTransform(SequencingOrderSummaryView order) {
PoolDto poolDto = Dtos.asDto(order.getPool(), indexChecker);
SequencingOrderCompletionDto socDto = Dtos.asDto(order, indexChecker);
return new PoolPickerEntry(poolDto, Collections.singletonList(socDto));
}
Aggregations