Example #1
0
  /**
   * Process the specified HTTP request, and create the corresponding HTTP response (or forward to
   * another web component that will create it). Return an <code>ActionForward</code> instance
   * describing where and how control should be forwarded, or <code>null</code> if the response has
   * already been completed.
   *
   * @param form
   * @param req
   * @param res
   * @param mapping The ActionMapping used to select this instance
   * @exception IOException if an input/output error occurs
   * @exception ServletException if a servlet exception occurs
   * @return destination
   */
  public ActionForward execute(
      ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res)
      throws IOException, ServletException {
    ActionMessages errors = new ActionMessages();
    ActionForward destination = null;

    if (!this.checkLogon(req)) {
      return mapping.findForward("logon");
    }
    Integer action;

    try {
      action = Integer.parseInt(req.getParameter("action"));
    } catch (Exception e) {
      action = BlacklistAction.ACTION_LIST;
    }

    AgnUtils.logger().info("Action: " + action);

    try {
      destination = executeIntern(mapping, req, errors, destination, action);
    } catch (Exception e) {
      AgnUtils.logger().error("execute: " + e + "\n" + AgnUtils.getStackTrace(e));
      errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.exception"));
    }

    // Report any errors we have discovered back to the original form
    if (!errors.isEmpty()) {
      saveErrors(req, errors);
    }
    return destination;
  }
Example #2
0
 /**
  * Setter for property linkName.
  *
  * @param name New value of property linkName.
  */
 public void setLinkName(String name) {
   if (tracklink != null) {
     tracklink.setShortname(name);
   } else {
     AgnUtils.logger().error("setLinkName: Trying to set name for invalid tracklink");
   }
 }
Example #3
0
 /** Setter for property linkUrl. */
 public void setLinkUrl(String linkURL) {
   if (tracklink != null) {
     tracklink.setFullUrl(linkURL);
   } else {
     AgnUtils.logger().error("setLinkUrl: Trying to set url for invalid tracklink");
   }
 }
Example #4
0
  /**
   * Loads a customer by email. Set all bindings to status
   *
   * @param newEmail
   * @param req
   */
  protected void updateUserStatus(String newEmail, HttpServletRequest req) {
    ApplicationContext aContext = this.getWebApplicationContext();
    Recipient cust = (Recipient) aContext.getBean("Recipient");
    RecipientDao dao = (RecipientDao) aContext.getBean("RecipientDao");

    cust.setCompanyID(this.getCompanyID(req));
    int customerID = dao.findByKeyColumn(cust, "email", newEmail);
    cust.setCustomerID(customerID);

    cust.setCustParameters(dao.getCustomerDataFromDb(cust.getCompanyID(), cust.getCustomerID()));

    Hashtable hash = dao.loadAllListBindings(cust.getCompanyID(), cust.getCustomerID());
    Iterator it = hash.keySet().iterator();

    while (it.hasNext()) {
      String mailinglist = (String) it.next();
      Hashtable list = (Hashtable) hash.get(mailinglist);
      Iterator iter = list.keySet().iterator();
      while (iter.hasNext()) {
        String media = (String) iter.next();
        BindingEntry entry = (BindingEntry) list.get(media);
        entry.setUserStatus(BindingEntry.USER_STATUS_BLACKLIST);
        entry.setUserRemark("Blacklisted by " + AgnUtils.getAdmin(req).getAdminID());
        entry.updateStatusInDB(cust.getCompanyID());
      }
    }
  }