Package pro.taskana.task.rest
Class TaskCommentController
- java.lang.Object
-
- pro.taskana.task.rest.TaskCommentController
-
@RestController @EnableHypermediaSupport(type=HAL) public class TaskCommentController extends Object
Controller for allTaskCommentrelated endpoints.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<TaskCommentRepresentationModel>createTaskComment(String taskId, TaskCommentRepresentationModel taskCommentRepresentationModel)This endpoint creates a Task Comment.org.springframework.http.ResponseEntity<TaskCommentRepresentationModel>deleteTaskComment(String taskCommentId)This endpoint deletes a given Task Comment.org.springframework.http.ResponseEntity<TaskCommentRepresentationModel>getTaskComment(String taskCommentId)This endpoint retrieves a Task Comment.org.springframework.http.ResponseEntity<TaskCommentCollectionRepresentationModel>getTaskComments(String taskId, List<pro.taskana.task.rest.TaskCommentController.TaskCommentsSortBy> sortBy, List<pro.taskana.common.api.BaseQuery.SortDirection> order)This endpoint retrieves all Task Comments for a specific Task.org.springframework.http.ResponseEntity<TaskCommentRepresentationModel>updateTaskComment(String taskCommentId, TaskCommentRepresentationModel taskCommentRepresentationModel)This endpoint updates a given Task Comment.
-
-
-
Method Detail
-
getTaskComment
@GetMapping(path="/api/v1/tasks/comments/{taskCommentId}") @Transactional(readOnly=true, rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<TaskCommentRepresentationModel> getTaskComment(@PathVariable String taskCommentId) throws pro.taskana.common.api.exceptions.NotAuthorizedException, pro.taskana.task.api.exceptions.TaskNotFoundException, pro.taskana.task.api.exceptions.TaskCommentNotFoundException, pro.taskana.common.api.exceptions.InvalidArgumentExceptionThis endpoint retrieves a Task Comment.- Parameters:
taskCommentId- the Id of the Task Comment- Returns:
- the Task Comment
- Throws:
pro.taskana.common.api.exceptions.NotAuthorizedException- if the user is not authorized for the requested Task Commentpro.taskana.task.api.exceptions.TaskNotFoundException- TODO: this is never thrownpro.taskana.task.api.exceptions.TaskCommentNotFoundException- if the requested Task Comment is not foundpro.taskana.common.api.exceptions.InvalidArgumentException- if the requested Id is null or empty
-
getTaskComments
@GetMapping(path="/api/v1/tasks/{taskId}/comments") @Transactional(readOnly=true, rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<TaskCommentCollectionRepresentationModel> getTaskComments(@PathVariable String taskId, @RequestParam(name="sort-by",required=false) List<pro.taskana.task.rest.TaskCommentController.TaskCommentsSortBy> sortBy, @RequestParam(required=false) List<pro.taskana.common.api.BaseQuery.SortDirection> order) throws pro.taskana.common.api.exceptions.NotAuthorizedException, pro.taskana.task.api.exceptions.TaskNotFoundException, pro.taskana.common.api.exceptions.InvalidArgumentExceptionThis endpoint retrieves all Task Comments for a specific Task. Further filters can be applied.- Parameters:
taskId- the Id of the Task whose comments are requestedsortBy- Sort the result by a given field. Multiple sort values can be declared. When the primary sort value is the same, the second one will be used.order- The order direction for each sort value. This value requires the use of 'sort-by'. The amount of sort-by and order declarations have to match. Alternatively the value can be omitted. In this case the default sort order (ASCENDING) will be applied to every sort-by value.- Returns:
- a list of Task Comments
- Throws:
pro.taskana.common.api.exceptions.NotAuthorizedException- If the current user has no authorization to retrieve a Task Comment from a certain Task or is not authorized to access the Task.pro.taskana.task.api.exceptions.TaskNotFoundException- If the given Task Id in the Task Comment does not refer to an existing Taskpro.taskana.common.api.exceptions.InvalidArgumentException- if some parameters were not supplied correctly
-
deleteTaskComment
@DeleteMapping(path="/api/v1/tasks/comments/{taskCommentId}") @Transactional(readOnly=true, rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<TaskCommentRepresentationModel> deleteTaskComment(@PathVariable String taskCommentId) throws pro.taskana.common.api.exceptions.NotAuthorizedException, pro.taskana.task.api.exceptions.TaskNotFoundException, pro.taskana.task.api.exceptions.TaskCommentNotFoundException, pro.taskana.common.api.exceptions.InvalidArgumentExceptionThis endpoint deletes a given Task Comment.- Parameters:
taskCommentId- the Id of the Task Comment which should be deleted- Returns:
- no content, if everything went well.
- Throws:
pro.taskana.common.api.exceptions.NotAuthorizedException- if the current user is not authorized to delete a Task Commentpro.taskana.task.api.exceptions.TaskNotFoundException- If the given Task Id in the Task Comment does not refer to an existing task.pro.taskana.task.api.exceptions.TaskCommentNotFoundException- if the requested Task Comment does not existpro.taskana.common.api.exceptions.InvalidArgumentException- if the requested Task Comment Id is null or empty
-
updateTaskComment
@PutMapping(path="/api/v1/tasks/comments/{taskCommentId}") @Transactional(readOnly=true, rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<TaskCommentRepresentationModel> updateTaskComment(@PathVariable String taskCommentId, @RequestBody TaskCommentRepresentationModel taskCommentRepresentationModel) throws pro.taskana.common.api.exceptions.NotAuthorizedException, pro.taskana.task.api.exceptions.TaskNotFoundException, pro.taskana.task.api.exceptions.TaskCommentNotFoundException, pro.taskana.common.api.exceptions.InvalidArgumentException, pro.taskana.common.api.exceptions.ConcurrencyExceptionThis endpoint updates a given Task Comment.- Parameters:
taskCommentId- the Task Comment which should be updated.taskCommentRepresentationModel- the new comment for the requested id.- Returns:
- the updated Task Comment
- Throws:
pro.taskana.common.api.exceptions.NotAuthorizedException- if the current user does not have access to the Task Commentpro.taskana.task.api.exceptions.TaskNotFoundException- if the referenced Task within the Task Comment does not existpro.taskana.task.api.exceptions.TaskCommentNotFoundException- if the requested Task Comment does not existpro.taskana.common.api.exceptions.InvalidArgumentException- if the Id in the path and in the request body does not matchpro.taskana.common.api.exceptions.ConcurrencyException- if the requested Task Comment has been updated in the meantime by a different process.
-
createTaskComment
@PostMapping(path="/api/v1/tasks/{taskId}/comments") @Transactional(rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<TaskCommentRepresentationModel> createTaskComment(@PathVariable String taskId, @RequestBody TaskCommentRepresentationModel taskCommentRepresentationModel) throws pro.taskana.common.api.exceptions.NotAuthorizedException, pro.taskana.common.api.exceptions.InvalidArgumentException, pro.taskana.task.api.exceptions.TaskNotFoundExceptionThis endpoint creates a Task Comment.- Parameters:
taskId- the Id of the Task where a Task Comment should be created.taskCommentRepresentationModel- the Task Comment to create.- Returns:
- the created Task Comment
- Throws:
pro.taskana.common.api.exceptions.NotAuthorizedException- if the current user is not authorized to create a Task Commentpro.taskana.common.api.exceptions.InvalidArgumentException- if the Task Comment Id is null or emptypro.taskana.task.api.exceptions.TaskNotFoundException- if the requested task does not exist
-
-