Class TransformBetweenTaskZipAndStarter
This class gets one or several assignments and a student submission as input and produces a request file, that subsequently can be graded by Graja.
The converter makes simplifying assumptions about the requested types of documents, that need to be generated by Graja (= {INFO,SEVERE} x {TEACHER,STUDENT} x {html,plain}).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TaskZipExtracted
extractTaskZip
(String pathToTaskZip, Path workspace, BigDecimal scoreMax, Integer scorePrecision) Constructs an object containing all valuable information of a task.zip resource.static TaskZipExtracted
extractTaskZip1stPhase
(String pathToTaskZip, Path workspace) Performs the first phase including: unzip, create necessary directories, read and unmarshal tpl file (if any).static TaskZipExtracted
extractTaskZip1stPhaseReturnException
(String pathToTaskZip, Path workspace) Performs the first phase including: unzip, create necessary directories, read and unmarshal tpl file (if any).static TaskZipExtracted
extractTaskZip2ndPhase
(TaskZipExtracted tzeIncomplete, BigDecimal scoreMax, Integer scorePrecision) static TaskZipExtracted
extractTaskZip2ndPhaseReturnException
(TaskZipExtracted tzeIncomplete, BigDecimal scoreMax, Integer scorePrecision) generateFrontendProformaSubmissionRequestTOFromTaskZip
(String srcPathToSubmission, String srcPathToTaskZip, String submissionNaturalLanguage, Integer maxSubmissionUnpackSizeKib, BigDecimal scoreMax, Integer scorePrecision, DebugSwitchesTO debugSwitches, ResultSpecTO resultSpecIn, Path tmpdir) This method creates an instance ofFrontendProformaSubmissionRequestTO
from an assignment and a submission.static RequestTO
generateGrajaMultiRequestTOFromTaskZipList
(Variant variant, String pathToSubmissionZip, String expectedRootFolderInSubmissionZip, ArrayList<Map.Entry<String, String>> pathsToTaskZips, String submissionNaturalLanguage, Integer maxSubmissionUnpackSizeKib, ArrayList<BigDecimal> scoreMaxList, Integer scorePrecision, DebugSwitchesTO debugSwitches, ResultSpecTO resultSpec, Path tmpdir) This method creates an instance ofFrontendGrajaMultiRequestTO
from a collection of assignments and a submission.static FrontendGrajaSingleRequestTO
generateGrajaSingleFrontendRequestTOFromTaskZip
(boolean proforma, String pathToSubmission, String pathToTaskZip, String submissionNaturalLanguage, Integer maxSubmissionUnpackSizeKib, BigDecimal scoreMax, Integer scorePrecision, DebugSwitchesTO debugSwitches, ResultSpecTO resultSpec, Path tmpdir) This method creates an instance ofFrontendGrajaSingleRequestTO
orBackendRequestTO
from an assignment and a submission.static Path
generateProformaSubmissionFromTaskZip
(String srcPathToSubmission, String srcPathToTaskZip, String submissionNaturalLanguage, Integer maxSubmissionUnpackSizeKib, BigDecimal scoreMax, Integer scorePrecision, DebugSwitchesTO debugSwitches, ResultSpecTO resultSpecIn, Path tmpdir) This method creates an instance ofFrontendProformaSubmissionRequestTO
from an assignment and a submission.static FeedbackLevelType
static Test
getTestByTestType
(List<Test> tests, String testType) static Task
static Task
readTaskXml
(Path pathToTaskXml) static TemplateSpec
static TemplateSpec
readTplXml
(Path pathToTplXml)
-
Constructor Details
-
TransformBetweenTaskZipAndStarter
public TransformBetweenTaskZipAndStarter()
-
-
Method Details
-
generateProformaSubmissionFromTaskZip
public static Path generateProformaSubmissionFromTaskZip(String srcPathToSubmission, String srcPathToTaskZip, String submissionNaturalLanguage, Integer maxSubmissionUnpackSizeKib, BigDecimal scoreMax, Integer scorePrecision, DebugSwitchesTO debugSwitches, ResultSpecTO resultSpecIn, Path tmpdir) throws IllegalArgumentException, IOException, javax.xml.bind.JAXBException This method creates an instance of
FrontendProformaSubmissionRequestTO
from an assignment and a submission. The resulting object can be used as input to Graja for grading.- Parameters:
srcPathToSubmission
- input zip file or input folder for the student submissionsrcPathToTaskZip
- input file for the assignment in proforma task.zip formatsubmissionNaturalLanguage
- ISO-639-1 code of the language that is assumed to be used in the submitted files. This will be used to guess the right 8-bit-encoding.maxSubmissionUnpackSizeKib
- maximum KiB allowed for unzipped submissionscoreMax
- the target maximum score. If not null, the resulting assignment will be scaled to that target score.scorePrecision
- number of decimal digits of scaled scores.debugSwitches
- input data for debug switchesresultSpec
- input data for result specificationtmpdir
- must point to an existing path that can be used to create temporary files.- Returns:
- A request of the specified type
- Throws:
IllegalArgumentException
IOException
javax.xml.bind.JAXBException
-
generateFrontendProformaSubmissionRequestTOFromTaskZip
public static FrontendProformaSubmissionRequestTO generateFrontendProformaSubmissionRequestTOFromTaskZip(String srcPathToSubmission, String srcPathToTaskZip, String submissionNaturalLanguage, Integer maxSubmissionUnpackSizeKib, BigDecimal scoreMax, Integer scorePrecision, DebugSwitchesTO debugSwitches, ResultSpecTO resultSpecIn, Path tmpdir) throws IllegalArgumentException, IOException, javax.xml.bind.JAXBException This method creates an instance of
FrontendProformaSubmissionRequestTO
from an assignment and a submission. The resulting object can be used as input to Graja for grading.- Parameters:
srcPathToSubmission
- input zip file or input folder for the student submissionsrcPathToTaskZip
- input file for the assignment in proforma task.zip formatsubmissionNaturalLanguage
- ISO-639-1 code of the language that is assumed to be used in the submitted files. This will be used to guess the right 8-bit-encoding.maxSubmissionUnpackSizeKib
- maximum KiB allowed for unzipped submissionscoreMax
- the target maximum score. If not null, the resulting assignment will be scaled to that target score.scorePrecision
- number of decimal digits of scaled scores.debugSwitches
- input data for debug switchesresultSpec
- input data for result specificationtmpdir
- must point to an existing path that can be used to create temporary files.- Returns:
- A request of the specified type
- Throws:
IllegalArgumentException
IOException
javax.xml.bind.JAXBException
-
getProformaSubmissionFeedbackLevel
-
generateGrajaSingleFrontendRequestTOFromTaskZip
public static FrontendGrajaSingleRequestTO generateGrajaSingleFrontendRequestTOFromTaskZip(boolean proforma, String pathToSubmission, String pathToTaskZip, String submissionNaturalLanguage, Integer maxSubmissionUnpackSizeKib, BigDecimal scoreMax, Integer scorePrecision, DebugSwitchesTO debugSwitches, ResultSpecTO resultSpec, Path tmpdir) throws IllegalArgumentException, IOException, javax.xml.bind.JAXBException This method creates an instance of
FrontendGrajaSingleRequestTO
orBackendRequestTO
from an assignment and a submission. The resulting object can be used as input to Graja for grading.- Parameters:
proforma
- if true, this method returns aVariant.FRONTEND_GRAJA_SINGLE_PROFORMA
object, else aVariant.FRONTEND_GRAJA_SINGLE_PLAINOLD
object. and specifies, which request type is generated.pathToSubmission
- input zip file or input folder for the student submissionpathToTaskZip
- input file for the assignment in proforma task.zip formatsubmissionNaturalLanguage
- ISO-639-1 code of the language that is assumed to be used in the submitted files. This will be used to guess the right 8-bit-encoding.maxSubmissionUnpackSizeKib
- maximum KiB allowed for unzipped submissionscoreMax
- the target maximum score. If not null, the resulting assignment will be scaled to that target score.scorePrecision
- number of decimal digits of scaled scores.debugSwitches
- input data for debug switchesresultSpec
- input data for result specificationtmpdir
- must point to an existing path that can be used to create temporary files.- Returns:
- A request of the specified type
- Throws:
IllegalArgumentException
ResourceDBLockedException
IOException
javax.xml.bind.JAXBException
-
generateGrajaMultiRequestTOFromTaskZipList
public static RequestTO generateGrajaMultiRequestTOFromTaskZipList(Variant variant, String pathToSubmissionZip, String expectedRootFolderInSubmissionZip, ArrayList<Map.Entry<String, String>> pathsToTaskZips, String submissionNaturalLanguage, Integer maxSubmissionUnpackSizeKib, ArrayList<BigDecimal> scoreMaxList, Integer scorePrecision, DebugSwitchesTO debugSwitches, ResultSpecTO resultSpec, Path tmpdir) throws IllegalArgumentException, IOException, javax.xml.bind.JAXBExceptionThis method creates an instance of
FrontendGrajaMultiRequestTO
from a collection of assignments and a submission. The resulting object can be used as input to Graja for grading.- Parameters:
variant
- must be one of {Variant.FRONTEND_GRAJA_MULTI_PLAINOLD
,Variant.FRONTEND_GRAJA_MULTI_PROFORMA
} and specifies, which request type is generated.pathToSubmissionZip
- input file for the student submissionexpectedRootFolderInSubmissionZip
- denotes the expected root folder in the submissionpathsToTaskZips
- input files for the assignment in proforma task.zip format. Every entry is a pair of an assignment key and an assignment. The key serves as an expected directory name inside the submission zip file.submissionNaturalLanguage
- ISO-639-1 code of the language that is assumed to be used in the submitted files. This will be used to guess the right 8-bit-encoding.maxSubmissionUnpackSizeKib
- maximum KiB allowed for unzipped submissionscoreMax
- the target maximum score (one for each task). If not null, the resulting assignments will be scaled to that target score.scorePrecision
- number of decimal digits of scaled scores.debugSwitches
- input data for debug switchesresultSpec
- input data for result specificationtmpdir
- must point to an existing path that can be used to create temporary files.- Returns:
- A request of the specified
variant
- Throws:
IllegalArgumentException
IOException
javax.xml.bind.JAXBException
-
extractTaskZip
public static TaskZipExtracted extractTaskZip(String pathToTaskZip, Path workspace, BigDecimal scoreMax, Integer scorePrecision) throws IllegalArgumentException, IOException, javax.xml.bind.JAXBException Constructs an object containing all valuable information of a task.zip resource.- Throws:
IllegalArgumentException
IOException
javax.xml.bind.JAXBException
-
extractTaskZip1stPhase
public static TaskZipExtracted extractTaskZip1stPhase(String pathToTaskZip, Path workspace) throws IllegalArgumentException, IOException, javax.xml.bind.JAXBException Performs the first phase including: unzip, create necessary directories, read and unmarshal tpl file (if any). On success the following data of the result object is included: unzipOk=true, exception=null, all path* are set, all tpl* are set, taskXmlFilename is set, task=null. On error, instead an exception is thrown.- Throws:
IllegalArgumentException
IOException
javax.xml.bind.JAXBException
-
extractTaskZip2ndPhase
public static TaskZipExtracted extractTaskZip2ndPhase(TaskZipExtracted tzeIncomplete, BigDecimal scoreMax, Integer scorePrecision) throws IllegalArgumentException, IOException, javax.xml.bind.JAXBException - Parameters:
tzeIncomplete
- must include the following data: unzip=true, exception=null, all path* are set, all tpl* are set, taskXmlFilename is set, task=null.- Throws:
IllegalArgumentException
IOException
javax.xml.bind.JAXBException
-
extractTaskZip1stPhaseReturnException
public static TaskZipExtracted extractTaskZip1stPhaseReturnException(String pathToTaskZip, Path workspace) Performs the first phase including: unzip, create necessary directories, read and unmarshal tpl file (if any). On success the following data of the result object is included: unzipOk=true, exception=null, all path* are set, all tpl* are set, taskXmlFilename is set, task=null. On error, exception is set (!=null). -
extractTaskZip2ndPhaseReturnException
public static TaskZipExtracted extractTaskZip2ndPhaseReturnException(TaskZipExtracted tzeIncomplete, BigDecimal scoreMax, Integer scorePrecision) - Parameters:
tzeIncomplete
- must include the following data: unzip=true, exception=null, all path* are set, all tpl* are set, taskXmlFilename is set, task=null.
-
readTplXml
public static TemplateSpec readTplXml(InputStream in) throws javax.xml.bind.JAXBException, IOException - Throws:
javax.xml.bind.JAXBException
IOException
-
readTaskXml
- Throws:
javax.xml.bind.JAXBException
IOException
-
readTplXml
public static TemplateSpec readTplXml(Path pathToTplXml) throws javax.xml.bind.JAXBException, IOException - Throws:
javax.xml.bind.JAXBException
IOException
-
readTaskXml
- Throws:
javax.xml.bind.JAXBException
IOException
-
getTestByTestType
-