Examples of DynaActionForm


Examples of org.apache.struts.action.DynaActionForm

    int individualID = userObject.getIndividualID();    // logged in user

    String forward = "emailList";

    MailHome home = (MailHome)CVUtility.getHomeObject("com.centraview.mail.MailHome", "Mail");
    DynaActionForm emailForm = (DynaActionForm)form;
    String folderID = (String)request.getParameter("folderID");
   
    StringBuffer returnParameter = new StringBuffer();
    if (folderID != null && folderID.length() > 0) {
      returnParameter.append("?folderID="+folderID);
View Full Code Here

Examples of org.apache.struts.action.DynaActionForm

    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
   
    try {
      HttpSession session = request.getSession();
      int individualId = ((UserObject)session.getAttribute("userobject")).getIndividualID();
      DynaActionForm dynaForm = (DynaActionForm)form;
      ThreadVO tVO = new ThreadVO();

      tVO.setTitle(dynaForm.get("title").toString());
      tVO.setTicketId(Integer.parseInt(request.getParameter("ticketId")));
      tVO.setPriorityId(Integer.parseInt((dynaForm.get("priority")).toString()));
      tVO.setDetail((String)dynaForm.get("threaddetail"));
      tVO.setCreatedBy(individualId);
      tVO.setOwner(individualId);

      SupportFacadeHome sfh = (SupportFacadeHome)CVUtility.getHomeObject("com.centraview.support.supportfacade.SupportFacadeHome", "SupportFacade");
      SupportFacade remote = (SupportFacade)sfh.create();
View Full Code Here

Examples of org.apache.struts.action.DynaActionForm

    HttpSession session = request.getSession(true);
    session.removeAttribute("printtemplate");
    UserObject userObject = (UserObject) session.getAttribute("userobject");
    int individualID = userObject.getIndividualID();
    try {
      DynaActionForm dynaform = (DynaActionForm) form;
      dynaform.reset(mapping, request);
      dynaform.set("templateName", "");
      dynaform.set("id", "");
      dynaform.set("savedsearch", "");
      dynaform.set("templateData", "");
      dynaform.set("file", "");
      dynaform.set("radio", "");
      dynaform.set("artifactname", "");
      dynaform.set("categoryId", "");
      dynaform.set("artifactid", "");
      dynaform.set("individualId", "");
      dynaform.set("entityId", "");
      dynaform.set("ename", "");
      dynaform.set("individualName", "");
      dynaform.set("mergetype", "PRINT");
      dynaform.set("savedsearch1", "");
      dynaform.set("entitysavedsearch", "");
      dynaform.set("specificentity", "");
      dynaform.set("accountList", null);
      dynaform.set("templateList", null);
      dynaform.set("templatefrom", "");
      dynaform.set("templatereplyto", "");
      dynaform.set("templatesubject", "");
      dynaform.set("toPrint", null);
      dynaform.set("emailList", null);
      dynaform.set("toIndividuals", null);
      dynaform.set("selectedEntityId", "");
      dynaform.set("individualId", "");
      dynaform.set("attachmentList", new ArrayList());

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

      if (artifactName == null) {
        artifactName = "entity";
      }
      dynaform.set("artifactname", artifactName);

      String entityId = request.getParameter("entityId");
      String entityName = request.getParameter("entityName");

      String indvId = request.getParameter("indvId");
      String indvName = request.getParameter("indvName");

      if (entityId != null && entityName != null) {
        dynaform.set("entityId", entityId);
        dynaform.set("ename", entityName);
      }

      if (indvId != null && indvName != null) {
        dynaform.set("individualName", indvName);
        dynaform.set("individualId", indvId);
      }
      // Check wheather the User is have any email account set up already.
      // if user as more then one accout we will set the value to true. so that
      // it will not show EMAIL
      // else it will be false
View Full Code Here

Examples of org.apache.struts.action.DynaActionForm

              }
            }
          }
          request.setAttribute("ticketform", ticketForm);
         
          DynaActionForm dynaForm = (DynaActionForm)form;
         
          if (tVO != null) {
            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());

            if (tVO.getCreatedByVO() != null) {
              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());
            }
          }
          request.setAttribute(SupportConstantKeys.TYPEOFSUBMODULE, "Ticket");
          FORWARD_final = FORWARD_vieweditthread;
        }
View Full Code Here

Examples of org.apache.struts.action.DynaActionForm

    ActionErrors allErrors = new ActionErrors();
    String forward = "closeWindow";
    String errorForward = "errorOccurred";
   
    // "newMailFolderForm", defined in struts-config-email.xml
    DynaActionForm emailForm = (DynaActionForm)form;

    try
    {
      MailHome home = (MailHome)CVUtility.getHomeObject("com.centraview.mail.MailHome", "Mail");
      Mail remote = (Mail)home.create();
      remote.setDataSource(dataSource);
     
      // TODO: validate input;

      MailFolderVO newFolder = new MailFolderVO();

      Integer parentID = (Integer)emailForm.get("parentID");
      Integer accountID = (Integer)emailForm.get("accountID");
      String folderName = (String)emailForm.get("folderName");
     
     
      newFolder.setParentID(parentID.intValue());
      newFolder.setEmailAccountID(accountID.intValue());
      newFolder.setFolderName(folderName);
      newFolder.setFolderType(MailFolderVO.USER_FOLDER_TYPE);

      int newFolderID = remote.addEmailFolder(newFolder, true);

      if (newFolderID < 1)
      {
        forward = errorForward;
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.freeForm", "The email folder could not be created. Please make sure all fields are filled in and try again. Also make sure you have privileges to create folders on your email server."));
        this.saveErrors(request, allErrors);
      }else{
        emailForm.set("closeWindow", new Boolean(true));
      }
     
    }catch(Exception e){
      System.out.println("[Exception][SaveNewFolderHandler] Exception thrown in execute(): " + e);
      // TODO: remove stack trace
View Full Code Here

Examples of org.apache.struts.action.DynaActionForm

      {
        eventid = Integer.parseInt(request.getParameter("eventid").toString());
      }

      //request.setAttribute("eventid",""+eventid);
      DynaActionForm dynaForm = (DynaActionForm) form;
      dynaForm.initialize(mapping);

      /*ListGenerator lg = ListGenerator.getListGenerator(dataSource);
      lg.makeListDirty("Event");*/
      //return (mapping.findForward("addattendees"));
      FORWARD_final = FORWARD_displayAddAttendee;
View Full Code Here

Examples of org.apache.struts.action.DynaActionForm

  {
    int eventid = 0;
    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();

      String strEventid = (String) dynaForm.get("eventid");
      strEventid = (String) request.getParameter("eventid");

      String strIndividualId = (String) request.getParameter("Individualid");

      if (request.getParameter("Individualid") != null)
View Full Code Here

Examples of org.apache.struts.action.DynaActionForm

    ActionErrors allErrors = new ActionErrors();
    String forward = "displayComposeForm";
    String errorForward = "errorOccurred";

    // "composeMailForm", defined in struts-config-email.xml
    DynaActionForm emailForm = (DynaActionForm)form;

    try {
      // get the message ID from the form bean
      Integer messageID = (Integer)emailForm.get("messageID");

      // now, check the message ID on the form...
      if (messageID == null || messageID.intValue() <= 0 ) {
        // if Message ID is not set on the form, then there is
        // no point in continuing forward. Show user the door. :-)
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Message ID"));
        return(mapping.findForward(errorForward));
      }

      // This tells the Send.do handler to delete the
      // draft after it has been sent
      Boolean composeFromTemplate = (Boolean)request.getAttribute("composeFromTemplate");
      if (composeFromTemplate == null || composeFromTemplate.booleanValue() == false) {
        emailForm.set("savedDraftID", messageID);
      }

      if (composeFromTemplate == null || composeFromTemplate.booleanValue() == true) {
        emailForm.set("loadTemplate", messageID);
        emailForm.set("templateID", messageID);
      }

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

      // handle recipients (To:)
      ArrayList toList = (ArrayList)messageVO.getToList();
      String to = this.appendAddresses(toList);
      emailForm.set("to", to);

      // handle recipients (Cc:)
      ArrayList ccList = (ArrayList)messageVO.getCcList();
      String cc = this.appendAddresses(ccList);
      emailForm.set("cc", cc);

      // handle recipients (Bcc:)
      ArrayList bccList = (ArrayList)messageVO.getBccList();
      String bcc = this.appendAddresses(bccList);
      emailForm.set("bcc", bcc);

      // set the subject on the form bean. Don't forget to prepend "Fw: "
      String subject = (String)messageVO.getSubject();
      emailForm.set("subject", subject);

      String body = messageVO.getBody();
      emailForm.set("body", body);

      // Handle attachments - the attachment handler puts a HashMap
      // object on the session as an attribute named "AttachfileList".
      // This hashmap contains the list of attached files, with the
      // key being the fileID and the value being the filename.
      // So we'll have to replicate that behavior here, getting the
      // ArrayList of attachments from the MailMessageVO, looping
      // through that list, and adding an entry to a HashMap for each
      // attached file. Then, stick that HashMap onto the session as
      // an attribute named "AttachfileList". PLEASE NOTE: we are going
      // to want to change this in the future. 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 SendHandler
      // reflects your changes.
      ArrayList attachmentList = (ArrayList)messageVO.getAttachedFiles();
      ArrayList attachmentFileIDs = new ArrayList();
      Iterator iter = attachmentList.iterator();
      ArrayList attachments = new ArrayList();
      int i = 0;
      while (iter.hasNext()) {
        CvFileVO fileVO = (CvFileVO)iter.next();
        int fileID = fileVO.getFileId();
        String fileName = fileVO.getName();
        attachments.add(new DDNameValue(fileID+"#"+fileName,fileName));
      }

      //Setting the Attachments to form.
      emailForm.set("attachmentList", attachments);
    } catch (Exception e) {
      System.out.println("[Exception][EditDraftHandler] Exception thrown in execute(): " + e.toString());
      e.printStackTrace();
    }
    return(mapping.findForward(forward));
View Full Code Here

Examples of org.apache.struts.action.DynaActionForm

  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

    try {
      DynaActionForm dynaform = (DynaActionForm) form;
      int ptdetailid = 0;
      String strptdetailid = (String) dynaform.get("ptdetailid");
      ptdetailid = Integer.parseInt(strptdetailid);

      // Collect the Template information on basis of the passed templateID
      PrintTemplateVO ptVO = new PrintTemplateVO();
      PrintTemplateHome PTHome = (PrintTemplateHome) CVUtility.getHomeObject("com.centraview.printtemplate.PrintTemplateHome", "Printtemplate");
      PrintTemplate PTRemote = PTHome.create();
      PTRemote.setDataSource(dataSource);
      ptVO = PTRemote.getPrintTemplate(ptdetailid);

      if (ptVO.getPtname() != null)
        dynaform.set("templatetitle", ptVO.getPtname());
      dynaform.set("pttextarea", ptVO.getPtData());
      if (ptVO.getPtsubject() != null) {
        dynaform.set("templatesubject", ptVO.getPtsubject());
      }

      dynaform.set("artifactid", "" + ptVO.getArtifactId());
      dynaform.set("ptcategoryid", "" + ptVO.getPtcategoryId());

      request.setAttribute("typeofoperation", "Edit");
      request.setAttribute("body", "main");

      FORWARD_final = FORWARD_printtemplate;
View Full Code Here

Examples of org.apache.struts.action.DynaActionForm

    ActionErrors allErrors = new ActionErrors();
    String forward = "displayComposeForm";
    String errorForward = "errorOccurred";

    // "composeMailForm", defined in struts-config-email.xml
    DynaActionForm emailForm = (DynaActionForm) form;
    MailHome home = (MailHome) CVUtility.getHomeObject("com.centraview.mail.MailHome", "Mail");

    try {
      // get the message ID from the form bean
      Integer messageID = (Integer) emailForm.get("messageID");

      // now, check the message ID on the form...
      if (messageID == null || messageID.intValue() <= 0) {
        // if Message ID is not set on the form, then there is
        // no point in continuing forward. Show user the door. :-)
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Message ID"));
        return (mapping.findForward(errorForward));
      }

      Mail remote = home.create();
      remote.setDataSource(dataSource);
      MailMessageVO messageVO = remote.getEmailMessageVO(individualID, messageID.intValue());

      // set the subject on the form bean. Don't forget to prepend "Re: "
      String prevSubject = messageVO.getSubject();
      StringBuffer newSubject = new StringBuffer("");
      if (prevSubject != null && prevSubject.length() > 0) {
        if ((prevSubject.toLowerCase()).startsWith("re: ")) {
          // If the subject already has "Re:" pre-pended,
          // do not add another "Re:"
          newSubject.append(prevSubject);
        } else {
          newSubject.append("Re: " + prevSubject);
        }
      } else {
        newSubject.append("Re: your message");
      }
      emailForm.set("subject", newSubject.toString());

      String linebreak = "\n";
      UserPrefererences userPref = userObject.getUserPref();
      if ((userPref.getContentType()).equals("HTML")) {
        linebreak = "<br>\n";
      }

      StringBuffer body = new StringBuffer();
      body.append(linebreak + linebreak + "---- Original Message: ----" + linebreak);
      body.append("From: " + messageVO.getFromAddress() + linebreak);
      body.append("Sent: " + messageVO.getReceivedDate() + linebreak);
      body.append("Subject: " + messageVO.getSubject() + linebreak + linebreak);

      // if the original message is an HTML message, we can only quote
      // it if the user is using IE (with HTMLArea). Otherwise, we need
      // to attach the original message as an attachment to the new message
      boolean saveOrigBodyAsAttachment = false;
      String originalBody = messageVO.getBody();
      originalBody = originalBody.replaceAll("\r", "");
      originalBody = originalBody.replaceAll("\n", linebreak);

      body.append(originalBody);

      String messageBody = body.toString();
      emailForm.set("body", messageBody);

      // we always reply with the From: address as the new To: address
      // keep in mind that we should use ReplyTo: if it was supplied
      String from = messageVO.getFromAddress();
      String replyTo = messageVO.getReplyTo();
      if (replyTo != null && replyTo.length() > 0) {
        emailForm.set("to", replyTo);
      } else {
        emailForm.set("to", from);
      }

      Boolean replyToAll = (Boolean) emailForm.get("replyToAll");
      if (replyToAll != null && replyToAll.booleanValue()) {
        // if we're replying to all recipients, we put all
        // the previous To: addresses and Cc: addresses in
        // the new Cc: field
        StringBuffer cc = new StringBuffer();

        ArrayList toList = (ArrayList) messageVO.getToList();
        cc.append(this.appendCcAddresses(toList));

        // make sure to add a , between the first set of addresses,
        // and the second set, if the first set was not empty
        if (cc.length() > 0) {
          cc.append(", ");
        }

        ArrayList ccList = (ArrayList) messageVO.getCcList();
        cc.append(this.appendCcAddresses(ccList));

        emailForm.set("cc", cc.toString());
      } // end if (replyToAll != null && replyToAll.booleanValue())

      ArrayList attachmentMap = new ArrayList();
      if (saveOrigBodyAsAttachment) {
        CvFolderVO attachmentFolderVO = remote.getAttachmentFolder(individualID);
        int attachmentFolderID = attachmentFolderVO.getFolderId();
        int newFileID = -1;

        // somehow create a file using CvFileFacade, and get a CvFileVO from
        // that.
        CvFileVO fileVO = new CvFileVO();
        SimpleDateFormat df = new SimpleDateFormat("MMMM_dd_yyyy_hh_mm_ss_S");
        String prependDate = df.format(new Date());
        fileVO.setName("OriginalMessage_#" + messageID.intValue() + "_" + prependDate + ".html");
        fileVO.setTitle("OriginalMessage_#" + messageID.intValue());
        fileVO.setDescription("");
        fileVO.setFileSize(0.0f); // float
        fileVO.setVersion("1.0");
        fileVO.setStatus("PUBLISHED");
        fileVO.setVisibility(CvFileVO.FV_PRIVATE);
        fileVO.setPhysical(CvFileVO.FP_PHYSICAL);
        fileVO.setPhysicalFolder(attachmentFolderID);
        fileVO.setAuthorId(individualID);
        fileVO.setIsTemporary(CvFileVO.FIT_YES);

        ByteArrayInputStream inputStream = new ByteArrayInputStream(originalBody.getBytes());

        try {
          CvFileFacade fileFacade = new CvFileFacade();
          newFileID = fileFacade.addFile(individualID, attachmentFolderID, fileVO, inputStream, dataSource);
        } catch (CvFileException cfe) {
          // I guess do nothing
        }

        if (newFileID > 0) {
          // Add the CvFileVO to attachmentList, and the following line for the
          // attachmentMap
          fileVO.setFileId(newFileID);
          String strFileID = String.valueOf(newFileID);
          String strFileName = "OriginalMessage_" + messageID.intValue();

          attachmentMap.add(new DDNameValue(strFileID + "#" + strFileName, strFileName));
        }
      } // end if (saveOrigBodyAsAttachment)

      if (!attachmentMap.isEmpty()) {
        emailForm.set("attachmentList", attachmentMap);
      }

    } catch (Exception e) {
      logger.error("[Exception] ReplyHandler.Execute Handler ", e);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.