use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef in project OpenOLAT by OpenOLAT.
the class QTI21StatisticResourceResult method getAssessmentItems.
public List<AssessmentItem> getAssessmentItems() {
List<AssessmentItemRef> itemRefs = resolvedAssessmentTest.getAssessmentItemRefs();
List<AssessmentItem> items = new ArrayList<>(itemRefs.size());
for (AssessmentItemRef itemRef : itemRefs) {
AssessmentItem item = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef).getRootNodeLookup().extractIfSuccessful();
items.add(item);
}
return items;
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef in project OpenOLAT by OpenOLAT.
the class AssessmentTestEditorAndComposerTreeModel method buildRecursively.
private void buildRecursively(AssessmentSection section, TreeNode parentNode) {
GenericTreeNode sectionNode = new GenericTreeNode(section.getIdentifier().toString());
sectionNode.setTitle(section.getTitle());
sectionNode.setIconCssClass("o_icon o_mi_qtisection");
sectionNode.setUserObject(section);
parentNode.addChild(sectionNode);
for (SectionPart part : section.getSectionParts()) {
if (part instanceof AssessmentItemRef) {
buildRecursively((AssessmentItemRef) part, sectionNode);
} else if (part instanceof AssessmentSection) {
buildRecursively((AssessmentSection) part, sectionNode);
}
}
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef in project OpenOLAT by OpenOLAT.
the class AssessmentTestFactory method appendAssessmentItem.
public static void appendAssessmentItem(AssessmentSection section, String itemFilename) throws URISyntaxException {
AssessmentItemRef item = new AssessmentItemRef(section);
item.setIdentifier(IdentifierGenerator.newAsIdentifier("ai"));
item.setHref(new URI(itemFilename));
section.getSectionParts().add(item);
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef in project OpenOLAT by OpenOLAT.
the class QTI21WordExport method renderAssessmentSection.
public void renderAssessmentSection(AssessmentSection assessmentSection, OpenXMLDocument document, boolean withResponses, Translator translator) {
String title = assessmentSection.getTitle();
document.appendHeading1(title, null);
List<RubricBlock> rubricBlocks = assessmentSection.getRubricBlocks();
for (RubricBlock rubricBlock : rubricBlocks) {
String htmlRubric = htmlBuilder.blocksString(rubricBlock.getBlocks());
document.appendHtmlText(htmlRubric, true);
}
for (SectionPart sectionPart : assessmentSection.getChildAbstractParts()) {
if (sectionPart instanceof AssessmentSection) {
renderAssessmentSection((AssessmentSection) sectionPart, document, withResponses, translator);
} else if (sectionPart instanceof AssessmentItemRef) {
AssessmentItemRef itemRef = (AssessmentItemRef) sectionPart;
ResolvedAssessmentItem resolvedAssessmentItem = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
AssessmentItem assessmentItem = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
URI itemUri = resolvedAssessmentTest.getSystemIdByItemRefMap().get(itemRef);
renderAssessmentItem(assessmentItem, new File(itemUri), mediaDir, document, withResponses, translator, htmlBuilder);
document.appendPageBreak();
}
}
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef in project openolat by klemens.
the class BigAssessmentTestPackageBuilder method openBigTest_sub.
public long openBigTest_sub() {
final File resourceFile = new File("/HotCoffee/QTI/20160219-180424/testfa908329-ab44-4821-a20d-ca634b6afb06.xml");
final QtiXmlReader qtiXmlReader = UnitTestHelper.createUnitTestQtiXmlReader();
final ResourceLocator fileResourceLocator = new FileResourceLocator();
final long start = System.nanoTime();
final AssessmentObjectXmlLoader assessmentObjectXmlLoader = new AssessmentObjectXmlLoader(qtiXmlReader, fileResourceLocator);
final ResolvedAssessmentTest resolvedTest = assessmentObjectXmlLoader.loadAndResolveAssessmentTest(resourceFile.toURI());
Assert.assertNotNull(resolvedTest);
final AssessmentTest test = resolvedTest.getTestLookup().extractIfSuccessful();
Assert.assertNotNull(test);
final long time = (System.nanoTime() - start);
final AssessmentItemRef itemRef = resolvedTest.getAssessmentItemRefs().get(0);
final ResolvedAssessmentItem resolvedItem = resolvedTest.getResolvedAssessmentItem(itemRef);
Assert.assertNotNull(resolvedItem);
final AssessmentItem item = resolvedItem.getRootNodeLookup().extractIfSuccessful();
Assert.assertNotNull(item);
Assert.assertEquals(1, item.getItemBody().findInteractions().size());
return time;
}
Aggregations