Interface SubmissionController<T>
- Type Parameters:
T
- The type of the additional data inSubmitSubmissionDto
.
- All Known Implementing Classes:
BaseSubmissionController
,BaseSubmissionControllerWithoutRequestMapping
public interface SubmissionController<T>
Controller for managing submissions.
Add @RestController
and @RequestMapping("/api/submission")
to the implementing class.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the evaluation result for a submission.ResponseEntity
<org.springframework.data.domain.Page<SubmissionDto<T>>> getSubmissions
(org.springframework.data.domain.Pageable page, String userFilter, Long taskFilter, String assignmentFilter, SubmissionMode modeFilter) Returns a paged (filtered) list of submissions.submit
(SubmitSubmissionDto<T> submission, boolean runInBackground, boolean persist) Executes and grades a submission.
-
Method Details
-
submit
@PostMapping(produces={"application/json","text/plain"}, consumes="application/json") ResponseEntity<Serializable> submit(@RequestBody SubmitSubmissionDto<T> submission, @RequestParam(required=false,defaultValue="false") boolean runInBackground, @RequestParam(required=false,defaultValue="true") boolean persist) Executes and grades a submission.- Parameters:
submission
- The submission.runInBackground
- Whether to run the grading in background or wait for grading to finish (default:false
).persist
- Whether to persist the submission (default:true
). Only applies ifrunInBackground
isfalse
.- Returns:
- The submission identifier if
runInBackground
istrue
; the grading result ifrunInBackground
isfalse
; or an error response. - Implementation Requirements:
- Only clients with role
AuthConstants.SUBMIT
should be allowed to access this endpoint.
-
getResult
@GetMapping(value="/{id}/result", produces="application/json") ResponseEntity<GradingDto> getResult(@PathVariable UUID id, @RequestHeader(value="X-API-TIMEOUT",required=false,defaultValue="10") int timeout, @RequestParam(required=false,defaultValue="false") boolean delete) Returns the evaluation result for a submission.- Parameters:
id
- The submission identifier.timeout
- The maximum time to wait for the result in seconds (default:10
, maximum:60
).delete
- Whether the submission should be deleted.- Returns:
- The result of the submission or an error response.
- Implementation Requirements:
- Only clients with role
AuthConstants.SUBMIT
should be allowed to access this endpoint.
-
getSubmissions
@GetMapping(produces="application/json") ResponseEntity<org.springframework.data.domain.Page<SubmissionDto<T>>> getSubmissions(org.springframework.data.domain.Pageable page, @RequestParam(required=false) String userFilter, @RequestParam(required=false) Long taskFilter, @RequestParam(required=false) String assignmentFilter, @RequestParam(required=false) SubmissionMode modeFilter) Returns a paged (filtered) list of submissions.- Parameters:
page
- The page of submissions to load.userFilter
- Optional user filter string (applies equals toSubmissionDto.userId()
).taskFilter
- Optional task filter (applies equals toSubmissionDto.taskId()
).assignmentFilter
- Optional assignment filter string (applies equals toSubmissionDto.assignmentId()
).modeFilter
- Optional mode filter (applies equals toSubmissionDto.mode()
).- Returns:
- Page of submissions or an error response.
- Implementation Requirements:
- Only clients with role
AuthConstants.READ_SUBMISSION
should be allowed to access this endpoint.
-