Package com.ateam.webstore.model

Examples of com.ateam.webstore.model.Employee


 
  public Employee registerEmployee(String fname, String lname, String email, String password, Long securityQuestionID, String securityAnswer
      , String ssn, String jobTitle, Date dateOfHire, String deptCode, Double salary) {
    SecurityQuestion secQuestion = new SecurityQuestionService().getById(securityQuestionID);
    Person person = new Person(email, password, secQuestion, securityAnswer);
    return store(new Employee(fname, lname, ssn, jobTitle, dateOfHire, deptCode, salary, person));
  }
View Full Code Here


         */
        public AdminEmployeeDetailsView getEmployeeDetailsView() {
              
            AdminEmployeeDetailsView ev = new AdminEmployeeDetailsView(getMainAdminView());
           
            Employee e = getEmployee();
              
                if (e != null) {
                ev.setEmployee(e);
                ev.addContentView(new ContentView(JSP_EMPLOYEE_DETAILS, "Employee "+e.getId()));
                }
                else {
                        ev.addContentView(new ContentView(JSP_MESSAGE, "Not Found"));
                        ev.setMessage("Sorry, employee not found.");
                }
               
                Collection<EmployeeRoles> roles = e.getRoles();
                for (EmployeeRoles role : roles) {
                  ev.addRole(role.getRole().getDescription());
                }
              
                return ev;
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());
                        }
                        else {
                                resultView = getAdminHomeView();
                        }

                } catch (Exception e) {
                        l.log(Level.INFO, "", e);                     
                }
              
                login.setResultView(resultView);
              
                l.info("Login results:"+v);
               
                try {
                    String roleNames = "";
                    Collection<EmployeeRoles> roles = emp.getRoles();
                    for (EmployeeRoles role : roles) {
                      //roleNames += role.getId();
                      roleNames += role.getRole().getDescription();
                    }
                  
View Full Code Here

                }
                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()));
View Full Code Here

     
      FormSubmission fs = new FormSubmission();
     
      fs.setResultView(getEmployeeListView());
      try {
        Employee e = getEmployee();
        service.remove(e);
        fs.setResultMessage("Employee deleted");
      } catch (Exception e) {
        fs.setResultMessage("Failed to delete employee");
        l.log(Level.WARNING, "Failed to delete eomplyee", e);
View Full Code Here

TOP

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

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.