Package org.olat.group

Examples of org.olat.group.BusinessGroup


        releaseAdminLockAndGroupMUE();
        doBack();
      }
    } else if (source == bgCopyWizardCtr) {
      if (event.equals(Event.DONE_EVENT)) {
        BusinessGroup newGroup = bgCopyWizardCtr.getNewGroup();
        if (newGroup == null) {
          throw new AssertException("bgCopyWizardCtr.getNewGroup returned null");
        } else {
          releaseAdminLockAndGroupMUE();
          getWindowControl().pop();
View Full Code Here


     
      Link[] ownerGroupLinks= new Link[ownerGroups.size()];
      int ownerNumber = 0;
     
      for (Iterator iter = ownerGroups.iterator(); iter.hasNext();) {
        BusinessGroup group = (BusinessGroup) iter.next();
        Link tmp = LinkFactory.createCustomLink("cmd.user.remove.group.own." + group.getKey(), "cmd.user.remove.group.own." + group.getKey(), "userdetails.remove", Link.BUTTON_SMALL, userDetailsVC, this);
        tmp.setUserObject(group);
        ownerGroupLinks[ownerNumber] = tmp;
        ownerNumber++;
      }
      userDetailsVC.contextPut("ownerGroupLinks", ownerGroupLinks);
      userDetailsVC.contextPut("noOwnerGroups", (ownerGroups.size() > 0 ? Boolean.FALSE : Boolean.TRUE));
      userDetailsVC.contextPut("showOwnerGroups", Boolean.TRUE);
    } else {
      userDetailsVC.contextPut("showOwnerGroups", Boolean.FALSE);
    }
    // 3. expose the participant groups of the identity
    List participantGroups = groupManager.findBusinessGroupsAttendedBy(bgContext.getGroupType(), this.currentIdentity, bgContext);
   
    Link[] participantGroupLinks= new Link[participantGroups.size()];
    int participantNumber = 0;
   
    for (Iterator iter = participantGroups.iterator(); iter.hasNext();) {
      BusinessGroup group = (BusinessGroup) iter.next();
      Link tmp = LinkFactory.createCustomLink("cmd.user.remove.group.part." + group.getKey(), "cmd.user.remove.group.part." + group.getKey(), "userdetails.remove", Link.BUTTON_SMALL, userDetailsVC, this);
      tmp.setUserObject(group);
      participantGroupLinks[participantNumber] = tmp;
      participantNumber++;
    }
    userDetailsVC.contextPut("noParticipantGroups", (participantGroups.size() > 0 ? Boolean.FALSE : Boolean.TRUE));
View Full Code Here

  /**
   * @see org.olat.core.gui.components.table.TableDataModel#getValueAt(int, int)
   */
  public Object getValueAt(int row, int col) {
    BusinessGroup businessGroup = (BusinessGroup) objects.get(row);
    Integer numbParts = (Integer) members.get(row);
    Integer max = businessGroup.getMaxParticipants();
    switch (col) {
      case 0:
        return businessGroup.getName();
      case 1:
        String description = businessGroup.getDescription();
        description = FilterFactory.getHtmlTagsFilter().filter(description);
        description = Formatter.truncate(description, 256);
        return description;
      case 2:
        // Belegt/Plätze
        if (max == null) {
          // no limit => return only members
          return numbParts;
        }
        // return format 2/10
        StringBuilder buf = new StringBuilder();
        buf.append(numbParts);
        buf.append(trans.translate("grouplist.table.partipiciant.delimiter"));
        buf.append(businessGroup.getMaxParticipants());
        if(numbParts>businessGroup.getMaxParticipants()) {
          Tracing.logInfo("Group overflow detected for the group: " + businessGroup + ", participants: " + numbParts + " maxParticipamts: " + businessGroup.getMaxParticipants(), BusinessGroupTableModelWithMaxSize.class);
        }
        return buf.toString();
      case 3:
        // Waiting-list
        if (businessGroup.getWaitingListEnabled().booleanValue()) {
          // Waitinglist is enabled => show current size
          int intValue = securityManager.countIdentitiesOfSecurityGroup(businessGroup.getWaitingGroup());
          return new Integer(intValue);
        }
        return trans.translate("grouplist.table.noWaitingList");
      case 4:
        // Status
        if (securityManager.isIdentityInSecurityGroup(this.identity,businessGroup.getPartipiciantGroup())) {
          return trans.translate("grouplist.table.state.onPartipiciantList");
        } else if (securityManager.isIdentityInSecurityGroup(this.identity,businessGroup.getWaitingGroup())) {
          int pos = businessGroupManager.getPositionInWaitingListFor(identity,businessGroup);
          String[] onWaitingListArgs = new String[] { Integer.toString(pos) };
          return trans.translate("grouplist.table.state.onWaitingList",onWaitingListArgs);
        } else if (max != null && !businessGroup.getWaitingListEnabled().booleanValue() && (numbParts.intValue() >= max.intValue()) ) {
          return trans.translate("grouplist.table.state.enroll.full");
        else if (max != null && businessGroup.getWaitingListEnabled().booleanValue() && (numbParts.intValue() >= max.intValue()) ) {
          return trans.translate("grouplist.table.state.WaitingList");
        }
        return trans.translate("grouplist.table.state.notEnrolled");
      case 5:
        // Action enroll
        if (isEnrolledInAnyGroup(identity)) {
          // Allready enrolled => does not show action-link 'enroll'
          return Boolean.FALSE;
        }
        if (max != null && !businessGroup.getWaitingListEnabled().booleanValue() && (numbParts.intValue() >= max.intValue()) ) {
          // group is full => => does not show action-link 'enroll'
          return Boolean.FALSE;
        }
        return Boolean.TRUE;
      case 6:
        // Action cancel enrollment
        if (isEnrolledIn(businessGroup, identity)) {
          // check if user is on waiting-list
          if (securityManager.isIdentityInSecurityGroup(this.identity,businessGroup.getWaitingGroup())) {
            // user is on waitinglist => show allways action cancelEnrollment for waitinglist
             return Boolean.TRUE;
          }
          // user is not on waitinglist => show action cancelEnrollment only if enabled
          if (cancelEnrollEnabled) {
View Full Code Here

/**
* Check if an identity is in any security-group.
* @param identity
* @return true: Found identity in any security-group of this table model.
*/  private boolean isEnrolledInAnyGroup(Identity identity) {
    BusinessGroup businessGroup;
    // loop over all business-groups
    for (Iterator iter = objects.iterator(); iter.hasNext() ;) {
      businessGroup = (BusinessGroup)iter.next();
      if (isEnrolledIn(businessGroup, identity) ) {
        return true;
View Full Code Here

        StringBuilder nokGroups = new StringBuilder();
        Integer max = this.groupNamesForm.getGroupMax();
        Iterator iter = groupNames.iterator();
        while (iter.hasNext()) {
          String groupName = (String) iter.next();
          BusinessGroup newGroup = doCopyGroup(groupName, max);
          if (newGroup == null) {
            nokGroups.append("<li>");
            nokGroups.append(groupName);
            nokGroups.append("</li>");
          } else {
View Full Code Here

    // 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

  /**
   * @see org.olat.core.gui.components.table.TableDataModel#getValueAt(int, int)
   */
  public Object getValueAt(int row, int col) {
    BusinessGroup businessGroup = (BusinessGroup) objects.get(row);
    switch (col) {
      case 0:
        String name = businessGroup.getName();
        name = StringEscapeUtils.escapeHtml(name).toString();
        return name;
      case 1:
        String tmp = businessGroup.getDescription();
        tmp = FilterFactory.getHtmlTagsFilter().filter(tmp);
        tmp = Formatter.truncate(tmp, 256);
        return tmp;
      default:
        return "ERROR";
View Full Code Here

    switch (col) {
      case 0 :
        String cat = p.getCategory();
        return (cat == null ? "n/a" : cat);
      case 1 :
        BusinessGroup grp = p.getGrp();
        return (grp == null ? "n/a" : grp.getKey().toString());
      case 2 :
        String resType = p.getResourceTypeName();
        return (resType == null ? "n/a" : resType);
      case 3 :
        String name = p.getName();
View Full Code Here

    StringBuffer warningMessage = new StringBuffer();
    if (mailTemplate != null) {
      MailerWithTemplate mailer = MailerWithTemplate.getInstance();
      HashMap identityGroupList = new HashMap();
      for (Iterator iter = selectedGroups.iterator(); iter.hasNext();) {
        BusinessGroup group = (BusinessGroup)iter.next();
     
        // Build owner group, list of identities
        SecurityGroup ownerGroup = group.getOwnerGroup();
        List ownerIdentities = ManagerFactory.getManager().getIdentitiesOfSecurityGroup(ownerGroup);
        // loop over this list and send email
        for (Iterator iterator = ownerIdentities.iterator(); iterator.hasNext();) {
          Identity identity = (Identity) iterator.next();
          if (identityGroupList.containsKey(identity) ) {
            List groupsOfIdentity = (List)identityGroupList.get(identity);
            groupsOfIdentity.add(group);
          } else {
            List groupsOfIdentity = new ArrayList();
            groupsOfIdentity.add(group);
            identityGroupList.put(identity, groupsOfIdentity);
          }       
        }
      }
      //   loop over identity list and send email
      for (Iterator iterator = identityGroupList.keySet().iterator(); iterator.hasNext();) {
        Identity identity = (Identity) iterator.next();
           
        mailTemplate.addToContext("responseTo", emailResponseTo);
        if (!isTemplateChanged) {
          // Email template has NOT changed => take translated version of subject and body text
          Translator identityTranslator = new PackageTranslator(PACKAGE, I18nManager.getInstance().getLocaleOrDefault(identity.getUser().getPreferences().getLanguage()));
          mailTemplate.setSubjectTemplate(identityTranslator.translate(keyEmailSubject));
          mailTemplate.setBodyTemplate(identityTranslator.translate(keyEmailBody));
        }
        // loop over all repositoriesOfIdentity to build email message
        StringBuilder buf = new StringBuilder();
        for (Iterator groupIterator = ((List)identityGroupList.get(identity)).iterator(); groupIterator.hasNext();) {
          BusinessGroup group = (BusinessGroup) groupIterator.next();
          buf.append("\n  ").append( group.getName() ).append(" / ").append(FilterFactory.getHtmlTagsFilter().filter(group.getDescription()));
        }
        mailTemplate.addToContext("groupList", buf.toString());
        mailTemplate.putVariablesInMailContext(mailTemplate.getContext(), identity);
        Tracing.logDebug(" Try to send Delete-email to identity=" + identity.getName() + " with email=" + identity.getUser().getProperty(UserConstants.EMAIL, null), this.getClass());
        List<Identity> ccIdentities = new ArrayList<Identity>();
        if(mailTemplate.getCpfrom()) {
          ccIdentities.add(sender);
        } else {
          ccIdentities = null
        }
        MailerResult mailerResult = mailer.sendMailUsingTemplateContext(identity, ccIdentities, null, mailTemplate, sender);
        if (mailerResult.getReturnCode() == MailerResult.OK) {
          // Email sended ok => set deleteEmailDate
          for (Iterator groupIterator = ((List)identityGroupList.get(identity)).iterator(); groupIterator.hasNext();) {
            BusinessGroup group = (BusinessGroup) groupIterator.next();
            Tracing.logAudit("Group-Deletion: Delete-email send to identity=" + identity.getName() + " with email=" + identity.getUser().getProperty(UserConstants.EMAIL, null) + " for group=" + group, this.getClass());
            markSendEmailEvent(group);
          }
        } else {
          warningMessage.append( pT.translate("email.error.send.failed", new String[] {identity.getUser().getProperty(UserConstants.EMAIL, null), identity.getName()} ) ).append("\n");
        }
      }
    } else {
      // no template => User decides to sending no delete-email, mark only in lifecycle table 'sendEmail'
      for (Iterator iter = selectedGroups.iterator(); iter.hasNext();) {
        BusinessGroup group = (BusinessGroup)iter.next();
        Tracing.logAudit("Group-Deletion: Move in 'Email sent' section without sending email, group=" + group, this.getClass());
        markSendEmailEvent(group);
      }
    }   
    return warningMessage.toString();   
View Full Code Here

    return dbq.list();
  }

  public void deleteGroups(List objects) {
    for (Iterator iter = objects.iterator(); iter.hasNext();) {
      BusinessGroup businessGroup = (BusinessGroup) iter.next();
      String archiveFileName = archive(getArchivFilePath(businessGroup), businessGroup);
      Tracing.logAudit("Group-Deletion: archived businessGroup=" + businessGroup + " , archive-file-name=" + archiveFileName, this.getClass());
      CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup).deleteTools(businessGroup);
      BusinessGroupManagerImpl.getInstance().deleteBusinessGroup(businessGroup);
      LifeCycleManager.createInstanceFor(businessGroup).deleteTimestampFor(SEND_DELETE_EMAIL_ACTION);
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.