Class VilleSubmission
- All Implemented Interfaces:
Comparable<VilleSubmissionFields>
,VilleSubmissionFields
- Direct Known Subclasses:
GitLabSubmission
VilleSubmissionFields
, based on the first five columns of a ViLLe CSV row.
This implementation assumes the input String[]
contains exactly the core metadata fields in this order:
User$First name$Last name$Time$Student number or other id code$
The corresponding indexes (0 to 4) must match this layout. Each method returns the raw value from that position, after basic validation and trimming. This class enforces lightweight sanitation rules:
getUser()
must contain "@" and a dot after it (e.g., email)getFirstName()
andgetLastName()
must not contain numeric charactersgetTime()
must match the patternyyyy-MM-dd
getStudentId()
is not validated by default due to wide variation in formats
Extend this class and override getStudentId()
if additional validation is required.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionReturns the student's first name from column 1.Returns the student's last name from column 2.Returns the base folder name used to group this submission under an outer task-level directory.Returns the student ID from column 4.getTime()
Returns the submission timestamp from column 3.getUser()
Returns the user identifier (typically an email address) from column 0.String[]
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface studentrepoloader.model.villecsv.mapper.VilleSubmissionFields
compareTo, getFolderName, getID
-
Field Details
-
villeCsvRow
-
-
Method Details
-
getUser
Returns the user identifier (typically an email address) from column 0.The value must contain both an
@
and a.
to be considered valid.- Specified by:
getUser
in interfaceVilleSubmissionFields
- Returns:
- trimmed user email
- Throws:
IllegalArgumentException
- if the user string is malformed
-
getFirstName
Returns the student's first name from column 1.Must not contain numeric characters.
- Specified by:
getFirstName
in interfaceVilleSubmissionFields
- Returns:
- trimmed first name
- Throws:
IllegalArgumentException
- if the name contains digits
-
getLastName
Returns the student's last name from column 2.Must not contain numeric characters.
- Specified by:
getLastName
in interfaceVilleSubmissionFields
- Returns:
- trimmed last name
- Throws:
IllegalArgumentException
- if the name contains digits
-
getTime
Returns the submission timestamp from column 3.Must conform to the format
yyyy-MM-dd
, e.g.,2025-03-10
.- Specified by:
getTime
in interfaceVilleSubmissionFields
- Returns:
- validated timestamp string
- Throws:
IllegalArgumentException
- if the value is not a valid date
-
getStudentId
Returns the student ID from column 4.This field is not validated by default due to wide variation in formats, including numeric IDs and Finnish-style OIDs. Implementations may override this method if stricter validation is needed.
- Specified by:
getStudentId
in interfaceVilleSubmissionFields
- Returns:
- trimmed student ID
-
getParentFolderName
Returns the base folder name used to group this submission under an outer task-level directory.In this implementation, the parent folder name is derived from the filename of the original ViLLe CSV export this submission was parsed from. Specifically, it strips the file extension from
viLLeCsvFile.getVilleCsvFile().getName()
to use as a stable identifier for grouping.This ensures that all submissions originating from the same export file are grouped under a consistent folder name, which is ideal for constructing deterministic output structures like:
clones/ └── Tehtävä_1.1_05092025_08_22_PM/ ├── antti15_Esimerkki_Antti/ └── ...
This method is called by
SubmissionCloner
or any other system component that requires layout information when rendering student submissions to disk.- Specified by:
getParentFolderName
in interfaceVilleSubmissionFields
- Returns:
- the original CSV filename without extension, used as parent folder name
-
getViLLeCsvFile
- Returns:
ViLLeCsvFile
object associated with this submission object.
-
getVilleCsvRow
- Returns:
- The original array used to construct this object.
-
toString
-