use of uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing in project OpenOLAT by OpenOLAT.
the class DrawingAssessmentItemBuilder method createAssessmentItem.
private static AssessmentItem createAssessmentItem(String title) {
AssessmentItem assessmentItem = AssessmentItemFactory.createAssessmentItem(QTI21QuestionType.drawing, title);
// define the response
Identifier responseDeclarationId = Identifier.assumedLegal("RESPONSE_1");
ResponseDeclaration responseDeclaration = createDrawingResponseDeclaration(assessmentItem, responseDeclarationId);
assessmentItem.getNodeGroups().getResponseDeclarationGroup().getResponseDeclarations().add(responseDeclaration);
// outcomes
appendDefaultOutcomeDeclarations(assessmentItem, 1.0d);
ItemBody itemBody = appendDefaultItemBody(assessmentItem);
appendDrawingInteraction(itemBody, responseDeclarationId);
// response processing
ResponseProcessing responseProcessing = createResponseProcessing(assessmentItem, responseDeclarationId);
assessmentItem.getNodeGroups().getResponseProcessingGroup().setResponseProcessing(responseProcessing);
return assessmentItem;
}
use of uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing in project OpenOLAT by OpenOLAT.
the class FIBAssessmentItemBuilder method createAssessmentItem.
private static AssessmentItem createAssessmentItem(String title, EntryType type) {
AssessmentItem assessmentItem = AssessmentItemFactory.createAssessmentItem(QTI21QuestionType.fib, title);
// define the response
Identifier responseDeclarationId = Identifier.assumedLegal("RESPONSE_1");
if (type == EntryType.numerical) {
ResponseDeclaration responseDeclaration = createNumericalEntryResponseDeclaration(assessmentItem, responseDeclarationId, 42);
assessmentItem.getNodeGroups().getResponseDeclarationGroup().getResponseDeclarations().add(responseDeclaration);
} else {
ResponseDeclaration responseDeclaration = createTextEntryResponseDeclaration(assessmentItem, responseDeclarationId, "gap", Collections.emptyList());
assessmentItem.getNodeGroups().getResponseDeclarationGroup().getResponseDeclarations().add(responseDeclaration);
}
// outcomes
appendDefaultOutcomeDeclarations(assessmentItem, 1.0d);
ItemBody itemBody = appendDefaultItemBody(assessmentItem);
appendTextEntryInteraction(itemBody, responseDeclarationId);
// response processing
ResponseProcessing responseProcessing = createResponseProcessing(assessmentItem, responseDeclarationId);
assessmentItem.getNodeGroups().getResponseProcessingGroup().setResponseProcessing(responseProcessing);
return assessmentItem;
}
use of uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing in project OpenOLAT by OpenOLAT.
the class AssessmentItemBuilder method build.
public final void build() {
List<OutcomeDeclaration> outcomeDeclarations = assessmentItem.getOutcomeDeclarations();
outcomeDeclarations.clear();
ResponseProcessing responseProcessing = assessmentItem.getResponseProcessing();
List<ResponseRule> responseRules = responseProcessing.getResponseRules();
responseRules.clear();
List<ResponseDeclaration> responseDeclarations = assessmentItem.getResponseDeclarations();
responseDeclarations.clear();
List<ModalFeedback> modalFeedbacks = assessmentItem.getModalFeedbacks();
modalFeedbacks.clear();
buildItemBody();
buildResponseAndOutcomeDeclarations();
buildModalFeedbacksAndHints(outcomeDeclarations, responseRules);
buildMinMaxScores(outcomeDeclarations, responseRules);
buildMainScoreRule(outcomeDeclarations, responseRules);
buildHint(outcomeDeclarations, responseRules);
}
use of uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing in project OpenOLAT by OpenOLAT.
the class MultipleChoiceAssessmentItemBuilder method createAssessmentItem.
private static AssessmentItem createAssessmentItem(String title, String defaultAnswer) {
AssessmentItem assessmentItem = AssessmentItemFactory.createAssessmentItem(QTI21QuestionType.mc, title);
NodeGroupList nodeGroups = assessmentItem.getNodeGroups();
Identifier responseDeclarationId = Identifier.assumedLegal("RESPONSE_1");
Identifier correctResponseId = IdentifierGenerator.newAsIdentifier("mc");
// define correct answer
ResponseDeclaration responseDeclaration = createMultipleChoiceCorrectResponseDeclaration(assessmentItem, responseDeclarationId, Collections.singletonList(correctResponseId));
nodeGroups.getResponseDeclarationGroup().getResponseDeclarations().add(responseDeclaration);
// outcomes
appendDefaultOutcomeDeclarations(assessmentItem, 1.0d);
// the single choice interaction
ItemBody itemBody = appendDefaultItemBody(assessmentItem);
ChoiceInteraction choiceInteraction = appendChoiceInteraction(itemBody, responseDeclarationId, 0, true);
appendSimpleChoice(choiceInteraction, defaultAnswer, correctResponseId);
// response processing
ResponseProcessing responseProcessing = createResponseProcessing(assessmentItem, responseDeclarationId);
assessmentItem.getNodeGroups().getResponseProcessingGroup().setResponseProcessing(responseProcessing);
return assessmentItem;
}
use of uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing in project OpenOLAT by OpenOLAT.
the class SingleChoiceAssessmentItemBuilder method createAssessmentItem.
private static AssessmentItem createAssessmentItem(String title, String defaultAnswer) {
AssessmentItem assessmentItem = AssessmentItemFactory.createAssessmentItem(QTI21QuestionType.sc, title);
// define correct answer
Identifier responseDeclarationId = Identifier.assumedLegal("RESPONSE_1");
Identifier correctResponseId = IdentifierGenerator.newAsIdentifier("sc");
ResponseDeclaration responseDeclaration = createSingleChoiceCorrectResponseDeclaration(assessmentItem, responseDeclarationId, correctResponseId);
assessmentItem.getNodeGroups().getResponseDeclarationGroup().getResponseDeclarations().add(responseDeclaration);
// outcomes
appendDefaultOutcomeDeclarations(assessmentItem, 1.0d);
// the single choice interaction
ItemBody itemBody = appendDefaultItemBody(assessmentItem);
ChoiceInteraction choiceInteraction = appendChoiceInteraction(itemBody, responseDeclarationId, 1, true);
appendSimpleChoice(choiceInteraction, defaultAnswer, correctResponseId);
// response processing
ResponseProcessing responseProcessing = createResponseProcessing(assessmentItem, responseDeclarationId);
assessmentItem.getNodeGroups().getResponseProcessingGroup().setResponseProcessing(responseProcessing);
return assessmentItem;
}
Aggregations