Package org.olat.group.context

Examples of org.olat.group.context.BGContext


    // 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 {
View Full Code Here


    // 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);
      }
View Full Code Here

  /**
   * @see org.olat.course.groupsandrights.CourseGroupManager#exportCourseLeaningGroups(java.io.File)
   */
  public void exportCourseLeaningGroups(File fExportDirectory) {
    BGContext context = findDefaultLearningContext();
    File fExportFile = new File(fExportDirectory, LEARNINGGROUPEXPORT_XML);
    BusinessGroupManagerImpl.getInstance().exportGroups(context, fExportFile);
  }
View Full Code Here

  /**
   * @see org.olat.course.groupsandrights.CourseGroupManager#importCourseLearningGroups(java.io.File)
   */
  public void importCourseLearningGroups(File fImportDirectory) {
    File fGroupExportXML = new File(fImportDirectory, LEARNINGGROUPEXPORT_XML);
    BGContext context = findDefaultLearningContext();
    if (context == null) throw new AssertException(
        "Unable to find default context for imported course. Should have been created before calling importCourseLearningGroups()");
    BusinessGroupManagerImpl.getInstance().importGroups(context, fGroupExportXML);
  }
View Full Code Here

  /**
   * @see org.olat.course.groupsandrights.CourseGroupManager#exportCourseRightGroups(java.io.File)
   */
  public void exportCourseRightGroups(File fExportDirectory) {
    BGContext context = findDefaultRightsContext();
    File fExportFile = new File(fExportDirectory, RIGHTGROUPEXPORT_XML);
    BusinessGroupManagerImpl.getInstance().exportGroups(context, fExportFile);
  }
View Full Code Here

  /**
   * @see org.olat.course.groupsandrights.CourseGroupManager#importCourseRightGroups(java.io.File)
   */
  public void importCourseRightGroups(File fImportDirectory) {
    File fGroupExportXML = new File(fImportDirectory, RIGHTGROUPEXPORT_XML);
    BGContext context = findDefaultRightsContext();
    if (context == null) throw new AssertException(
        "Unable to find default context for imported course. Should have been created before calling importCourseLearningGroups()");
    BusinessGroupManagerImpl.getInstance().importGroups(context, fGroupExportXML);
  }
View Full Code Here

    BusinessGroupManagerImpl.getInstance().importGroups(context, fGroupExportXML);
  }

  private BGContext findDefaultLearningContext() {
    List contexts = getLearningGroupContexts();
    BGContext context = null;
    for (Iterator iter = contexts.iterator(); iter.hasNext();) {
      context = (BGContext) iter.next();
      if (context.isDefaultContext()) break;
    }
    return context;
  }
View Full Code Here

    return context;
  }

  private BGContext findDefaultRightsContext() {
    List contexts = getRightGroupContexts();
    BGContext context = null;
    for (Iterator iter = contexts.iterator(); iter.hasNext();) {
      context = (BGContext) iter.next();
      if (context.isDefaultContext()) break;
    }
    return context;
  }
View Full Code Here

  public List getWaitingListGroupsFromAllContexts(Identity identity) {
    List allGroups = new ArrayList();
    BusinessGroupManager groupManager = BusinessGroupManagerImpl.getInstance();
    Iterator iterator = learningGroupContexts.iterator();
    while (iterator.hasNext()) {
      BGContext bgContext = (BGContext) iterator.next();
      List contextGroups = groupManager.findBusinessGroupsWithWaitingListAttendedBy(bgContext.getGroupType(), identity, bgContext);
      allGroups.addAll(contextGroups);
    }
    return allGroups;
  }
View Full Code Here

   * @param exportDirectory  Archive files will be created in this dir.
   */
  private void archiveAllContextFor(List contextList, String fileName, File exportDirectory) {
    int contextCounter = 1;
    for (Iterator iter = contextList.iterator(); iter.hasNext();) {
      BGContext context = (BGContext) iter.next();
      if (context.isDefaultContext()) {
        BusinessGroupManagerImpl.getInstance().archiveGroups(context, new File(exportDirectory, "default_" + fileName));
      } else {
        BusinessGroupManagerImpl.getInstance().archiveGroups(context, new File(exportDirectory, "context_" + contextCounter + "_" + fileName));
        contextCounter++;
      }
View Full Code Here

TOP

Related Classes of org.olat.group.context.BGContext

Copyright © 2018 www.massapicom. 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.