Skip to content
Snippets Groups Projects

Resolve "Allow for refreshing status information for a single or all application instances in a bulk"

1 unresolved thread
Files
7
@@ -181,6 +181,18 @@ public class BulkController {
.collect(Collectors.toList());
}
@GetMapping("/refresh/{id}")
@PreAuthorize("hasRole('ROLE_SYSTEM_ADMIN') || hasRole('ROLE_VL_MANAGER')")
public ResponseEntity<BulkDeploymentViewS> getRefreshedState(@PathVariable Long id) {
return ResponseEntity.ok(mapToView(this.bulkApplicationService.updateState(id)));
}
private List<BulkDeploymentViewS> mapToView(List<BulkDeployment> deployments) {
return deployments.stream()
.map(bulk -> mapToView(bulk, BulkDeploymentViewS.class))
.collect(Collectors.toList());
}
private <T extends BulkDeploymentViewS> T mapToView(BulkDeployment bulk, Class<T> viewType) {
T bulkView = modelMapper.map(bulk, viewType);
bulkView.setCreator(getUserView(bulk.getCreatorId()));
@@ -188,6 +200,14 @@ public class BulkController {
return bulkView;
}
private BulkDeploymentView mapToView(BulkDeployment deployment) {
BulkDeploymentView bulkView = modelMapper.map(deployment, BulkDeploymentView.class);
bulkView.setCreator(getUserView(deployment.getCreatorId()));
mapDetails(deployment, bulkView);
return bulkView;
}
private void mapDetails(BulkDeployment deployment, BulkDeploymentViewS view) {
if (deployment.getType().equals(BulkType.APPLICATION)) {
Map<String, String> details = new HashMap<>();
Loading