Source:
<code>public ModelAndView setupForm(@PathVariable Long poolId, ModelMap model) throws IOException { Pool pool = null; if (poolId == PoolImpl.UNSAVED_ID) { 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()); <START> PoolDto poolDto = Dtos.asDto(pool, true, false, errorEditDistance, warningEditDistance); <END> ObjectMapper mapper = new ObjectMapper(); model.put("pool", pool); model.put("poolDto", poolId == PoolImpl.UNSAVED_ID ? "{}" : mapper.writeValueAsString(poolDto)); model.put("partitions", containerService.listPartitionsByPoolId(poolId).stream() .map(partition -> Dtos.asDto(partition, errorEditDistance, warningEditDistance)).collect(Collectors.toList())); model.put("runs", poolId == PoolImpl.UNSAVED_ID ? Collections.emptyList() : Dtos.asRunDtos(runService.listByPoolId(poolId))); model.put("orders", poolId == PoolImpl.UNSAVED_ID ? Collections.emptyList() : Dtos.asSequencingOrderDtos(sequencingOrderService.getByPool(pool), errorEditDistance, warningEditDistance)); model.put("duplicateIndicesSequences", mapper.writeValueAsString(poolDto.getDuplicateIndicesSequences())); model.put("nearDuplicateIndicesSequences", mapper.writeValueAsString(poolDto.getNearDuplicateIndicesSequences())); model.put("includedLibraryAliquots", Dtos.asDto(pool, true, false, errorEditDistance, warningEditDistance).getPooledElements()); return new ModelAndView("/WEB-INF/pages/editPool.jsp", model); }</code><technical_language>original call this unsaved. matters way... assuming checked behaviour</technical_language>

Target:
public ModelAndView setupForm(@PathVariable Long poolId, ModelMap model) throws IOException { Pool pool = null; if (poolId == PoolImpl.UNSAVED_ID) { 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); model.put("poolDto", poolId == PoolImpl.UNSAVED_ID ? "{}" : mapper.writeValueAsString(poolDto)); Collection<Partition> partitions = containerService.listPartitionsByPoolId(poolId); model.put("partitions", partitions.stream() .map(partition -> Dtos.asDto(partition, indexChecker)).collect(Collectors.toList())); model.put("runs", poolId == PoolImpl.UNSAVED_ID ? Collections.emptyList() : Dtos.asRunDtos(runService.listByPoolId(poolId))); if (poolId == PoolImpl.UNSAVED_ID) { model.put("orders", Collections.emptyList()); } else { Collection<SequencingOrder> sequencingOrders = sequencingOrderService.getByPool(pool); model.put("orders", Dtos.asSequencingOrderDtos(sequencingOrders, indexChecker)); } model.put("duplicateIndicesSequences", mapper.writeValueAsString(poolDto.getDuplicateIndicesSequences())); model.put("nearDuplicateIndicesSequences", mapper.writeValueAsString(poolDto.getNearDuplicateIndicesSequences())); model.put("includedLibraryAliquots", Dtos.asDto(pool, true, false, indexChecker).getPooledElements()); return new ModelAndView("/WEB-INF/pages/editPool.jsp", model); }