Source:
private void updateRun(Run from, Run to) throws IOException { log.debug("Updating run " + to.getId()); to.setCompletionDate(to.getCompletionDate()); to.setHealth(to.getHealth()); if (to.getSequencerPartitionContainers().size() != 1) { throw new IOException(String.format("Existing run %s has unexpected number of sequencerPartitionContainers (%d)", to.getAlias(), to.getSequencerPartitionContainers().size())); } if (from.getSequencerPartitionContainers().size() != 1) { throw new IOException(String.format("Migrating run %s has unexpected number of sequencerPartitionContainers (%d)", from.getAlias(), from.getSequencerPartitionContainers().size())); } SequencerPartitionContainer fromFlowcell = from.getSequencerPartitionContainers().get(0); SequencerPartitionContainer toFlowcell = to.getSequencerPartitionContainers().get(0); for (Partition fromPartition : fromFlowcell.getPartitions()) { if (fromPartition.getPool() != null) { boolean saved = false; for (Partition toPartition : toFlowcell.getPartitions()) { if (toPartition.getPartitionNumber().equals(fromPartition.getPartitionNumber())) { if (toPartition.getPool() != null) { if (!mergeRunPools) throw new IOException("A pool already exists for lane " + toPartition.getPartitionNumber()); } else { toPartition.setPool(fromPartition.getPool()); setPoolModifiedDetails(fromPartition.getPool()); log.debug( "added " + toPartition.getPool().getAlias() + " to run " + to.getId() + " lane " + toPartition.getPartitionNumber()); } saved = true; break; } } if (!saved) throw new IndexOutOfBoundsException(String.format("Partition %d not found in run %s", fromPartition.getPartitionNumber(), to.getAlias())); } } }

Target:
private void updateRun(Run from, Run to) throws IOException { log.debug("Updating run " + to.getId()); to.setCompletionDate(from.getCompletionDate()); to.setHealth(from.getHealth()); if (to.getSequencerPartitionContainers().size() != 1) { throw new IOException(String.format("Existing run %s has unexpected number of sequencerPartitionContainers (%d)", to.getAlias(), to.getSequencerPartitionContainers().size())); } if (from.getSequencerPartitionContainers().size() != 1) { throw new IOException(String.format("Migrating run %s has unexpected number of sequencerPartitionContainers (%d)", from.getAlias(), from.getSequencerPartitionContainers().size())); } SequencerPartitionContainer fromFlowcell = from.getSequencerPartitionContainers().get(0); SequencerPartitionContainer toFlowcell = to.getSequencerPartitionContainers().get(0); for (Partition fromPartition : fromFlowcell.getPartitions()) { if (fromPartition.getPool() != null) { boolean saved = false; for (Partition toPartition : toFlowcell.getPartitions()) { if (toPartition.getPartitionNumber().equals(fromPartition.getPartitionNumber())) { if (toPartition.getPool() != null) { if (!mergeRunPools) throw new IOException("A pool already exists for lane " + toPartition.getPartitionNumber()); } else { toPartition.setPool(fromPartition.getPool()); setPoolModifiedDetails(fromPartition.getPool()); log.debug( "added " + toPartition.getPool().getAlias() + " to run " + to.getId() + " lane " + toPartition.getPartitionNumber()); } saved = true; break; } } if (!saved) throw new IndexOutOfBoundsException(String.format("Partition %d not found in run %s", fromPartition.getPartitionNumber(), to.getAlias())); } } }