Interface GitLabSubmissionFields

All Superinterfaces:
Comparable<VilleSubmissionFields>, VilleSubmissionFields
All Known Implementing Classes:
demopalautus, GitLabSubmission, MyOwnGitlabSubmission, MyOwnVilleGitLabSubmission

public interface GitLabSubmissionFields extends VilleSubmissionFields
An extension of VilleSubmissionFields representing a submission made via a GitLab link box in ViLLe.

This interface adds additional metadata fields that are specific to GitLab-based assignment boxes, as used in introductory programming and software engineering courses.

The source of this data is typically a CSV export from ViLLe that has a header like:

 User$First name$Last name$Time$Student number or other id code$Score$
 Liitä linkki Gitlab-repositorioosi tähän.$
 Jos käytit tehtävän tai tehtävien teossa apuna AI-työkalua (esim. ChatGPT tai Copilot), liitä tähän käymäsi keskustelu tai linkki siihen.$
 Jos teit demotehtävät ryhmässä, kerro tähän keitä ryhmässä oli ja miten vastuu ryhmässä jakautui.$
 
For an example of the actual submission form in ViLLe, see:
defaultVilleSubmissionTemplateExample.png

⚠ Note: Although the example header uses the $ character as a delimiter, ViLLe allows the user to select any delimiter during CSV export. It is often recommended to choose a delimiter other than the default semicolon ;, since that is explicitly rejected by VilleCsvUtils.readAllRows(...) in VilleCsvUtils.

This interface defines only the required accessors. All implementing classes must:

  • Provide a constructor that accepts a single String[] representing a CSV row
  • Ensure that each getter returns exactly one value from that array
  • Not reuse a field across multiple getters — all mappings must be 1-to-1

The input String[] is typically one of the rows returned by: ViLLeCsvFile.getEntries(), where each array represents a single parsed entry from the CSV file (excluding the header).

All arrays in this list are guaranteed to have the same length — matching the number of columns in the header. However, not all fields in the array need to be used, but each getter method must return exactly one unique field from this array. No two getters may map to the same index.

A default implementation — GitLabSubmission — is provided for basic cases where custom field sanitation or logic is not required.

  • Method Details

    • expectedHostPrefix

      default String expectedHostPrefix()
      Returns the expected prefix for a valid GitLab repository URL.

      This is used to identify and validate links submitted by students. By default, it returns the prefix for the University of Turku's GitLab instance: https://gitlab.utu.fi/.

      Implementations may override this if submissions are expected from a different GitLab host (e.g., for testing or multi-university setups).

      Returns:
      the required starting string for a valid GitLab repository URL
    • getScore

      String getScore()
      Returns the score assigned to this submission.

      This is typically a numeric string but may also contain comments or feedback, depending on ViLLe configuration.

      Returns:
      score field as-is from the CSV
    • getGitLabLink

      String getGitLabLink()
      Returns the raw GitLab link field as entered by the student, without any processing.

      This is the unmodified value directly from the CSV, and may include surrounding commentary, invalid protocols (e.g., SSH), UI links, or malformed fragments.

      This method is useful for diagnostics and logging.

      Returns:
      unprocessed input string from the GitLab link field
    • getRepoUrl

      default GitLabRepoUrl getRepoUrl()
      Returns a parsed and sanitized GitLab repository link as a value object, along with a complete record of cleaning steps that were applied.

      This method centralizes all link normalization logic, including:

      • Trimming whitespace
      • SSH → HTTPS conversion
      • Removal of GitLab UI path suffixes (e.g., /-/blob/...)
      • Automatic appending of .git if missing
      • Selection of only the first valid-looking substring
      If no valid cloneable link is found, the returned value object will still contain a URL, but the step list will include ERROR_NOT_A_CLONE_LINK.

      This method should be used whenever the link is passed to downstream tools, such as in CLI-based Git operations or repository cloning. It ensures that formatting issues and common student input errors are addressed consistently and traceably.

      Example usage in CLI pipeline:

      
       for (DefaultGitLabSubmission s : submissions) {
           GitLabRepoUrl repo = s.getRepoUrl();
           System.out.println("Clean URL: " + repo.url());
           System.out.println("Steps:     " + repo.steps());
       }
       
      Returns:
      a GitLabRepoUrl containing the sanitized URL and applied transformations
    • getAiDisclosure

      String getAiDisclosure()
      Returns the student's disclosure regarding use of AI tools (e.g., ChatGPT, GitHub Copilot).

      This field may contain multiline text or be left blank.

      Returns:
      AI tool usage disclosure
    • getGroupWork

      String getGroupWork()
      Returns the student's response to the group work question.

      This may include the names of collaborators and a description of how the task was divided. This field may be multiline and is optional.

      Returns:
      group work information