Package com.centraview.mail

Examples of com.centraview.mail.MailMessageVO


      String fromAddress = custProfileTemplateForm.getFromAddress();
      String replyTo = custProfileTemplateForm.getReplyTo();
      String emailSubject = custProfileTemplateForm.getSubject();
      String emailBody = custProfileTemplateForm.getBody();
     
      MailMessageVO mailMessage = new MailMessageVO();
      ArrayList toList = new ArrayList();
      toList.add(toAddress);
      mailMessage.setToList(toList);
      mailMessage.setHeaders("Change Of Profile Information");
      mailMessage.setContentType("text/plain");
      mailMessage.setFromAddress(fromAddress);
      mailMessage.setReplyTo(replyTo);
      mailMessage.setSubject(emailSubject);
     
      StringBuffer body = new StringBuffer("");
      body.append(emailBody);
      body.append("\n\nCustomer Profile Change Request:\n\n");
     
      DynaActionForm dynaForm = (DynaActionForm)form;
     
      String entityName = (String)dynaForm.get("entityName");
      body.append("Entity Name: " + entityName + "\n");
     
      String website = (String)dynaForm.get("website");
      body.append("Website: " + website + "\n");
     
      String street1 = (String)dynaForm.get("street1");
      body.append("Street1: " + street1 + "\n");
     
      String street2 = (String)dynaForm.get("street2");
      body.append("Street2: " + street2 + "\n");
     
      String city = (String)dynaForm.get("city");
      body.append("City: " + city + "\n");
     
      String state = (String)dynaForm.get("state");
      body.append("State: " + state + "\n");
     
      String zipCode = (String)dynaForm.get("zipCode");
      body.append("Zip Code: " + zipCode + "\n");
     
      String country = (String)dynaForm.get("country");
      body.append("Country: " + country + "\n");
     
      String mocContent = "";
      String mocTypeName = "";
      if (dynaForm.get("email") != null) {
        mocContent = (dynaForm.get("email") == null) ? "" : (String)dynaForm.get("email");
        body.append("Email: " + mocContent + "\n");
      }
     
      for (int i = 1; i < 4; i++) {
        mocContent = CVUtility.getMOCContent(dynaForm, i + "");
        int mocType = Integer.parseInt((String)dynaForm.get("mocType" + i));
        mocTypeName = CVUtility.getSyncAs(mocType);
        body.append(mocTypeName + ": " + mocContent + "\n");
      }
     
      body.append("\n\nEnd CentraView Web Request\n");
     
      mailMessage.setBody(body.toString());
     
      boolean messageSent = emailSettingsRemote.simpleMessage(individualID,mailMessage);
     
      if (! messageSent) {
        // if email message is not sent, let the user know we suck
View Full Code Here


    String fromAddress = userInfoTemplateForm.getFromAddress();
    String replyTo = userInfoTemplateForm.getReplyTo();
    String emailSubject = userInfoTemplateForm.getSubject();
    String emailBody = userInfoTemplateForm.getBody();

    MailMessageVO mailMessage = new MailMessageVO();
    ArrayList toList = new ArrayList();
    toList.add(toAddress);
    mailMessage.setToList(toList);
    mailMessage.setHeaders("Change Of User Information");
    mailMessage.setContentType("text/plain");
    mailMessage.setFromAddress(fromAddress);
    mailMessage.setReplyTo(replyTo);
    mailMessage.setSubject(emailSubject);


    StringBuffer body = new StringBuffer("");
    body.append(emailBody);
    body.append("\n\nUser Information Change Request:\n\n");

    DynaActionForm dynaForm = (DynaActionForm)form;

    String entityName = (String)dynaForm.get("individualName");
    body.append("Individual Name: " + entityName + "\n");

    String title = (String)dynaForm.get("title");
    body.append("Title: " + title + "\n");

    String street1 = (String)dynaForm.get("street1");
    body.append("Street1: " + street1 + "\n");

    String street2 = (String)dynaForm.get("street2");
    body.append("Street2: " + street2 + "\n");

    String city = (String)dynaForm.get("city");
    body.append("City: " + city + "\n");

    String state = (String)dynaForm.get("state");
    body.append("State: " + state + "\n");

    String zipCode = (String)dynaForm.get("zipCode");
    body.append("Zip Code: " + zipCode + "\n");

    String country = (String)dynaForm.get("country");
    body.append("Country: " + country + "\n");

    String mocContent = "";
    String mocTypeName = "";
      if (dynaForm.get("email") != null) {
        mocContent = (dynaForm.get("email") == null) ? "" : (String)dynaForm.get("email");
      body.append("Email: " + mocContent + "\n");
      }

    for(int i=1 ; i<4 ; i++ ){
      mocContent = CVUtility.getMOCContent(dynaForm, i+"");
      int mocType = Integer.parseInt((String)dynaForm.get("mocType"+i));
      mocTypeName = CVUtility.getSyncAs(mocType);
      body.append(mocTypeName+": " + mocContent + "\n");
      }

    body.append("\n\n\nLogin Information Change Request:\n\n");

    Integer userID = (Integer)dynaForm.get("userID");
    body.append("UserID: " + userID.toString() +"\n");

    String username = (String)dynaForm.get("username");
    body.append("Username: " + username +"\n");

    String oldPassword = (String)dynaForm.get("oldPassword");
    body.append("Old Password: " + oldPassword + "\n");

    String newPassword = (String)dynaForm.get("newPassword");
    body.append("New Password: " + newPassword + "\n");

    String newPasswordConf = (String)dynaForm.get("newPasswordConf");
    body.append("Confirm Password: " + newPasswordConf  + "\n");

    body.append("\n\nEnd CentraView Web Request\n");

    mailMessage.setBody(body.toString());

      boolean messageSent = false;
      try {
        messageSent = emailSettingsRemote.simpleMessage(individualID,mailMessage);
      } catch(Exception e) {
View Full Code Here

              }
            }
          }

          // create a MailMessageVO
          MailMessageVO messageVO = new MailMessageVO();

          if (attachmentFileIDs != null && attachmentFileIDs.size() > 0) {
            CvFileFacade fileRemote = new CvFileFacade();

            for (int i = 0; i < attachmentFileIDs.size(); i++) {
              int fileID = ((Integer)attachmentFileIDs.get(i)).intValue();
              // get the CvFileVO from the EJB layer
              CvFileVO fileVO = fileRemote.getFile(individualID, fileID, dataSource);
              if (fileVO != null) {
                // add this attachment to the messageVO
                messageVO.addAttachedFiles(fileVO);
              }
            }
          }

          // Send Email to all the Individual with the updated information of
View Full Code Here

      MailHome home = (MailHome)CVUtility.getHomeObject("com.centraview.mail.MailHome", "Mail");
      Mail remote = home.create();
      remote.setDataSource(dataSource);

      // create a MailMessageVO
      MailMessageVO messageVO = new MailMessageVO();

      String from = (String)emailForm.get("from");
      messageVO.setFromAddress(from);
      String replyTo = (String)emailForm.get("replyTo");
      messageVO.setReplyTo(replyTo);

      String subject = (String)emailForm.get("subject");
      if (subject == null || subject.equals("")) {
        messageVO.setSubject("[No Subject] ");
      } else {
        messageVO.setSubject(subject);
      }

      String body = (String)emailForm.get("body");
      if (body == null) {
        body = "";
      }
      messageVO.setBody(body);

      Boolean composeInHTML = (Boolean)emailForm.get("composeInHTML");
      if (composeInHTML.booleanValue()) {
        messageVO.setContentType(MailMessageVO.HTML_TEXT_TYPE);
      } else {
        messageVO.setContentType(MailMessageVO.PLAIN_TEXT_TYPE);
      }

      ArrayList toList = this.parseAddresses((String)emailForm.get("to"));
      if (toList.size() <= 0) {
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
            "error.general.requiredField", "To:"));
      } else {
        messageVO.setToList(toList);
      }

      ArrayList ccList = this.parseAddresses((String)emailForm.get("cc"));
      messageVO.setCcList(ccList);

      ArrayList bccList = this.parseAddresses((String)emailForm.get("bcc"));
      messageVO.setBccList(bccList);

      // TODO: figure out what headers to set when sending mail
      messageVO.setHeaders("");

      messageVO.setReceivedDate(new java.util.Date());

      // Handle attachments - the attachment handler puts a ArrayList
      // This ArrayList contains the list of attached fileIDs.
      // So we'll get that ArrayList, iterate through it, creating a
      // CvFileVO object for each attachment, then add that file VO
      // to the messageVO object which will take care of the rest in
      // the EJB layer. Note that in the future, we'll want to make
      // this better by not saving the attachment list on the session.
      // So if you intend to modify this code, please consult the rest
      // of the team to see if it makes sense to make that change now.
      // Also, if you make a change here, you must make sure the
      // attachment handling code in ForwardHandler reflects your changes.
      if (attachmentFileIDs != null && attachmentFileIDs.size() > 0) {
        CvFileFacade fileRemote = new CvFileFacade();

        for (int i = 0; i < attachmentFileIDs.size(); i++) {
          int fileID = ((Integer)attachmentFileIDs.get(i)).intValue();
          // get the CvFileVO from the EJB layer
          CvFileVO fileVO = fileRemote.getFile(individualID, fileID, dataSource);
          if (fileVO != null) {
            // add this attachment to the messageVO
            messageVO.addAttachedFiles(fileVO);
          }
        } // end while (attachIter.hasNext())
      } // end if (attachmentMap != null && attachmentMap.size() > 0)

      if (!allErrors.isEmpty()) {
View Full Code Here

 
      Mail remote = (Mail)home.create();
      remote.setDataSource(dataSource);

      MailMessageVO messageVO = remote.getEmailMessageVO(individualID, messageID.intValue());

      emailForm.set("accountID", new Integer(messageVO.getEmailAccountID()));
      Integer folderID = new Integer(messageVO.getEmailFolderID());
      emailForm.set("folderID", folderID);
     
      emailForm.set("private",(String)messageVO.getPrivate());
      String fromAddress = (String)messageVO.getFromAddress();
      if (fromAddress != null && CVUtility.isEmailAddressValid(fromAddress))
      {
        emailForm.set("from", new InternetAddress(fromAddress));
      }else{
    InternetAddress blankfromAddress = new InternetAddress();
    blankfromAddress.setAddress("");
        emailForm.set("from", blankfromAddress);
      }

      // the the To: list. Make sure it contains InternetAddress objects
      ArrayList toListVO = (ArrayList)messageVO.getToList();
      ArrayList toList = new ArrayList();
      Iterator toIter = toListVO.iterator();
      while (toIter.hasNext())
      {
        toList.add((InternetAddress)toIter.next());
      }
      emailForm.set("toList", toList);

      // the the cc: list. Make sure it contains InternetAddress objects
      ArrayList ccListVO = (ArrayList)messageVO.getCcList();
      ArrayList ccList = new ArrayList();
      Iterator ccIter = ccListVO.iterator();
      while (ccIter.hasNext())
      {
        ccList.add((InternetAddress)ccIter.next());
      }
      emailForm.set("ccList", ccList);

      ArrayList bccList = new ArrayList();
      emailForm.set("bccList", bccList);

      emailForm.set("messageDate", messageVO.getReceivedDate());

      emailForm.set("subject", messageVO.getSubject());

      ArrayList attachmentList = new ArrayList();
      emailForm.set("attachmentList", messageVO.getAttachedFiles());


      String body = (String)messageVO.getBody();

      // figure out if the message's Content-Type: is text/plain
      // If so, replace newlines with <br>'s.
      String contentType = (String)messageVO.getContentType();
      if (contentType != null && contentType.equals(MailMessageVO.PLAIN_TEXT_TYPE))
      {
        // we need to make it pretty
        body = body.replaceAll("\r", "");
        body = body.replaceAll("\n", "<br>\n");
      }

      emailForm.set("body", body);

      String headers = (String)messageVO.getHeaders();

    }catch(Exception e){
      logger.debug("[Exception][CommonViewMessageHandler] Exception thrown in execute(): " + e);
  }
    return(mapping.findForward(forward));
View Full Code Here

  * @return void
  */
  private void sendAlertEmail(int individualID,String individualIDs,String body) throws SendFailedException
  {
    try{
      MailMessageVO mailMessageVO = new MailMessageVO();
      ArrayList toList = new ArrayList();

      InitialContext ic = CVUtility.getInitialContext();
      ContactHelperLocalHome contactHome = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
      ContactHelperLocal contactRemote = (ContactHelperLocal)contactHome.create();
      contactRemote.setDataSource(dataSource);
      toList = contactRemote.getEmailContactForIndividuals(individualIDs);
      String fromAddress = contactRemote.getPrimaryEmailAddress(individualID,2);

      if (fromAddress != null && !fromAddress.equals("") && toList != null && toList.size() != 0)
      {
        EmailSettingsLocalHome emailSettingsHome = (EmailSettingsLocalHome)ic.lookup("local/EmailSettings");
        EmailSettingsLocal emailSettingsRemote = (EmailSettingsLocal)emailSettingsHome.create();
        emailSettingsRemote.setDataSource(dataSource);

        // Its a predefined Template for the replying message for Task Completion
        EmailTemplateForm taskTemplateForm = emailSettingsRemote.getEmailTemplate(AdministrationConstantKeys.EMAIL_TEMPLATE_TASK);
        String subject = taskTemplateForm.getSubject();
        String bodyTemplate = taskTemplateForm.getBody()+ "\n";

        mailMessageVO.setToList(toList);
        mailMessageVO.setFromAddress(fromAddress);
        mailMessageVO.setHeaders("Task Completion");
        mailMessageVO.setSubject(subject);
        mailMessageVO.setBody(bodyTemplate+body);
        mailMessageVO.setContentType(MailMessageVO.PLAIN_TEXT_TYPE);

        boolean sendFlag = emailSettingsRemote.simpleMessage(individualID,mailMessageVO);
      }// end of if(fromAddress != null && !fromAddress.equals("") && toList != null && toList.size() != 0)
    }
    catch(Exception e){
View Full Code Here

      String toAddress = suggestionTemplateForm.getToAddress();
      String fromAddress = suggestionTemplateForm.getFromAddress();
      String replyTo = suggestionTemplateForm.getReplyTo();
      String subject = suggestionTemplateForm.getSubject();

      MailMessageVO mailMessageVO = new MailMessageVO();
      ArrayList toList = new ArrayList();
      toList.add(toAddress);
      mailMessageVO.setToList(toList);
      mailMessageVO.setFromAddress(fromAddress);
      mailMessageVO.setReplyTo(replyTo);
      mailMessageVO.setHeaders("Suggestion");
      mailMessageVO.setSubject(subject);
      mailMessageVO.setBody(body);
      mailMessageVO.setContentType(MailMessageVO.PLAIN_TEXT_TYPE);

      boolean sendFlag = emailSettingsRemote.simpleMessage(individualID,mailMessageVO);
      request.setAttribute(HrConstantKeys.TYPEOFSUBMODULE,HrConstantKeys.SUGGESTION);

    }//end of try block
View Full Code Here

          /*
           * Special case.  Until the app is properly configured, i.e. forgot
           * password template setup, smtp relay setup, none of this will work.
           */
         
          MailMessageVO mailMessage = new MailMessageVO();
          mailMessage.setHeaders("Forgotten Password");
          mailMessage.setContentType("text/plain");
          mailMessage.addToAddress(formEmail);
          mailMessage.setFromAddress(fromAddress);
          mailMessage.setReplyTo(replyTo);
          mailMessage.setSubject(emailSubject);
          mailMessage.setBody(forgotPasswordMesssage);
          boolean sendFlag = emailSettingsRemote.simpleMessage(individualID,mailMessage);
          request.setAttribute("action", "succeed");
        else {
          request.setAttribute("action", "fail");
        }
View Full Code Here

     
      MailHome home = (MailHome)CVUtility.getHomeObject("com.centraview.mail.MailHome", "Mail");
      Mail remote = (Mail)home.create();
      remote.setDataSource(dataSource);

      MailMessageVO messageVO = remote.getEmailMessageVO(individualID, messageID.intValue());

      String body = (String)messageVO.getBody();

      MailImportHome importHome = (MailImportHome)CVUtility.getHomeObject("com.centraview.mail.MailImportHome", "MailImport");
      MailImport importRemote = (MailImport)importHome.create();
      importRemote.setDataSource(dataSource);
     
View Full Code Here

        if (endDateTime != null) {
          String endDate = dateFormatter.format(endDateTime);
          body.append("End: " + endDate + "\n");
        }
        body.append("Creator: " + basicActivityVO.getOwnerName() + "\n\n");
        MailMessageVO mailMessageVO = new MailMessageVO();
        mailMessageVO.setFromAddress(fromAddress);
        mailMessageVO.setHeaders("X-CentraView-Activity-Invitation: true");
        mailMessageVO.setSubject(subject);
        mailMessageVO.setBody(body.toString());
        mailMessageVO.setContentType(MailMessageVO.PLAIN_TEXT_TYPE);
        mailMessageVO.setReceivedDate(new java.util.Date());
        if (toList != null && toList.size() != 0) {
          mailMessageVO.setToList(toList);
          boolean sendFlag = emailSettingsRemote.simpleMessage(userId, mailMessageVO);
        }
      }
    } catch (Exception e) {
      logger.error("[Exception] ActivityHelperEJB.extraActions: ", e);
View Full Code Here

TOP

Related Classes of com.centraview.mail.MailMessageVO

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.