PMT-26 refactor try/catch getAListOfAllEmployeesFromASpecificProject
This commit is contained in:
parent
9692f1f179
commit
94298293a8
1 changed files with 8 additions and 5 deletions
|
@ -159,14 +159,17 @@ public class ApiController implements DefaultApi {
|
||||||
.map(Allocation::getEmployeeId)
|
.map(Allocation::getEmployeeId)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
List<EmployeeResponseDTO> employees = apiClientFactory.getEmployeeApi().findAll1().stream()
|
try {
|
||||||
.filter(employeeResponseDTO -> employeeIds.contains(employeeResponseDTO.getId()))
|
List<EmployeeResponseDTO> employees = apiClientFactory.getEmployeeApi().findAll1().stream()
|
||||||
.toList();
|
.filter(employeeResponseDTO -> employeeIds.contains(employeeResponseDTO.getId()))
|
||||||
|
.toList();
|
||||||
|
return new ResponseEntity<>(employees, HttpStatus.OK);
|
||||||
|
} catch (RestClientException exception) {
|
||||||
|
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
// Was wenn, die Liste der Allocation und die Liste der EmployeeResponseDTO nicht die gleiche Anzahl haben.
|
// Was wenn, die Liste der Allocation und die Liste der EmployeeResponseDTO nicht die gleiche Anzahl haben.
|
||||||
// Das EmployeeResponseDTO wird vom EmployeeService gestellt, sollte man die Daten auf eigenes DTO mappen.
|
// Das EmployeeResponseDTO wird vom EmployeeService gestellt, sollte man die Daten auf eigenes DTO mappen.
|
||||||
|
|
||||||
return new ResponseEntity<>(employees, HttpStatus.OK);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue