Search in sources :

Example 1 with PoolDto

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);
}
Also used : Dtos(uk.ac.bbsrc.tgac.miso.dto.Dtos) ModelAndView(org.springframework.web.servlet.ModelAndView) NotFoundException(org.springframework.security.acls.model.NotFoundException) PoolDto(uk.ac.bbsrc.tgac.miso.dto.PoolDto) Pool(uk.ac.bbsrc.tgac.miso.core.data.Pool) PoolImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.PoolImpl) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with PoolDto

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);
}
Also used : Consumer(java.util.function.Consumer) List(java.util.List) SequencingOrderCompletionDto(uk.ac.bbsrc.tgac.miso.dto.SequencingOrderCompletionDto) PaginationFilter(uk.ac.bbsrc.tgac.miso.core.util.PaginationFilter) PoolDto(uk.ac.bbsrc.tgac.miso.dto.PoolDto) WhineyFunction(uk.ac.bbsrc.tgac.miso.core.util.WhineyFunction) Map(java.util.Map) IOException(java.io.IOException) PaginatedDataSource(uk.ac.bbsrc.tgac.miso.core.util.PaginatedDataSource) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) SequencingOrderCompletionDto(uk.ac.bbsrc.tgac.miso.dto.SequencingOrderCompletionDto) PoolDto(uk.ac.bbsrc.tgac.miso.dto.PoolDto) List(java.util.List) ArrayList(java.util.ArrayList)

Example 3 with PoolDto

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));
}
Also used : PoolDto(uk.ac.bbsrc.tgac.miso.dto.PoolDto) SequencingOrderCompletionDto(uk.ac.bbsrc.tgac.miso.dto.SequencingOrderCompletionDto) PoolPickerEntry(uk.ac.bbsrc.tgac.miso.webapp.util.PoolPickerResponse.PoolPickerEntry)

Aggregations

PoolDto (uk.ac.bbsrc.tgac.miso.dto.PoolDto)3 SequencingOrderCompletionDto (uk.ac.bbsrc.tgac.miso.dto.SequencingOrderCompletionDto)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Consumer (java.util.function.Consumer)1 Collectors (java.util.stream.Collectors)1 NotFoundException (org.springframework.security.acls.model.NotFoundException)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1 Pool (uk.ac.bbsrc.tgac.miso.core.data.Pool)1 PoolImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.PoolImpl)1 PaginatedDataSource (uk.ac.bbsrc.tgac.miso.core.util.PaginatedDataSource)1 PaginationFilter (uk.ac.bbsrc.tgac.miso.core.util.PaginationFilter)1 WhineyFunction (uk.ac.bbsrc.tgac.miso.core.util.WhineyFunction)1 Dtos (uk.ac.bbsrc.tgac.miso.dto.Dtos)1 PoolPickerEntry (uk.ac.bbsrc.tgac.miso.webapp.util.PoolPickerResponse.PoolPickerEntry)1