Package cpe.hapa.model

Examples of cpe.hapa.model.User


    return totalActiveSessions;
  }
 
  public static void addSession(Key key) throws NumberFormatException, ParseException, EntityNotFoundException {
    if(!properties.containsKey(key)) {
      User user = UserDAO.getByKey(key);
      if(user != null) {
        user.setDateConnexion(new Date());
        UserDAO.update(user);
        totalActiveSessions++;
        System.out.println("Session créée");
      } else {
        return;
View Full Code Here


   
    long lastConnectionTime;
    long currentTime = new Date().getTime();
    long sessionTime;
   
    User user = UserDAO.getByKey(key);
    if(user != null) {
      lastConnectionTime = user.getDateConnexion().getTime();
      sessionTime = (long) ((currentTime - lastConnectionTime)/1000);
      user.setDureeConnexion(sessionTime);
      UserDAO.update(user);
      properties.remove(key);
      totalActiveSessions--;
      System.out.println("Session de "+ user.getLogin() + " détruite");
    }
  }
View Full Code Here

    }
    return createModel(e);
  }
 
  public static User getByKey(Key userKey) throws NumberFormatException, ParseException {
    User user = null;
   
    if(userKey!=null) {
      try {
        DatastoreService datastore = DatastoreSingleton.getInstance();
        Entity entity = datastore.get(userKey);
View Full Code Here

    Query q = new Query("User");
    return datastore.prepare(q).countEntities(withDefaults());
  }
 
  protected static User createModel(Entity entity) throws NumberFormatException, ParseException {
    return new User(
      entity.getKey(),
      String.valueOf(entity.getProperty("nom")),
      String.valueOf(entity.getProperty("prenom")),
      new SimpleDateFormat("yyyy-MM-dd").parse(String.valueOf(entity.getProperty("dateNaissance"))),
      String.valueOf(entity.getProperty("email")),
View Full Code Here

TOP

Related Classes of cpe.hapa.model.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.