Esempio n. 1
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) {
     return true;
   }
   if (!(obj instanceof Account)) {
     return false;
   }
   Account other = (Account) obj;
   return id == other.id
       && customerId == other.customerId
       && type == other.type
       && Util.equals(balance, other.balance);
 }
  public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    String id = request.getParameter("id");
    if (Util.isEmpty(id)) {
      log.error("Missing required transaction id");
      return ViewUtil.createErrorView("error.missing.transaction.id");
    }

    Transaction transaction = null;
    try {

      String accessMode = null;

      if (adminManager != null) {
        accessMode = adminManager.getParameter("accessmode");
      }

      if (accessMode != null && !accessMode.equalsIgnoreCase("jdbc")) {
        transaction = accessModeController.doGetTransaction(Integer.parseInt(id));
      } else {

        transaction = bankManager.getTransaction(Integer.parseInt(id));
        log.info("Using regular JDBC connection");
      }

    } catch (NumberFormatException e) {
      log.error("Invalid transaction id = " + id, e);
      return ViewUtil.createErrorView(
          "error.invalid.transaction.id", new Object[] {request.getParameter("id")});
    } catch (DataAccessException e) {
      log.error("Invalid transaction id = " + id, e);
      return ViewUtil.createErrorView(
          "error.invalid.transaction.id", new Object[] {request.getParameter("id")});
    }

    return new ModelAndView("transaction", "transaction", transaction);
  }