use of uk.ac.ed.ph.jqtiplus.node.content.basic.Block in project OpenOLAT by OpenOLAT.
the class MatchAssessmentItemBuilder 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 MatchInteraction) {
break;
} else {
questionBlocks.add(block);
}
}
return questionBlocks;
}
use of uk.ac.ed.ph.jqtiplus.node.content.basic.Block in project OpenOLAT by OpenOLAT.
the class SimpleChoiceAssessmentItemBuilder method extractChoiceInteraction.
private void extractChoiceInteraction() {
try (StringOutput sb = new StringOutput()) {
List<Block> blocks = assessmentItem.getItemBody().getBlocks();
for (Block block : blocks) {
if (block instanceof ChoiceInteraction) {
choiceInteraction = (ChoiceInteraction) block;
responseIdentifier = choiceInteraction.getResponseIdentifier();
shuffle = choiceInteraction.getShuffle();
break;
} else if (block != null) {
serializeJqtiObject(block, sb);
}
}
question = sb.toString();
} catch (IOException e) {
log.error("", e);
}
choices = new ArrayList<>();
if (choiceInteraction != null) {
choices.addAll(choiceInteraction.getSimpleChoices());
orientation = choiceInteraction.getOrientation();
cssClass = choiceInteraction.getClassAttr();
maxChoices = choiceInteraction.getMaxChoices();
minChoices = choiceInteraction.getMinChoices();
}
}
use of uk.ac.ed.ph.jqtiplus.node.content.basic.Block in project OpenOLAT by OpenOLAT.
the class UploadAssessmentItemBuilder method extractExtendedTextInteraction.
private void extractExtendedTextInteraction() {
try (StringOutput sb = new StringOutput()) {
List<Block> blocks = assessmentItem.getItemBody().getBlocks();
for (Block block : blocks) {
if (block instanceof UploadInteraction) {
uploadInteraction = (UploadInteraction) block;
responseIdentifier = uploadInteraction.getResponseIdentifier();
break;
} else {
serializeJqtiObject(block, sb);
}
}
question = sb.toString();
} catch (IOException e) {
log.error("", e);
}
}
use of uk.ac.ed.ph.jqtiplus.node.content.basic.Block in project OpenOLAT by OpenOLAT.
the class UploadAssessmentItemBuilder 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 UploadInteraction) {
break;
} else {
questionBlocks.add(block);
}
}
return questionBlocks;
}
use of uk.ac.ed.ph.jqtiplus.node.content.basic.Block in project OpenOLAT by OpenOLAT.
the class HottextAssessmentItemBuilder method extractHottextInteraction.
private void extractHottextInteraction() {
try (StringOutput sb = new StringOutput()) {
List<Block> blocks = assessmentItem.getItemBody().getBlocks();
for (Block block : blocks) {
if (block instanceof HottextInteraction) {
hottextInteraction = (HottextInteraction) block;
for (BlockStatic innerBlock : hottextInteraction.getBlockStatics()) {
serializeJqtiObject(innerBlock, sb);
}
responseIdentifier = hottextInteraction.getResponseIdentifier();
break;
}
}
question = sb.toString();
} catch (IOException e) {
log.error("", e);
}
}
Aggregations