AssignmentController

class AssignmentController: Any

AssignmentController contains MVC controller functions that handle requests related with Assignments (for example, assignment creation, edition, etc.)

Fields

Name Description
val assignmentsRootLocation: String
val LOG: LoggerFactory.getLogger(this.javaClass.name)
val assignmentRepository: AssignmentRepository
val assignmentReportRepository: AssignmentReportRepository
val assignmentTagRepository: AssignmentTagRepository
val assignmentTestMethodRepository: AssignmentTestMethodRepository
val assigneeRepository: AssigneeRepository
val assignmentACLRepository: AssignmentACLRepository
val submissionRepository: SubmissionRepository
val gitSubmissionRepository: GitSubmissionRepository
val gitClient: GitClient
val assignmentTeacherFiles: AssignmentTeacherFiles
val submissionService: SubmissionService
val assignmentService: AssignmentService
val cacheManager: CacheManager

Constructors

<init>

constructor(assignmentRepository: AssignmentRepository, assignmentReportRepository: AssignmentReportRepository, assignmentTagRepository: AssignmentTagRepository, assignmentTestMethodRepository: AssignmentTestMethodRepository, assigneeRepository: AssigneeRepository, assignmentACLRepository: AssignmentACLRepository, submissionRepository: SubmissionRepository, gitSubmissionRepository: GitSubmissionRepository, gitClient: GitClient, assignmentTeacherFiles: AssignmentTeacherFiles, submissionService: SubmissionService, assignmentService: AssignmentService, cacheManager: CacheManager)

AssignmentController contains MVC controller functions that handle requests related with Assignments (for example, assignment creation, edition, etc.)

Parameters

Name Description
assignmentRepository: AssignmentRepository
assignmentReportRepository: AssignmentReportRepository
assignmentTagRepository: AssignmentTagRepository
assignmentTestMethodRepository: AssignmentTestMethodRepository
assigneeRepository: AssigneeRepository
assignmentACLRepository: AssignmentACLRepository
submissionRepository: SubmissionRepository
gitSubmissionRepository: GitSubmissionRepository
gitClient: GitClient
assignmentTeacherFiles: AssignmentTeacherFiles
submissionService: SubmissionService
assignmentService: AssignmentService
cacheManager: CacheManager

Methods

getNewAssignmentForm

fun getNewAssignmentForm(model: ModelMap): String

Controller that handles HTTP GET requests for the Assignment creation form.

Parameters

Name Description
model: ModelMap

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

ReturnValue

Name Description
String

A String with the name of the relevant View

createOrEditAssignment

fun createOrEditAssignment(assignmentForm: AssignmentForm, bindingResult: BindingResult, redirectAttributes: RedirectAttributes, principal: Principal): String

Controller that handles HTTP POST requests for the Assignment creation form.

Parameters

Name Description
assignmentForm: AssignmentForm

is an AssignmentForm

bindingResult: BindingResult

is a BindingResult

redirectAttributes: RedirectAttributes

is a RedirectAttributes

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
String

is a String with the name of the relevant View

getAssignmentDetail

fun getAssignmentDetail(assignmentId: String, model: ModelMap, principal: Principal): String

Handles requests for for an Assignment's "Info" page.

Parameters

Name Description
assignmentId: String

is a String identifying the relevant Assignment

model: ModelMap

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

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
String

a String with the name of the relevant View

getEditAssignmentForm

fun getEditAssignmentForm(assignmentId: String, model: ModelMap, principal: Principal): String

Controller that handles HTTP GET requests for the Assignment edition form.

Parameters

Name Description
assignmentId: String

is a String representing the relevant Assignment

model: ModelMap

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

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
String

a String with the name of the relevant View

refreshAssignmentGitRepository

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

Controller that handles requests for the refreshing of the Assignment's configuration from its Git repository.

Parameters

Name Description
assignmentId: String

is a String, identifying the relevant assignment

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
ResponseEntity<String>

a ResponseEntity

setupAssignmentToGitRepository

fun setupAssignmentToGitRepository(assignmentId: String, model: ModelMap, principal: Principal): String

Controller that handles requests for the creation of the connection between the Assignment and the Git repository that contains its configuration.

Parameters

Name Description
assignmentId: String

is a String, identifying the relevant Assignment

model: ModelMap

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

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
String

a String with the name of the relevant View

connectAssignmentToGitRepository

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

Controller to handle requests related with connecting an Assigment with a git repository. This is needed to obtain the information that is defined by code (instructions, unit tests, etc).

Parameters

Name Description
assignmentId: String

is a String representing the relevant Assignment

redirectAttributes: RedirectAttributes

is a RedirectAttributes

model: ModelMap

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

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
String

A String with the name of the relevant View

listMyAssignments

fun listMyAssignments(tags: String?, model: ModelMap, principal: Principal): String

Controller to handle the page that lists the Assignments to which the logged-in user has access.

Parameters

Name Description
tags: String?

is a String containing the names of multiple tags. Each tag name is separated by a comma. Only the assignments that have all the tags will be placed in the model.

model: ModelMap

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

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
String

A String with the name of the relevant View

listMyArchivedAssignments

fun listMyArchivedAssignments(tags: String?, model: ModelMap, principal: Principal): String

Controller to handle the page that lists the archived assignments to which the logged-in teacher has access.

Parameters

Name Description
tags: String?

is a String containing the names of multiple tags. Each tag name is separated by a comma. Only the assignments that have all the tags will be placed in the model.

model: ModelMap

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

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
String

A String with the name of the relevant View

deleteAssignment

fun deleteAssignment(assignmentId: String, redirectAttributes: RedirectAttributes, principal: Principal): String

Controller to handle the deletion of an Assignment.

Parameters

Name Description
assignmentId: String

is a String representing the relevant Assignment

redirectAttributes: RedirectAttributes

is a RedirectAttributes

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
String

A String with the name of the relevant View

toggleAssignmentStatus

fun toggleAssignmentStatus(assignmentId: String, redirectAttributes: RedirectAttributes, principal: Principal): String

Controller that allows toggling the status of an Assignment between "active" and "inactive".

Parameters

Name Description
assignmentId: String

is a String representing the relevant Assignment

redirectAttributes: RedirectAttributes

is a RedirectAttributes

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
String

A String with the name of the relevant View

archiveAssignment

fun archiveAssignment(assignmentId: String, redirectAttributes: RedirectAttributes, principal: Principal): String

Controller that allows the archiving of an Assignment.

Parameters

Name Description
assignmentId: String

is a String representing the relevant Assignment

redirectAttributes: RedirectAttributes

is a RedirectAttributes

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
String

A String with the name of the relevant View

markAllSubmissionsAsFinal

fun markAllSubmissionsAsFinal(assignmentId: String, redirectAttributes: RedirectAttributes, principal: Principal): String

Controller that allows marking the latest submission of each group as final. Note that the latest submission might not be the best one.

Parameters

Name Description
assignmentId: String

is a String representing the relevant Assignment

redirectAttributes: RedirectAttributes

is a RedirectAttributes

principal: Principal

is a Principal representing the user making the request

ReturnValue

Name Description
String

A String with the name of the relevant View