Package com.ateam.webstore.ui.models

Examples of com.ateam.webstore.ui.models.Visitor


//    }
//    else {
//      title = "All Orders";
//      olv.setOrders(service.getAll()); 
//    }
    Visitor v = (Visitor) req.getSession().getAttribute(SESSION_ATTRIBUTE_VISITOR);
    title = "All Orders";
    olv.setOrders(service.getByCustomerId(v.getCustomer().getId()))
   
    olv.addContentView(new ContentView(JSP_ORDER_LIST, title));
    return olv;
  }
View Full Code Here


   * @param id  User ID
   * @return
   */
  public Collection<Address> getUserAddresses() {

    Visitor v = (Visitor) req.getSession().getAttribute(SESSION_ATTRIBUTE_VISITOR);
   
    return service.getByCustomerId(v.getCustomer().getId());
   
  }
View Full Code Here

    //Get the form data
    AddressEditForm ade = getAddressFromRequest();
   
    //Validate and add address
    if (ade.isValid()) try {
      Visitor v = (Visitor) req.getSession().getAttribute(SESSION_ATTRIBUTE_VISITOR);
      addr = new Address(ade.getStreetAddress1(), ade.getCity(), ade.getState(), ade.getZip(), false, v.getCustomer().getPerson());
      addr = service.store(addr);
    } catch (Exception e) {
      l.log(Level.WARNING, "Failed to store addr", e);
      ade.setResultMessage("Could not store address");
    }
View Full Code Here

   *
   * @param v
   * @return
   */
  private View setVisitorInfo(View v) {
    Visitor vis = (Visitor) req.getSession().getAttribute(SESSION_ATTRIBUTE_VISITOR);

    v.setShowLogonForm(true);
   
    if (vis != null) {
      l.info("visitor in session:"+vis);
      v.setShowVisitorInfo(vis.isKnown());
    }
    else {
      l.info("No visitor in session");
      //TODO Look for cookies if not in session
      vis = new Visitor();
    }

    v.setVisitor(vis);
   
    return v;
View Full Code Here

    FormSubmission fs = new FormSubmission();

    String message = req.getParameter(Parameters.MESSAGE.getId());
   
    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();
View Full Code Here

      public LoginForm getLoginRequest() {
       
        l.info("Parsing Login Request from session "+req.getSession().getId());
       
        LoginForm login = new LoginForm();
        Visitor v = new Visitor();
        v.setEmail(req.getParameter(Parameters.EMAIL.getId()));
        login.setVisitor(v);
        login.setPassword(req.getParameter(Parameters.PASSWORD.getId()));
       
        req.getSession().setAttribute(SESSION_ATTRIBUTE_VISITOR, v);
        login.setVisitor(v);
View Full Code Here

              
                LoginForm login = (LoginForm) getLoginRequest();
              
                l.info("Processing Login Request from session "+req.getSession().getId());
             
                Visitor v = login.getVistor();
                Employee emp = null;
                View resultView = null;
              
                try {
                        emp= service.authenticateEmployee(login.getVistor().getEmail(), login.getPassword());
                        if (emp!= null) {
                                l.info("Login Successful for "+login.getVistor().getEmail());

                                v.setEmployeeAuthenticated(true);
                                v.setEmployee(emp);
                                v.setKnown(true);
                              
                                req.getSession().setAttribute(SESSION_ATTRIBUTE_VISITOR,v);
                                login.setForm(FormName.LOGIN);
                                login.setSuccess(true);

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

                if (v.isEmployeeAuthenticated()) try {
                      
                        if (login.getRedirect() != null) {
                                resultView = new View();
                                resultView.setRedirectPath(login.getRedirect());
                        }
View Full Code Here

   */
  public View () {
    contentViews = new ArrayList<ContentView>();
    navLinks = new HashMap<String,String>();
    contentViews = new ArrayList<ContentView>();
    visitor = new Visitor();
  }
View Full Code Here

  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    try {
     
    Visitor vis = (Visitor) req.getSession().getAttribute(SESSION_ATTRIBUTE_VISITOR);
   
    View v = null;   
   
      if (vis != null && vis.isEmployeeAuthenticated()) {
       
        if (req.getParameterMap().containsKey(Parameters.LOGIN.getId())) {
          EmployeeHandler eh = new EmployeeHandler(req);
          v = eh.getLoginView(null);
        }
View Full Code Here

    String formId = req.getParameter(Parameters.FORM_ID.getId());
   
    l.info("process form:"+formId);

    Visitor v = (Visitor) req.getSession().getAttribute(SESSION_ATTRIBUTE_VISITOR);
   
    if (v != null && v.isEmployeeAuthenticated()) {
      if (formId == null) {
        l.warning("null form ID ");
        throw new Exception();
      }
      else if (formId.equals(FormName.EDIT_PRODUCT.getId())) {
View Full Code Here

TOP

Related Classes of com.ateam.webstore.ui.models.Visitor

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.