Package com.centraview.email

Examples of com.centraview.email.FolderList


      mailmessage.setReplyTo(replyTo);
 
      String accountid               = (String) dynaForm.get("accountID");
      mailmessage.setAccountID(Integer.parseInt(accountid));
 
      FolderList fl                  = (FolderList) session.getAttribute("folderlist");
      Set listkey                    = fl.keySet();
      Iterator it                    = listkey.iterator();
 
      String smtpserver              = "";
      while (it.hasNext())
      {
      AccountDetail ad1  = (AccountDetail) fl.get(it.next());
      if (Integer.parseInt(accountid) == ad1.getAccountid())
      {
        smtpserver = ad1.getSmtpserver();
        mailmessage.setFolder(ad1.getFolderIDFromName("Sent", "SYSTEM"));
      } //end of if statement (Integer.parseInt(accountid) == ad1.getAccountid())
View Full Code Here


      {
        // get current user's individualID
        individualId = userObject.getIndividualID();
      }

      FolderList fl = (FolderList)session.getAttribute("folderlist");
      int accountID = 0;

      //if (fl == null)
      //{
        EmailFacadeHome aa = (EmailFacadeHome)CVUtility.getHomeObject("com.centraview.email.emailfacade.EmailFacadeHome", "EmailFacade");
        EmailFacade remote = (EmailFacade)aa.create();
        remote.setDataSource(dataSource);
        fl = (FolderList)remote.getFolderList(individualId);
        session.setAttribute("folderlist", fl);
        accountID = fl.getDefaultaccount();
      //}

      request.setAttribute(AdminConstantKeys.PREFERENCEPAGE, "EMAIL");
      FORWARD_final = FORWARD_emailpage;
    }
View Full Code Here

  public FolderList getFolderList(int userId) throws AuthorizationFailedException
  {
    if(!CVUtility.isModuleVisible("Email",userId, this.dataSource))
      throw new AuthorizationFailedException("Email- getFolderList");

    FolderList  folderList = null;
    try
    {
      InitialContext ic = CVUtility.getInitialContext();
      ManageFolderLocalHome home = (ManageFolderLocalHome)ic.lookup("local/ManageFolder");
      ManageFolderLocal remote =  home.create();
View Full Code Here

  This method returns folder list
  */

  public FolderList getFolderList(int userID)
  {
    FolderList folderlist = new FolderList();
    HashMap hashmap = new HashMap();
    HashMap hmEmail = new HashMap();
    try
    {
      CVDal cvdal = new CVDal(dataSource);


      InitialContext ic = CVUtility.getInitialContext();
      PreferenceLocalHome home = (PreferenceLocalHome)ic.lookup("local/Preference");

      PreferenceLocal remote = home.create();
      remote.setDataSource(this.dataSource);

      //hmEmail = remote.getUserEmailDelegators(userID);
      hmEmail.put(new Integer(userID),Constants.VIEWSENDEMAIL);


      Set s=hmEmail.keySet();

      Iterator iter=s.iterator();
      AccountDetail accountdetail = null;


      cvdal.setSql("email.getdefaultemailaccount");
      cvdal.setInt(1, userID);

      //System.out.println("userID"+userID);
      Collection defaultaccount = cvdal.executeQuery();
      cvdal.clearParameters();

      Iterator iteratordefaultaccount = defaultaccount.iterator();
      int defaultAccount= 0;
      while(iteratordefaultaccount.hasNext())
      {
        HashMap hmAccount = (HashMap)iteratordefaultaccount.next();
        String prefAccount=(String)hmAccount.get("preference_value");
        if (prefAccount != null && !prefAccount.equals("")){
          defaultAccount=Integer.parseInt(prefAccount);
        }
      }


      while (iter.hasNext())
      {
        Integer intKey  =(Integer)iter.next();
        String str    =(String)hmEmail.get(intKey);

        //System.out.println(" str "+str);
        //System.out.println(" int  "+intKey.intValue());

      //System.out.println("The userID is: " + Integer.toString(userID));
        cvdal.setSql("email.emaillistfolder");
        cvdal.setInt(1, intKey.intValue());
        cvdal.setInt(2, intKey.intValue());
        Collection collection = cvdal.executeQuery();
        cvdal.clearParameters();




        Iterator iterator = collection.iterator();
        String signature = null;
        int j = 0;
        int accountID = 0;
        int k = 0;
        while(iterator.hasNext())
        {

          HashMap hashmap1 = (HashMap)iterator.next();
          signature = (String)hashmap1.get("signature");


          accountID = ((Number)hashmap1.get("accountID")).intValue();
          //System.out.println("accountID  ::"+accountID);
/*
          if(((String)hashmap1.get("Default")).equals("YES"))
          {
            folderlist.setDefaultaccount(accountID);
            if(((String)hashmap1.get("FolderName")).equalsIgnoreCase("Inbox"))
            {
              folderlist.setDefaultFolder(((Long)hashmap1.get("folderid")).intValue());
              //System.out.println("DEFAULT  " + folderlist.getDefaultFolder());
            }
          }
*/
          //System.out.println("defaultAccount  ::"+defaultAccount);
          if(defaultAccount == accountID){
            folderlist.setDefaultaccount(accountID);
            if(((String)hashmap1.get("FolderName")).equalsIgnoreCase("Inbox"))
            {
              folderlist.setDefaultFolder(((Long)hashmap1.get("folderid")).intValue());
              //System.out.println("DEFAULT  " + folderlist.getDefaultFolder());
            }
          }

          if(k == 0)
          {
            //System.out.println("i == 0");
            String address = (String)hashmap1.get("address");
            String accountName = (String)hashmap1.get("accountName");
            accountdetail = new AccountDetail(address);
            // 1408
            String smtpserver = (String)hashmap1.get("smtpserver");
            accountdetail.setSmtpserver( smtpserver );

            accountdetail.setRights(str);

            int folderID = ((Long)hashmap1.get("folderid")).intValue();
            int parentID = ((Long)hashmap1.get("parent")).intValue();
            String folderName = (String)hashmap1.get("FolderName");
            String folderType = (String)hashmap1.get("ftype");

            String parentName = (String)hashmap1.get("parentname");

            int unreadmessages =((Long)hashmap1.get("unreadmessages")).intValue();

            int  allmesaage = ((Long)hashmap1.get("allMesages")).intValue();
            if ( allmesaage == -1 )
            {
              hashmap1 = (HashMap)iterator.next();
              allmesaage = ((Long)hashmap1.get("allMesages")).intValue();
              k++;
            }

            accountdetail.addFolder(new Folder(folderName, folderID, parentID, folderType , allmesaage ,unreadmessages ,parentName));
            accountdetail.setAccountid(accountID);
            accountdetail.setSignature(signature  );
            j = accountID;
          }
          else if(accountID != j)
          {
            //System.out.println("lastid" + j);
            folderlist.put(new Integer(j), accountdetail);
            //System.out.println("lastid");
            String s1 = (String)hashmap1.get("address");
            String s3 = (String)hashmap1.get("accountName");

            accountdetail = new AccountDetail(s1);
            accountdetail.setRights(str);
            int l1 = ((Long)hashmap1.get("folderid")).intValue();
            int j2 = ((Long)hashmap1.get("parent")).intValue();
            String s7 = (String)hashmap1.get("FolderName");
            String parentName = (String)hashmap1.get("parentname");
            String s9 = (String)hashmap1.get("ftype");

            int unreadmessages =((Long)hashmap1.get("unreadmessages")).intValue();

            int  allmesaage = ((Long)hashmap1.get("allMesages")).intValue();
            if ( allmesaage == -1 )
            {
              hashmap1 = (HashMap)iterator.next();
              allmesaage = ((Long)hashmap1.get("allMesages")).intValue();
              k++;
            }

            accountdetail.addFolder(new Folder(s7, l1, j2, s9 , allmesaage ,unreadmessages,parentName ));
            accountdetail.setAccountid(accountID);
            accountdetail.setSignature(signature  );
            j = accountID;
          }
          else
          {
            //System.out.println("same id ");
            int i1 = ((Long)hashmap1.get("folderid")).intValue();
            int j1 = ((Long)hashmap1.get("parent")).intValue();
            String s4 = (String)hashmap1.get("FolderName");
            String parentName = (String)hashmap1.get("parentname");
            String s5 = (String)hashmap1.get("ftype");

            // 1408
            String smtpserver = (String)hashmap1.get("smtpserver");

            int unreadmessages =((Long)hashmap1.get("unreadmessages")).intValue();

            int  allmesaage = ((Long)hashmap1.get("allMesages")).intValue();
            if ( allmesaage == -1 )
            {
              hashmap1 = (HashMap)iterator.next();
              allmesaage = ((Long)hashmap1.get("allMesages")).intValue();
              k++;
            }

            accountdetail.addFolder(new Folder(s4, i1, j1, s5 , allmesaage ,unreadmessages, parentName));
            accountdetail.setRights(str);
            accountdetail.setAccountid(accountID);
            accountdetail.setSignature(signature  );
            j = accountID;
          }

          k++;
          //System.out.println("in while loop ---- value of k -"+k + "----" +accountdetail.getRights() + "----" + accountdetail.getAccountid());

        } //end of while loop

        folderlist.put(new Integer(j), accountdetail);
        //System.out.println(folderlist.size());
      }
      cvdal.destroy();
      cvdal = null;

View Full Code Here

TOP

Related Classes of com.centraview.email.FolderList

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.