Package com.ateam.webstore.model

Examples of com.ateam.webstore.model.Customer


    return repository.getOrdersInCompleted();
  }

  public Collection<Orders> getByCustomerId(Serializable id) {
    OrdersDAO repository = new OrdersDAO();
    Customer customer = new CustomerService().getById(id);
    return repository.getByCustomer(customer);
  }
View Full Code Here


public class CustomerDAO extends GenericDAOImpl<Customer, Serializable> {
 
  public Customer getCustomerByPersonID(Serializable id) {
   
    Customer customer = null;
   
    try {
      Query query = getPersistenceManager().newQuery(getPersistentClass(), "personID == :id");
      query.setUnique(true);
      customer = (Customer) query.execute(id);
View Full Code Here

    if (fs.validString(message)) {
      Visitor v = (Visitor) req.getSession().getAttribute(SESSION_ATTRIBUTE_VISITOR);
     
     
      try {
        Customer person = v.getCustomer();
       
        ServiceCase scase = new ServiceCase(person);
        service.store(scase);
       
        MessageService ms = new MessageService();
       
        Message mess = new Message(scase, person.getPerson(), false, 0, message);
        ms.store(mess);
        fs.setResultMessage("Feedback sent.");
       
        fs.setResultView(getMessageView("Feedback Sent.", "Send Feedback"));
       
View Full Code Here

    return repository.get(id);
  }
 
  public Collection<CreditCard> getByCustomerId(Serializable id) {
    CreditCardDAO repository = new CreditCardDAO();
    Customer customer = new CustomerService().getById(id);
    return repository.getByCustomer(customer);
  }
View Full Code Here

    return repository.get(id);
  }
 
  public WishList getByCustomerId(Serializable customerID) {
   
    Customer customer = new CustomerService().getById(customerID);   
    WishListDAO repository = new WishListDAO();
    return repository.getByCustomer(customer);
 
View Full Code Here

    AddressDAO repository = new AddressDAO();
    return repository.get(id);
  }
 
  public Collection<Address> getByCustomerId(Serializable id) {
    Customer customer = new CustomerService().getById(id);
    AddressDAO repository = new AddressDAO();
    return repository.getByPerson(customer.getPerson());
  }
View Full Code Here

    LoginForm login = getLoginRequest();
   
    l.info("Processing Login Request from session "+req.getSession().getId());
    Visitor v = login.getVistor();
   
    Customer cust = null;
    View resultView = null;
   
    try {
      cust = service.authenticateCustomer(req.getParameter(Parameters.EMAIL.getId()), req.getParameter(Parameters.PASSWORD.getId()));
      if (cust != null) {
        l.info("Login Successful for "+cust.getPerson().getLogin());
        v.setCustomer(cust);
        v.setAuthenticated(true);
        v.setKnown(true);
        v.setRemember(req.getParameter(Parameters.REMEMBER_ME.getId()) != null);
       
        req.getSession().setAttribute(SESSION_ATTRIBUTE_VISITOR, v);
        req.getSession().setAttribute(SESSION_ATTRIBUTE_USER_NAME, v.getEmail());
        login.setForm(FormName.LOGIN);
        login.setSuccess(true);

      }
      else {
        resultView = getLoginView("Invalid email or password. Please try again.", getMainView());
      }
     
    } catch (Exception e) {
      l.log(Level.INFO, "Failed authentication", e);
      resultView = getLoginView("Invalid email or password. Please try again.", getMainView());
    }

    if (v.isAuthenticated()) try {
      CartService cs = new CartService();
      l.info("retrieving cart for customerId:"+cust.getId());
      req.getSession().setAttribute(SESSION_ATTRIBUTE_CART, cs.getByCustomerId(cust.getId()));
     
      if (login.getRedirect() != null) {
        l.info("redirecting to "+login.getRedirect());
        resultView = new View();
        resultView.setRedirectPath(login.getRedirect());
View Full Code Here

  public Customer registerCustomer(String fname, String lname, String email, String password, Long securityQuestionID, String securityAnswer) {
   
    SecurityQuestion secQuestion = new SecurityQuestionService().getById(securityQuestionID);
    Person person = new Person(email, password, secQuestion, securityAnswer);
//    CustomerService custService = new CustomerService();
    return store(new Customer(fname, lname, person));
  }
View Full Code Here

      return add;
    }
   
    if (cart == null) {
      l.info("creating cart for session: "+req.getSession().getId());
      Customer cust = v.getCustomer();
      cart = new Cart(cust);
      service.store(cart);
      req.getSession().setAttribute(SESSION_ATTRIBUTE_CART, service.getByCustomerId(cust.getId()));
    }

    l.info("adding product to cart for session: "+req.getSession().getId());

    l.fine("add prodId :"+prodId);   
View Full Code Here

    return repository.get(id);
  }
 
  public Cart getByCustomerId(Serializable customerID) {
   
    Customer customer = new CustomerService().getById(customerID);   
    CartDAO repository = new CartDAO();
    return repository.getByCustomer(customer);
  }
View Full Code Here

TOP

Related Classes of com.ateam.webstore.model.Customer

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.