Package org.springframework.samples.jpetstore.domain

Examples of org.springframework.samples.jpetstore.domain.Account


    }
  }

  public void afterReturning(Object returnValue, Method m, Object[] args, Object target) throws Throwable {
    Order order = (Order) args[0];
    Account account = ((PetStoreFacade) target).getAccount(order.getUsername());

    // don't do anything if email address is not set
    if (account.getEmail() == null || account.getEmail().length() == 0) {
      return;
    }

    StringBuffer text = new StringBuffer();
    text.append("Dear ").append(account.getFirstName()).append(' ').append(account.getLastName());
    text.append(", thank your for your order from JPetStore. Please note that your order number is ");
    text.append(order.getOrderId());

    SimpleMailMessage mailMessage = new SimpleMailMessage();
    mailMessage.setTo(account.getEmail());
    mailMessage.setFrom(this.mailFrom);
    mailMessage.setSubject(this.subject);
    mailMessage.setText(text.toString());
    try {
      this.mailSender.send(mailMessage);
View Full Code Here


  public Account getAccount(String username) throws DataAccessException {
    return (Account) getSqlMapClientTemplate().queryForObject("getAccountByUsername", username);
  }

  public Account getAccount(String username, String password) throws DataAccessException {
    Account account = new Account();
    account.setUsername(username);
    account.setPassword(password);
    return (Account) getSqlMapClientTemplate().queryForObject("getAccountByUsernameAndPassword", account);
  }
View Full Code Here

TOP

Related Classes of org.springframework.samples.jpetstore.domain.Account

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.