Source:
public List<ImportedCrosses> generateCrossesList(final List<ImportedCrosses> importedCrosses, final AdvancingSourceList rows, final AdvancingNursery advancingParameters, final Workbook workbook, final List<Integer> gids) throws RuleException { final List<Method> methodList = this.fieldbookMiddlewareService.getAllBreedingMethods(false); final Map<Integer, Method> breedingMethodMap = new HashMap<>(); for (final Method method : methodList) { breedingMethodMap.put(method.getMid(), method); } int index = 0; final TimerWatch timer = new TimerWatch("cross"); int previousMaxSequence = 0; for (final AdvancingSource advancingSource : rows.getRows()) { final List<String> names; advancingSource.setCurrentMaxSequence(previousMaxSequence); final Integer breedingMethodId = advancingSource.getBreedingMethodId(); final Method selectedMethod = breedingMethodMap.get(breedingMethodId); if (!this.germplasmDataManager.isMethodNamingConfigurationValid(breedingMethodId)) { throw new RulesNotConfiguredException(this.messageSource.getMessage("error.save.cross.rule.not.configured", new Object[] {selectedMethod.getMname()}, "The rules" + " were not configured", LocaleContextHolder.getLocale())); } advancingSource.setBreedingMethod(selectedMethod); advancingSource.setPlantsSelected(1); final RuleExecutionContext namingExecutionContext = this.setupNamingRuleExecutionContext(advancingSource, advancingParameters.isCheckAdvanceLinesUnique()); names = (List<String>) this.rulesService.runRules(namingExecutionContext); previousMaxSequence = advancingSource.getCurrentMaxSequence() + 1; for (final String name : names) { importedCrosses.get(index++).setDesig(name); } } timer.stop(); return importedCrosses; }

Target:
public List<ImportedCrosses> generateCrossesList(final List<ImportedCrosses> importedCrosses, final AdvancingSourceList rows, final AdvancingNursery advancingParameters, final Workbook workbook, final List<Integer> gids) throws RuleException { final List<Method> methodList = this.fieldbookMiddlewareService.getAllBreedingMethods(false); final Map<Integer, Method> breedingMethodMap = new HashMap<>(); for (final Method method : methodList) { breedingMethodMap.put(method.getMid(), method); } int index = 0; final TimerWatch timer = new TimerWatch("cross"); int previousMaxSequence = 0; for (final AdvancingSource advancingSource : rows.getRows()) { final List<String> names; advancingSource.setCurrentMaxSequence(previousMaxSequence); final Integer breedingMethodId = advancingSource.getBreedingMethodId(); final Method selectedMethod = breedingMethodMap.get(breedingMethodId); if (!this.germplasmDataManager.isMethodNamingConfigurationValid(selectedMethod)) { throw new RulesNotConfiguredException(this.messageSource.getMessage("error.save.cross.rule.not.configured", new Object[] {selectedMethod.getMname()}, "The rules" + " were not configured", LocaleContextHolder.getLocale())); } advancingSource.setBreedingMethod(selectedMethod); advancingSource.setPlantsSelected(1); final RuleExecutionContext namingExecutionContext = this.setupNamingRuleExecutionContext(advancingSource, advancingParameters.isCheckAdvanceLinesUnique()); names = (List<String>) this.rulesService.runRules(namingExecutionContext); previousMaxSequence = advancingSource.getCurrentMaxSequence() + 1; for (final String name : names) { importedCrosses.get(index++).setDesig(name); } } timer.stop(); return importedCrosses; }