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); } } } }
private void doEditNodeAssessment(UserRequest ureq, AssessableCourseNode courseNode) { if (mayEdit) { ICourse course = CourseFactory.loadCourse(ores); UserCourseInformationsManager userCourseInformationsManager = CoreSpringFactory.getImpl(UserCourseInformationsManager.class); Date initialLaunchDate = userCourseInformationsManager.getInitialLaunchDate( ores.getResourceableId(), assessedUserCourseEnvironment.getIdentityEnvironment().getIdentity()); AssessedIdentityWrapper assessedIdentityWrapper = AssessmentHelper.wrapIdentity( assessedUserCourseEnvironment, initialLaunchDate, courseNode); assessmentEditCtr = new AssessmentEditController( ureq, getWindowControl(), stackPanel, course, courseNode, assessedIdentityWrapper); listenTo(assessmentEditCtr); main.setContent(assessmentEditCtr.getInitialComponent()); } else { throw new OLATSecurityException( "doEditNodeAssessment() called but controller configured with mayEdit=false"); } }