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 TaskZipExtractedextractTaskZip(String pathToTaskZip, Path workspace, BigDecimal scoreMax, Integer scorePrecision) Constructs an object containing all valuable information of a task.zip resource.static TaskZipExtractedextractTaskZip1stPhase(String pathToTaskZip, Path workspace) Performs the first phase including: unzip, create necessary directories, read and unmarshal tpl file (if any).static TaskZipExtractedextractTaskZip1stPhaseReturnException(String pathToTaskZip, Path workspace) Performs the first phase including: unzip, create necessary directories, read and unmarshal tpl file (if any).static TaskZipExtractedextractTaskZip2ndPhase(TaskZipExtracted tzeIncomplete, BigDecimal scoreMax, Integer scorePrecision) static TaskZipExtractedextractTaskZip2ndPhaseReturnException(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 ofFrontendProformaSubmissionRequestTOfrom an assignment and a submission.static FrontendGrajaRequestTOgenerateGrajaFrontendRequestTOFromTaskZip(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 ofFrontendGrajaRequestTOorBackendRequestTOfrom an assignment and a submission.static PathgenerateProformaSubmissionFromTaskZip(String srcPathToSubmission, String srcPathToTaskZip, String submissionNaturalLanguage, Integer maxSubmissionUnpackSizeKib, BigDecimal scoreMax, Integer scorePrecision, DebugSwitchesTO debugSwitches, ResultSpecTO resultSpecIn, Path tmpdir) This method creates an instance ofFrontendProformaSubmissionRequestTOfrom an assignment and a submission.static FeedbackLevelTypestatic TestgetTestByTestType(List<Test> tests, String testType) static Taskstatic TaskreadTaskXml(Path pathToTaskXml) static TemplateSpecstatic TemplateSpecreadTplXml(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
FrontendProformaSubmissionRequestTOfrom 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:
IllegalArgumentExceptionIOExceptionjavax.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
FrontendProformaSubmissionRequestTOfrom 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:
IllegalArgumentExceptionIOExceptionjavax.xml.bind.JAXBException
-
getProformaSubmissionFeedbackLevel
-
generateGrajaFrontendRequestTOFromTaskZip
public static FrontendGrajaRequestTO generateGrajaFrontendRequestTOFromTaskZip(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
FrontendGrajaRequestTOorBackendRequestTOfrom 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_PROFORMAobject, else aVariant.FRONTEND_GRAJA_PLAINOLDobject. 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:
IllegalArgumentExceptionResourceDBLockedExceptionIOExceptionjavax.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:
IllegalArgumentExceptionIOExceptionjavax.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:
IllegalArgumentExceptionIOExceptionjavax.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:
IllegalArgumentExceptionIOExceptionjavax.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.JAXBExceptionIOException
-
readTaskXml
- Throws:
javax.xml.bind.JAXBExceptionIOException
-
readTplXml
public static TemplateSpec readTplXml(Path pathToTplXml) throws javax.xml.bind.JAXBException, IOException - Throws:
javax.xml.bind.JAXBExceptionIOException
-
readTaskXml
- Throws:
javax.xml.bind.JAXBExceptionIOException
-
getTestByTestType
-