Package org.olat.group

Examples of org.olat.group.BusinessGroup


  //////////////////////
  // ACCOUNT MANAGEMENT
  //////////////////////
  public BusinessGroup getAccountManagerGroupFor(CoursePropertyManager cpm, CourseNode courseNode, ICourse course, String groupName, String groupDescription, Identity identity) {
    Long groupKey = null;
    BusinessGroup accountManagerGroup = null;
    Property accountManagerGroupProperty = cpm.findCourseNodeProperty(courseNode, null, null, ProjectBrokerCourseNode.CONF_ACCOUNTMANAGER_GROUP_KEY);
    // Check if forum-property exist
    if (accountManagerGroupProperty != null) {
      groupKey = accountManagerGroupProperty.getLongValue();
      log.debug("accountManagerGroupProperty=" + accountManagerGroupProperty + "  groupKey=" + groupKey);
    }
    log.debug("groupKey=" + groupKey);
    if (groupKey != null) {
      accountManagerGroup = BusinessGroupManagerImpl.getInstance().loadBusinessGroup(groupKey, false);
      log.debug("load businessgroup=" + accountManagerGroup);
      if (accountManagerGroup != null) {
        return accountManagerGroup;
      } else {
        if (accountManagerGroupProperty != null) {
          cpm.deleteProperty(accountManagerGroupProperty);
        }
        groupKey = null;
        log.warn("ProjectBroker: Account-manager does no longer exist, create a new one");
      }
    }
    if (groupKey == null) {
      log.debug("No group for project-broker exist => create a new one");
      BGContext context = createGroupContext(course);
     
      accountManagerGroup = BusinessGroupManagerImpl.getInstance().createAndPersistBusinessGroup(BusinessGroup.TYPE_LEARNINGROUP, identity, groupName, groupDescription, null, null, false, false, context);
      int i = 2;
      while (accountManagerGroup == null) {
        // group with this name exist already, try another name
        accountManagerGroup = BusinessGroupManagerImpl.getInstance().createAndPersistBusinessGroup(BusinessGroup.TYPE_LEARNINGROUP, identity, groupName + " #" + i, groupDescription, null, null, false, false, context);
        i++;
      }
      log.debug("createAndPersistBusinessGroup businessgroup=" + accountManagerGroup);     
     
      saveAccountManagerGroupKey(accountManagerGroup.getKey(), cpm, courseNode);
      log.debug("created account-manager default businessgroup=" + accountManagerGroup);
    }
    return accountManagerGroup;
  }
View Full Code Here


  public boolean isAccountManager(Identity identity, CoursePropertyManager cpm, CourseNode courseNode) {
    Property accountManagerGroupProperty = cpm.findCourseNodeProperty(courseNode, null, null, ProjectBrokerCourseNode.CONF_ACCOUNTMANAGER_GROUP_KEY);
    if (accountManagerGroupProperty != null) {
       Long groupKey = accountManagerGroupProperty.getLongValue();
      BusinessGroup accountManagerGroup = BusinessGroupManagerImpl.getInstance().loadBusinessGroup(groupKey, false);
      if (accountManagerGroup != null) {
        return isAccountManager(identity,  accountManagerGroup);
      }
    }
    return false;
View Full Code Here

    log.debug("deleteAccountManagerGroup start...");
    Property accountManagerGroupProperty = cpm.findCourseNodeProperty(courseNode, null, null, ProjectBrokerCourseNode.CONF_ACCOUNTMANAGER_GROUP_KEY);
    if (accountManagerGroupProperty != null) {
      Long groupKey = accountManagerGroupProperty.getLongValue();
      if (groupKey != null) {
        BusinessGroup accountManagerGroup = BusinessGroupManagerImpl.getInstance().loadBusinessGroup(groupKey, false);
        if (accountManagerGroup != null) {
          BusinessGroupManagerImpl.getInstance().deleteBusinessGroup(accountManagerGroup);
          log.audit("ProjectBroker: Deleted accountManagerGroup=" + accountManagerGroup);
        } else {
          log.debug("deleteAccountManagerGroup: accountManagerGroup=" + accountManagerGroup + " has already been deleted");
View Full Code Here

      log.debug("deleteAccountManagerGroup: found no accountManagerGroup-key");
    }
  }

  public void updateAccountManagerGroupName(String groupName, String groupDescription, BusinessGroup accountManagerGroup) {
    BusinessGroup reloadedBusinessGroup = (BusinessGroup)DBFactory.getInstance().loadObject(BusinessGroupImpl.class, accountManagerGroup.getKey());
    reloadedBusinessGroup.setName(groupName);
    reloadedBusinessGroup.setDescription(groupDescription);
    BusinessGroupManagerImpl.getInstance().updateBusinessGroup(reloadedBusinessGroup);
  }
View Full Code Here

    BGContext context = createGroupContext(CourseFactory.loadCourse(courseId));
    // TODO: groupNbr no longer used => remove for 6.4
    int groupNbr = projects.size() + 1;
    log.debug("createProjectGroupFor groupName=" + groupName);
    BusinessGroup projectGroup = BusinessGroupManagerImpl.getInstance().createAndPersistBusinessGroup(BusinessGroup.TYPE_LEARNINGROUP, identity, groupName, groupDescription, null, null, false, false, context);
    // projectGroup could be null when a group with name already exists
    int counter = 2;
    while (projectGroup == null) {
      // name alreday exist try another one
      String newGroupName = groupName + " #" + counter ;
View Full Code Here

        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;
         
          userGroups.add(groupEntry);
          }     
View Full Code Here

    if (source == tblCtr){
      if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
        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

      CoordinatorManager.getCoordinator().getSyncer().doInSync(group, new SyncerExecutor(){
        public void execute() {
          Tracing.logInfo("doEnroll start: group="+OresHelper.createStringRepresenting(group), identity.getName(), EnrollmentManager.class);
          Codepoint.codepoint(EnrollmentManager.class, "doInSync1");
          // 6_1_0-RC15: reload group object here another node might have changed this in the meantime
          BusinessGroup reloadedGroup = (BusinessGroup) DBFactory.getInstance().loadObject(group, true);         
          if (reloadedGroup.getMaxParticipants() != null && !reloadedGroup.getMaxParticipants().equals("")) {
            int participantsCounter = securityManager.countIdentitiesOfSecurityGroup(reloadedGroup.getPartipiciantGroup());
           
            Tracing.logInfo("doEnroll - participantsCounter: " + participantsCounter + ", maxParticipants: " + reloadedGroup.getMaxParticipants().intValue(), identity.getName(), EnrollmentManager.class);
            if (participantsCounter >= reloadedGroup.getMaxParticipants().intValue()) {
              // already full, show error and updated choose page again
              if (!reloadedGroup.getWaitingListEnabled().booleanValue()) {
                // No Waiting List => List is full
                enrollStatus.setErrorMessage(trans.translate("error.group.full"));
              } else {
                boolean done = addUserToWaitingList(identity, reloadedGroup, enNode, coursePropertyManager, wControl, trans);
                enrollStatus.setIsInWaitingList(done);
View Full Code Here

   * @return true if this identity is any waiting-list group in this course that
   *         has a name that is in the group names list
   */
  protected BusinessGroup getBusinessGroupWhereInWaitingList(Identity identity, List groupNames, List areaNames, CourseGroupManager cgm) {
    List groups = loadGroupsFromNames(groupNames, areaNames, cgm);
    BusinessGroup businessGroup;
    // loop over all business-groups
    for (Iterator iter = groups.iterator(); iter.hasNext();) {
      businessGroup = (BusinessGroup) iter.next();
      if (securityManager.isIdentityInSecurityGroup(identity, businessGroup.getWaitingGroup())) { return businessGroup; }
    }
    return null;
  }
View Full Code Here

    Iterator iterator = groupNames.iterator();
    while (iterator.hasNext()) {
      String groupName = (String) iterator.next();
      List mygroups = cgm.getLearningGroupsFromAllContexts(groupName);
      for (Iterator it = mygroups.iterator(); it.hasNext();) {
        BusinessGroup bg = (BusinessGroup) it.next();
        if (!groups.contains(bg)) groups.add(bg);
      }
    }
    // add groups from areas
    iterator = areaNames.iterator();
    while (iterator.hasNext()) {
      String areaName = (String) iterator.next();
      List mygroups = cgm.getLearningGroupsInAreaFromAllContexts(areaName);
      for (Iterator it = mygroups.iterator(); it.hasNext();) {
        BusinessGroup bg = (BusinessGroup) it.next();
        if (!groups.contains(bg)) groups.add(bg);
      }
    }
    return groups;
  }
View Full Code Here

TOP

Related Classes of org.olat.group.BusinessGroup

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.