예제 #1
0
  /** @inheritDoc */
  public List getUnassignedMembersInRole(final String siteContext, final Role role) {
    List siteMembers = getSiteMembersInRole(siteContext, role);

    // Get all userUids of all users in sections
    List<String> sectionedUserUids = new ArrayList<String>();
    List sections = getSections(siteContext);
    for (Iterator sectionIter = sections.iterator(); sectionIter.hasNext(); ) {
      CourseSection section = (CourseSection) sectionIter.next();
      List sectionUsers = securityService.unlockUsers(getLock(role), section.getUuid());
      for (Iterator userIter = sectionUsers.iterator(); userIter.hasNext(); ) {
        org.sakaiproject.user.api.User user = (org.sakaiproject.user.api.User) userIter.next();
        sectionedUserUids.add(user.getId());
      }
    }

    // Now generate the list of unsectioned enrollments by subtracting the two collections
    // Since the APIs return different kinds of objects, we need to iterate
    List<ParticipationRecord> unsectionedMembers = new ArrayList<ParticipationRecord>();
    for (Iterator iter = siteMembers.iterator(); iter.hasNext(); ) {
      ParticipationRecord record = (ParticipationRecord) iter.next();
      if (!sectionedUserUids.contains(record.getUser().getUserUid())) {
        unsectionedMembers.add(record);
      }
    }
    return unsectionedMembers;
  }
예제 #2
0
 private List getSiteInstructors(String siteContext) {
   Course course = getCourse(siteContext);
   if (course == null) {
     return new ArrayList();
   }
   List sakaiMembers =
       securityService.unlockUsers(SectionAwareness.INSTRUCTOR_MARKER, course.getUuid());
   List<InstructorRecordImpl> membersList = new ArrayList<InstructorRecordImpl>();
   for (Iterator iter = sakaiMembers.iterator(); iter.hasNext(); ) {
     org.sakaiproject.user.api.User sakaiUser = (org.sakaiproject.user.api.User) iter.next();
     User user = SakaiUtil.convertUser(sakaiUser);
     if (user != null) {
       InstructorRecordImpl record = new InstructorRecordImpl(course, user);
       membersList.add(record);
     }
   }
   return membersList;
 }
예제 #3
0
  private List getSiteTeachingAssistants(String siteContext) {
    Course course = getCourse(siteContext);
    if (course == null) {
      return new ArrayList();
    }
    List sakaiMembers = securityService.unlockUsers(SectionAwareness.TA_MARKER, course.getUuid());
    if (log.isDebugEnabled()) log.debug("Site TAs size = " + sakaiMembers.size());

    List<TeachingAssistantRecordImpl> membersList = new ArrayList<TeachingAssistantRecordImpl>();
    for (Iterator iter = sakaiMembers.iterator(); iter.hasNext(); ) {
      org.sakaiproject.user.api.User sakaiUser = (org.sakaiproject.user.api.User) iter.next();
      User user = SakaiUtil.convertUser(sakaiUser);
      if (user != null) {
        TeachingAssistantRecordImpl record = new TeachingAssistantRecordImpl(course, user);
        membersList.add(record);
      }
    }
    return membersList;
  }
예제 #4
0
 private List getSiteEnrollments(String siteContext) {
   Course course = getCourse(siteContext);
   if (course == null) {
     log.error("Could not find course site " + siteContext);
     return new ArrayList();
   }
   List sakaiMembers =
       securityService.unlockUsers(SectionAwareness.STUDENT_MARKER, course.getUuid());
   if (log.isDebugEnabled()) log.debug("Site students size = " + sakaiMembers.size());
   List<EnrollmentRecordImpl> membersList = new ArrayList<EnrollmentRecordImpl>();
   for (Iterator iter = sakaiMembers.iterator(); iter.hasNext(); ) {
     org.sakaiproject.user.api.User sakaiUser = (org.sakaiproject.user.api.User) iter.next();
     User user = SakaiUtil.convertUser(sakaiUser);
     if (user != null) {
       EnrollmentRecordImpl record = new EnrollmentRecordImpl(course, null, user);
       membersList.add(record);
     }
   }
   return membersList;
 }