Class JsExecutionController
- java.lang.Object
-
- com.anton.martynenko.jswrapper.jsexecution.JsExecutionController
-
@RestController @RequestMapping("/executions") public class JsExecutionController extends java.lang.ObjectMain Spring MVC REST-controller.- Since:
- 1.0
- Author:
- Martynenko Anton
-
-
Constructor Summary
Constructors Constructor Description JsExecutionController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<org.springframework.hateoas.EntityModel<JsExecutionDTO>>cancelJsExecution(java.lang.Integer executionId)Cancel execution by id.org.springframework.http.ResponseEntity<org.springframework.hateoas.EntityModel<JsExecutionDTO>>createNew(JsExecutionDTO newJsExecutionDTO)Runs new JS code execution.org.springframework.http.ResponseEntity<java.lang.String>deleteJsExecution(java.lang.Integer executionId)DeleteJsExecutionby id.org.springframework.http.ResponseEntity<java.lang.String>getDetails(java.lang.Integer executionId, java.lang.String property)Returns script body plain text ofJsExecutionby id.org.springframework.hateoas.EntityModel<JsExecutionDTO>getOne(java.lang.Integer executionId)ReturnsJsExecutionby id.org.springframework.hateoas.CollectionModel<org.springframework.hateoas.EntityModel<JsExecutionDTO>>listAll(java.util.Optional<Status> status, java.util.Optional<SortBy> sortBy)ReturnsJsExecutioncollection.
-
-
-
Method Detail
-
createNew
@PostMapping(produces="application/json") public org.springframework.http.ResponseEntity<org.springframework.hateoas.EntityModel<JsExecutionDTO>> createNew(@RequestBody JsExecutionDTO newJsExecutionDTO)
Runs new JS code execution.- Parameters:
newJsExecutionDTO- new JsExecution to save and run- Returns:
ResponseEntitywith containing json view ofJsExecutionwith HATEOAS links- Since:
- 1.0
-
getOne
@GetMapping(value="/{executionId}", produces={"application/json","application/problem+json"}) public org.springframework.hateoas.EntityModel<JsExecutionDTO> getOne(@PathVariable java.lang.Integer executionId)ReturnsJsExecutionby id.- Parameters:
executionId-JsExecutionid.- Returns:
EntityModelcontaining json view ofJsExecutionwith HATEOAS links- Since:
- 1.0
-
listAll
@GetMapping(produces="application/json") public org.springframework.hateoas.CollectionModel<org.springframework.hateoas.EntityModel<JsExecutionDTO>> listAll(@RequestParam(required=false) java.util.Optional<Status> status, @RequestParam(required=false) java.util.Optional<SortBy> sortBy)
ReturnsJsExecutioncollection.- Parameters:
status- optionalStatusfiltration criteriasortBy- optionalSortBysorting criteria- Returns:
CollectionModelofEntityModel(JsExecutionjson view with HATEOAS links)- Since:
- 1.0
-
cancelJsExecution
@DeleteMapping(value="/{executionId}/cancel", produces={"application/json","application/problem+json"}) public org.springframework.http.ResponseEntity<org.springframework.hateoas.EntityModel<JsExecutionDTO>> cancelJsExecution(@PathVariable java.lang.Integer executionId)Cancel execution by id.- Parameters:
executionId-JsExecutionid- Returns:
ResponseEntitycontaining json view ofJsExecutionwith HATEOAS links- Since:
- 1.0
-
deleteJsExecution
@DeleteMapping(value="/{executionId}", produces="application/problem+json") public org.springframework.http.ResponseEntity<java.lang.String> deleteJsExecution(@PathVariable java.lang.Integer executionId)DeleteJsExecutionby id.- Parameters:
executionId-JsExecutionid- Returns:
- empty response body
- Since:
- 1.0
-
getDetails
@GetMapping(value="/{executionId}/{property}", produces={"text/plain","application/problem+json"}) public org.springframework.http.ResponseEntity<java.lang.String> getDetails(@PathVariable java.lang.Integer executionId, @PathVariable java.lang.String property)Returns script body plain text ofJsExecutionby id.- Parameters:
executionId-JsExecutionidproperty-JsExecution's property string view- Returns:
- plain text or empty body
- Since:
- 1.1
-
-