use of org.olat.course.nodes.IQSURVCourseNode in project openolat by klemens.
the class CourseQTIArchiveController method addQTINodesAndParentsToList.
/**
* Recursive method that adds tasks nodes and all its parents to a list
* @param recursionLevel
* @param courseNode
* @return A list of Object[indent, courseNode, selectable]
*/
private List<AssessmentNodeData> addQTINodesAndParentsToList(int recursionLevel, CourseNode courseNode) {
// 1) Get list of children data using recursion of this method
List<AssessmentNodeData> childrenData = new ArrayList<>();
for (int i = 0; i < courseNode.getChildCount(); i++) {
CourseNode child = (CourseNode) courseNode.getChildAt(i);
List<AssessmentNodeData> childData = addQTINodesAndParentsToList((recursionLevel + 1), child);
if (childData != null) {
childrenData.addAll(childData);
}
}
if (childrenData.size() > 0 || courseNode instanceof IQSURVCourseNode) {
// Store node data in hash map. This hash map serves as data model for
// the tasks overview table. Leave user data empty since not used in
// this table. (use only node data)
AssessmentNodeData nodeData = new AssessmentNodeData(recursionLevel, courseNode);
if (courseNode instanceof IQSURVCourseNode) {
nodeData.setSelectable(true);
} else {
nodeData.setSelectable(false);
}
List<AssessmentNodeData> nodeAndChildren = new ArrayList<>();
nodeAndChildren.add(nodeData);
nodeAndChildren.addAll(childrenData);
return nodeAndChildren;
}
return null;
}
Aggregations