Advertisement
sorenslothe

SessionModel

Apr 14th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. package domain;
  2.  
  3. import dk.au.hum.imv.persistence.db.DatabasePersistent;
  4.  
  5. public class SessionModel {
  6.    
  7.     private long userId = DatabasePersistent.NOT_IN_DB_ID_VALUE;
  8.    
  9.     public SessionModel() {
  10.        
  11.     }
  12.    
  13.     public void login(long userId) {
  14.         this.userId = userId;
  15.     }
  16.    
  17.     public void logout() {
  18.         this.userId = DatabasePersistent.NOT_IN_DB_ID_VALUE;
  19.     }
  20.    
  21.     public boolean isLoggedIn() {
  22.         return (userId != DatabasePersistent.NOT_IN_DB_ID_VALUE);
  23.     }
  24.    
  25.     public long getUserId() {
  26.         return userId;
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement