Package org.powertac.visualizer.web.rest
Class GraphResource
- java.lang.Object
-
- org.powertac.visualizer.web.rest.GraphResource
-
@RestController @RequestMapping("/api") public class GraphResource extends Object
REST controller for managing Graph.
-
-
Constructor Summary
Constructors Constructor Description GraphResource(GraphService graphService, UserRepository userRepository)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<Graph>
createGraph(@Valid Graph graph)
POST /graphs : Create a new graph.org.springframework.http.ResponseEntity<Void>
deleteGraph(Long id)
DELETE /graphs/:id : delete the "id" graph.org.springframework.http.ResponseEntity<List<Graph>>
getAllGraphs(org.springframework.data.domain.Pageable pageable)
GET /graphs : get all the graphs.org.springframework.http.ResponseEntity<Graph>
getGraph(Long id)
GET /graphs/:id : get the "id" graph.org.springframework.http.ResponseEntity<List<Graph>>
getMyGraphs()
Get all graphs owned by logged in user, plus all shared graphs.org.springframework.http.ResponseEntity<Graph>
updateGraph(@Valid Graph graph)
PUT /graphs : Updates an existing graph.
-
-
-
Constructor Detail
-
GraphResource
public GraphResource(GraphService graphService, UserRepository userRepository)
-
-
Method Detail
-
createGraph
@PostMapping("/graphs") @Timed public org.springframework.http.ResponseEntity<Graph> createGraph(@Valid @RequestBody @Valid Graph graph) throws URISyntaxException
POST /graphs : Create a new graph.- Parameters:
graph
- the graph to create- Returns:
- the ResponseEntity with status 201 (Created) and with body the new graph, or with status 400 (Bad Request) if the graph has already an ID
- Throws:
URISyntaxException
- if the Location URI syntax is incorrect
-
updateGraph
@PutMapping("/graphs") @Timed public org.springframework.http.ResponseEntity<Graph> updateGraph(@Valid @RequestBody @Valid Graph graph) throws URISyntaxException
PUT /graphs : Updates an existing graph.- Parameters:
graph
- the graph to update- Returns:
- the ResponseEntity with status 200 (OK) and with body the updated graph, or with status 400 (Bad Request) if the graph is not valid, or with status 500 (Internal Server Error) if the graph couldnt be updated
- Throws:
URISyntaxException
- if the Location URI syntax is incorrect
-
getAllGraphs
@GetMapping("/graphs") @Timed public org.springframework.http.ResponseEntity<List<Graph>> getAllGraphs(org.springframework.data.domain.Pageable pageable) throws URISyntaxException
GET /graphs : get all the graphs.- Parameters:
pageable
- the pagination information- Returns:
- the ResponseEntity with status 200 (OK) and the list of graphs in body
- Throws:
URISyntaxException
- if there is an error to generate the pagination HTTP headers
-
getGraph
@GetMapping("/graphs/{id}") @Timed public org.springframework.http.ResponseEntity<Graph> getGraph(@PathVariable Long id)
GET /graphs/:id : get the "id" graph.- Parameters:
id
- the id of the graph to retrieve- Returns:
- the ResponseEntity with status 200 (OK) and with body the graph, or with status 404 (Not Found)
-
deleteGraph
@DeleteMapping("/graphs/{id}") @Timed public org.springframework.http.ResponseEntity<Void> deleteGraph(@PathVariable Long id)
DELETE /graphs/:id : delete the "id" graph.- Parameters:
id
- the id of the graph to delete- Returns:
- the ResponseEntity with status 200 (OK)
-
getMyGraphs
@GetMapping("/mygraphs") @Timed public org.springframework.http.ResponseEntity<List<Graph>> getMyGraphs() throws URISyntaxException
Get all graphs owned by logged in user, plus all shared graphs.- Throws:
URISyntaxException
-
-