Package pl.put.poznan.sqc.application
Class SQCController
- java.lang.Object
-
- pl.put.poznan.sqc.application.SQCController
-
@RestController @RequestMapping("/scenario") public class SQCController extends Object
A controller that gives access to the SQC app functionality via REST API calls.
-
-
Constructor Summary
Constructors Constructor Description SQCController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<String>
deleteScenario()
DELETE an existing scenario, if any.org.springframework.http.ResponseEntity<String>
getActorCountMap()
GET a map of actors and the number of steps they partake in.org.springframework.http.ResponseEntity<String>
getActorlessSteps()
GET a list of step texts where no actor begins the step.org.springframework.http.ResponseEntity<String>
getDepth(int d)
GET a scenario, but only to a certain depthorg.springframework.http.ResponseEntity<String>
getKeywordCount()
GET a total number of keywords in all the steps of the current scenario.org.springframework.http.ResponseEntity<String>
getLonelyActors()
GET a list of actors that do not appear in any steps.org.springframework.http.ResponseEntity<String>
getStepCount()
GET a total number of steps in the current scenario.org.springframework.http.ResponseEntity<String>
postScenario(String json)
POST a new scenario.
-
-
-
Method Detail
-
postScenario
@PostMapping(value="", produces="application/json") public org.springframework.http.ResponseEntity<String> postScenario(@RequestBody String json)
POST a new scenario. It overrides any existing previous scenarios.- Parameters:
json
- description of the scenario as a JSON passed in request body- Returns:
- request response with a comment and a status code: [CREATED] if successful / [BAD REQUEST] if a parsing error occurred
- See Also:
SQCService
-
deleteScenario
@DeleteMapping(value="", produces="application/json") public org.springframework.http.ResponseEntity<String> deleteScenario()
DELETE an existing scenario, if any.- Returns:
- request response with a comment and a status code: [OK] if deleted / [NOT FOUND] if none to deleted: none will be left in memory
-
getStepCount
@GetMapping(value="/steps", produces="application/json") public org.springframework.http.ResponseEntity<String> getStepCount()
GET a total number of steps in the current scenario.- Returns:
- request response with a comment and a status code: [OK] and a number if successful / [NOT FOUND] if no scenario
-
getKeywordCount
@GetMapping(value="/keywords", produces="application/json") public org.springframework.http.ResponseEntity<String> getKeywordCount()
GET a total number of keywords in all the steps of the current scenario.- Returns:
- request response with a comment and a status code: [OK] and a number if successful / [NOT FOUND] if no scenario
-
getActorlessSteps
@GetMapping(value="/actorless", produces="application/json") public org.springframework.http.ResponseEntity<String> getActorlessSteps()
GET a list of step texts where no actor begins the step.- Returns:
- request response with a comment and a status code: [OK] and a list if successful / [NOT FOUND] if no scenario
-
getDepth
@GetMapping(value="/depth/{d}", produces="application/json") public org.springframework.http.ResponseEntity<String> getDepth(@PathVariable int d)
GET a scenario, but only to a certain depth- Parameters:
d
- the depth- Returns:
- request response with a comment and a status code:
[OK] and a list if successful /
[NOT FOUND] if no scenario
405 BAD REQUEST
if unacceptable depth
-
getLonelyActors
@GetMapping(value="/actors/lonely", produces="application/json") public org.springframework.http.ResponseEntity<String> getLonelyActors()
GET a list of actors that do not appear in any steps.- Returns:
- response with a list of actors + [OK] if successful / [NOT FOUND] if no scenario
-
getActorCountMap
@GetMapping(value="/actors/count", produces="application/json") public org.springframework.http.ResponseEntity<String> getActorCountMap()
GET a map of actors and the number of steps they partake in.- Returns:
- response as a json object + a status code:
200 OK
and a list if successful /404 NOT FOUND
if no scenario /
-
-