Package org.apache.struts.action

Examples of org.apache.struts.action.DynaActionForm


    String type = null;
    CalendarList DL = null;
    HashMap unscheduledactivity = null;
    HashMap scheduledactivity = null;

    DynaActionForm calendardyna = (DynaActionForm) form;

    try {
      HttpSession session = request.getSession(true);
      UserObject userobject = (UserObject) session.getAttribute("userobject");
      int userID = userobject.getIndividualID();
      int individualID = userobject.getIndividualID();

      // Delegation
      if (session.getAttribute("delegatorName") != null) {
        userID = Integer.parseInt((String) session.getAttribute("delegatorName"));
      }
      if (request.getParameter("delegatorName") != null) {
        userID = Integer.parseInt(request.getParameter("delegatorName"));
      }

      session.setAttribute("delegatorName", String.valueOf(userID));
      calendardyna.set("delegatorName", session.getAttribute("delegatorName"));

      Vector userColl = Delegator.getCalendarDelegatorIds(individualID, com.centraview.common.Constants.ACTIVITYMODULE,
          com.centraview.common.Constants.VIEW, dataSource);
      DDNameValue mydd = new DDNameValue(String.valueOf(individualID), (userobject.getfirstName() + ' ' + userobject.getlastName()));
      userColl.add(mydd);
      request.setAttribute("delegatorNameVec", userColl);

      // Selected Acitivity Type
      String activityType = request.getParameter("activityType");

      if (session.getAttribute("activityType") == null) {
        session.setAttribute("activityType", "All");
      }

      if (activityType != null) {
        session.setAttribute("activityType", activityType);
      }

      activityType = (String) session.getAttribute("activityType");
      calendardyna.set("activityType", activityType);

      Vector activityTypeVec = new Vector();

      activityTypeVec.add(new DDNameValue("All", "All Activities"));
      activityTypeVec.add(new DDNameValue("Appointment", "Appointment"));
      activityTypeVec.add(new DDNameValue("Meeting", "Meeting"));
      activityTypeVec.add(new DDNameValue("Call", "Call"));
      activityTypeVec.add(new DDNameValue("NextAction", "NextAction"));
      activityTypeVec.add(new DDNameValue("OpportunityInfo", "OpportunityInfo"));
      activityTypeVec.add(new DDNameValue("ProjectInfo", "ProjectInfo"));
      activityTypeVec.add(new DDNameValue("Event", "Event"));
      activityTypeVec.add(new DDNameValue("Task", "Task"));
      request.setAttribute("activityTypeVec", activityTypeVec);

      // What the hell??? what is the purpose of the default values here?
      int timespan = 30;
      TimeZone tz = null;

      // get time zone from parameter or from preferences; worst case default to
      // EST.
      try {
        if (request.getParameter("timeZone") != null) {
          tz = TimeZone.getTimeZone(request.getParameter("timeZone"));
        } else {
          tz = TimeZone.getTimeZone((userobject.getUserPref()).getTimeZone());
        }
      } catch (Exception e) {
        tz = TimeZone.getTimeZone("EST");
      }
      request.setAttribute("TZ", tz);

      GlobalMasterLists globalMasterLists = GlobalMasterLists.getGlobalMasterLists(dataSource);
      Vector timeZoneVec = (Vector) globalMasterLists.get("TimeZone");
      request.setAttribute("timeZoneVec", timeZoneVec);
      String timeZoneID = tz.getID();
      calendardyna.set("timeZone", timeZoneID);

      request.setAttribute("showAdvancedSearch", new Boolean(false));
      request.setAttribute("showCustomViews", new Boolean(false));
      request.setAttribute("showComposeButton", new Boolean(false));
      request.setAttribute("showPrintButton", new Boolean(false));
      request.setAttribute("searchButtonDescription", "Perform a quick search for activities information.");
      request.setAttribute("newButtonValue", "Schedule");
      HashMap moduleList = new HashMap();

      if (globalMasterLists.get("moduleList") != null) {
        moduleList = (HashMap) globalMasterLists.get("moduleList");
      }

      String moduleID = (String) moduleList.get("Activities");
      request.setAttribute("moduleId", moduleID);

      // if the type wasn't set on the parameter
      // use the user preferences defaulting to daily view.
      type = request.getParameter("Type");
      if (type == null || type.length() <= 0) {
        // Get the preferred view from the Preferences
        UserPrefererences up = userobject.getUserPref();
        String prefView = (up.getCalendarDefaultView() == null) ? "DAILY" : up.getCalendarDefaultView(); // default
                                                                                                          // it
                                                                                                          // to
                                                                                                          // DAILY
        if (prefView.equals("DAILY")) {
          type = "DAILY";
        } else if (prefView.equals("MONTHLY")) {
          type = "MONTHLY";
        } else if (prefView.equals("WEEKLY")) {
          type = "WEEKLY";
        } else if (prefView.equals("WEEKLYCOLUMNS")) {
          type = "WEEKLYCOLUMNS";
        } else if (prefView.equals("YEARLY")) {
          type = "YEARLY";
        }
        request.setAttribute("Type", type);
      }

      // Default start and end time. are today, 0:00 through tomorrow 0:00
      GregorianCalendar startTimeUser = new GregorianCalendar(tz);

      // Set the default starting day of week to Monday.
      // TODO: make a preference for the starting day of the week, and use it
      // here.
      startTimeUser.setFirstDayOfWeek(Calendar.MONDAY);
      startTimeUser.setTimeInMillis(System.currentTimeMillis());
      int currentDay = startTimeUser.get(Calendar.DATE);
      int currentMonth = startTimeUser.get(Calendar.MONTH);
      int currentYear = startTimeUser.get(Calendar.YEAR);

      GregorianCalendar currentDateCalendar = new GregorianCalendar(currentYear, currentMonth, currentDay);
      request.setAttribute("currentDate", currentDateCalendar);

      String monthName = CalendarUtil.getCalenderMonthName(currentMonth);
      calendardyna.set("currentDate", monthName + " " + currentDay + ", " + currentYear);
      calendardyna.set("currentDay", new Integer(currentDay));
      calendardyna.set("currentMonth", new Integer(currentMonth));
      calendardyna.set("currentMonthName", monthName);
      calendardyna.set("currentYear", new Integer(currentYear));

      // the sDay, sMonth and sYear is the date set by the navigation or
      // selection
      String selectedDay = request.getParameter("selectedDay");
      String selectedMonthName = request.getParameter("selectedMonthName");
      String selectedYear = request.getParameter("selectedYear");

      // Check to see is session exists, if not set to default
      if (session.getAttribute("selectedDay") == null) {
        session.setAttribute("selectedDay", (new Integer(currentDay)).toString());
      }

      if (session.getAttribute("selectedMonthName") == null) {
        session.setAttribute("selectedMonthName", monthName);
      }

      if (session.getAttribute("selectedYear") == null) {
        session.setAttribute("selectedYear", (new Integer(currentYear)).toString());
      }

      // If request passes in selected day, set session to new value
      if (selectedDay != null) {
        session.setAttribute("selectedDay", selectedDay);
      }

      if (selectedMonthName != null) {
        session.setAttribute("selectedMonthName", selectedMonthName);
      }

      if (selectedYear != null) {
        session.setAttribute("selectedYear", selectedYear);
      }

      // set local objects to value stored in session
      selectedDay = (String) session.getAttribute("selectedDay");
      selectedMonthName = (String) session.getAttribute("selectedMonthName");
      selectedYear = (String) session.getAttribute("selectedYear");

      int day = Integer.parseInt(selectedDay);
      int month = (selectedMonthName == null) ? currentMonth : CalendarUtil.getCalendarMonth(selectedMonthName);
      int year = (selectedYear == null) ? currentYear : Integer.parseInt(selectedYear);
      if (selectedMonthName == null) {
        selectedMonthName = CalendarUtil.getCalenderMonthName(currentMonth);
      }

      GregorianCalendar selectedDate = new GregorianCalendar(year, month, 1);
      request.setAttribute("selectedDate", selectedDate);
      request.setAttribute("showWeeklyColumn", new Boolean(true));
      calendardyna.set("selectedDate", selectedMonthName + " " + day + ", " + year);
      calendardyna.set("selectedDay", String.valueOf(day));
      calendardyna.set("selectedYear", String.valueOf(year));
      calendardyna.set("selectedMonthName", selectedMonthName);

      // Selected Day midnight
      startTimeUser.clear();
      startTimeUser.set(year, month, day);

      HashMap calendarNavBar = CalendarUtil.setCalendarNavBar(year, month, day, type);
      calendardyna.set("calendarNavBar", calendarNavBar.get("calendarNavBar"));
      calendardyna.set("headerList", calendarNavBar.get("headerList"));
      calendardyna.set("headerLinkList", calendarNavBar.get("headerLinkList"));
      calendardyna.set("dateList", calendarNavBar.get("dateList"));
      calendardyna.set("startDayOfWeek", calendarNavBar.get("startDayOfWeek"));

      GregorianCalendar endTimeUser = new GregorianCalendar(tz);
      endTimeUser.setTime(startTimeUser.getTime());
      endTimeUser.add(Calendar.DATE, 1); // Selected Day+1 midnight

      if (type.equals("DAILY")) {
        // Daily view, set the timespan to 15, 30 or 60
        // minutes per table row, based on the dropdown.
        if (request.getParameter("timespan") != null) {
          timespan = Integer.parseInt(request.getParameter("timespan"));
        }
        startTimeUser.set(year, month, day, 0, 0);
        endTimeUser.setTime(startTimeUser.getTime());
        endTimeUser.add(Calendar.DATE, 1);
        Final_Forward = ".view.calendar.dailylist";
      } else if (type.equals("MONTHLY")) {
        // Monthly View
        // That means timespan is 1440 for some reason. I guess
        // the math works out that way .. ?!
        timespan = 1440;
        // start is first of the month
        startTimeUser.set(year, month, 1, 0, 0);
        // end is first of NEXT month
        endTimeUser.setTime(startTimeUser.getTime());
        endTimeUser.add(Calendar.MONTH, 1);
        Final_Forward = ".view.calendar.monthlylist";
      } else if (type.equals("WEEKLY")) {
        // Weekly (NON-columnar) view
        // That means timespan is 1440 for some reason. I guess
        // the math works out that way .. ?!
        timespan = 1440;
        // in the non-columnar view we always start the week on Monday.
        startTimeUser.setFirstDayOfWeek(Calendar.MONDAY);
        startTimeUser = CalendarUtil.setToStartOfWeek(startTimeUser);
        endTimeUser.setTime(startTimeUser.getTime());
        endTimeUser.add(Calendar.DAY_OF_MONTH, 7);
        Final_Forward = ".view.calendar.weeklylist";
      } else if (type.equals("WEEKLYCOLUMNS")) {
        timespan = 60;
        startTimeUser.set(Calendar.DAY_OF_WEEK, startTimeUser.getFirstDayOfWeek());
        startTimeUser = CalendarUtil.setToStartOfWeek(startTimeUser);
        endTimeUser.setTime(startTimeUser.getTime());
        endTimeUser.add(Calendar.DAY_OF_MONTH, 7);
        Final_Forward = ".view.calendar.weeklycolumnarlist";
      } else if (type.equals("YEARLY")) {
        Final_Forward = ".view.calendar.yearlylist";
        return (mapping.findForward(Final_Forward));
      }

      request.setAttribute("Month", String.valueOf(month));

      HashMap lgmap = null;
      lgmap = CalendarUtil.getCalendarCollection(startTimeUser, endTimeUser, tz, userID, timespan, "", dataSource);
      DL = (CalendarList) lgmap.get("calendarlist");

      unscheduledactivity = (HashMap) lgmap.get("unscheduledactivity");
      scheduledactivity = (HashMap) lgmap.get("scheduledactivity");
      TreeMap allDayActivity = (TreeMap) lgmap.get("allDayActivity");

      Iterator arrIt = lgmap.keySet().iterator();
      while (arrIt.hasNext()) {
        String key = (String) arrIt.next();
        if (key.equals("calendarlist")) {
          CalendarList cl = (CalendarList) lgmap.get(key);
          Iterator it = cl.keySet().iterator();
          while (it.hasNext()) {
            Object o = cl.get(it.next());
            if (o instanceof CalendarListElement) {
              CalendarListElement ele = (CalendarListElement) o;
              Set setmember = ele.keySet();
              Iterator itMember = setmember.iterator();
              while (itMember.hasNext()) {
                Object keyValue = itMember.next();
                CalendarMember elemember = (CalendarMember) ele.get(keyValue);
                CalendarActivityObject calActivity = elemember.getActivityobject();
                ArrayList activitiesAttendeesList = calActivity.getActivityAttendee();
                if ("PRIVATE".equals(calActivity.getActivityVisibility()) && calActivity.getActivityOwnerId() != individualID
                    && !activitiesAttendeesList.contains(individualID + "")) {
                  calActivity.setActivity("Private");
                  calActivity.setActivityDetail("Private");
                }
              }
            }
          }
          continue;
        }

        Map map = (Map) lgmap.get(key);
        Iterator it = map.keySet().iterator();

        while (it.hasNext()) {
          CalendarActivityObject cao = (CalendarActivityObject) map.get(it.next());
          ArrayList activitiesAttendeesList = cao.getActivityAttendee();
          if ("PRIVATE".equals(cao.getActivityVisibility()) && cao.getActivityOwnerId() != individualID
              && !activitiesAttendeesList.contains(individualID + "")) {
            cao.setActivity("Private");
            cao.setActivityDetail("Private");
          }
        }
      }

      DL.setSearchString(request.getParameter("searchTextBox"));
      request.setAttribute("allDayActivity", allDayActivity);

      ArrayList nonCalendarActivityList = new ArrayList();
      if (scheduledactivity != null) {
        Set scheduleSet = scheduledactivity.keySet();
        Iterator scheduleIt = scheduleSet.iterator();
        while (scheduleIt.hasNext()) {
          CalendarActivityObject ele = (CalendarActivityObject) scheduledactivity.get(scheduleIt.next());
          String activitytype = ele.getActivityType();
          String iconFileName = CalendarUtil.getActivityIconFileName(activitytype);
          String activityTitle = ele.getActivity();
          StringBuffer displayLink = new StringBuffer("/activities/view_activity.do?rowId=");
          displayLink.append(ele.getActivityID());
          HashMap nonCalenderActivityMap = new HashMap();
          nonCalenderActivityMap.put("activityIcon", iconFileName);
          nonCalenderActivityMap.put("activityLink", displayLink.toString());
          nonCalenderActivityMap.put("activityTitle", activityTitle);
          nonCalendarActivityList.add(nonCalenderActivityMap);
        }// end while (it.hasNext())
      }
      if (unscheduledactivity != null) {
        Set unScheduleSet = unscheduledactivity.keySet();
        Iterator unScheduleIt = unScheduleSet.iterator();
        while (unScheduleIt.hasNext()) {
          CalendarActivityObject ele = (CalendarActivityObject) unscheduledactivity.get(unScheduleIt.next());
          String activitytype = ele.getActivityType();
          String iconFileName = CalendarUtil.getActivityIconFileName(activitytype);
          StringBuffer displayLink = new StringBuffer("/activities/view_activity.do?rowId=");
          displayLink.append(ele.getActivityID());
          String activityTitle = ele.getActivity();
          HashMap nonCalenderActivityMap = new HashMap();
          nonCalenderActivityMap.put("activityIcon", iconFileName);
          nonCalenderActivityMap.put("activityLink", displayLink.toString());
          nonCalenderActivityMap.put("activityTitle", activityTitle);
          nonCalendarActivityList.add(nonCalenderActivityMap);
        }
      }
      calendardyna.set("nonCalendarActivity", nonCalendarActivityList);

      // set the Icon and the links on the calendar elements.
      Set listkey = DL.keySet();
      Iterator it = listkey.iterator();
      while (it.hasNext()) {
        CalendarListElement ele = (CalendarListElement) DL.get(it.next());
        Set elekey = ele.keySet();
        Iterator eleit = elekey.iterator();
        while (eleit.hasNext()) {
          CalendarMember calmember = (CalendarMember) ele.get(eleit.next());
          CalendarActivityObject calActivity = calmember.getActivityobject();

          String activitytype = calActivity.getActivityType();
          String iconFileName = CalendarUtil.getActivityIconFileName(activitytype);
          calmember.setIcon(iconFileName);

          if ((calActivity.getActivity() != null) && (!calActivity.getActivity().equals("Private"))) {
            calmember.setRequestURL("c_openPopup('/activities/view_activity.do?rowId=" + (calActivity.getActivityID()).intValue() + "&"
                + ConstantKeys.TYPEOFACTIVITY + "=" + activitytype + "')");
          } else {
            calmember.setRequestURL("void(0);");
          }
        }
      } // end while (eleit.hasNext())
      request.setAttribute("displaylist", DL);
    } catch (Exception e) {
      logger.error("[Exception][CommonCalendarHandler.execute] Exception Thrown: ", e);
      e.printStackTrace();
      return (mapping.findForward("failure"));
    }
    calendardyna.set("selectView", type);
    request.setAttribute("calendarForm", calendardyna);
    return (mapping.findForward(Final_Forward));
  } // end execute(...)
View Full Code Here


    String returnStatus = "";
    try
    {

      DynaActionForm dynaForm = (DynaActionForm)form;

      HttpSession session = request.getSession(true);

      String typeOfSave = "save";
      int individualID = 0;
      UserObject userObject = (UserObject)session.getAttribute("userobject");

    UserPrefererences userPrefererences = userObject.getUserPref();

      // no need to check for null on userobjectd here, because if it is null
      // we should fail now! instead of making an EJB call with bogus info.    
      individualID = userObject.getIndividualID();

      if (request.getParameter("buttonpress") != null)
      {
        typeOfSave = request.getParameter("buttonpress");
        String minutes = (String) (dynaForm.get("minutes"));
        String seconds = (String) (dynaForm.get("seconds"));
        Vector vec = new Vector();
        PreferenceVO pvo1 = new PreferenceVO();
        PreferenceVO pvo2 = new PreferenceVO();
        PreferenceVO pvo3 = new PreferenceVO();
        pvo1.setModuleId(4);
        pvo1.setPreferenceName("calendarrefreshmin");
        pvo1.setPreferenceValue(minutes);
        pvo2.setModuleId(4);
        pvo2.setPreferenceName("calendarrefreshsec");
        pvo2.setPreferenceValue(seconds);
        pvo3.setModuleId(4);
        pvo3.setPreferenceName("caldefaultview");
        pvo3.setPreferenceValue((String) (dynaForm.get("radio")));

        if(minutes != null && !minutes.equals("") && !minutes.equals("null")
              && seconds != null && !seconds.equals("") && !seconds.equals("null"))
        {
            userPrefererences.setCalendarRefreshMin(minutes);
          userPrefererences.setCalendarRefreshSec(seconds);
          userObject.setUserPref(userPrefererences);
          session.setAttribute("userobject",userObject);
        }
       
        if(dynaForm.get("radio") != null)
        {
          userPrefererences.setCalendarDefaultView((String) dynaForm.get("radio"));
          userObject.setUserPref(userPrefererences);
          session.setAttribute("userobject",userObject);
        }
       
        vec.addElement(pvo1);
View Full Code Here

    ActionErrors allErrors = new ActionErrors();
    String forward = ".forward.preference.mail.account_list";
    String errorForward = ".view.preference.mail.new_account";

    // "mailAccountForm" defined in struts-config-preference.xml
    DynaActionForm accountForm = (DynaActionForm)form;

    MailHome home = (MailHome)CVUtility.getHomeObject("com.centraview.mail.MailHome", "Mail");

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

      // build a MailAccountVO
      MailAccountVO accountVO = new MailAccountVO();

      // the owner is always the logged in user
      accountVO.setOwnerID(individualID);

      // account name - required
      String accountName = (String)accountForm.get("accountName");
      if (accountName == null || accountName.length() <= 0) {
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Account Name"));
      }
      accountVO.setAccountName(accountName);

      // server type - "pop3" by default
      String accountType = MailAccountVO.POP3_TYPE;
      if ((String)accountForm.get("serverType") != null) {
        if (((String)accountForm.get("serverType")).equals("imap")) {
          accountType = MailAccountVO.IMAP_TYPE;
        }
      }
      accountVO.setAccountType(accountType);

      // default account - if user has no other accounts,
      // then make this one the default, else not default
      boolean defaultAccount = false;
      int defaultAccountID = remote.getDefaultAccountID(individualID);

      if (defaultAccountID == 0) {
        defaultAccount = true;
      }
      accountVO.setDefaultAccount(defaultAccount);

      // email address - must be a valid InternetAddress
      String emailAddress = (String)accountForm.get("emailAddress");
      if (emailAddress == null) {
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Email Address"));
      } else if (! CVUtility.isEmailAddressValid(emailAddress)) {
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.email.invalidAddress", emailAddress));
      }
      accountVO.setEmailAddress(emailAddress);

      // leave on server - false by default
      Boolean leaveOnServerForm = (Boolean)accountForm.get("leaveOnServer");
      boolean leaveOnServer = false;
      if (leaveOnServerForm != null && leaveOnServerForm.booleanValue() == true) {
        leaveOnServer = true;
      }
      accountVO.setLeaveMessagesOnServer(leaveOnServer);

      // user name - required
      String username = (String)accountForm.get("username");
      if (username == null || username.length() <= 0) {
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "User Name (login)"));
      }
      accountVO.setLogin(username);

      // password - required
      String password = (String)accountForm.get("password");
      if (password == null || password.length() <= 0) {
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Password"));
      }
      accountVO.setPassword(password);

      // mail server (POP3 or IMAP) - required
      String mailServer = (String)accountForm.get("mailServer");
      if (mailServer == null || mailServer.length() <= 0) {
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Mail Server Address"));
      }
      accountVO.setMailServer(mailServer);
     
      // reply to - optional
      String replyTo = (String)accountForm.get("replyTo");
      accountVO.setReplyToAddress(replyTo);

      // signature - optional
      String signature = (String)accountForm.get("signature");
      accountVO.setSignature(signature);

      // port - required, must be valid Integer
      Integer smtpPort = (Integer)accountForm.get("port");
      if (smtpPort == null || smtpPort.intValue() <= 0) {
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "SMTP Port"));
      }
      accountVO.setSmtpPort(smtpPort.intValue());

      // smtp server - required
      String smtpServer = (String)accountForm.get("smtpServer");
      if (smtpServer == null || smtpServer.length() <= 0) {
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "SMTP Server"));
      }
      accountVO.setSmtpServer(smtpServer);

      Boolean authenticationRequiredForSMTP = (Boolean)accountForm.get("authenticationRequiredForSMTP");
      if (authenticationRequiredForSMTP != null) {
        if (authenticationRequiredForSMTP.booleanValue()) {
          accountVO.setAuthenticationRequiredForSMTP(true);
        } else {
          accountVO.setAuthenticationRequiredForSMTP(false);
View Full Code Here

    String button = request.getParameter("save_close");
    String button1 = request.getParameter("save_new");
    //System.out.println("button " + button + " button1 " + button1);

    String status = "changes Group updated in the database";
    DynaActionForm dynaForm = (DynaActionForm) form;

    if (button != null)
    {
      returnStatus = "saveandclose";
    }
    else
    {
      returnStatus = "successandnew";
    }

    // this.updateGroup(form , status);
    ListGenerator lg = ListGenerator.getListGenerator(dataSource);
    lg.makeListDirty("Marketing");
    dynaForm.initialize(mapping);

    return (mapping.findForward(returnStatus));
  }
View Full Code Here

  }

  public void updateList(ActionForm form, String status)
  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    DynaActionForm dynaform = (DynaActionForm) form;

    /*
    MarketingFacadeHome aa = (MarketingFacadeHome)CVUtility.getHomeObject("com.centraview.marketing.marketingfacade.MarketingFacadeHome","MarketingFacade");
    MarketingFacade remote =(MarketingFacade)aa.create();
    */
 
View Full Code Here

{
  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException
  {
    request.setAttribute(AdminConstantKeys.PREFERENCEPAGE, "NEWEMAIL");
    // default "port" to 25 unless it's given
    DynaActionForm accountForm = (DynaActionForm)form;
    Integer port = (Integer)accountForm.get("port");
    if (port == null || port.intValue() <= 0) {
      port = new Integer(25);
    }
    accountForm.set("port", port);
    return(mapping.findForward(".view.preference.mail.new_account"));
  }   // end execute() method
View Full Code Here

    HttpSession session = request.getSession(true);
    UserObject  userobjectd = (UserObject)session.getAttribute( "userobject" );
    int individualId = userobjectd.getIndividualID();
    ListPreference listpreference= userobjectd.getListPreference("Email");
    MailMessage mailMessage = new MailMessage();
    DynaActionForm dynaForm = (DynaActionForm)form;

    String accountid   = (String) dynaForm.get( "AccountID" );

    String messageid    = (String) request.getParameter( "messageid" );
   
    mailMessage.setMessageID( Integer.parseInt( messageid ) );
         

    HashMap attchmentids =( HashMap) session.getAttribute( "AttachfileList" );


    int id = Integer.parseInt( accountid );

    /** code added for query change **/
    FolderList fl = ( FolderList )session.getAttribute("folderlist");
    Set listkey = fl.keySet();
    Iterator it = listkey.iterator();
    int accountID;
    AccountDetail ad1 = null;
    while(it.hasNext())
    {
      ad1 =(AccountDetail)fl.get(it.next());
      accountID = ad1.getAccountid();
      if( id == accountID )
      break;

    }
    int folderidfordraft = ad1.getFolderIDFromName( "Drafts" , "SYSTEM" );
    mailMessage.setFolder( folderidfordraft );
    // up to here
    mailMessage.setAccountID( Integer.parseInt( accountid )  );
    String mailFrom   = (String) dynaForm.get( "composeFrom" );

    mailMessage.setMailFrom( mailFrom  );

    //to
    ArrayList toarray = new ArrayList();
    String to  = (String) dynaForm.get( "composeTo" );

    StringTokenizer st = new StringTokenizer( to , "," );
    while ( st.hasMoreTokens())
    {
      toarray.add( new MailAddress( st.nextToken() ) );
    }
    mailMessage.setTo( toarray );


    //cc
    ArrayList ccarray = new ArrayList();
    String cc = (String) dynaForm.get( "composeCc" );

    StringTokenizer stcc = new StringTokenizer( cc , "," );
    while ( stcc.hasMoreTokens())
    {
      ccarray.add(new MailAddressstcc.nextToken()  ) );
    }
    mailMessage.setCc( ccarray );

    //bcc
    ArrayList bccarray = new ArrayList();
    String bcc = (String ) dynaForm.get( "composeBcc" );

    StringTokenizer stbcc = new StringTokenizer( bcc , "," );
    while ( stbcc.hasMoreTokens())
    {
      bccarray.add( new MailAddress( stbcc.nextToken() ) );
    }
    mailMessage.setBcc(bccarray);

    //message subject
    String subject = (String) dynaForm.get( "composeSubject" );
    mailMessage.setSubject( subject ) ;
    //message body
    String body = (String) dynaForm.get( "composeMessage" );
    mailMessage.setBody(body);

    //message Date
    long l = ( new java.util.Date() ).getTime();
    mailMessage.setMessageDate( new java.sql.Timestamp( ) ) ;
View Full Code Here

    ActionErrors allErrors = new ActionErrors();
    String forward = "showContactDetails";

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

    int newIndividualID = -1;

    try
    {
View Full Code Here

   
    ActionErrors allErrors = new ActionErrors();
    String forward = ".forward.preference.mail.account_list";

    // "mailAccountForm" defined in struts-config-preference.xml
    DynaActionForm accountForm = (DynaActionForm)form;
   
    try {
      // get the account ID from the form bean
      Integer accountID = (Integer)accountForm.get("accountID");
     
      // now, check the account ID on the form...
      if (accountID == null || accountID.intValue() <= 0) {
        // if account ID is not set on the form, then there is
        // no point in continuing forward. Show user the door. :-)
View Full Code Here

  MarketingFacadeHome aa = (MarketingFacadeHome)CVUtility.getHomeObject("com.centraview.marketing.marketingfacade.MarketingFacadeHome", "MarketingFacade");
    try
    {
      MarketingFacade remote = (MarketingFacade)aa.create();
      remote.setDataSource(dataSource);
    DynaActionForm dyna = (DynaActionForm)form;
    if (row != null && !row.equals("")){
      int rowID = Integer.parseInt(row);
      ListVO listVO = remote.viewList(rowID);
      dyna.set("listname", listVO.getTitle());
      dyna.set("listdescription", listVO.getDescription());
      dyna.set("listid", listVO.getListID()+"");
      dyna.set("create", listVO.getCreated());
      dyna.set("modify", listVO.getModified());
      dyna.set("owner", listVO.getOwnerID()+"");
      dyna.set("ownername", listVO.getOwnerName());
    }
    request.setAttribute("listFormBean", dyna);
    } //end of try block
    catch (Exception e)
    {
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.