Package org.olat.group

Examples of org.olat.group.BusinessGroupManager


        id3 = ManagerFactory.getManager().createAndPersistIdentity("zwoi", null, OLATAuthenticationController.PROVIDER_OLAT, "zwoi", Encoder.encrypt("hashipassi"));
        id4 = ManagerFactory.getManager().createAndPersistIdentity("drp", null, OLATAuthenticationController.PROVIDER_OLAT, "drü", Encoder.encrypt("hashipassi"));
        res = OLATResourceManager.getInstance().createOLATResourceInstance(this);
        OLATResourceManager.getInstance().saveOLATResource(res);
       
        BusinessGroupManager gm = BusinessGroupManagerImpl.getInstance();
        group = gm.createAndPersistBusinessGroup(BusinessGroup.TYPE_BUDDYGROUP,
                identity, "a buddygroup", "a desc", null, null, null/* enableWaitinglist */, null/* enableAutoCloseRanks */, null);

        PropertyTest.isInitialized = true;
      } catch (Exception e) {
        log.error(
View Full Code Here


  }


  public boolean checkAccess(ContextEntry contextEntry, BusinessControl businessControl, Identity identity, Roles roles) {
    Long key = contextEntry.getOLATResourceable().getResourceableId();
    BusinessGroupManager bman = BusinessGroupManagerImpl.getInstance();
    List oGroups = bman.findBusinessGroupsOwnedBy(null, identity, null);
    List aGroups = bman.findBusinessGroupsAttendedBy(null, identity, null);
   
    boolean inGroup = false; //TODO
    for (Iterator it_ogroups = oGroups.iterator(); !inGroup && it_ogroups.hasNext();) {
      BusinessGroup gr = (BusinessGroup) it_ogroups.next();
      Long grk = gr.getKey();
View Full Code Here

      }
    }
  }

  private BusinessGroup doCopyGroup() {
    BusinessGroupManager groupManager = BusinessGroupManagerImpl.getInstance();
    // reload original group to prevent context proxy problems
    this.originalGroup = groupManager.loadBusinessGroup(this.originalGroup);
    BGContext bgContext = this.originalGroup.getGroupContext();
    String bgName = this.groupController.getGroupName();
    String bgDesc = this.groupController.getGroupDescription();
    Integer bgMax = this.groupController.getGroupMax();
    Integer bgMin = this.groupController.getGroupMin();
    boolean copyAreas = (this.flags.isEnabled(BGConfigFlags.AREAS) && this.copyForm.isCopyAreas());

    BusinessGroup newGroup = groupManager.copyBusinessGroup(this.originalGroup, bgName, bgDesc, bgMin, bgMax, bgContext, null, copyAreas,
        copyForm.isCopyTools(), copyForm.isCopyRights(), copyForm.isCopyOwners(), copyForm.isCopyParticipants(), copyForm
            .isCopyMembersVisibility(), copyForm.isCopyWaitingList());
    return newGroup;
  }
View Full Code Here

   * @see org.olat.group.context.BGContextManager#copyAndAddBGContextToResource(java.lang.String,
   *      org.olat.resource.OLATResource, org.olat.group.context.BGContext)
   */
  public BGContext copyAndAddBGContextToResource(String contextName, OLATResource resource, BGContext originalBgContext) {
    BGAreaManager areaManager = BGAreaManagerImpl.getInstance();
    BusinessGroupManager groupManager = BusinessGroupManagerImpl.getInstance();
    if (!originalBgContext.isDefaultContext()) { throw new AssertException("Can only copy default contexts"); }

    // 1. Copy context as default context. Owner group of original context will
    // not be
    // copied since this is a default context
    BGContext targetContext = createAndAddBGContextToResource(contextName, resource, originalBgContext.getGroupType(), null, true);
    // 2. Copy areas
    Map areas = areaManager.copyBGAreasOfBGContext(originalBgContext, targetContext);
    // 3. Copy Groups
    // only group configuration will be copied, no group members are copied
    List origGroups = getGroupsOfBGContext(originalBgContext);
    Iterator iter = origGroups.iterator();
    while (iter.hasNext()) {
      BusinessGroup origGroup = (BusinessGroup) iter.next();
      groupManager.copyBusinessGroup(origGroup, origGroup.getName(), origGroup.getDescription(), origGroup.getMinParticipants(), origGroup
          .getMaxParticipants(), targetContext, areas, true, true, true, false, false, true, false);
    }
    return targetContext;
  }
View Full Code Here

  /**
   * @see org.olat.group.context.BGContextManager#deleteBGContext(org.olat.group.context.BGContext)
   */
  public void deleteBGContext(BGContext bgContext) {
    bgContext = (BGContext) DBFactory.getInstance().loadObject(bgContext);
    BusinessGroupManager bgManager = BusinessGroupManagerImpl.getInstance();
    BGAreaManager areaManager = BGAreaManagerImpl.getInstance();
    // 1) Delete all groups from group context
    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);
View Full Code Here

  }

  /** rights tests */
  public void testHasRightIsInMethods() {
      BGContextManager cm = BGContextManagerImpl.getInstance();
      BusinessGroupManager bgm = BusinessGroupManagerImpl.getInstance();
      Manager secm = ManagerFactory.getManager();
      BGRightManager rm = BGRightManagerImpl.getInstance();
      BGAreaManager am = BGAreaManagerImpl.getInstance();
     
      // 1) context one: learning groups
      BGContext c1 = cm.createAndAddBGContextToResource("c1name", course1, BusinessGroup.TYPE_LEARNINGROUP, id1, true);
      // create groups without waitinglist
      BusinessGroup g1 = bgm.createAndPersistBusinessGroup(BusinessGroup.TYPE_LEARNINGROUP, null, "g1", null, new Integer(0), new Integer(10), false, false, c1);
      BusinessGroup g2 = bgm.createAndPersistBusinessGroup(BusinessGroup.TYPE_LEARNINGROUP, null, "g2", null, new Integer(0), new Integer(10), false, false, c1);
      // members
      secm.addIdentityToSecurityGroup(id1, g2.getOwnerGroup());
      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
View Full Code Here

   * Gets all groups for this portlet and wraps them into PortletEntry impl.
   * @param ureq
   * @return the PortletEntry list.
   */
  private List<PortletEntry> getAllPortletEntries() {
    BusinessGroupManager bgm = BusinessGroupManagerImpl.getInstance();
    groupList = bgm.findBusinessGroupsAttendedBy(null, identity, null);
    groupList.addAll(bgm.findBusinessGroupsOwnedBy(null, identity, null));
    List<PortletEntry> entries = convertBusinessGroupToPortletEntryList(groupList);
    return entries;
  }
View Full Code Here

    return convertedList;
  }
 
  protected void reloadModel(SortingCriteria sortingCriteria) {
    if (sortingCriteria.getSortingType() == SortingCriteria.AUTO_SORTING) {
      BusinessGroupManager bgm = BusinessGroupManagerImpl.getInstance();
      groupList = bgm.findBusinessGroupsAttendedBy(null, identity, null);
      groupList.addAll(bgm.findBusinessGroupsOwnedBy(null, identity, null));

      groupList = getSortedList(groupList, sortingCriteria);

      List<PortletEntry> entries = convertBusinessGroupToPortletEntryList(groupList);
     
View Full Code Here

      }
    }
  }

  private BusinessGroup doCopyGroup(String newGroupName, Integer max) {
    BusinessGroupManager groupManager = BusinessGroupManagerImpl.getInstance();
    // reload original group to prevent context proxy problems
    this.originalGroup = groupManager.loadBusinessGroup(this.originalGroup);
    BGContext bgContext = this.originalGroup.getGroupContext();
    boolean copyAreas = (flags.isEnabled(BGConfigFlags.AREAS) && copyForm.isCopyAreas());

    BusinessGroup newGroup = groupManager.copyBusinessGroup(this.originalGroup, newGroupName, this.originalGroup.getDescription(), null, max, bgContext, null, copyAreas,
        copyForm.isCopyTools(), copyForm.isCopyRights(), copyForm.isCopyOwners(), copyForm.isCopyParticipants(), copyForm
            .isCopyMembersVisibility(), copyForm.isCopyWaitingList());
    return newGroup;
  }
View Full Code Here

        DBFactory.getJunitInstance().clearDatabase();
        // identity with null User should be ok for test case
        res = OLATResourceManager.getInstance().createOLATResourceInstance(this);
        OLATResourceManager.getInstance().saveOLATResource(res);
        identity = ManagerFactory.getManager().createAndPersistIdentity("foo", null, OLATAuthenticationController.PROVIDER_OLAT, "foo", Encoder.encrypt("hashipassi"));
        BusinessGroupManager gm = BusinessGroupManagerImpl.getInstance();
        group = gm.createAndPersistBusinessGroup(BusinessGroup.TYPE_BUDDYGROUP,
                identity, "a buddygroup", "a desc", null, null, null/* enableWaitinglist */, null/* enableAutoCloseRanks */, null);

        LifeCycleManagerTest.isInitialized = true;
      } catch (Exception e) {
        log.error(
View Full Code Here

TOP

Related Classes of org.olat.group.BusinessGroupManager

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.