Examples of BGContextManager


Examples of org.olat.group.context.BGContextManager

   * @see org.olat.course.groupsandrights.CourseGroupManager#getLearningAreasOfGroupFromAllContexts(java.lang.String)
   */
  public List getLearningAreasOfGroupFromAllContexts(String groupName) {
    List areas = new ArrayList();
    BGAreaManager areaManager = BGAreaManagerImpl.getInstance();
    BGContextManager contextManager = BGContextManagerImpl.getInstance();
    Iterator iterator = learningGroupContexts.iterator();
    while (iterator.hasNext()) {
      BGContext bgContext = (BGContext) iterator.next();
      BusinessGroup group = contextManager.findGroupOfBGContext(groupName, bgContext);
      if (group != null) {
        List groupAreas = areaManager.findBGAreasOfBusinessGroup(group);
        areas.addAll(groupAreas);
      }
    }
View Full Code Here

Examples of org.olat.group.context.BGContextManager

  /**
   * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingLearningGroupsFromAllContexts(org.olat.core.id.Identity,
   *      java.lang.String)
   */
  public List getParticipatingLearningGroupsFromAllContexts(Identity identity, String groupName) {
    BGContextManager contextManager = BGContextManagerImpl.getInstance();
    List groups = new ArrayList();
    Iterator iter = learningGroupContexts.iterator();
    while (iter.hasNext()) {
      BGContext context = (BGContext) iter.next();
      BusinessGroup group = contextManager.findGroupAttendedBy(identity, groupName, context);
      if (group != null) groups.add(group);
    }
    return groups;
  }
View Full Code Here

Examples of org.olat.group.context.BGContextManager

  /**
   * @see org.olat.course.groupsandrights.CourseGroupManager#getAllRightGroupsFromAllContexts()
   */
  public List getAllRightGroupsFromAllContexts() {
    List allGroups = new ArrayList();
    BGContextManager contextManager = BGContextManagerImpl.getInstance();
    Iterator iterator = rightGroupContexts.iterator();
    while (iterator.hasNext()) {
      BGContext bgContext = (BGContext) iterator.next();
      List contextGroups = contextManager.getGroupsOfBGContext(bgContext);
      allGroups.addAll(contextGroups);
    }
    return allGroups;
  }
View Full Code Here

Examples of org.olat.group.context.BGContextManager

  /**
   * @see org.olat.course.groupsandrights.CourseGroupManager#isIdentityParticipantInAnyLearningGroup(org.olat.core.id.Identity)
   */
  public boolean isIdentityParticipantInAnyLearningGroup(Identity identity) {
    BGContextManager contextManager = BGContextManagerImpl.getInstance();
    Iterator iterator = learningGroupContexts.iterator();
    while (iterator.hasNext()) {
      BGContext bgContext = (BGContext) iterator.next();
      if (contextManager.isIdentityInBGContext(identity, bgContext, true, false)) return true;
    }
    return false;
  }
View Full Code Here

Examples of org.olat.group.context.BGContextManager

  /**
   * @see org.olat.course.groupsandrights.CourseGroupManager#isIdentityParticipantInAnyRightGroup(org.olat.core.id.Identity)
   */
  public boolean isIdentityParticipantInAnyRightGroup(Identity identity) {
    BGContextManager contextManager = BGContextManagerImpl.getInstance();
    Iterator iterator = rightGroupContexts.iterator();
    while (iterator.hasNext()) {
      BGContext bgContext = (BGContext) iterator.next();
      if (contextManager.isIdentityInBGContext(identity, bgContext, true, false)) return true;
    }
    return false;
  }
View Full Code Here

Examples of org.olat.group.context.BGContextManager

  /**
   * @see org.olat.course.groupsandrights.CourseGroupManager#createCourseGroupmanagement(java.lang.String)
   */
  public void createCourseGroupmanagement(String courseTitle) {
    BGContextManager contextManager = BGContextManagerImpl.getInstance();
    // 1. context for learning groups
    if (this.learningGroupContexts.size() == 0) {
      String learningGroupContextName = CourseGroupManager.DEFAULT_NAME_LC_PREFIX + courseTitle;
      contextManager.createAndAddBGContextToResource(learningGroupContextName, courseResource,
          BusinessGroup.TYPE_LEARNINGROUP, null, true);
      // no need to add it to list of contexts, already done by createAndAddBGContextToResource

    }
    // 2. context for right groups
    if (this.rightGroupContexts.size() == 0) {
      String rightGroupContextName = CourseGroupManager.DEFAULT_NAME_RC_PREFIX + courseTitle;
      contextManager.createAndAddBGContextToResource(rightGroupContextName, courseResource,
          BusinessGroup.TYPE_RIGHTGROUP, null, true);
      // no need to add it to list of contexts, already done by createAndAddBGContextToResource
    }
  }
View Full Code Here

Examples of org.olat.group.context.BGContextManager

  public void createCourseGroupmanagementAsCopy(CourseGroupManager originalCourseGroupManager, String courseTitle) {

    // wrap as transatcion: do everything or nothing

    // 1. do copy learning group contexts
    BGContextManager contextManager = BGContextManagerImpl.getInstance();
    List origLgC = originalCourseGroupManager.getLearningGroupContexts();
    Iterator iter = origLgC.iterator();
    while (iter.hasNext()) {
      BGContext origContext = (BGContext) iter.next();
      if (origContext.isDefaultContext()) {
        // we found default context, copy this one
        String learningGroupContextName = CourseGroupManager.DEFAULT_NAME_LC_PREFIX + courseTitle;
        contextManager.copyAndAddBGContextToResource(learningGroupContextName, this.courseResource, origContext);
        // no need to add it to list of contexts, already done by copyAndAddBGContextToResource
      } else {
        // not a course default context but an associated context - copy only
        // reference
        contextManager.addBGContextToResource(origContext, courseResource);
        // no need to add it to list of contexts, already done by addBGContextToResource       
      }
    }
    // 2. do copy right group contexts
    List origRgC = originalCourseGroupManager.getRightGroupContexts();
    iter = origRgC.iterator();
    while (iter.hasNext()) {
      BGContext origContext = (BGContext) iter.next();
      if (origContext.isDefaultContext()) {
        // we found default context, copy this one
        String rightGroupContextName = CourseGroupManager.DEFAULT_NAME_RC_PREFIX + courseTitle;
        contextManager.copyAndAddBGContextToResource(rightGroupContextName, this.courseResource, origContext);
        // no need to add it to list of contexts, already done by copyAndAddBGContextToResource
      } else {
        // not a course default context but an associated context - copy only
        // reference
        contextManager.addBGContextToResource(origContext, courseResource);
        // no need to add it to list of contexts, already done by addBGContextToResource
      }
    }
  }
View Full Code Here

Examples of org.olat.group.context.BGContextManager

  /**
   * @see org.olat.course.groupsandrights.CourseGroupManager#deleteCourseGroupmanagement()
   */
  public void deleteCourseGroupmanagement() {
    BGContextManager contextManager = BGContextManagerImpl.getInstance();
    // contextManager.removeAllBGContextsFromResource(courseResource);

    List allContexts = contextManager.findBGContextsForResource(courseResource, true, true);
    Iterator iter = allContexts.iterator();
    while (iter.hasNext()) {
      BGContext context = (BGContext) iter.next();
      if (context.isDefaultContext()) {
        contextManager.deleteBGContext(context);
      } else {
        // not a default context, only unlink from this course
        contextManager.removeBGContextFromResource(context, courseResource);
      }
    }
    Tracing.logAudit("Deleting course groupmanagement for " + courseResource.toString(), this.getClass());
  }
View Full Code Here

Examples of org.olat.group.context.BGContextManager

      q.append(" select context from org.olat.group.context.BGContextImpl as context");
      DBQuery query = db.createQuery(q.toString());

      List<BGContext> contexts = (List<BGContext>) query.list();
      if (log.isDebug()) log.info("Migrating " + contexts.size() + " BG Contexts.");
      BGContextManager contextManager = BGContextManagerImpl.getInstance();
      int bgcounter = 0;
      for (BGContext context : contexts) {
        try{
          String oldDesc = context.getDescription();
          if (StringHelper.containsNonWhitespace(oldDesc)) {
            String newDesc = migrateStringSavely(oldDesc);
            context.setDescription(newDesc);
            contextManager.updateBGContext(context);
            bgcounter++;
          }
          DBFactory.getInstance().intermediateCommit();
        } catch (Exception e) {
          log.error("Error during Migration: "+e, e);
View Full Code Here

Examples of org.olat.group.context.BGContextManager

    String bgWithWaitingListName = "Group with WaitingList";
    String bgWithWaitingListDesc = "some short description for Group with WaitingList";
    Boolean enableWaitinglist = new Boolean(true);
    Boolean enableAutoCloseRanks = new Boolean(true);
   
     BGContextManager bgcm = BGContextManagerImpl.getInstance();
    BGContext groupContext = bgcm.createAndPersistBGContext("c1name", "c1desc", BusinessGroup.TYPE_LEARNINGROUP, null, true);
    System.out.println("testAddToWaitingListAndFireEvent: groupContext=" + groupContext);
    bgWithWaitingList = bgManager.createAndPersistBusinessGroup(BusinessGroup.TYPE_LEARNINGROUP, id1, bgWithWaitingListName, bgWithWaitingListDesc, null, null, enableWaitinglist, enableAutoCloseRanks, groupContext);
    bgWithWaitingList.setMaxParticipants(new Integer(2));
    // create mock objects
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.