Package it.hotel.model.user

Examples of it.hotel.model.user.User


   */
  @Override
  protected ModelAndView processFormSubmission(HttpServletRequest request,
      HttpServletResponse response, Object command, BindException errors)
      throws Exception {
    User user = (User) command;
   
    user = userManager.getUser(user.getUserName(), user.getPassword());
   
    if(user != null && !"guest".equals(user.getRole().getName())){
      ((IUserContainer)getApplicationContext().getBean(SystemConstants.USER_CONTAINER)).setUser(user);
      return new ModelAndView(getSuccessView());
    }
   
    return new ModelAndView(getFormView());
View Full Code Here


    return users;
  }
 
  private List<User> loadUsers(Map roles, ResultSet result) throws SQLException {
      List<User> users = new ArrayList<User>();
      User user = null;
      IUser prevUser = null;
      while (result.next()) {
        String userName = result.getString(1);
        if (prevUser == null || !userName.equals(prevUser.getUserName())) {
          if (user != null) {
            users.add(user);
          }
          user = new User();
          user.setUserName(userName);
          user.setPassword(result.getString(2));
          String roleName = result.getString(3);
          Role role = (Role) roles.get(roleName);
          user.setRole(role);
          user.setName(result.getString(4));
          user.setSurname(result.getString(5));
          user.setStructureId((result.getInt(6)));
          user.setEmail(result.getString(7));
          prevUser = user;
        }
      }
      if (user != null){
        users.add(user);
View Full Code Here

   *              
   */
  public User loadUser(String userName, String password,
      Map roles) {
    Connection conn = null;
    User user = null;
    PreparedStatement stat = null;
    ResultSet res = null;
    try {
      conn = this.getConnection();
      stat = conn.prepareStatement(LOAD_USER);
View Full Code Here

   * @return Either the User Object corresponding to the given parameters or
   *         null if there isn't any corresponding user.
   */
  public User loadUser(String userName, Map roles) {
    Connection conn = null;
    User user = null;
    PreparedStatement stat = null;
    ResultSet res = null;
    try {
      conn = this.getConnection();
      stat = conn.prepareStatement(LOAD_USER_FROM_USERNAME);
View Full Code Here

   * @return The populated user object.
   * @throws SQLException
   */
  protected User createUserFromRecord(ResultSet res, Map roles)
      throws SQLException {
    User user = null;
    while (res.next()) {
      if (user == null) {
        user = new User();
        user.setUserName(res.getString(1));
        user.setPassword(res.getString(2));
        String roleName = res.getString(3);
        Role role = (Role) roles.get(roleName);
        user.setName(res.getString(4));
          user.setSurname(res.getString(5));
          user.setStructureId(res.getInt(6));
          user.setEmail(res.getString(7));
          user.setRole(role);
      }
    }
    return user;
  }
View Full Code Here

  /**
   * @throws
   */
  public User getUser(String userName) throws SystemException {
    SystemUtils.getLogger().finest("Invocato");
    User user = null;
    try {
      Map roles = this.getRoleManager().getRoles();
      user = this.getUserDAO().loadUser(userName, roles);
    } catch (Throwable t) {
            throw new SystemException("Error in downloading user", t);
View Full Code Here

  /**
   * @throws
   */
  public User getUser(String userName, String password) throws SystemException {
    SystemUtils.getLogger().finest("Invocato");
    User user = null;
    try {
      Map roles = this.getRoleManager().getRoles();
      user = this.getUserDAO().loadUser(userName, password, roles);
    } catch (Throwable t) {
            throw new SystemException("Error in downloading user", t);
View Full Code Here

    List rolesWithPermission = this.getRoleManager().getRolesWithPermission(permissionName);
    for (int i=0; i<rolesWithPermission.size(); i++) {
      Role role = (Role) rolesWithPermission.get(i);
      List localUsers = this.getUsersWithRole(role.getName());
      for (int j=0; j<localUsers.size(); j++) {
        User user = (User) localUsers.get(j);
        usersMap.put(user.getUserName(), user);
      }
    }
  }
View Full Code Here

    try {
      List userNames = this.getUserDAO().loadUserNamesWithRole(rolename);
      users = new ArrayList<User>();
      for (int i=0; i<userNames.size(); i++) {
        String userName = (String) userNames.get(i);
        User user = this.getUser(userName);
        if (user != null) {
          users.add(user);
        }
      }
    } catch (Throwable t) {
View Full Code Here

    int days = Integer.parseInt(bookinginfo[4]);
    String customername = bookinginfo[5];
    String customersurname = bookinginfo[6];
    GregorianCalendar startdate = CalendarUtils.GetGregorianCalendarFromSms(date);
    GregorianCalendar finishdate = CalendarUtils.GetCalendarDaysAfter(startdate,days);
    User user = null;
    try {
      user = userManager.getUser(username, password);
      Booking booking = new Booking();
      booking.setBeginDate(startdate);
      booking.setFinishDate(finishdate);
      Structure structure = (Structure) structureManager.get(user.getStructureId());
      booking.setStructure(structure);
      Room roomToBook = roomManager.getRoomFromRoomNumber(user.getStructureId(), room);
      booking.setRoom(roomToBook);
      Customer customer = new Customer();
      customer.setName(customername);
      customer.setSurname(customersurname);
      customer.setStructure(structure);
View Full Code Here

TOP

Related Classes of it.hotel.model.user.User

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.