Package com.centraview.email.emailfacade

Examples of com.centraview.email.emailfacade.EmailFacade


    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    try
    {
      //System.out.println("Email : updateStatusHandler");
      EmailFacadeHome cfh = (EmailFacadeHome)CVUtility.getHomeObject("com.centraview.email.emailfacade.EmailFacadeHome","EmailFacade");
      EmailFacade remote =( EmailFacade )cfh.create();
      remote.setDataSource(dataSource);
      String headerName = Constants.EH_ATTENDEE_STATUS_KEY;
      String headerValue = status;
      //ejb call to update header 
      remote.updateHeader(userId,messageId,headerName,headerValue);
      remote = null;
      //ejb call to update activity
      ActivityFacadeHome afh = (ActivityFacadeHome)CVUtility.getHomeObject("com.centraview.activity.activityfacade.ActivityFacadeHome","ActivityFacade");
      ActivityFacade af = afh.create();
      af.setDataSource(dataSource);
View Full Code Here


    mailMessage.setMessageDate( new java.sql.Timestamp( ) ) ;

    mailMessage.setAttachFileIDs( attchmentids );

    EmailFacadeHome facade = (EmailFacadeHome)CVUtility.getHomeObject("com.centraview.email.emailfacade.EmailFacadeHome","EmailFacade");
    EmailFacade remote =( EmailFacade )facade.create();
    remote.setDataSource(dataSource);
    int mesgid =  remote.editDraft( individualId , mailMessage  );

    request.setAttribute( "messageid" ,  messageid  )
    request.setAttribute( "action" ,"Drafts"  )
    request.setAttribute( "rowId" ,  messageid  );   
  }
View Full Code Here

        {}
      }
      String messageID[] = request.getParameterValues("rowId");

      EmailFacadeHome cfh = (EmailFacadeHome)CVUtility.getHomeObject("com.centraview.email.emailfacade.EmailFacadeHome", "EmailFacade");
      EmailFacade remote = (EmailFacade)cfh.create();
      remote.setDataSource(dataSource);
      remote.emailMarkasRead(sourcefolderid, smarkFlag, messageID);
    }
    catch (Exception e)
    {
      System.out.println("[Exception][EmailMarkasreadHandler.execute] Exception Thrown: " + e);
      e.printStackTrace();
View Full Code Here

      }

      if (flag == true)
      {
        MailMessage mailmessage = null;
        EmailFacade remote = (EmailFacade)cfh.create();

        HashMap hm = new HashMap();
        hm.put("MessageID", new Integer(messageID));
        mailmessage = remote.getMailMessage(individualID, hm);
        remote.setDataSource(dataSource);

        String mailIdList[] = { rowId };

        remote.emailMarkasRead(Integer.parseInt(folderid), 1, mailIdList);

        ArrayList to = mailmessage.getTo();
        ArrayList cc = mailmessage.getCc();

        String arrayTO[] = new String[to.size()];
View Full Code Here

      String smtpserver = (String)dynaForm.get("smtpserver");
      mailaccount.setSmtpserver(smtpserver);

      EmailFacadeHome facade = (EmailFacadeHome)CVUtility.getHomeObject("com.centraview.email.emailfacade.EmailFacadeHome", "EmailFacade");
      EmailFacade remote = (EmailFacade)facade.create();
      remote.setDataSource(dataSource);

      int newAccountID = remote.createNewEmailAccount(individualId, mailaccount);

      if (newAccountID != 0)
      {
        return(mapping.findForward("success"));
      }
View Full Code Here

    HttpSession session = request.getSession(true);
    UserObject userobjectd = (UserObject)session.getAttribute("userobject");
        int individualId = userobjectd.getIndividualID();

    EmailFacadeHome cfh = (EmailFacadeHome)CVUtility.getHomeObject("com.centraview.email.emailfacade.EmailFacadeHome", "EmailFacade");
    EmailFacade remote = (EmailFacade)cfh.create();
    remote.setDataSource(dataSource);

    int accountid        = 0;
    String accountID           = (String) request.getParameter("accountid");

    if (accountID != null && !accountID.equals(""))
    {
      accountid = Integer.parseInt(accountID);
    } //end of if statement (aid != null && !aid.equals(""))

    //System.out.println("accountID"+accountID);




    //System.out.println("accountid"+accountid);

    FolderList fl        = (FolderList) session.getAttribute("folderlist");


    int folderid = fl.getDefaultFolder();

    if(request.getParameter("folderid")!= null)
      folderid =Integer.parseInt(request.getParameter("folderid"));

    //System.out.println("folderid"+folderid);


    Set listkey = fl.keySet();
    Iterator it = listkey.iterator();
    while(it.hasNext())
    {
      AccountDetail ad1 =(AccountDetail)fl.get(it.next());

      String accountAddress = ad1.getAccountaddress();
      ArrayList folderList = ad1.getFolderList() ;

      int parentID = 0;
      String path = "";
      Folder f = null;
      int id = 0;
      for( int i=0 ; i < folderList.size(); i++ )
      {
          f = (Folder)folderList.get( i );
          id = f.getFolderid();
          accountid = ad1.getAccountid();
          if(id==folderid)
          {
            break;
          }
      }
      if (accountid != 0){
        break;
      }
    }

      //System.out.println("accountid Before Accounting Detail"+accountid);
    AccountDetail ad     = (AccountDetail) fl.get(new Integer(accountid));
    ArrayList al         = ad.getFolderList();
    Folder f;

    boolean createJunkMailFolder = true;

    int parentId = 0;
    int junkMailId = 0;
    for (int i = 0; i < al.size(); i++)
    {
    f = (Folder) al.get(i);

      if (f.getFoldername().equalsIgnoreCase("trash")
         && f.getFtype().equalsIgnoreCase("system"))
      {
        parentId = f.getParentfolderid();
        //break;
      }
      if (f.getFoldername().equalsIgnoreCase("junk mail")
         && f.getFtype().equalsIgnoreCase("user"))
      {
         junkMailId = f.getFolderid();
         createJunkMailFolder = false;
        //break;
      }
      //end of if statement (f.getFoldername().equalsIgnoreCase("trash")
        // && f.getFtype().equalsIgnoreCase("user"))
    } //end of for loop (int i = 0; i < al.size(); i++)

    if (parentId != 0){
      createJunkMailFolder = true;
    }


//System.out.println("parentId"+parentId);
//System.out.println("createJunkMailFolder"+createJunkMailFolder);

    if(createJunkMailFolder){

      HashMap hmFolder = new HashMap();
      hmFolder.put("AccountID", new Integer(accountid));
      hmFolder.put("SubfolderID", new Integer(parentId));
      hmFolder.put("foldername", "Junk Mail");
      int i = remote.checkFoldersPresence(individualId, hmFolder);
      if (i != 0) // 0 means folder is present already
      {
        junkMailId = remote.addFolder(individualId, hmFolder);

          FolderList folderList = (FolderList)remote.getFolderList(individualId);
        session.setAttribute("folderlist", folderList);
      }
    }

//System.out.println("parentId After"+parentId);

        String messageID[] = request.getParameterValues("rowId");
        ArrayList emailFrom = remote.getEmailsFrom(messageID);

//System.out.println("emailFrom"+emailFrom);

    int ruleId = remote.getRuleId(accountid);

//System.out.println("ruleId Before"+ruleId);

    boolean rulecreated = false;
    if (ruleId == 0){

      HashMap hm = new HashMap();
      hm.put("RuleName", "JunkMail");
      hm.put("Description", "JunkMail");
      hm.put("EnabledStatus", "YES");
      hm.put("AccountID", accountid+"");

      int size = emailFrom.size();

      //System.out.println("size"+size);
      String join[] = new String[size];
      String field[] = new String[size];
      String condition[] = new String[size];
      String criteria[] = new String[size];

      for (int i=0; i<size; i++){
        join[i]="1";
        field[i]="1";
        condition[i]="3";
        String fromEmail = (emailFrom.get(i)).toString();
        int startIndex = fromEmail.indexOf("<");
        int endIndex = fromEmail.indexOf(">");
        if (startIndex >0){
          fromEmail = fromEmail.substring(startIndex,(endIndex-1));
        }
        criteria[i]=fromEmail;
        //System.out.println("emailFrom"+fromEmail);
      }
      hm.put("Join", join);
      hm.put("Field", field);
      hm.put("Condition", condition);
      hm.put("Criteria", criteria);

      hm.put("ActionMoveMessage", "1");
      hm.put("MoveFolderId", junkMailId+"");
      hm.put("ActionDeleteMessage", "0");
      hm.put("ActionMarkasRead", "0");
      hm.put("JunkMail", "TRUE");
      ruleId = remote.addRule(hm);
      rulecreated = true;
    }

    //System.out.println("Rule Id Final :"+ruleId);

    RuleDetails ruledetails = remote.getRuleDetails(ruleId);
    dynaForm.set("RuleID", ruledetails.getRuleID());
    dynaForm.set("AccountID", ruledetails.getAccountID());
    dynaForm.set("name", ruledetails.getName());
    dynaForm.set("description", ruledetails.getDescription());
    dynaForm.set("enabled", ruledetails.getEnabled());
View Full Code Here

      UserObject userobjectd = (UserObject)session.getAttribute("userobject");
      int individualId = userobjectd.getIndividualID();

      DynaActionForm dynaForm = (DynaActionForm)form;
      EmailFacadeHome cfh = (EmailFacadeHome)CVUtility.getHomeObject("com.centraview.email.emailfacade.EmailFacadeHome", "EmailFacade");
      EmailFacade remote = (EmailFacade)cfh.create();
      remote.setDataSource(dataSource);

      HashMap hmFolder = new HashMap();
      String str = (String)dynaForm.get("accountid");
      String folderid = (String)dynaForm.get("folderid");
      String foldername = (String)dynaForm.get("foldername");
      String parentid = (String)dynaForm.get("parentid");

      hmFolder.put("AccountID", new Integer(Integer.parseInt(str)));
      hmFolder.put("parentid", new Integer(Integer.parseInt(parentid)));
      hmFolder.put("foldername", foldername);
      hmFolder.put("folderid", new Integer(Integer.parseInt(folderid)));

      int i = remote.editFolder(individualId, hmFolder);
      // TODO do something with this return value?
      dynaForm.initialize(mapping);
    }
    catch (Exception e)
    {
View Full Code Here

      HashMap attchmentids           = (HashMap) session.getAttribute("AttachfileList");
      mailmessage.setAttachFileIDs(attchmentids);
 
      session.removeAttribute("AttachfileList");
      EmailFacadeHome aa             = (EmailFacadeHome) CVUtility.getHomeObject("com.centraview.email.emailfacade.EmailFacadeHome", "EmailFacade");
      EmailFacade remote             = (EmailFacade) aa.create();
      remote.setDataSource(dataSource);
     
      //to
      StringTokenizer st             = new StringTokenizer(mailTo, ",");
      while (st.hasMoreTokens())
      {
        String addr = st.nextToken();
      ArrayList al = new ArrayList();
      if(addr!=null)
      {
        al.add(new MailAddress(addr));
        mailmessage.setTo(al);
        remote.sendMailMessage(individualID, mailmessage);
      }
      } //end of while loop (st.hasMoreTokens())
      }//end of if(strAction !=null..)
  } //end of try block
  catch (Exception e)
View Full Code Here

          newEventHashMap.put("EndDate", endTimestamp);

          //Add the attachment here
          MailMessage mailmessage = null;
          EmailFacadeHome cfh = (EmailFacadeHome)CVUtility.getHomeObject("com.centraview.email.emailfacade.EmailFacadeHome", "EmailFacade");
          EmailFacade facade = (EmailFacade)cfh.create();
          HashMap hm = new HashMap();
          hm.put("MessageID", new Integer(eventID));

          mailmessage = facade.getAttachment(individualId, hm);

          ArrayList attachments = mailmessage.getAttachmentID();
          HashMap newAttachments = new HashMap();
          if (attachments != null)
          {
View Full Code Here

    {
      String foldername = "";
      String ruleid = request.getParameter("rowId");
      int ruleID = Integer.parseInt(ruleid);
      EmailFacadeHome cfh = (EmailFacadeHome)CVUtility.getHomeObject("com.centraview.email.emailfacade.EmailFacadeHome", "EmailFacade");
      EmailFacade remote = (EmailFacade)cfh.create();
      remote.setDataSource(dataSource);

      RuleDetails ruledetails = remote.getRuleDetails(ruleID);
      DynaActionForm dynaForm = (DynaActionForm)form;
      dynaForm.set("RuleID", ruledetails.getRuleID());
      dynaForm.set("AccountID", ruledetails.getAccountID());
      dynaForm.set("name", ruledetails.getName());
      dynaForm.set("description", ruledetails.getDescription());
View Full Code Here

TOP

Related Classes of com.centraview.email.emailfacade.EmailFacade

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.