Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @GetMapping("campaign/{campaignId}/poll")
- public ResponseEntity<IvoiceApiResponse<List<IncomingCallTaskDto>>>
- findNew(@PathVariable("campaignId") String campaignId,
- @RequestParam(value = "lastTaskId", required = false) String lastTaskId) {
- List<CallTask> newTasks;
- if (Optional.ofNullable(lastTaskId).isPresent()) {
- log.info(format("Requesting call tasks performed after task with id: %s, for campaign: %s", lastTaskId, campaignId));
- newTasks = incomingCallTaskService.findNew(campaignId, lastTaskId);
- } else {
- log.info(format("Requesting call tasks performed for campaign: %s", campaignId));
- newTasks = incomingCallTaskService.findNew(campaignId);
- }
- List<IncomingCallTaskDto> dtos = newTasks.stream()
- .filter((newTask) -> (newTask.getCampaign().equals(campaignId))).map(IncomingCallTaskController::map).collect(Collectors.toList());
- IvoiceApiResponse<List<IncomingCallTaskDto>> apiResponse = IvoiceApiResponse.response(dtos);
- return new ResponseEntity<>(apiResponse, HttpStatus.OK);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement