Package org.olat.group

Examples of org.olat.group.BusinessGroupManager


    tblCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.group.name", 1, TABLE_ACTION_LAUNCH, ureq.getLocale()));
    tblCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.user.role", 2, null, ureq.getLocale()));
    tblCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.user.joindate", 3, null, ureq.getLocale()));
       
    //build data model
    BusinessGroupManager bgm = BusinessGroupManagerImpl.getInstance();
    Manager sm = ManagerFactory.getManager();
    List<Object[]> userGroups = new ArrayList<Object[]>();
      //loop over all kind of groups with all possible memberships
      List<String> bgTypes = new ArrayList<String>();
      bgTypes.add(BusinessGroup.TYPE_BUDDYGROUP);
      bgTypes.add(BusinessGroup.TYPE_LEARNINGROUP);
      bgTypes.add(BusinessGroup.TYPE_RIGHTGROUP);
      for (String bgType : bgTypes) {       
        List<BusinessGroup> ownedGroups = bgm.findBusinessGroupsOwnedBy(bgType, identity, null);
        List<BusinessGroup> attendedGroups = bgm.findBusinessGroupsAttendedBy(bgType, identity, null);
        List<BusinessGroup> waitingGroups = bgm.findBusinessGroupsWithWaitingListAttendedBy(bgType, identity, null);
        //using HashSet to remove duplicate entries
        HashSet<BusinessGroup> allGroups = new HashSet<BusinessGroup>();
        allGroups.addAll(ownedGroups);
        allGroups.addAll(attendedGroups);
        allGroups.addAll(waitingGroups);
       
        Iterator<BusinessGroup> iter = allGroups.iterator();
        while (iter.hasNext()) {
          Object[] groupEntry = new Object[4];
          BusinessGroup group = iter.next();
          groupEntry[0] = translate(group.getType());
          groupEntry[1] = group;
          Date joinDate = null;
          if(attendedGroups.contains(group)&&ownedGroups.contains(group)) {
            groupEntry[2] = translate("attende.and.owner");
            joinDate = sm.getSecurityGroupJoinDateForIdentity(group.getPartipiciantGroup(), identity);
          }
          else if(attendedGroups.contains(group)) {
            groupEntry[2] = translate("attende");
            joinDate = sm.getSecurityGroupJoinDateForIdentity(group.getPartipiciantGroup(), identity);
          }
          else if(ownedGroups.contains(group)) {
            groupEntry[2] = translate("owner");
            joinDate = sm.getSecurityGroupJoinDateForIdentity(group.getOwnerGroup(), identity);
          }
          else if(waitingGroups.contains(group)) {
            int waitingListPosition = bgm.getPositionInWaitingListFor(identity, group);
            groupEntry[2] = translate("waiting", String.valueOf(waitingListPosition));
            joinDate = sm.getSecurityGroupJoinDateForIdentity(group.getWaitingGroup(), identity);
          }
          groupEntry[3] = joinDate;
         
View Full Code Here


        TableEvent te = (TableEvent) event;
        String actionid = te.getActionId();
        int rowid = te.getRowId();
        BusinessGroup currBusinessGroup = tableDataModel.getBusinessGroupAtRow(rowid);
        if (actionid.equals(TABLE_ACTION_LAUNCH)) {
          BusinessGroupManager bgm = BusinessGroupManagerImpl.getInstance();
          currBusinessGroup = bgm.loadBusinessGroup(currBusinessGroup.getKey(), false);
          if (currBusinessGroup==null) {
            //group seems to be removed meanwhile, reload table and show error
            showError("group.removed");
            buildTableController(ureq, wControl);
            vc.put("table.groups", tblCtr.getInitialComponent())
View Full Code Here

  private void doHandleToolEvents(UserRequest ureq, String cmd) {
    if (cmd.indexOf(CMD_START_GROUP_PREFIX) == 0) {
      // launch the group in a new top nav tab
      String groupIdent = cmd.substring(CMD_START_GROUP_PREFIX.length());
      Long groupKey = new Long(Long.parseLong(groupIdent));
      BusinessGroupManager groupManager = BusinessGroupManagerImpl.getInstance();
      BusinessGroup group = groupManager.loadBusinessGroup(groupKey, false);
      // check if the group still exists and the user is really in this group
      // (security, changed group)
      if (group != null && groupManager.isIdentityInBusinessGroup(ureq.getIdentity(), group)) {
        Manager securityManager = ManagerFactory.getManager();
        boolean isCoach = securityManager.isIdentityInSecurityGroup(ureq.getIdentity(), group.getOwnerGroup());
        // create group without admin flag enabled eventhough the user might be
        // coach. the flag is not needed here
        // since the groups knows itself if the user is coach and the user sees
View Full Code Here

    if (waitingListGroups.size() > 0) {
      myTool.addHeader(translate("header.tools.waitingListGroups"));
      Iterator iter = waitingListGroups.iterator();
      while (iter.hasNext()) {
        BusinessGroup group = (BusinessGroup) iter.next();
        BusinessGroupManager businessGroupManager = BusinessGroupManagerImpl.getInstance();
        int pos = businessGroupManager.getPositionInWaitingListFor(identity, group);
        myTool.addLink(CMD_START_GROUP_PREFIX + group.getKey().toString(), group.getName() + "(" + pos + ")", group
            .getKey().toString(), null);
        myTool.setEnabled(group.getKey().toString(), false);
      }
    }
View Full Code Here

   *          null if in any context
   * @param contextList list of contexts that should be searched
   * @return true if in group, false otherwhise
   */
  private boolean isIdentityInGroup(Identity identity, String groupName, String groupContextName, List contextList) {
    BusinessGroupManager groupManager = BusinessGroupManagerImpl.getInstance();
    Iterator iter = contextList.iterator();
    while (iter.hasNext()) {
      BGContext context = (BGContext) iter.next();
      if (groupContextName == null || context.getName().equals(groupContextName)) {
        boolean inGroup = groupManager.isIdentityInBusinessGroup(identity, groupName, context);
        if (inGroup) return true; // finished
      }
    }
    return false;
  }
View Full Code Here

  /**
   * @see org.olat.course.groupsandrights.CourseGroupManager#getOwnedLearningGroupsFromAllContexts(org.olat.core.id.Identity)
   */
  public List getOwnedLearningGroupsFromAllContexts(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.findBusinessGroupsOwnedBy(bgContext.getGroupType(), identity, bgContext);
      allGroups.addAll(contextGroups);
    }
    return allGroups;
  }
View Full Code Here

  /**
   * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingLearningGroupsFromAllContexts(org.olat.core.id.Identity)
   */
  public List getParticipatingLearningGroupsFromAllContexts(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.findBusinessGroupsAttendedBy(bgContext.getGroupType(), identity, bgContext);
      allGroups.addAll(contextGroups);
    }
    return allGroups;
  }
View Full Code Here

  /**
   * @see org.olat.course.groupsandrights.CourseGroupManager#getParticipatingRightGroupsFromAllContexts(org.olat.core.id.Identity)
   */
  public List getParticipatingRightGroupsFromAllContexts(Identity identity) {
    List allGroups = new ArrayList();
    BusinessGroupManager groupManager = BusinessGroupManagerImpl.getInstance();
    Iterator iterator = rightGroupContexts.iterator();
    while (iterator.hasNext()) {
      BGContext bgContext = (BGContext) iterator.next();
      List contextGroups = groupManager.findBusinessGroupsAttendedBy(bgContext.getGroupType(), identity, bgContext);
      allGroups.addAll(contextGroups);
    }
    return allGroups;
  }
View Full Code Here

   *
   * @see org.olat.course.groupsandrights.CourseGroupManager#getWaitingListGroupsFromAllContexts(org.olat.core.id.Identity)
   */
  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

      calendarWrapper.getKalendarConfig().setVis(personalKalendarConfig.isVis());
    }
    calendars.add(calendarWrapper);
   
    // get group calendars
    BusinessGroupManager bgManager = BusinessGroupManagerImpl.getInstance();
    List<BusinessGroup> ownerGroups = bgManager.findBusinessGroupsOwnedBy(null, ureq.getIdentity(), null);
    addCalendars(ureq, ownerGroups, true, calendars);
    List<BusinessGroup> attendedGroups = bgManager.findBusinessGroupsAttendedBy(null, ureq.getIdentity(), null);
    for (Iterator<BusinessGroup> ownerGroupsIterator = ownerGroups.iterator(); ownerGroupsIterator.hasNext();) {
      BusinessGroup ownerGroup = ownerGroupsIterator.next();
      if (attendedGroups.contains(ownerGroup))
        attendedGroups.remove(ownerGroup);
    }
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.