Advertisement
andersonalmada2

Untitled

Aug 5th, 2022
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. package br.ufc.mandacaru5.model;
  2.  
  3. import javax.persistence.Column;
  4. import javax.persistence.Entity;
  5. import javax.persistence.GeneratedValue;
  6. import javax.persistence.GenerationType;
  7. import javax.persistence.Id;
  8. import javax.persistence.SequenceGenerator;
  9.  
  10. import org.springframework.security.core.GrantedAuthority;
  11.  
  12. @Entity
  13. public class Role implements GrantedAuthority {
  14.  
  15.     @Id
  16.     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "role_generator")
  17.     @SequenceGenerator(name="role_generator", sequenceName = "role_seq", allocationSize=1)
  18.     private int id;
  19.     @Column(nullable = false, unique = true)
  20.     private String name;
  21.    
  22.     @Override
  23.     public String getAuthority() {
  24.         return name;
  25.     }
  26.  
  27.     public int getId() {
  28.         return id;
  29.     }
  30.  
  31.     public void setId(int id) {
  32.         this.id = id;
  33.     }
  34.  
  35.     public String getName() {
  36.         return name;
  37.     }
  38.  
  39.     public void setName(String name) {
  40.         this.name = name;
  41.     }
  42.  
  43.     @Override
  44.     public String toString() {
  45.         return "Role [id=" + id + ", name=" + name + "]";
  46.     }
  47.    
  48.    
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement