Package beans

Examples of beans.User


        * it calls this method, which resets the string buffer
        */
       public void startElement(String uri, String localName,String qName, Attributes attributes) throws SAXException {
              temp = "";
              if (qName.equalsIgnoreCase("Object")) {
                     this.u = new User();
              }
       }
View Full Code Here


    @Override
    public boolean fetchdata(Login login, javax.swing.JTextField username,javax.swing.JPasswordField password) {   

            boolean flag=false;
            User u = new User();

            String data = new RestClient().apacheHttpClientGet(Login.url+"api/reservation/auth/user/?format=json", username.getText(), password.getPassword());
            if( data!=null) {
                try {
                    u.setUsername(username.getText());
                    u.setPassword(password.getPassword());
                    login.setUsers_map(new HashMap());
                    JSONObject jsonObject = (JSONObject) new JSONParser().parse(data);
                    for (Object c : (JSONArray) jsonObject.get("objects")){
                        jsonObject = (JSONObject) c;
                        User remoteuser = new User(Integer.parseInt((String)jsonObject.get("id")),(String) jsonObject.get("username"));               
                        login.getUsers_map().put(remoteuser.getUsername(), remoteuser);
                    }
                } catch (ParseException ex) {
                    Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
                }
                flag = true;
            }
            else {        
                flag=false;
            }

            User temp = (User) login.getUsers_map().get(u.getUsername());
            if (temp!=null){
                u=temp;
                u.setPassword(password.getPassword());
            }
           
View Full Code Here

    @Override
    public boolean fetchdata(Login login, JTextField username, JPasswordField password) {

        boolean flag=false;
        User u = new User();
        UsersHandler usersHandler=null;
        String data = new RestClient().apacheHttpClientGet(Login.url+"api/reservation/auth/user/?format=xml", username.getText(), password.getPassword());
        if( data!=null) {
            u.setUsername(username.getText());
            u.setPassword(password.getPassword());
            usersHandler = new UsersHandler(login, data, u);       
            flag = true;
        }
        else {        
            flag=false;
        }

        for (int i=0 ; i<usersHandler.getUsers().size();i++){
            User utemp = (User) usersHandler.getUsers().get(i);
           
            if (utemp.getUsername().equalsIgnoreCase(username.getText())){
                u=utemp;
                u.setPassword(password.getPassword());
                break;
            }
        }
View Full Code Here

   * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    System.out.println(request.getParameter("num"));
    System.out.println(request.getParameter("rate"));
    User user =(User)request.getSession().getAttribute("user");
    System.out.println(user.getLogin());
   
    GameDAOInterface game = new JDBCGameDAO();
    float rate=0;
    try{
      rate=game.voteForGame(user.getLogin(), Integer.parseInt(request.getParameter("num")), Integer.parseInt(request.getParameter("rate")));
    }catch(Exception e){
      System.out.println(e.getMessage());
    }
    System.out.println(rate);
    String content = ""+rate;
View Full Code Here

   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
   
    JDBCUserDAO userDAO = new JDBCUserDAO();
    if(userDAO.checkIfExistAndValidate(request.getParameter("login"), request.getParameter("pwd"))){
      User user =userDAO.getUser(request.getParameter("login"));
      request.getSession().setAttribute("user",user);
      if(user.getDateFinAbonnementFormatDate()!=null){
        if(user.getDateFinAbonnementFormatDate().compareTo(new Date()) > 0){
          request.getSession().setAttribute("allowed","true");
        }
      }
      response.sendRedirect(response.encodeURL("index.jsp"));
      return;
View Full Code Here

  /**
   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    UserDAOInterface userDAO = new JDBCUserDAO();
    User user=(User)request.getSession().getAttribute("user");
    boolean verifie=userDAO.codeVerification(user, request.getParameter("code"));
    System.out.println("verifie"+verifie);
    if( verifie){
      request.getSession().setAttribute("allowed","true");
    }
View Full Code Here

   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    SendMail t = new SendMail();
    UserDAOInterface userDAO = new JDBCUserDAO();
    User user=(User)request.getSession().getAttribute("user");
    String code =userDAO.createAbonnement(user.getLogin(),request.getParameter("duree"));
    try {
      String content="Merci de vous �tres abonn�s sur notre site de jeux en ligne" +
          "<br>"+user.getLogin()+"Voici votre code d'acc�s pour "+request.getParameter("duree")+" mois de fun !  :" +
          "<br> Code :"+code;
         
      t.run(request,"Souscription � un abonnement de "+request.getParameter("duree")+" mois",content,user.getEmail());
    } catch (MessagingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

View Full Code Here

  }

  @Override
  public User getUser(String login) {
    Connection con=null;
    User user=null;
    try{
      con= getDataSource().getConnection();
      user=new User();
      PreparedStatement pstmt = con.prepareStatement("select date_fin_abonnement, email,administrateur,news_letter from UTILISATEUR where login=?");
      pstmt.setString(1, login);
      ResultSet res =pstmt.executeQuery();
      if(res.next()){
        user.setLogin(login);
        user.setDateFinAbonnement(res.getDate(1));
        user.setEmail(res.getString(2));
        user.setAdministrateur(res.getInt(3));
        user.setNewsLetter(res.getInt(4));
        return user;
       
      }
    }catch(Exception e){
      System.out.println("probleme de connection");
View Full Code Here

TOP

Related Classes of beans.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.