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