Package com.ateam.webstore.ui.forms

Examples of com.ateam.webstore.ui.forms.RegistrationForm


      
        public FormSubmission processAddEmployeeRequest() {
                 
                l.info("Processing registration request from session "+req.getSession().getId());
              
                RegistrationForm add = getRegistrationRequest();
              
                if (!add.isValid()) {
                  l.info("registration form error in session "+req.getSession().getId());
                  add.setResultView(getAdminAddEmployeeView(null))
                }
                else if (service.employeeExists(add.getEmail())) {
                    l.info("employee exists "+req.getSession().getId());
                        add.setResultView(getAdminAddEmployeeView("An account for"+add.getEmail()+" already exists"));
                }
                else {
                 
                  l.info("registration form check OK "+req.getSession().getId());
                    View rv = new View(getAdminHomeView());
                    Employee e = null;
                    try {
                        String ssn = Utilities.padStringToLength(Math.abs(new Random().nextInt())+"", "0", 9, false);
                        e = service.registerEmployee(add.getFirstName(), add.getLastName(), add.getEmail(), add.getPw(), new Long(1), "foo", ssn, "Employee", new Date(new java.util.Date().getTime()), "A1", new Double(100000));
                        RoleService rs = new RoleService();
                        Role role = rs.getById(new Integer(add.getRoleId()));
                        EmployeeRoles er = new EmployeeRoles(new Date(new java.util.Date().getTime()), e, role);
                        EmployeeRolesService ers = new EmployeeRolesService();
                        ers.store(er);
                            rv.setMessage("Employee addition Complete");
                            add.setResultMessage("Employee successfull added");
                    } catch (Exception e1) {
                      if (e != null) {
                        service.remove(e);
                      }
                        l.log(Level.WARNING, "", e1);
                        rv.setError(true);
                        rv = getAdminAddEmployeeView("An error occured.");
                        add.setResultMessage("Unable to process request");
                    }

                    add.setResultView(rv);                
                }
              
                return add;
        }
View Full Code Here


    }
   
    private RegistrationForm getRegistrationRequest() {
      l.info("Parsing Registration Request from session "+req.getSession().getId());
     
      RegistrationForm reg = new RegistrationForm();

      reg.setFirstName(req.getParameter(Parameters.FIRST_NAME.getId()));
      reg.setLastName(req.getParameter(Parameters.LAST_NAME.getId()));
      reg.setEmail(req.getParameter(Parameters.EMAIL.getId()));
      reg.setPw(req.getParameter(Parameters.PASSWORD.getId()));
      reg.setCpw(req.getParameter(Parameters.CONFIRMPASSWORD.getId()));
      reg.setRoleId(req.getParameter(Parameters.ROLE.getId()));
      reg.setForm(FormName.REGISTER);
      reg.setAdmin(true);
     
      return reg;
    }
View Full Code Here

   */
  public FormSubmission processRegistrationRequest() {
   
    l.info("Processing registration request from session "+req.getSession().getId());
   
    RegistrationForm reg = getRegistrationRequest();
   
    if (!reg.isValid()) {
      reg.setResultView(getRegistrationView(reg));
    }
    else if (service.customerExists(reg.getEmail())) {
      reg.setResultView(getRegistrationView("An account for"+reg.getEmail()+" already exists"));
    }
    else {
      View rv = new View(getMainView());
     
      rv.addContentView(new ContentView(JSP_LOGIN, "Login"));
     
      try {
        service.registerCustomer(reg.getFirstName(), reg.getLastName(), reg.getEmail(), reg.getPw(), reg.getSecurityQuestionIdLong(), reg.getSecurityAnswer());
        rv.setMessage("Registration Complete, please login.");
      } catch (Exception e) {
        l.log(Level.WARNING, "", e);
        rv.setError(true);
        //rv.setMessage("Failed!! "+e.getMessage());
        reg.setResultView(getRegistrationView("An error occured."));
      }

      reg.setResultView(rv);     
    }
   
    return reg;
  }
View Full Code Here

  }
 
  private RegistrationForm getRegistrationRequest() {
    l.info("Parsing Registration Request from session "+req.getSession().getId());
   
    RegistrationForm reg = new RegistrationForm();

    reg.setFirstName(req.getParameter(Parameters.FIRST_NAME.getId()));
    reg.setLastName(req.getParameter(Parameters.LAST_NAME.getId()));
    reg.setEmail(req.getParameter(Parameters.EMAIL.getId()));
    reg.setPw(req.getParameter(Parameters.PASSWORD.getId()));
    reg.setCpw(req.getParameter(Parameters.CONFIRMPASSWORD.getId()));
    reg.setSecurityQuestionId(req.getParameter(Parameters.SECURITY_QUESTION.getId()));
    reg.setSecurityAnswer(req.getParameter(Parameters.SECURITY_ANSWER.getId()));
    reg.setForm(FormName.REGISTER);
   
    return reg;
  }
View Full Code Here

TOP

Related Classes of com.ateam.webstore.ui.forms.RegistrationForm

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.