UploadController

class UploadController: Any

UploadController is an MVC controller class to handle requests related with the upload of submissions.

Fields

Name Description
val gitSubmissionsRootLocation: String
val mavenizedProjectsRootLocation: String
val deleteOriginalProjectFolder: Boolean
val LOG: LoggerFactory.getLogger(this.javaClass.name)
val storageService: StorageService
val buildWorker: BuildWorker
val authorRepository: AuthorRepository
val projectGroupRepository: ProjectGroupRepository
val submissionRepository: SubmissionRepository
val gitSubmissionRepository: GitSubmissionRepository
val submissionReportRepository: SubmissionReportRepository
val assignmentRepository: AssignmentRepository
val assignmentACLRepository: AssignmentACLRepository
val assigneeRepository: AssigneeRepository
val asyncExecutor: Executor
val assignmentTeacherFiles: AssignmentTeacherFiles
val gitClient: GitClient
val gitSubmissionService: GitSubmissionService
val submissionService: SubmissionService
val zipService: ZipService

Constructors

<init>

constructor(storageService: StorageService, buildWorker: BuildWorker, authorRepository: AuthorRepository, projectGroupRepository: ProjectGroupRepository, submissionRepository: SubmissionRepository, gitSubmissionRepository: GitSubmissionRepository, submissionReportRepository: SubmissionReportRepository, assignmentRepository: AssignmentRepository, assignmentACLRepository: AssignmentACLRepository, assigneeRepository: AssigneeRepository, asyncExecutor: Executor, assignmentTeacherFiles: AssignmentTeacherFiles, gitClient: GitClient, gitSubmissionService: GitSubmissionService, submissionService: SubmissionService, zipService: ZipService)

UploadController is an MVC controller class to handle requests related with the upload of submissions.

Parameters

Name Description
storageService: StorageService
buildWorker: BuildWorker
authorRepository: AuthorRepository
projectGroupRepository: ProjectGroupRepository
submissionRepository: SubmissionRepository
gitSubmissionRepository: GitSubmissionRepository
submissionReportRepository: SubmissionReportRepository
assignmentRepository: AssignmentRepository
assignmentACLRepository: AssignmentACLRepository
assigneeRepository: AssigneeRepository
asyncExecutor: Executor
assignmentTeacherFiles: AssignmentTeacherFiles
gitClient: GitClient
gitSubmissionService: GitSubmissionService
submissionService: SubmissionService
zipService: ZipService

Methods

getUploadForm

fun getUploadForm(model: ModelMap, principal: Principal, request: HttpServletRequest): String

Controller that handles related with the base URL.

If the principal can only access one Assignment, then that assignment's upload form will be displayed. Otherwise, a list of assignments will be displayed.

Parameters

Name Description
model: ModelMap

is a ModelMap that will be populated with the information to use in a View

principal: Principal

is a Principal representing the user making the request

request: HttpServletRequest

is a HttpServletRequest

ReturnValue

Name Description
String

A String identifying the relevant View

getUploadForm

fun getUploadForm(model: ModelMap, principal: Principal, assignmentId: String, request: HttpServletRequest): String

Controller that handles requests related with the Assignment's upload page.

Parameters

Name Description
model: ModelMap

is a ModelMap that will be populated with the information to use in a View

principal: Principal

is a Principal representing the user making the request

assignmentId: String

is a String, identifying the relevant Assigment

request: HttpServletRequest

is an HttpServletRequest

ReturnValue

Name Description
String

A String identifying the relevant View

upload

fun upload(uploadForm: UploadForm, bindingResult: BindingResult, file: MultipartFile, principal: Principal, request: HttpServletRequest): ResponseEntity<String>

Controller that handles requests for the actual file upload that delivers/submits the student's code.

Parameters

Name Description
uploadForm: UploadForm

is an Uploadform

bindingResult: BindingResult

is a BindingResult

file: MultipartFile

is a MultipartFile

principal: Principal

is a Principal representing the user making the request

request: HttpServletRequest

is an HttpServletRequest

ReturnValue

Name Description
ResponseEntity<String>

a ResponseEntity

upload

fun upload(gitSubmissionId: String, principal: Principal, request: HttpServletRequest): ResponseEntity<String>

Controller that handles requests for the generation of a GitSubmission's build report.

Parameters

Name Description
gitSubmissionId: String

is a String identifying a GitSubmission

principal: Principal

is a Principal representing the user making the request

request: HttpServletRequest

is a HttpServletRequest

ReturnValue

Name Description
ResponseEntity<String>

a ResponseEntity

rebuild

fun rebuild(submissionId: Long, principal: Principal): String

Controller that handles requests for the Submission's rebuild process. The rebuild process is a process where by a student's submission gets compiled and evaluated again. It can be useful, for example, in situations where an error was detected in the teacher's tests and the teacher wants to apply corrected tests to the student's submission.

Parameters

Name Description
submissionId: Long

is a Long, identifying the student's Submission

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
String

a String identifying the relevant View

rebuildFull

fun rebuildFull(submissionId: Long, principal: Principal): String

Parameters

Name Description
submissionId: Long
principal: Principal

ReturnValue

Name Description
String

markAsFinal

fun markAsFinal(submissionId: Long, redirectToSubmissionsList: Boolean, principal: Principal): String

Controller that handles requests for marking a Submission as "final". Since, by design, students' can make multiple submissions in DP, marking a submission as "final" is the way for the teacher to indicate that it's the one that shall be considered when exporting the submissions' data (e.g. for grading purposes).

Note that only one submission per ProjectGroup can be marked as final. This means that, when a certain submission is marked as final, any previously "finalized" submission by the same group will not be final anymore.

Parameters

Name Description
submissionId: Long

is a Long, identifying the student's Submission

redirectToSubmissionsList: Boolean

is a Boolean. If true, then after the marking process is done, the user will be redirected to the group's submissions list. Otherwise, the redirection will be done to the the final submission's build report.

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
String

a String identifying the relevant View

cleanup

fun cleanup(assignmentId: String, request: HttpServletRequest): String

Parameters

Name Description
assignmentId: String
request: HttpServletRequest

ReturnValue

Name Description
String

setupStudentSubmissionUsingGitRepository

fun setupStudentSubmissionUsingGitRepository(assignmentId: String, gitRepositoryUrl: String?, model: ModelMap, principal: Principal, request: HttpServletRequest): String

Controller that handles requests for connecting a student's GitHub repository with an Assignment available in DP.

This process works like a two step wizard. This is the first part. The second part is in "/student/setup-git-2".

Parameters

Name Description
assignmentId: String

is a String, identifying the relevant Assignment

gitRepositoryUrl: String?

is a String with the student's GitHub repository URL

model: ModelMap

is a ModelMap that will be populated with the information to use in a View

principal: Principal

is a Principal representing the user making the request

request: HttpServletRequest

ReturnValue

Name Description
String

A String identifying the relevant View

connectAssignmentToGitRepository

fun connectAssignmentToGitRepository(gitSubmissionId: String, redirectAttributes: RedirectAttributes, model: ModelMap, principal: Principal): String

Controller that handles requests for connecting a student's GitHub repository with DP.

This process works like a two step wizard. This is the second part. The first part is in "/student/setup-git".

Parameters

Name Description
gitSubmissionId: String
redirectAttributes: RedirectAttributes
model: ModelMap

is a ModelMap that will be populated with the information to use in a View

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
String

A String identifying the relevant View

refreshAssignmentGitRepository

fun refreshAssignmentGitRepository(submissionId: String, principal: Principal): ResponseEntity<String>

Controller that handles requests for the creation of a new submission via Git, by refreshing the contents that are in the respective student's repository.

Parameters

Name Description
submissionId: String

is a String identifying the student's last Git submission

principal: Principal

is a Principal representing the user making the requets

ReturnValue

Name Description
ResponseEntity<String>

a ResponseEntity

disconnectAssignmentToGitRepository

fun disconnectAssignmentToGitRepository(gitSubmissionId: String, redirectAttributes: RedirectAttributes, principal: Principal): String

Controller that handles requests for the resetting of the connection between a GitHub and an Assignment.

Parameters

Name Description
gitSubmissionId: String

is a String identifying a GitSubmission

redirectAttributes: RedirectAttributes

is a RedirectAttributes

principal: Principal

is Principal representing the user making the request

ReturnValue

Name Description
String

a String with the name of the relevant View

deleteSubmission

fun deleteSubmission(submissionId: Long, principal: Principal): String

Controller that handles requests for the deletion of a Submission.

Parameters

Name Description
submissionId: Long

is a Long, identifying the Submission to delete

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
String

a String with the name of the relevant View

handleStorageError

fun handleStorageError(e: StorageException): ResponseEntity<String>

Parameters

Name Description
e: StorageException

ReturnValue

Name Description
ResponseEntity<String>

handleStorageError

fun handleStorageError(e: InvalidProjectStructureException): ResponseEntity<String>

Parameters

Name Description
e: InvalidProjectStructureException

ReturnValue

Name Description
ResponseEntity<String>