Source:
public ResponseEntity<Void> updateLots( @PathVariable final String cropName, @ApiParam("Request with fields to update and criteria to update") @RequestBody final LotUpdateRequestDto lotRequest) { final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), Integer.class.getName()); List<ExtendedLotDto> extendedLotDtos = null; if ((lotRequest.getSingleInput() == null && lotRequest.getMultiInput() == null) || (lotRequest.getSingleInput() != null && lotRequest.getMultiInput() != null)) { errors.reject("lot.update.invalid.input", ""); throw new ApiRequestValidationException(errors.getAllErrors()); } if (lotRequest.getSingleInput() != null) { this.inventoryCommonValidator.validateSearchCompositeDto(lotRequest.getSingleInput().getSearchComposite(), errors); final LotsSearchDto searchDTO = this.searchRequestDtoResolver.getLotsSearchDto(lotRequest.getSingleInput().getSearchComposite()); extendedLotDtos = this.lotService.searchLots(searchDTO, null); if (lotRequest.getSingleInput().getSearchComposite().getSearchRequest() == null) { this.extendedLotListValidator .validateAllProvidedLotUUIDsExist(extendedLotDtos, lotRequest.getSingleInput().getSearchComposite().getItemIds()); } } else { final List<String> lotUIDs = lotRequest.getMultiInput().getLotList().stream().map(LotUpdateDto::getLotUID).collect(Collectors.toList()); final LotsSearchDto lotsSearchDto = new LotsSearchDto(); lotsSearchDto.setLotUUIDs(lotUIDs); extendedLotDtos = this.lotService.searchLots(lotsSearchDto, null); this.extendedLotListValidator.validateAllProvidedLotUUIDsExist(extendedLotDtos, Sets.newHashSet(lotUIDs)); } try { inventoryLock.lockWrite(); this.lotService.updateLots(extendedLotDtos, lotRequest); } finally { inventoryLock.unlockWrite(); } return new ResponseEntity<>(HttpStatus.NO_CONTENT); }

Target:
public ResponseEntity<Void> updateLots( @PathVariable final String cropName, @ApiParam("Request with fields to update and criteria to update") @RequestBody final LotUpdateRequestDto lotRequest) { final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), Integer.class.getName()); List<ExtendedLotDto> extendedLotDtos = null; if ((lotRequest.getSingleInput() == null && lotRequest.getMultiInput() == null) || (lotRequest.getSingleInput() != null && lotRequest.getMultiInput() != null)) { errors.reject("lot.update.invalid.input", ""); throw new ApiRequestValidationException(errors.getAllErrors()); } if (lotRequest.getSingleInput() != null) { this.inventoryCommonValidator.validateSearchCompositeDto(lotRequest.getSingleInput().getSearchComposite(), errors); final LotsSearchDto searchDTO = this.searchRequestDtoResolver.getLotsSearchDto(lotRequest.getSingleInput().getSearchComposite()); extendedLotDtos = this.lotService.searchLots(searchDTO, null); if (lotRequest.getSingleInput().getSearchComposite().getSearchRequest() == null) { this.extendedLotListValidator .validateAllProvidedLotUUIDsExist(extendedLotDtos, lotRequest.getSingleInput().getSearchComposite().getItemIds()); } } else { final List<String> lotUIDs = lotRequest.getMultiInput().getLotList().stream().map(LotMultiUpdateRequestDto.LotUpdateDto::getLotUID).collect(Collectors.toList()); final LotsSearchDto lotsSearchDto = new LotsSearchDto(); lotsSearchDto.setLotUUIDs(lotUIDs); extendedLotDtos = this.lotService.searchLots(lotsSearchDto, null); this.extendedLotListValidator.validateAllProvidedLotUUIDsExist(extendedLotDtos, Sets.newHashSet(lotUIDs)); this.extendedLotListValidator.validateLotUUIDsDuplicated(extendedLotDtos, lotUIDs); } try { inventoryLock.lockWrite(); this.lotService.updateLots(extendedLotDtos, lotRequest); } finally { inventoryLock.unlockWrite(); } return new ResponseEntity<>(HttpStatus.NO_CONTENT); }