public IdentityAssessmentEditController( WindowControl wControl, UserRequest ureq, StackedController stackPanel, Identity assessedIdentity, ICourse course, boolean mayEdit, boolean headers) { super(ureq, wControl); this.stackPanel = stackPanel; this.mayEdit = mayEdit; main = new Panel("main"); assessedUserCourseEnvironment = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course); this.ores = OresHelper.clone(course); this.headers = headers; doIdentityAssessmentOverview(ureq, true); putInitialPanel(main); BusinessControl bc = getWindowControl().getBusinessControl(); ContextEntry ce = bc.popLauncherContextEntry(); if (ce != null) { OLATResourceable oresNode = ce.getOLATResourceable(); if (OresHelper.isOfType(oresNode, CourseNode.class)) { Long courseNodeId = oresNode.getResourceableId(); Structure runStructure = assessedUserCourseEnvironment.getCourseEnvironment().getRunStructure(); CourseNode courseNode = runStructure.getNode(courseNodeId.toString()); if (courseNode instanceof AssessableCourseNode) { doEditNodeAssessment(ureq, (AssessableCourseNode) courseNode); } } } }
/** * Utility method.<br> * Build (recursively) the list of all test nodes belonging to the specified <code>ICourse</code>. * <br> * The returned <code>List</code> is empty if course has no AssessableCourseNode. Structure course * node are excluded from the list.<br> * <br> * <b>PRE CONDITIONS</b> * * <ul> * <li><code>course != null</code> * </ul> * * <br> * <b>POST CONDITIONS</b> * * <ul> * <li>The returned list, if not empty, contains ONLY instances of type <code> * AssessableCourseNode</code> * </ul> */ private List<AssessableCourseNode> getCourseTestNodes(ICourse course) { List<AssessableCourseNode> assessableNodes = new ArrayList<AssessableCourseNode>(); Structure courseStruct = course.getRunStructure(); CourseNode rootNode = courseStruct.getRootNode(); getCourseTestNodes(rootNode, assessableNodes); return assessableNodes; }