use of uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction in project OpenOLAT by OpenOLAT.
the class AssessmentItemBuilderTest method buildAssessmentItem_essay.
@Test
public void buildAssessmentItem_essay() throws IOException, URISyntaxException {
QtiSerializer qtiSerializer = new QtiSerializer(new JqtiExtensionManager());
EssayAssessmentItemBuilder itemBuilder = new EssayAssessmentItemBuilder("Essay", qtiSerializer);
if (build.booleanValue()) {
itemBuilder.build();
}
AssessmentItem assessmentItem = itemBuilder.getAssessmentItem();
ItemValidationResult itemResult = serializeAndReload(assessmentItem);
AssessmentItem reloadedItem = itemResult.getResolvedAssessmentItem().getItemLookup().extractIfSuccessful();
List<Interaction> interactions = reloadedItem.getItemBody().findInteractions();
Assert.assertNotNull(interactions);
Assert.assertEquals(1, interactions.size());
Assert.assertTrue(interactions.get(0) instanceof ExtendedTextInteraction);
}
use of uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method appendExtendedTextInteraction.
public static ExtendedTextInteraction appendExtendedTextInteraction(ItemBody itemBody, Identifier responseDeclarationId) {
ExtendedTextInteraction textInteraction = new ExtendedTextInteraction(itemBody);
textInteraction.setResponseIdentifier(responseDeclarationId);
itemBody.getBlocks().add(textInteraction);
return textInteraction;
}
use of uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction in project openolat by klemens.
the class AssessmentTestHelper method needManualCorrection.
public static boolean needManualCorrection(AssessmentItemRef itemRef, ResolvedAssessmentTest resolvedAssessmentTest) {
ResolvedAssessmentItem resolvedAssessmentItem = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
if (resolvedAssessmentItem != null && resolvedAssessmentItem.getItemLookup() != null && resolvedAssessmentItem.getItemLookup().getRootNodeHolder() != null) {
AssessmentItem assessmentItem = resolvedAssessmentItem.getItemLookup().getRootNodeHolder().getRootNode();
List<Interaction> interactions = assessmentItem.getItemBody().findInteractions();
for (Interaction interaction : interactions) {
if (interaction instanceof UploadInteraction || interaction instanceof DrawingInteraction || interaction instanceof ExtendedTextInteraction) {
return true;
}
}
}
return false;
}
use of uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction in project openolat by klemens.
the class EssayAssessmentItemBuilder method getQuestionBlocks.
/**
* @return A copy of the list of blocks which make the question.
* The list is a copy and modification will not be persisted.
*/
public List<Block> getQuestionBlocks() {
List<Block> blocks = assessmentItem.getItemBody().getBlocks();
List<Block> questionBlocks = new ArrayList<>(blocks.size());
for (Block block : blocks) {
if (block instanceof ExtendedTextInteraction) {
break;
} else {
questionBlocks.add(block);
}
}
return questionBlocks;
}
Aggregations