Esempio n. 1
0
 @Override
 public boolean equals(Object obj) {
   if (!(obj instanceof TappUser)) {
     return false;
   }
   if (this == obj) {
     return true;
   }
   TappUser other = (TappUser) obj;
   return new EqualsBuilder().append(getId(), other.getId()).isEquals();
 }
 /**
  * get current user via spring security framework
  *
  * @return n/a
  */
 public static TappUser getCurrentUser() {
   if (SecurityContextHolder.getContext().getAuthentication() == null) {
     return null;
   }
   if (SecurityContextHolder.getContext().getAuthentication().getPrincipal() instanceof TappUser) {
     TappUser userInfo =
         (TappUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
     userInfo = tappUserService.loadUserByUsername(userInfo.getUsername());
     return userInfo;
   }
   return null;
 }