Package org.apache.struts.action

Examples of org.apache.struts.action.DynaActionForm


    UserObject userObject = (UserObject)session.getAttribute("userobject");

    int individualID = userObject.getIndividualID();    // logged in user
   
    // "mailCheckForm" defined in struts-config-preference.xml
    DynaActionForm mailForm = (DynaActionForm)form;
   
    UserPrefererences userPrefs = userObject.getUserPref();
    int prefValue = userPrefs.getEmailCheckInterval();
   
    try {
      mailForm.set("mailCheckInterval", new Integer(prefValue));
    }catch(NumberFormatException nfe){
      mailForm.set("mailCheckInterval", new Integer(10));
    }

    // holy crikies, batman! where's the giant try/catch block!?!?
   
    return mapping.findForward(".view.preference.mail.auto_check_settings");
View Full Code Here


  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

    try
    {
      DynaActionForm dynaForm = (DynaActionForm)form;
      HttpSession session = request.getSession();
    UserObject userobject =(UserObject) session.getAttribute("userobject");
    UserPrefererences userPrefererences = userobject.getUserPref();
     
      String typeOfSave = "save";
      int individualID = 0;
      String[] leftportlet = (String[])request.getParameterValues("portletsLeft");
      String[] rightportlet = (String[])request.getParameterValues("portletsRight");
      Vector vec = new Vector();

      if (rightportlet != null)
      {
        for (int i = 0; i < rightportlet.length; i++)
        {
          PreferenceVO pvo3 = new PreferenceVO();
          pvo3.setModuleId(4);
          pvo3.setPreferenceName(rightportlet[i]);
          pvo3.setPreferenceValue("YES");

          vec.addElement(pvo3);

        }
      }
      if (leftportlet != null)
      {

        for (int i = 0; i < leftportlet.length; i++)
        {
          PreferenceVO pvo4 = new PreferenceVO();
          pvo4.setModuleId(4);
          pvo4.setPreferenceName(leftportlet[i]);
          pvo4.setPreferenceValue("NO");

          vec.addElement(pvo4);
        }
      }
      UserObject userObject = (UserObject)session.getAttribute("userobject");
      // might as well null pointer now before we do any real harm
      individualID = userObject.getIndividualID();
      if (request.getParameter("buttonpress") != null)
      {
        typeOfSave = request.getParameter("buttonpress");

        PreferenceVO pvo1 = new PreferenceVO();
        PreferenceVO pvo2 = new PreferenceVO();

        pvo1.setModuleId(4);
        pvo1.setPreferenceName("homesettingrefreshmin");
        String minutes = (String) (dynaForm.get("minutes"));
        pvo1.setPreferenceValue(minutes);
        pvo2.setModuleId(4);
        pvo2.setPreferenceName("homesettingrefreshsec");
        String seconds = (String) (dynaForm.get("seconds"));
        pvo2.setPreferenceValue(seconds);
        vec.addElement(pvo1);
        vec.addElement(pvo2);
       
        PreferenceHome prefHome = (PreferenceHome)CVUtility.getHomeObject("com.centraview.preference.PreferenceHome", "Preference");
View Full Code Here

            ticketForm.setPhone(moc.getContent());
          }
        }
      }
      request.setAttribute("ticketform", ticketForm);
      DynaActionForm dynaForm = (DynaActionForm) form;
      dynaForm.set("threadid", new Integer(tVO.getId()).toString());
      dynaForm.set("ticketnumber", new Integer(ticketVO.getId()).toString());
      dynaForm.set("title", tVO.getTitle());
      dynaForm.set("threaddetail", tVO.getDetail());
      dynaForm.set("priority", new Integer(tVO.getPriorityId()).toString());
      dynaForm.set("createdby", tVO.getCreatedByVO().getFirstName() + " " + tVO.getCreatedByVO().getLastName());
      dynaForm.set("createdbyid", new Integer(tVO.getCreatedBy()).toString());
      dynaForm.set("createddate", tVO.getCreatedOn().toString());

      if (tVO.getModifiedOn() != null) {
        dynaForm.set("modifieddate", tVO.getModifiedOn().toString());
      }
      FORWARD_final = FORWARD_vieweditthread;
    } catch (Exception e) {
      logger.error("[execute]: Exception", e);
      throw new ServletException(e);
View Full Code Here

  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

    try
    {
      DynaActionForm dynaForm = (DynaActionForm)form;

      HttpSession session = request.getSession();
      UserObject userObject = (UserObject)session.getAttribute("userobject");
      int individualID = userObject.getIndividualID();

      IndividualVO individualVO;
      AddressVO addressVO = null;

      ContactFacadeHome cfh = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
      ContactFacade remote = (ContactFacade)cfh.create();
      remote.setDataSource(dataSource);

      session.setAttribute("highlightmodule", "preferences");
      individualVO = remote.getIndividual(individualID);
      individualVO.populateFormBean(dynaForm);     

      if (individualVO.getUserName() != null)
      {
        dynaForm.set("userName", individualVO.getUserName());
      }
      request.setAttribute(AdminConstantKeys.PREFERENCEPAGE, "USERPROFILE");
    }catch(Exception e){
      System.out.println("[Exception][DisplayUserProfileHandler.execute] Exception Thrown: " + e);
      e.printStackTrace();
View Full Code Here

    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

  EmailFacadeHome cfh = (EmailFacadeHome)CVUtility.getHomeObject("com.centraview.email.emailfacade.EmailFacadeHome", "EmailFacade");
    try
    {
      DynaActionForm dynaForm = (DynaActionForm)form;

      HttpSession session = request.getSession(true);
      UserObject userobjectd = (UserObject)session.getAttribute("userobject");
      int individualID = userobjectd.getIndividualID();
      ListPreference listpreference = userobjectd.getListPreference("Email");
      String rowId = null;


      rowId = request.getParameter("rowId");
      int messageID = Integer.parseInt(rowId);

      String listAction = request.getParameter("listAction");

      String folderid = request.getParameter("folderid");
      if (folderid == null)
      {
        folderid = (String)session.getAttribute("folderid");
      }
      else
      {
        session.setAttribute("folderid", folderid);
      }


      String indexfrompage = request.getParameter("index");
     System.out.println("indexfrompage"+indexfrompage);

      if (listAction != null && listAction.equals("next"))
      {
      System.out.println("messageID"+messageID);
           messageID = messageID - 1 ;
           int index = 0;
           if (indexfrompage != null){
         index = Integer.parseInt(indexfrompage);
         indexfrompage = (index - 1)+"";
       }
           rowId = messageID + "";
      }

      System.out.println("indexfrompage"+indexfrompage);
      DisplayList displaylistSession = (DisplayList)session.getAttribute("displaylist");

      int index = 0;
      boolean flag = false;

      // THIS IS UTTER SILLINESS. WHY ARE WE LOOPING THROUGH A SESSION ATTRIBUTE
      // WITH A GENERIC NAME LIKE "displaylist", WHICH COULD HAVE BEEN SET
      // BY *ANY* HANDLER, WHEN WE *ALREADY HAVE* THE KEY TO THE MESSAGE?!??!
      // I'VE INTRODUCED A HACK HERE, TO ACCOUNT FOR CASES IN WHICH WE'RE TRYING
      // TO VIEW A MESSAGE DETAILS, BUT WE HAVEN'T COME FROM THE EMAIL LIST SCREEN.
      if (displaylistSession != null && (displaylistSession.getListType()).equals("Email"))
      {
        Set listkey = displaylistSession.keySet();
        Iterator it = listkey.iterator();

        while (it.hasNext())
        {
          index++;
          String str = (String)it.next();
          ListElement ele = (ListElement)displaylistSession.get(str);
          ListElementMember sm = (ListElementMember)ele.get("MessageID");
          Integer id = (Integer)sm.getMemberValue();
          int messageid = id.intValue();

          if (index == (Integer.parseInt(indexfrompage)))
          {
            flag = true;
            messageID = messageid;
            break;
          }
        } // end while(it.hasNext())
      }
      else
      {
        flag = true;
      }
/*
      if (listAction != null && listAction.equals("next"))
      {
      System.out.println("messageID"+messageID);
           messageID = messageID - 1 ;
           rowId = messageID + "";
      }

*/
      System.out.println("messageID after"+messageID);

      if (indexfrompage != null)
      {
        dynaForm.set("index", indexfrompage);
      }
      else
      {
        dynaForm.set("index", Integer.toString(index));
      }

      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()];
        for (int i = 0; i < arrayTO.length; i++)
        {
          MailAddress ma = (MailAddress)to.get(i);
          arrayTO[i] = ma.getAddress();
        }

        String arrayCC[] = new String[cc.size()];
        for (int j = 0; j < arrayCC.length; j++)
        {
          com.centraview.email.getmail.MailAddress macc = (MailAddress)cc.get(j);
          arrayCC[j] = macc.getAddress();
        }

        dynaForm.set("MessageID", Integer.toString(messageID));

        //From
        if (mailmessage.getMailFrom() != null)
        {
          dynaForm.set("from", mailmessage.getMailFrom());
        }
        // To
        if (arrayTO.length != 0)
        {
          dynaForm.set("to", arrayTO);
        }

        // CC
        if (arrayCC.length != 0)
        {
          dynaForm.set("cc", arrayCC);
        }

        //date
        if (mailmessage.getMessageDate() != null)
        {
          dynaForm.set("date", mailmessage.getMessageDate());
        }

        //subject
        if (mailmessage.getSubject() != null)
        {
          dynaForm.set("subject", mailmessage.getSubject());
        }

System.out.println("mailmessage.getSubject()"+mailmessage.getSubject());
        // body
        if (mailmessage.getBody() != null)
        {
          dynaForm.set("message", mailmessage.getBody());
        }
        if (mailmessage.getHeadersHM() != null)
        {
          HashMap hmHeader = (HashMap)mailmessage.getHeadersHM();
          String headerKey = (String)hmHeader.get(Constants.EH_SERVICE_KEY);
View Full Code Here

      int individualId = userobjectd.getIndividualID();
      ListPreference listpreference = userobjectd.getListPreference("Email");

      //account object created
      MailAccount mailaccount = new MailAccount();
      DynaActionForm dynaForm = (DynaActionForm)form;

      String address = (String)dynaForm.get("address");
      mailaccount.setAddress(address);

      String leaveonserver = (String)dynaForm.get("leaveonserver");
      mailaccount.setLeaveonserver(leaveonserver);

      String login = (String)dynaForm.get("username");
      mailaccount.setLogin(login);

      String mailserver = (String)dynaForm.get("mailserver");
      mailaccount.setMailserver(mailserver);

      String name = (String)dynaForm.get("name");
      mailaccount.setName(name);

      mailaccount.setOwner(individualId);

      String password = (String)dynaForm.get("password");
      mailaccount.setPassword(password);

      String replyto = (String)dynaForm.get("replyto");
      mailaccount.setReplyto(replyto);

      String servertype = (String)dynaForm.get("servertype");
      mailaccount.setServertype(servertype);

      String signature = (String)dynaForm.get("signature");
      mailaccount.setSignature(signature);

      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);
View Full Code Here

    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

    try {
      HttpSession session = request.getSession(true);

      DynaActionForm dynaForm = (DynaActionForm)form;

      String composeType = (String)dynaForm.get("composeType");
      if (composeType.equalsIgnoreCase("HTML")) {
        session.setAttribute(Constants.EMAILTYPEFLAG, "HTML");
      } else {
        session.setAttribute(Constants.EMAILTYPEFLAG, "PLAIN");
      }
View Full Code Here

    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    ActionErrors allErrors = new ActionErrors();
    ActionForward forward = null;
    try
    {
      DynaActionForm dynaForm = (DynaActionForm)form;

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

      String typeOfSave = "saveclose";
View Full Code Here

    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

  String blockForward = "displaylistruleemail";
    try
    {
        DynaActionForm dynaForm = (DynaActionForm)form;

    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());

    if (!rulecreated){

      int size = emailFrom.size();
      //System.out.println("size Before"+size);

      String colA[] = ruledetails.getcolA();
      String colB[] = ruledetails.getcolB();
      String colC[] = ruledetails.getcolC();
      String colD[] = ruledetails.getcolD();

      int colSize = colA.length;
      //System.out.println("col Before"+colSize);

      int finalSize = size + colSize - 1 ;

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

      String join[] = new String[finalSize];
      String field[] = new String[finalSize];
      String condition[] = new String[finalSize];
      String criteria[] = new String[finalSize];


      for (int i=0; i < colSize; i++){
        join[i]=colA[i];
        field[i]=colB[i];
        condition[i]=colC[i];
        criteria[i]=colD[i];
        //System.out.println("criteria[i]"+criteria[i]);
      }

      int j = 0;
      for (int i=colSize-1; i < finalSize; i++){
        join[i]="1";
        field[i]="1";
        condition[i]="3";

        String fromEmail = (emailFrom.get(j)).toString();
        int startIndex = fromEmail.indexOf("<");
        int endIndex = fromEmail.indexOf(">");
        if (startIndex >0){
          fromEmail = fromEmail.substring(startIndex+1,endIndex);
        }

        criteria[i]=fromEmail;
        //System.out.println("emailFrom"+fromEmail);
        j++;
      }

      dynaForm.set("colA", join);
      dynaForm.set("colB", field);
      dynaForm.set("colC", condition);
      dynaForm.set("colD", criteria);
    }
    else{
      dynaForm.set("colA", ruledetails.getcolA());
      dynaForm.set("colB", ruledetails.getcolB());
      dynaForm.set("colC", ruledetails.getcolC());
      dynaForm.set("colD", ruledetails.getcolD());
    }

    dynaForm.set("movemessageto", ruledetails.getMovemessageto());
    dynaForm.set("movemessagetofolder", ruledetails.getMovemessagetofolder());
    dynaForm.set("markasread", ruledetails.getMarkasread());
    dynaForm.set("deletemessage", ruledetails.getDeleteMessage());
    request.setAttribute("foldername", "Junk Mail");



View Full Code Here

      }
      HttpSession session = request.getSession(true);
      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)
    {
      System.out.println("[Exception][EditFolderEmailHandler.execute] Exception Thrown: " + e);
      e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.apache.struts.action.DynaActionForm

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.