Class Submission
- java.lang.Object
-
- de.hsh.graja.transform.submission.Submission
-
public class Submission extends Object
-
-
Constructor Summary
Constructors Constructor Description Submission()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Content
createComment(boolean createIntro, String header, boolean createOutro)
static Map<String,Submission>
createMultiSubmission(File srcZipFile, String submissionNaturalLanguage, Integer maxSubmissionUnpackSizeKib, String expectedRootFolderInSubmissionZip, Collection<String> expectedAssignmentKeys, Map<String,List<FileRestrictionTO>> fileRestrictions, ContentLogger log)
unzip a zip file and load it into memory Source file's encodings are guessed and converted to utf8.static Submission
createSingleSubmission(File src, String submissionNaturalLanguage, Integer maxSubmissionUnpackSizeKib, String submissionRestrictionsDescription, String submissionRestrictionsInternalDescription, List<FileRestrictionTO> fileRestrictions, ContentLogger log)
Create a submission object from a submitted file and treat it as a single submission.boolean
isEmpty()
boolean
write(Path destDir, ContentLogger log)
Writes all data to files.
-
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
-
createSingleSubmission
public static Submission createSingleSubmission(File src, String submissionNaturalLanguage, Integer maxSubmissionUnpackSizeKib, String submissionRestrictionsDescription, String submissionRestrictionsInternalDescription, List<FileRestrictionTO> fileRestrictions, ContentLogger log) throws SubmissionException
Create a submission object from a submitted file and treat it as a single submission. If the submitted file is a zip file, this method unzips the zip file and loads it into memory. Otherwise the submitted file is treated as a text file submission (usually java source code). When reading the files encodings are guessed and converted to utf8.- Parameters:
srcFile
- The submitted zip file or src foldersubmissionNaturalLanguage
- mandatory parameter, ISO 639-1 code of the language that is assumed as natural language in the submitted files. This will be used to guess the right 8-bit-encoding.maxSubmissionUnpackSizeKib
- maximum size of sumissoin when nupacked to memory or disclog
- hook for comments (@see CommentCollection)- Returns:
- null, if failed
- Throws:
SubmissionException
-
createMultiSubmission
public static Map<String,Submission> createMultiSubmission(File srcZipFile, String submissionNaturalLanguage, Integer maxSubmissionUnpackSizeKib, String expectedRootFolderInSubmissionZip, Collection<String> expectedAssignmentKeys, Map<String,List<FileRestrictionTO>> fileRestrictions, ContentLogger log) throws SubmissionException
unzip a zip file and load it into memory Source file's encodings are guessed and converted to utf8. This method loads several submissions, one for each key inexpectedAssignmentKeys
. If the zip file does not contain files below one of the expected assignment subfolders, the respective entry in the result map is missing or points to an empty set.- Parameters:
srcZipFile
- The submitted zip filesubmissionNaturalLanguage
- mandatory parameter, ISO 639-1 code of the language that is assumed as natural language in the submitted files. This will be used to guess the right 8-bit-encoding.maxSubmissionUnpackSizeKib
- maximum size of submission then unpacked to memory or discexpectedRootFolderInSubmissionZip
- name of the expected root folderexpectedAssignmentKeys
- collection of assignment keysfileRestrictions
- list of file restrictions, separately per assignmentlog
- hook for comments (@see CommentCollection)- Returns:
- null, if failed
- Throws:
SubmissionException
-
write
public boolean write(Path destDir, ContentLogger log)
Writes all data to files.- Parameters:
destDir
- Path to target directory where to unpack the fileslog
- hook for comments (@see CommentCollection)- Returns:
- true on success
-
-