Package org.olat.core.util.mail

Examples of org.olat.core.util.mail.ContactList


    List<Identity> participiants = cgm.getParticipantsFromLearningGroup(null);
    //FIXME:pb:c docu getParticipantsFromLearningGroup: really duplicates?
    Set<Identity> participantsWithoutDuplicates = new HashSet<Identity>(participiants);
   
    participiants = new ArrayList<Identity>(participantsWithoutDuplicates);
    ContactList cl = new ContactList(translate("form.message.chckbx.partips"));
    cl.addAllIdentites(participiants);
    return cl;

  }
View Full Code Here


      // fetch all participants and owners by getting all participants and
      // owners of all groups
      String groupName = iterator.next();
      List<BusinessGroup> mygroups = cgm.getLearningGroupsFromAllContexts(groupName);
      // create a ContactList with the name of the group
      ContactList tmp = new ContactList(groupName);
      for (int i = 0; i < mygroups.size(); i++) {
        BusinessGroup bg = mygroups.get(i);
        List<Identity> ids = secManager.getIdentitiesOfSecurityGroup(bg.getPartipiciantGroup());
        ids.addAll(secManager.getIdentitiesOfSecurityGroup(bg.getOwnerGroup()));
        // add all identities to the ContactList
        tmp.addAllIdentites(ids);
      }
      // add the ContactList
      groupsCL.add(tmp);
    }
    // remove duplicates and convert List -> to Array.
View Full Code Here

      // fetch all participants and owners by getting all participants and
      // owners of all groups
      String areaName = iterator.next();
      List<BusinessGroup> mygroups = cgm.getLearningGroupsInAreaFromAllContexts(areaName);
      // create a ContactList with the name of the group
      ContactList tmp = new ContactList(areaName);
      for (int i = 0; i < mygroups.size(); i++) {
        BusinessGroup bg = mygroups.get(i);
        List<Identity> ids = secManager.getIdentitiesOfSecurityGroup(bg.getPartipiciantGroup());
        ids.addAll(secManager.getIdentitiesOfSecurityGroup(bg.getOwnerGroup()));
        // add all identities to the ContactList
        tmp.addAllIdentites(ids);
      }
      // add the ContactList
      groupsCL.add(tmp);
    }
    // remove duplicates and convert List -> to Array.
View Full Code Here

        this.currentIdentity.getUser().getProperty(UserConstants.FIRSTNAME, getLocale()) }));
  }

  private void doSendMessage(List identities, String mailToName, UserRequest ureq) {
    ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
    ContactList contactList = new ContactList(mailToName);
    contactList.addAllIdentites(identities);
    cmsg.addEmailTo(contactList);
    if (contactCtr != null) contactCtr.dispose();
    contactCtr = new ContactFormController(ureq, getWindowControl(), false, true, false, false, cmsg);
    contactCtr.addControllerListener(this);
    sendMessageVC.put("contactForm", contactCtr.getInitialComponent());
View Full Code Here

    Manager scrtMngr = ManagerFactory.getManager();

    ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
    // two named ContactLists, the new way using the contact form
    // the same name as in the checkboxes are taken as contactlist names
    ContactList ownerCntctLst = new ContactList(businessGroupTranslator.translate("sendtochooser.form.chckbx.owners"));
    ContactList partipCntctLst = new ContactList(businessGroupTranslator.translate("sendtochooser.form.chckbx.partip"));
    ContactList waitingListContactList = new ContactList(businessGroupTranslator.translate("sendtochooser.form.chckbx.waitingList"));
    if (flags.isEnabled(BGConfigFlags.GROUP_OWNERS)) {
      if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) {
        SecurityGroup owners = this.currentGroup.getOwnerGroup();
        List<Identity> ownerList = scrtMngr.getIdentitiesOfSecurityGroup(owners);
        ownerCntctLst.addAllIdentites(ownerList);
        cmsg.addEmailTo(ownerCntctLst);
      } else {
        if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) {
          SecurityGroup owners = this.currentGroup.getOwnerGroup();
          List<Identity> ownerList = scrtMngr.getIdentitiesOfSecurityGroup(owners);
          for (Identity identity : new ArrayList<Identity>(ownerList)) {
            boolean keyIsSelected = false;
            for (Long key : sendToChooserForm.getSelectedOwnerKeys()) {
              if (key.equals(identity.getKey())) {
                keyIsSelected = true;
                break;
              }
            }
            if (!keyIsSelected) {
              ownerList.remove(identity);
            }
          }
          ownerCntctLst.addAllIdentites(ownerList);
          cmsg.addEmailTo(ownerCntctLst);
        }
      }
    }
    if (sendToChooserForm != null) {
      if  (sendToChooserForm.participantChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) {
        SecurityGroup participants = this.currentGroup.getPartipiciantGroup();
        List<Identity> participantsList = scrtMngr.getIdentitiesOfSecurityGroup(participants);
        partipCntctLst.addAllIdentites(participantsList);
        cmsg.addEmailTo(partipCntctLst);
      } else {
        if (sendToChooserForm.participantChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) {
          SecurityGroup participants = this.currentGroup.getPartipiciantGroup();
          List<Identity> participantsList = scrtMngr.getIdentitiesOfSecurityGroup(participants);
          for (Identity identity : new ArrayList<Identity>(participantsList)) {
            boolean keyIsSelected = false;
            for (Long key : sendToChooserForm.getSelectedPartipKeys()) {
              if (key.equals(identity.getKey())) {
                keyIsSelected = true;
                break;
              }
            }
            if (!keyIsSelected) {
              participantsList.remove(identity);
            }
          }
          partipCntctLst.addAllIdentites(participantsList);
          cmsg.addEmailTo(partipCntctLst);
        }
      }
     
    }
    if (sendToChooserForm != null && getIsGMAdminOwner(ureq) && this.currentGroup.getWaitingListEnabled().booleanValue()) {
      if (sendToChooserForm.waitingListChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) {
        SecurityGroup waitingList = this.currentGroup.getWaitingGroup();
        List<Identity> waitingListIdentities = scrtMngr.getIdentitiesOfSecurityGroup(waitingList);
        waitingListContactList.addAllIdentites(waitingListIdentities);
        cmsg.addEmailTo(waitingListContactList);
      } else {
        if (sendToChooserForm.waitingListChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) {
          SecurityGroup waitingList = this.currentGroup.getWaitingGroup();
          List<Identity> waitingListIdentities = scrtMngr.getIdentitiesOfSecurityGroup(waitingList);
          for (Identity identity : new ArrayList<Identity>(waitingListIdentities)) {
            boolean keyIsSelected = false;
            for (Long key : sendToChooserForm.getSelectedWaitingKeys()) {
              if (key.equals(identity.getKey())) {
                keyIsSelected = true;
                break;
              }
            }
            if (!keyIsSelected) {
              waitingListIdentities.remove(identity);
            }
          }
          waitingListContactList.addAllIdentites(waitingListIdentities);
          cmsg.addEmailTo(waitingListContactList);
        }
      }
    }
    String resourceUrl = JumpInManager.getJumpInUri(this.getWindowControl().getBusinessControl());
View Full Code Here

   * @return VelocityContainer
   */
  protected VelocityContainer sendParticipantsMessage(UserRequest ureq, WindowControl wControl, DefaultController listener, String velocity_root, Translator trans, List<Identity> participants) {
    VelocityContainer sendMessageVC = new VelocityContainer("sendmessage", velocity_root + "/sendmessage.html", trans, listener);
    ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
    ContactList contactList = null;
    if(participants.size() == 1) {
      contactList = new ContactList(participants.get(0).getUser().getProperty(UserConstants.EMAIL, ureq.getLocale()));
    } else {
      contactList = new ContactList(trans.translate("participants.message.to"));
    }
    contactList.addAllIdentites(participants);
    cmsg.addEmailTo(contactList);
    ContactFormController contactCtr = new ContactFormController(ureq, wControl, false, false, false, false, cmsg);
    contactCtr.addControllerListener(listener);
    sendMessageVC.contextPut("title", trans.translate("participants.message"));
    sendMessageVC.put("contactForm", contactCtr.getInitialComponent());
View Full Code Here

      listenTo(folderRunController);
      myContent.put("userinfo", folderRunController.getInitialComponent());

    } else if (menuCommand.equals(CMD_CONTACT)) {
      ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
      ContactList emailList = new ContactList(firstLastName);
      emailList.add(identity);
      cmsg.addEmailTo(emailList);
      removeAsListenerAndDispose(contactFormController);
      contactFormController = new ContactFormController(ureq, getWindowControl(), true,true,false,false,cmsg);
      listenTo(contactFormController);
      myContent.put("userinfo", contactFormController.getInitialComponent());
View Full Code Here

  }

  private void createParticipantsMail(UserRequest ureq, List<Identity> participants) {
    VelocityContainer sendMessageVC = new VelocityContainer("sendmessage", VELOCITY_ROOT + "/sendmessage.html", getTranslator(), this);
    ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
    ContactList contactList = null;
    if(participants.size() == 1) {
      contactList = new ContactList(participants.get(0).getName());
    } else {
      contactList = new ContactList(translate("participants.message.to"));
    }
    contactList.addAllIdentites(participants);
    cmsg.addEmailTo(contactList);
    contactCtr = new ContactFormController(ureq, getWindowControl(), false, false, false, false, cmsg);
    contactCtr.addControllerListener(this);
    sendMessageVC.contextPut("title", translate("participants.message"));
    sendMessageVC.put("contactForm", contactCtr.getInitialComponent());
View Full Code Here

        /*
         * find the first caretaker, looking from the leaf towards the root,
         * following the selected branch.
         */
        Manager mngr = ManagerFactory.getManager();
        ContactList caretaker = new ContactList(translate(NLS_CONTACT_TO_GROUPNAME_CARETAKER));
        final List emptyList = new ArrayList();
        List tmpIdent = new ArrayList();
        for (int i = historyStack.size() - 1; i >= 0 && tmpIdent.isEmpty(); i--) {
          // start at the selected category, the root category is asserted to
          // have the OLATAdministrator
          // so we end up having always at least one identity as receiver for a
          // request ;-)
          CatalogEntry tmp = historyStack.get(i);
          SecurityGroup tmpOwn = tmp.getOwnerGroup();
          if (tmpOwn != null) tmpIdent = mngr.getIdentitiesOfSecurityGroup(tmpOwn);
          else tmpIdent = emptyList;
        }
        for (int i = tmpIdent.size() - 1; i >= 0; i--) {
          caretaker.add((Identity) tmpIdent.get(i));
        }
       
        //create e-mail Message
        ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
        cmsg.addEmailTo(caretaker);
View Full Code Here

    // the owners of this qtiPkg
    RepositoryEntry myEntry = rm.lookupRepositoryEntry(qtiPackage.getRepresentingResourceable(), false);
    SecurityGroup qtiPkgOwners = myEntry.getOwnerGroup();

    // add qti resource owners as group
    ContactList cl = new ContactList("qtiPkgOwners");
    cl.addAllIdentites(ManagerFactory.getManager().getIdentitiesOfSecurityGroup(qtiPkgOwners));
    changeEmail.addEmailTo(cl);

    StringBuilder result = new StringBuilder();
    result.append(translate("qti.restricted.leading"));
    for (Iterator iter = referencees.iterator(); iter.hasNext();) {
      ReferenceImpl element = (ReferenceImpl) iter.next();
      // FIXME:discuss:possible performance/cache problem
      if ("CourseModule".equals(element.getSource().getResourceableTypeName())) {
        ICourse course = CourseFactory.loadCourse(element.getSource().getResourceableId());

        // the course owners

        RepositoryEntry entry = rm.lookupRepositoryEntry(course, false);
        String courseTitle = course.getCourseTitle();
        SecurityGroup owners = entry.getOwnerGroup();
        List stakeHoldersIds = ManagerFactory.getManager().getIdentitiesOfSecurityGroup(owners);

        // add stakeholders as group
        cl = new ContactList(courseTitle);
        cl.addAllIdentites(stakeHoldersIds);
        changeEmail.addEmailTo(cl);

        StringBuilder stakeHolders = new StringBuilder();
        User user = ((Identity) stakeHoldersIds.get(0)).getUser();
        Locale loc = ureq.getLocale();
View Full Code Here

TOP

Related Classes of org.olat.core.util.mail.ContactList

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.