use of org.opentosca.toscana.api.model.CsarResponse in project TOSCAna by StuPro-TOSCAna.
the class CsarController method listCSARs.
/**
* Responds with a list of csars stored on the transformer.
* <p>
* This always responds with HTTP-Code 200 (application/hal+json)
*/
@ApiOperation(value = "List all CSARs stored on the server", notes = "Returns a Hypermedia Resource containing all CSARs" + " that have been uploaded to the server and did not get removed", response = CsarResources.class, produces = "application/hal+json")
@RequestMapping(path = "", method = RequestMethod.GET, produces = "application/hal+json")
public ResponseEntity<Resources<CsarResponse>> listCSARs() {
Link selfLink = linkTo(methodOn(CsarController.class).listCSARs()).withSelfRel();
List<CsarResponse> responses = new ArrayList<>();
for (Csar csar : csarService.getCsars()) {
responses.add(new CsarResponse(csar.getIdentifier(), csar.getLifecyclePhases()));
}
Resources<CsarResponse> csarResources = new HiddenResources<>(responses, selfLink);
return ResponseEntity.ok().body(csarResources);
}
Aggregations