Class JsExecutionController
- java.lang.Object
-
- com.anton.martynenko.jswrapper.jsexecution.JsExecutionController
-
@RestController @RequestMapping("/executions") public class JsExecutionController extends java.lang.Object
Main 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)
DeleteJsExecution
by id.org.springframework.http.ResponseEntity<java.lang.String>
getDetails(java.lang.Integer executionId, java.lang.String property)
Returns script body plain text ofJsExecution
by id.org.springframework.hateoas.EntityModel<JsExecutionDTO>
getOne(java.lang.Integer executionId)
ReturnsJsExecution
by id.org.springframework.hateoas.CollectionModel<org.springframework.hateoas.EntityModel<JsExecutionDTO>>
listAll(java.util.Optional<Status> status, java.util.Optional<SortBy> sortBy)
ReturnsJsExecution
collection.
-
-
-
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:
ResponseEntity
with containing json view ofJsExecution
with 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)
ReturnsJsExecution
by id.- Parameters:
executionId
-JsExecution
id.- Returns:
EntityModel
containing json view ofJsExecution
with 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)
ReturnsJsExecution
collection.- Parameters:
status
- optionalStatus
filtration criteriasortBy
- optionalSortBy
sorting criteria- Returns:
CollectionModel
ofEntityModel
(JsExecution
json 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
-JsExecution
id- Returns:
ResponseEntity
containing json view ofJsExecution
with 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)
DeleteJsExecution
by id.- Parameters:
executionId
-JsExecution
id- 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 ofJsExecution
by id.- Parameters:
executionId
-JsExecution
idproperty
-JsExecution
's property string view- Returns:
- plain text or empty body
- Since:
- 1.1
-
-