Package org.olat.group.area

Examples of org.olat.group.area.BGArea


    ICourse course = CourseFactory.loadCourse(ores);
    for (Iterator iter = groups.iterator(); iter.hasNext();) {
      String groupName = (String) iter.next();
      List newAreas = course.getCourseEnvironment().getCourseGroupManager().getLearningAreasOfGroupFromAllContexts(groupName);
      for (Iterator iterator = newAreas.iterator(); iterator.hasNext();) {
        BGArea newArea = (BGArea) iterator.next();
        areas.add(newArea.getName());
      }
    }
    role = psf.getRole();
    // default is student
    isGlobalAuthor = false;
View Full Code Here


    final String areaName = "BGArea_1";

    final List<Exception> exceptionHolder = Collections.synchronizedList(new ArrayList<Exception>(1));
    final AtomicInteger finfishCount = new AtomicInteger(0);
   
    BGArea bgArea = BGAreaManagerImpl.getInstance().findBGArea(areaName, c1);
    assertNull(bgArea);
   
    startThreadCreateDeleteBGArea(areaName, maxLoop, exceptionHolder, 100, 20, finfishCount);
    startThreadCreateDeleteBGArea(areaName, maxLoop, exceptionHolder, 30, 40, finfishCount);
    startThreadCreateDeleteBGArea(areaName, maxLoop, exceptionHolder, 15, 20, finfishCount);
View Full Code Here

      public void run() {
        try{
          System.out.println("Thread starts: this="+this);
          for (int i=0; i<maxLoop; i++) {
            try {
              BGArea bgArea = BGAreaManagerImpl.getInstance().createAndPersistBGAreaIfNotExists(areaName, "description:" + areaName, c1);
              if (bgArea != null) {
                DBFactory.getInstance().closeSession();
                // created a new bg area
                sleep(sleepAfterCreate);
                BGAreaManagerImpl.getInstance().deleteBGArea(bgArea);
View Full Code Here

    final String areaName = "BGArea_2";

    final List<Exception> exceptionHolder = Collections.synchronizedList(new ArrayList<Exception>(1));
    final AtomicInteger finfishCount = new AtomicInteger(0);
   
    BGArea bgArea = BGAreaManagerImpl.getInstance().findBGArea(areaName, c1);
    assertNull(bgArea);
    bgArea = BGAreaManagerImpl.getInstance().createAndPersistBGAreaIfNotExists(areaName, "description:" + areaName, c1);
    assertNotNull(bgArea);
   
    startThreadUpdateBGArea(areaName, maxLoop, exceptionHolder, 20, finfishCount);
View Full Code Here

    // thread 2 : update,copy
    new Thread(new Runnable() {
      public void run() {
        for (int i=0; i<maxLoop; i++) {
          try {
            BGArea bgArea = BGAreaManagerImpl.getInstance().findBGArea(areaName, c1);
            DBFactory.getInstance().closeSession();// Detached the bg-area object with closing session
            if (bgArea != null) {
              bgArea.setDescription("description:" + areaName + i);
              BGAreaManagerImpl.getInstance().updateBGArea(bgArea);
            }
          } catch (Exception e) {
            exceptionHolder.add(e);
          } finally {
View Full Code Here

  public boolean existsArea(String areaname) {
    // FIXME:fg:b improve performance by adding a special query for the existence
    // check!
    List cnt = cgm.getAllAreasFromAllContexts();
    for (Iterator iter = cnt.iterator(); iter.hasNext();) {
      BGArea element = (BGArea) iter.next();
      if (element.getName().equals(areaname)) { return true; }
    }
    return false;
  }
View Full Code Here

    List groups = getGroupsOfBGContext(bgContext);
    bgManager.deleteBusinessGroups(groups);
    // 2) Delete all group areas
    List areas = areaManager.findBGAreasOfBGContext(bgContext);
    for (Iterator iter = areas.iterator(); iter.hasNext();) {
      BGArea area = (BGArea) iter.next();
      areaManager.deleteBGArea(area);
    }
    // 3) Delete group to resource relations
    List referencingResources = findOLATResourcesForBGContext(bgContext);
    for (Iterator iter = referencingResources.iterator(); iter.hasNext();) {
View Full Code Here

    } else if (AREAS_MEMBERS.equals(wizardType)) {
      List<BGArea> areas = BGAreaManagerImpl.getInstance().findBGAreasOfBGContext(context);
      Collections.sort(areas, new Comparator() {
        @Override
        public int compare(Object o1, Object o2) {
          BGArea a1 = (BGArea) o1;
          BGArea a2 = (BGArea) o2;
          return a1.getName().compareTo(a2.getName());
        }
      });
      for (Iterator iter = areas.iterator(); iter.hasNext();) {
        BGArea area = (BGArea) iter.next();
        Object[] groupChoiceRowData = new Object[2];
        groupChoiceRowData[0] = new Boolean(true);
        groupChoiceRowData[1] = new ObjectWrapper(area);
        objectArrays.add(groupChoiceRowData);
      }
View Full Code Here

          // create bulkgroups only if there is no name which already exists.
          newAreas = new HashSet<BGArea>();
          newAreaNames = new HashSet<String>();
          for (Iterator<String> iter = allNames.iterator(); iter.hasNext();) {
            String areaName = iter.next();
            BGArea newArea = areaManager.createAndPersistBGAreaIfNotExists(areaName, areaDesc, bgContext);
            newAreas.add(newArea);
            newAreaNames.add(areaName);
          }
          // do loggin if ual given
          for (Iterator<BGArea> iter = newAreas.iterator(); iter.hasNext();) {
            BGArea a = iter.next();
            ThreadLocalUserActivityLogger.log(GroupLoggingAction.AREA_CREATED, getClass(), LoggingResourceable.wrap(a))
          }           
          // workflow successfully finished
          // so far no events on the systembus to inform about new groups in BGContext
          fireEvent(ureq, Event.DONE_EVENT);
View Full Code Here

      secm.addIdentityToSecurityGroup(id1, g1.getPartipiciantGroup());
      secm.addIdentityToSecurityGroup(id2, g1.getPartipiciantGroup());
      secm.addIdentityToSecurityGroup(id2, g2.getPartipiciantGroup());
      secm.addIdentityToSecurityGroup(id3, g1.getOwnerGroup());
      // areas
      BGArea a1 = am.createAndPersistBGAreaIfNotExists("a1", "desca1",c1);
      BGArea a2 = am.createAndPersistBGAreaIfNotExists("a2", null, c1);
      BGArea a3 = am.createAndPersistBGAreaIfNotExists("a3", null, c1);
      am.addBGToBGArea(g1, a1);   
      am.addBGToBGArea(g2, a1);
      am.addBGToBGArea(g1, a2)
      am.addBGToBGArea(g2, a3);
     
      // 2) context two: right groups
      BGContext c2 = cm.createAndAddBGContextToResource("c2name", course1, BusinessGroup.TYPE_RIGHTGROUP, id2, true);
      // groups
      BusinessGroup g3 = bgm.createAndPersistBusinessGroup(BusinessGroup.TYPE_RIGHTGROUP, null, "g3", null, null, null, null/* enableWaitinglist */, null/* enableAutoCloseRanks */, c2);
      BusinessGroup g4 = bgm.createAndPersistBusinessGroup(BusinessGroup.TYPE_RIGHTGROUP, null, "g4", null, null, null, null/* enableWaitinglist */, null/* enableAutoCloseRanks */, c2);
      // members
      secm.addIdentityToSecurityGroup(id1, g3.getPartipiciantGroup());
      secm.addIdentityToSecurityGroup(id1, g4.getPartipiciantGroup());
      secm.addIdentityToSecurityGroup(id3, g4.getPartipiciantGroup());
      // rights
      rm.addBGRight(CourseRights.RIGHT_ARCHIVING, g3);
      rm.addBGRight(CourseRights.RIGHT_COURSEEDITOR, g3);
      rm.addBGRight(CourseRights.RIGHT_ARCHIVING, g4);
      rm.addBGRight(CourseRights.RIGHT_GROUPMANAGEMENT, g4);
     
      DBFactory.getInstance().closeSession(); // simulate user clicks
     
      // test groups
      CourseGroupManager gm = PersistingCourseGroupManager.getInstance(course1);
      assertTrue(gm.isIdentityInLearningGroup(id1, g1.getName()));
      assertTrue(gm.isIdentityInLearningGroup(id1, g2.getName()));
      assertFalse(gm.isIdentityInLearningGroup(id1, g3.getName())); // not a learning group
      assertFalse(gm.isIdentityInLearningGroup(id1, g4.getName())); // not a learning group

      assertTrue(gm.isIdentityInLearningGroup(id2, g1.getName()));
      assertTrue(gm.isIdentityInLearningGroup(id2, g2.getName()));
      assertFalse(gm.isIdentityInLearningGroup(id2, g3.getName())); // not a learning group
      assertFalse(gm.isIdentityInLearningGroup(id2, g4.getName())); // not a learning group

      DBFactory.getInstance().closeSession();
      assertTrue(gm.isIdentityInLearningGroup(id3, g1.getName()));
      assertFalse(gm.isIdentityInLearningGroup(id3, g2.getName()));
      assertFalse(gm.isIdentityInLearningGroup(id3, g3.getName())); // not a learning group
      assertFalse(gm.isIdentityInLearningGroup(id3, g4.getName())); // not a learning group

      assertTrue(gm.isIdentityInLearningGroup(id1, g1.getName(), c1.getName()));
      assertFalse(gm.isIdentityInLearningGroup(id1, g1.getName(), c2.getName()));
      assertTrue(gm.isIdentityInLearningGroup(id3, g1.getName(), c1.getName()));
      assertFalse(gm.isIdentityInLearningGroup(id3, g1.getName(), c2.getName()));
     
      // test areas
      DBFactory.getInstance().closeSession();
      assertTrue(gm.isIdentityInLearningArea(id1, a1.getName()));
      assertTrue(gm.isIdentityInLearningArea(id1, a2.getName()));
      assertTrue(gm.isIdentityInLearningArea(id1, a3.getName()));

      assertTrue(gm.isIdentityInLearningArea(id2, a1.getName()));
      assertTrue(gm.isIdentityInLearningArea(id2, a2.getName()));
      assertTrue(gm.isIdentityInLearningArea(id2, a3.getName()));

      DBFactory.getInstance().closeSession();
      assertTrue(gm.isIdentityInLearningArea(id3, a1.getName()));
      assertTrue(gm.isIdentityInLearningArea(id3, a2.getName()));
      assertFalse(gm.isIdentityInLearningArea(id3, a3.getName()));

      DBFactory.getInstance().closeSession();
      assertTrue(gm.getLearningAreasOfGroupFromAllContexts(g1.getName()).size() == 2);
      assertTrue(gm.getLearningAreasOfGroupFromAllContexts(g2.getName()).size() == 2);
     
View Full Code Here

TOP

Related Classes of org.olat.group.area.BGArea

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.