Guest User

Untitled

a guest
Oct 11th, 2018
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.00 KB | None | 0 0
  1. package com.db.model;
  2.  
  3. import com.fasterxml.jackson.annotation.JsonIgnore;
  4. import org.hibernate.validator.constraints.Length;
  5.  
  6. import javax.persistence.*;
  7. import java.io.Serializable;
  8. import java.util.Collection;
  9. import java.util.List;
  10.  
  11. @Entity
  12. public class ApplicationUser {
  13.  
  14.     @Id
  15.     @GeneratedValue(strategy = GenerationType.AUTO)
  16.     public long id;
  17.  
  18.     private String username;
  19.  
  20.     private String firstName;
  21.  
  22.     private String lastName;
  23.  
  24. //    @JsonIgnore
  25.     @Length(min = 2, max = 60)
  26.     private String password;
  27.  
  28.     private Long tsRegistration;
  29.  
  30.     private Long tslLastLogin;
  31.  
  32.     private Long bonusCredit;
  33.  
  34.     private String nationality;
  35.  
  36.     private String battleTag;
  37.  
  38.     private Integer mmr;
  39.  
  40.     private boolean enabled;
  41.  
  42.     private boolean tokenExpired;
  43.  
  44.     private String nickname;
  45.  
  46.     @JsonIgnore
  47.     @ManyToMany
  48.     @JoinTable(
  49.             name = "users_roles",
  50.             joinColumns = @JoinColumn(
  51.                     name = "user_id", referencedColumnName = "id"),
  52.             inverseJoinColumns = @JoinColumn(
  53.                     name = "role_id", referencedColumnName = "id"))
  54.     private List<Role> roles;
  55.  
  56.  
  57.     public ApplicationUser() {
  58.  
  59.     }
  60.  
  61.     public ApplicationUser(String username, String firstName, String lastName, @Length(min = 2, max = 60) String password, String nationality, String battleTag, List<Role> roles, String nickname) {
  62.         this.username = username;
  63.         this.firstName = firstName;
  64.         this.lastName = lastName;
  65.         this.password = password;
  66.         this.nationality = nationality;
  67.         this.battleTag = battleTag;
  68.         this.roles = roles;
  69.         this.tslLastLogin = System.currentTimeMillis();
  70.         this.tsRegistration = System.currentTimeMillis();
  71.         this.mmr=0;
  72.         this.bonusCredit=0L;
  73.         this.nickname = nickname;
  74.  
  75.     }
  76.  
  77.     public long getId() {
  78.         return id;
  79.     }
  80.  
  81.     public String getUsername() {
  82.         return username;
  83.     }
  84.  
  85.     public void setUsername(String username) {
  86.         this.username = username;
  87.     }
  88.  
  89.     public String getPassword() {
  90.         return password;
  91.     }
  92.  
  93.     public void setPassword(String password) {
  94.         this.password = password;
  95.     }
  96.  
  97.     public Long getTsRegistration() {
  98.         return tsRegistration;
  99.     }
  100.  
  101.     public void setTsRegistration(Long tsRegistration) {
  102.         this.tsRegistration = tsRegistration;
  103.     }
  104.  
  105.     public Long getTslLastLogin() {
  106.         return tslLastLogin;
  107.     }
  108.  
  109.     public void setTslLastLogin(Long tslLastLogin) {
  110.         this.tslLastLogin = tslLastLogin;
  111.     }
  112.  
  113.     public Long getBonusCredit() {
  114.         return bonusCredit;
  115.     }
  116.  
  117.     public void setBonusCredit(Long bonusCredit) {
  118.         this.bonusCredit = bonusCredit;
  119.     }
  120.  
  121.     public boolean isEnabled() {
  122.         return enabled;
  123.     }
  124.  
  125.     public void setEnabled(boolean enabled) {
  126.         this.enabled = enabled;
  127.     }
  128.  
  129.     public boolean isTokenExpired() {
  130.         return tokenExpired;
  131.     }
  132.  
  133.     public void setTokenExpired(boolean tokenExpired) {
  134.         this.tokenExpired = tokenExpired;
  135.     }
  136.  
  137.  
  138.     public Collection<Role> getRoles() {
  139.         return roles;
  140.     }
  141.  
  142.     public void setRoles(List<Role> roles) {
  143.         this.roles = roles;
  144.     }
  145.  
  146.     public String getFirstName() {
  147.         return firstName;
  148.     }
  149.  
  150.     public void setFirstName(String firstName) {
  151.         this.firstName = firstName;
  152.     }
  153.  
  154.     public String getLastName() {
  155.         return lastName;
  156.     }
  157.  
  158.     public void setLastName(String lastName) {
  159.         this.lastName = lastName;
  160.     }
  161.  
  162.     public String getNationality() {
  163.         return nationality;
  164.     }
  165.  
  166.     public void setNationality(String nationality) {
  167.         this.nationality = nationality;
  168.     }
  169.  
  170.     public String getBattleTag() {
  171.         return battleTag;
  172.     }
  173.  
  174.     public void setBattleTag(String battleTag) {
  175.         this.battleTag = battleTag;
  176.     }
  177.  
  178.     public Integer getMmr() {
  179.         return mmr;
  180.     }
  181.  
  182.     public void setMmr(Integer mmr) {
  183.         this.mmr = mmr;
  184.     }
  185.  
  186.     public String getNickname() {
  187.         return nickname;
  188.     }
  189.  
  190.     public void setNickname(String nickname) {
  191.         this.nickname = nickname;
  192.     }
  193.  
  194.     @Override
  195.     public String toString() {
  196.         return "ApplicationUser{" +
  197.                 "id=" + id +
  198.                 ", username='" + username + '\'' +
  199.                 ", firstName='" + firstName + '\'' +
  200.                 ", lastName='" + lastName + '\'' +
  201.                 ", password='" + password + '\'' +
  202.                 ", tsRegistration=" + tsRegistration +
  203.                 ", tslLastLogin=" + tslLastLogin +
  204.                 ", bonusCredit=" + bonusCredit +
  205.                 ", nationality='" + nationality + '\'' +
  206.                 ", battleTag='" + battleTag + '\'' +
  207.                 ", mmr='" + mmr + '\'' +
  208.                 ", enabled=" + enabled +
  209.                 ", tokenExpired=" + tokenExpired +
  210.                 ", roles=" + roles +
  211.                 '}';
  212.     }
  213. }
Add Comment
Please, Sign In to add comment