Source:
public void confirmPendingTransactions(final SearchCompositeDto searchCompositeDto) { final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), TransactionService.class.getName()); try{ lock.lock(); if (searchCompositeDto.getSearchRequestId() == null && (searchCompositeDto.getItemIds() == null || searchCompositeDto .getItemIds().isEmpty()) || (searchCompositeDto.getSearchRequestId() != null && searchCompositeDto.getItemIds() != null)) { errors.reject("transaction.selection.invalid", ""); throw new ApiRequestValidationException(errors.getAllErrors()); } TransactionsSearchDto transactionsSearchDto; if (searchCompositeDto.getSearchRequestId() != null) { transactionsSearchDto = (TransactionsSearchDto) this.searchRequestService .getSearchRequest(searchCompositeDto.getSearchRequestId(), TransactionsSearchDto.class); } else { transactionsSearchDto = new TransactionsSearchDto(); transactionsSearchDto.setTransactionIds(new ArrayList<>(searchCompositeDto.getItemIds())); } final List<TransactionDto> transactionDtos = this.transactionService.searchTransactions(transactionsSearchDto, null); final Set<ExtendedLotDto> lotDtos = transactionDtos.stream().map(TransactionDto::getLot).collect( Collectors.toSet()); transactionInputValidator.validateAllProvidedTransactionsExists(transactionDtos, searchCompositeDto.getItemIds()); transactionInputValidator.validateEmptyList(transactionDtos); transactionInputValidator.validatePendingStatus(transactionDtos); extendedLotListValidator.validateClosedLots(lotDtos.stream().collect(Collectors.toList())); this.transactionService.confirmPendingTransactions(transactionDtos); } finally { lock.unlock(); } }

Target:
public void confirmPendingTransactions(final SearchCompositeDto searchCompositeDto) { final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), TransactionService.class.getName()); try{ lock.lock(); if (searchCompositeDto.getSearchRequestId() == null && (searchCompositeDto.getItemIds() == null || searchCompositeDto .getItemIds().isEmpty()) || (searchCompositeDto.getSearchRequestId() != null && searchCompositeDto.getItemIds() != null)) { errors.reject("transaction.selection.invalid", ""); throw new ApiRequestValidationException(errors.getAllErrors()); } TransactionsSearchDto transactionsSearchDto; if (searchCompositeDto.getSearchRequestId() != null) { transactionsSearchDto = (TransactionsSearchDto) this.searchRequestService .getSearchRequest(searchCompositeDto.getSearchRequestId(), TransactionsSearchDto.class); } else { transactionsSearchDto = new TransactionsSearchDto(); transactionsSearchDto.setTransactionIds(new ArrayList<>(searchCompositeDto.getItemIds())); } final List<TransactionDto> transactionDtos = this.transactionService.searchTransactions(transactionsSearchDto, null); final Set<ExtendedLotDto> lotDtos = transactionDtos.stream().map(TransactionDto::getLot).collect( Collectors.toSet()); transactionInputValidator.validateEmptyList(transactionDtos); transactionInputValidator.validateAllProvidedTransactionsExists(transactionDtos, searchCompositeDto.getItemIds()); transactionInputValidator.validatePendingStatus(transactionDtos); extendedLotListValidator.validateClosedLots(lotDtos.stream().collect(Collectors.toList())); this.transactionService.confirmPendingTransactions(transactionDtos); } finally { lock.unlock(); } }