Examples of UserCourseEnvironmentImpl


Examples of org.olat.course.run.userview.UserCourseEnvironmentImpl

    //store ScoreEvaluation for the assessableCourseNode and student
    ScoreEvaluation scoreEvaluation = new ScoreEvaluation(score,passed, assessmentID);
   
    IdentityEnvironment ienv = new IdentityEnvironment();
    ienv.setIdentity(student);
    UserCourseEnvironment userCourseEnv = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
    boolean incrementAttempts = true;
    //assessableCourseNode.updateUserScoreEvaluation(scoreEvaluation, userCourseEnv, tutor, incrementAttempts); //alternative
     assessmentManager.saveScoreEvaluation(assessableCourseNode, tutor, student, scoreEvaluation, userCourseEnv, incrementAttempts);
     DBFactory.getInstance().closeSession();
     //the attempts mut have been incremented
View Full Code Here

Examples of org.olat.course.run.userview.UserCourseEnvironmentImpl

    assertNull(efficiencyStatement);
   
    //updateUserEfficiencyStatement of the student identity
    IdentityEnvironment ienv = new IdentityEnvironment();
    ienv.setIdentity(student);
    UserCourseEnvironment userCourseEnv = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
    efficiencyStatementManager.updateUserEfficiencyStatement(userCourseEnv);
    DBFactory.getInstance().closeSession();
    //check again the stored EfficiencyStatement 
    efficiencyStatement = checkEfficiencyStatement(courseRepositoryEntry);
   
View Full Code Here

Examples of org.olat.course.run.userview.UserCourseEnvironmentImpl

    }   
    if (type instanceof CourseHandler) {
      // course
      ICourse course = CourseFactory.loadCourse(repositoryEntry.getOlatResource());
      CourseNode rootNode = course.getRunStructure().getRootNode();
      UserCourseEnvironmentImpl uce = new UserCourseEnvironmentImpl(ureq.getUserSession().getIdentityEnvironment(), course
          .getCourseEnvironment());
      NodeEvaluation nodeEval = rootNode.eval(uce.getConditionInterpreter(), new TreeEvaluation());
      boolean mayAccessWholeTreeUp = NavigationHandler.mayAccessWholeTreeUp(nodeEval);
      if (!mayAccessWholeTreeUp || !nodeEval.isVisible()) {
        String explan = rootNode.getNoAccessExplanation();
        String sExplan = (explan == null ? translate("launch.noaccess") : Formatter.formatLatexFormulas(explan));
        main.contextPut("disabledlaunchreason", sExplan);
View Full Code Here

Examples of org.olat.course.run.userview.UserCourseEnvironmentImpl

      if (identityAndItsUserComment[0] != null){
       
        if (allowedIdKeys.contains(((Identity)identityAndItsUserComment[0]).getKey())){
          IdentityEnvironment ienv = new IdentityEnvironment();
          ienv.setIdentity((Identity)identityAndItsUserComment[0]);
          UserCourseEnvironment uce = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
          String userComment = (String) identityAndItsUserComment[1];
          if(userComment != null && !userComment.equals("")){
            if (hasUserComment){
                // Update userComment in db
                courseNode.updateUserUserComment(userComment, uce, coachIdentity);
View Full Code Here

Examples of org.olat.course.run.userview.UserCourseEnvironmentImpl

    // preload user assessment data in assessmnt properties cache to speed up
    // course loading
    course.getCourseEnvironment().getAssessmentManager().preloadCache(identity);

    // build up the running structure for this user;
    uce = new UserCourseEnvironmentImpl(ureq.getUserSession().getIdentityEnvironment(), course.getCourseEnvironment());
    // build score now
    uce.getScoreAccounting().evaluateAll();
    navHandler = new NavigationHandler(uce, false);

    // jump to either the forum or the folder if the business-launch-path says
View Full Code Here

Examples of org.olat.course.run.userview.UserCourseEnvironmentImpl

          currentToolCtr = null;
          if (needsRebuildAfterPublish) {
            needsRebuildAfterPublish = false;
           
            // rebuild up the running structure for this user, after publish;
            uce = new UserCourseEnvironmentImpl(ureq.getUserSession().getIdentityEnvironment(), CourseFactory.loadCourse(course.getResourceableId()).getCourseEnvironment());
            // build score now
            uce.getScoreAccounting().evaluateAll();
            navHandler = new NavigationHandler(uce, false);
           
            // rebuild and jump to root node
View Full Code Here

Examples of org.olat.course.run.userview.UserCourseEnvironmentImpl

    OLATResourceable ores = OresHelper.createOLATResourceableTypeWithoutCheck("TestCourse");
    CourseEnvironment cenv = CourseFactory.createEmptyCourse(ores, "Test", "Test", "learningObjectives").getCourseEnvironment();
    // 1. enroll wg1 user
    IdentityEnvironment ienv = new IdentityEnvironment();
    ienv.setIdentity(wg1);
    UserCourseEnvironment userCourseEnv = new UserCourseEnvironmentImpl(ienv, cenv);
    CoursePropertyManager coursePropertyManager = userCourseEnv.getCourseEnvironment().getCoursePropertyManager();
    enrollmentManager.doEnroll(wg1,bgWithWaitingList, enNode, coursePropertyManager,this /*WindowControl mock*/,testTranslator,
        new ArrayList()/*enrollableGroupNames*/, new ArrayList()/*enrollableAreaNames*/, userCourseEnv.getCourseEnvironment().getCourseGroupManager())
    assertTrue("Enrollment failed, user='wg1'", BusinessGroupManagerImpl.getInstance().isIdentityInBusinessGroup(wg1,bgWithWaitingList))
    int participantsCounter = ManagerFactory.getManager().countIdentitiesOfSecurityGroup(bgWithWaitingList.getPartipiciantGroup());
    assertTrue("Wrong number of participants," + participantsCounter , participantsCounter == 1);
    // 2. enroll wg2 user
    ienv = new IdentityEnvironment();
    ienv.setIdentity(wg2);
    userCourseEnv = new UserCourseEnvironmentImpl(ienv, cenv);
    coursePropertyManager = userCourseEnv.getCourseEnvironment().getCoursePropertyManager();
    enrollmentManager.doEnroll(wg2,bgWithWaitingList, enNode, coursePropertyManager,this /*WindowControl mock*/,testTranslator,
        new ArrayList()/*enrollableGroupNames*/, new ArrayList()/*enrollableAreaNames*/, userCourseEnv.getCourseEnvironment().getCourseGroupManager())
    assertTrue("Enrollment failed, user='wg2'", BusinessGroupManagerImpl.getInstance().isIdentityInBusinessGroup(wg2,bgWithWaitingList))
    assertTrue("Enrollment failed, user='wg1'", BusinessGroupManagerImpl.getInstance().isIdentityInBusinessGroup(wg1,bgWithWaitingList))
    participantsCounter = ManagerFactory.getManager().countIdentitiesOfSecurityGroup(bgWithWaitingList.getPartipiciantGroup());
    assertTrue("Wrong number of participants," + participantsCounter , participantsCounter == 2);
    // 3. enroll wg3 user => list is full => waiting-list
    ienv = new IdentityEnvironment();
    ienv.setIdentity(wg3);
    userCourseEnv = new UserCourseEnvironmentImpl(ienv, cenv);
    coursePropertyManager = userCourseEnv.getCourseEnvironment().getCoursePropertyManager();
    enrollmentManager.doEnroll(wg3,bgWithWaitingList, enNode, coursePropertyManager,this /*WindowControl mock*/,testTranslator,
        new ArrayList()/*enrollableGroupNames*/, new ArrayList()/*enrollableAreaNames*/, userCourseEnv.getCourseEnvironment().getCourseGroupManager());   
    assertFalse("Wrong enrollment, user='wg3' is in PartipiciantGroup, must be on waiting-list", BusinessGroupManagerImpl.getInstance().isIdentityInBusinessGroup(wg3,bgWithWaitingList))
    assertFalse("Wrong enrollment, user='wg3' is in PartipiciantGroup, must be on waiting-list", ManagerFactory.getManager().isIdentityInSecurityGroup(wg3, bgWithWaitingList.getPartipiciantGroup()));
    assertTrue("Wrong enrollment, user='wg3' must be on waiting-list", ManagerFactory.getManager().isIdentityInSecurityGroup(wg3, bgWithWaitingList.getWaitingGroup()));
    assertTrue("Enrollment failed, user='wg2'", BusinessGroupManagerImpl.getInstance().isIdentityInBusinessGroup(wg2,bgWithWaitingList))
    assertTrue("Enrollment failed, user='wg1'", BusinessGroupManagerImpl.getInstance().isIdentityInBusinessGroup(wg1,bgWithWaitingList))
    participantsCounter = ManagerFactory.getManager().countIdentitiesOfSecurityGroup(bgWithWaitingList.getPartipiciantGroup());
    assertTrue("Wrong number of participants," + participantsCounter , participantsCounter == 2);
    int waitingListCounter = ManagerFactory.getManager().countIdentitiesOfSecurityGroup(bgWithWaitingList.getWaitingGroup());
    assertTrue("Wrong number of waiting-list, must be 1, is " + waitingListCounter , waitingListCounter == 1);
    // cancel enrollment for wg2 => transfer wg3 from waiting-list to participants
    ienv = new IdentityEnvironment();
    ienv.setIdentity(wg2);
    userCourseEnv = new UserCourseEnvironmentImpl(ienv, cenv);
    coursePropertyManager = userCourseEnv.getCourseEnvironment().getCoursePropertyManager();
    enrollmentManager.doCancelEnrollment(wg2,bgWithWaitingList, enNode, coursePropertyManager,this /*WindowControl mock*/,testTranslator);   
    assertFalse("Cancel enrollment failed, user='wg2' is still participants.", BusinessGroupManagerImpl.getInstance().isIdentityInBusinessGroup(wg2,bgWithWaitingList))
    assertTrue("Enrollment failed, user='wg3'", BusinessGroupManagerImpl.getInstance().isIdentityInBusinessGroup(wg3,bgWithWaitingList))
    assertTrue("Enrollment failed, user='wg1'", BusinessGroupManagerImpl.getInstance().isIdentityInBusinessGroup(wg1,bgWithWaitingList))
    participantsCounter = ManagerFactory.getManager().countIdentitiesOfSecurityGroup(bgWithWaitingList.getPartipiciantGroup());
    assertTrue("Wrong number of participants, must be 2, is " + participantsCounter , participantsCounter == 2);
    waitingListCounter = ManagerFactory.getManager().countIdentitiesOfSecurityGroup(bgWithWaitingList.getWaitingGroup());
    assertTrue("Wrong number of waiting-list, must be 0, is " + waitingListCounter , waitingListCounter == 0);
    // cancel enrollment for wg1
    ienv = new IdentityEnvironment();
    ienv.setIdentity(wg1);
    userCourseEnv = new UserCourseEnvironmentImpl(ienv, cenv);
    coursePropertyManager = userCourseEnv.getCourseEnvironment().getCoursePropertyManager();
    enrollmentManager.doCancelEnrollment(wg1,bgWithWaitingList, enNode, coursePropertyManager,this /*WindowControl mock*/,testTranslator);   
    assertFalse("Cancel enrollment failed, user='wg2' is still participants.", BusinessGroupManagerImpl.getInstance().isIdentityInBusinessGroup(wg2,bgWithWaitingList))
    assertFalse("Cancel enrollment failed, user='wg1' is still participants.", BusinessGroupManagerImpl.getInstance().isIdentityInBusinessGroup(wg1,bgWithWaitingList))
    assertTrue("Enrollment failed, user='wg3'", BusinessGroupManagerImpl.getInstance().isIdentityInBusinessGroup(wg3,bgWithWaitingList))
    participantsCounter = ManagerFactory.getManager().countIdentitiesOfSecurityGroup(bgWithWaitingList.getPartipiciantGroup());
    assertTrue("Wrong number of participants, must be 1, is " + participantsCounter , participantsCounter == 1);
    waitingListCounter = ManagerFactory.getManager().countIdentitiesOfSecurityGroup(bgWithWaitingList.getWaitingGroup());
    assertTrue("Wrong number of waiting-list, must be 0, is " + waitingListCounter , waitingListCounter == 0);
    // cancel enrollment for wg3
    ienv = new IdentityEnvironment();
    ienv.setIdentity(wg3);
    userCourseEnv = new UserCourseEnvironmentImpl(ienv, cenv);
    coursePropertyManager = userCourseEnv.getCourseEnvironment().getCoursePropertyManager();
    enrollmentManager.doCancelEnrollment(wg3,bgWithWaitingList, enNode, coursePropertyManager,this /*WindowControl mock*/,testTranslator);   
    assertFalse("Cancel enrollment failed, user='wg3' is still participants.", BusinessGroupManagerImpl.getInstance().isIdentityInBusinessGroup(wg3,bgWithWaitingList))
    assertFalse("Cancel enrollment failed, user='wg2' is still participants.", BusinessGroupManagerImpl.getInstance().isIdentityInBusinessGroup(wg2,bgWithWaitingList))
    assertFalse("Cancel enrollment failed, user='wg1' is still participants.", BusinessGroupManagerImpl.getInstance().isIdentityInBusinessGroup(wg1,bgWithWaitingList))
    participantsCounter = ManagerFactory.getManager().countIdentitiesOfSecurityGroup(bgWithWaitingList.getPartipiciantGroup());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.