Examples of IdentityEnvironment


Examples of org.olat.core.id.IdentityEnvironment

    for (Iterator iter = identitiesAndTheirsNodePassed.iterator(); iter.hasNext();) {
      Object[] identityAndItsNodePassed = (Object[]) iter.next();
      if (identityAndItsNodePassed[0] != null){
       
        if (allowedIdKeys.contains(((Identity)identityAndItsNodePassed[0]).getKey())){
          IdentityEnvironment ienv = new IdentityEnvironment();
          ienv.setIdentity((Identity)identityAndItsNodePassed[0]);
          UserCourseEnvironment uce = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
          String nodePassed = (String) identityAndItsNodePassed[1];
          if((nodePassed != null && nodePassed.equals("y")) || (nodePassed != null && nodePassed.equals("n"))){
            if (hasPassed && cut == null){ // Configuration of manual assessment --> Display passed/not passed: yes, Type of display: Manual by tutor
                ScoreEvaluation seOld = courseNode.getUserScoreEvaluation(uce);
View Full Code Here

Examples of org.olat.core.id.IdentityEnvironment

    }
    ICourse course = CourseFactory.loadCourse(ores);
    // check if course node is visible for group
    // get first identity to use this identity for condition interpreter
    Identity identity = getGroupIdentitiesFromGroupmanagement(group).get(0);
    IdentityEnvironment identityEnvironment = new IdentityEnvironment();
    identityEnvironment.setIdentity(identity);
    UserCourseEnvironment uce = new UserCourseEnvironmentImpl(identityEnvironment, course.getCourseEnvironment());
    OnlyGroupConditionInterpreter ci = new OnlyGroupConditionInterpreter(uce);
    List listOfConditionExpressions = courseNode.getConditionExpressions();
    boolean allConditionAreValid = true;
    // loop over all conditions, all must be true
View Full Code Here

Examples of org.olat.core.id.IdentityEnvironment

    String userComment = "UselessUserComment";
   
    //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();
View Full Code Here

Examples of org.olat.core.id.IdentityEnvironment

    efficiencyStatement = efficiencyStatementManager.getUserEfficiencyStatement(courseRepositoryEntry.getKey(), student);
    DBFactory.getInstance().closeSession();
    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.core.id.IdentityEnvironment

    for (Iterator iter = identitiesAndTheirsUserComments.iterator(); iter.hasNext();) {
      Object[] identityAndItsUserComment = (Object[]) iter.next();
      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
View Full Code Here

Examples of org.olat.core.id.IdentityEnvironment

    CourseEditorEnv cev = getUserCourseEnv().getCourseEditorEnv();
    if (cev != null) {
      locale = cev.getEditorEnvLocale();
    } else {
      IdentityEnvironment ienv = getUserCourseEnv().getIdentityEnvironment();
      locale = ienv.getLocale();
    }
   
    // return true for locale="de_CH" and given lang="de"
    return (locale.toString().toLowerCase().startsWith(lang.toLowerCase()) ? ConditionInterpreter.INT_TRUE : ConditionInterpreter.INT_FALSE);
  }
View Full Code Here

Examples of org.olat.core.id.IdentityEnvironment

    EnrollmentManager enrollmentManager = EnrollmentManager.getInstance();
    ENCourseNode enNode = new ENCourseNode();
    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))
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.