use of eu.einfracentral.domain.Metadata in project resource-catalogue by madgeek-arc.
the class InfraServiceController method setActive.
@PatchMapping(path = "publish/{id}/{version}", produces = { MediaType.APPLICATION_JSON_VALUE })
@PreAuthorize("hasRole('ROLE_ADMIN')")
public ResponseEntity<InfraService> setActive(@PathVariable String id, @PathVariable String version, @RequestParam boolean active, @RequestParam Boolean latest, @ApiIgnore Authentication auth) throws ResourceNotFoundException {
InfraService service = infraService.get(id, version);
service.setActive(active);
service.setLatest(latest);
Metadata metadata = service.getMetadata();
metadata.setModifiedBy("system");
metadata.setModifiedAt(String.valueOf(System.currentTimeMillis()));
service.setMetadata(metadata);
if (active) {
logger.info("User '{}' set InfraService '{}' with id: {} as active", auth.getName(), service.getService().getName(), service.getService().getId());
} else {
logger.info("User '{}' set InfraService '{}' with id: {} as inactive", auth.getName(), service.getService().getName(), service.getService().getId());
}
return ResponseEntity.ok(infraService.update(service, auth));
}
Aggregations