package br.edu.ufcg.computacao.si1.model;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.UserDetails;

import javax.persistence.*;
import java.util.Collection;
import java.util.LinkedList;

@Entity(name = "Usuario")
@Table(name = "tb_usuario")
public class Usuario extends org.springframework.security.core.userdetails.User{
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    @Column
    private String nome;
    @Column(unique = true)
    private String email;
    @Column
    private String senha;
    @Column
    private String role;

    public Usuario() {
        super("default", "default", AuthorityUtils.createAuthorityList("USER"));
    }

    public Usuario(String nome, String email, String senha, String role) {

        super(email, senha, AuthorityUtils.createAuthorityList(role));

        this.nome = nome;
        this.email = email;
        this.senha = senha;
        this.role = role;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getN() {
        return nome;
    }

    public void setN(String n) {
        this.nome = n;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getSenha() {
        return senha;
    }

    public void setSenha(String senha) {
        this.senha = senha;
    }

    public String getR() {
        return role;
    }

    public void setR(String r) {
        this.role = r;
    }

}

@@ -81,244 +81,61 @@
 ore.
-GrantedAuthority;%0Aimport org.springframework.security.core.authority.AuthorityUtils;%0Aimport org.springframework.security.core.userdetails.UserDetails;%0A%0Aimport javax.persistence.*;%0Aimport java.util.Collection;%0Aimport java.util.LinkedList
+authority.AuthorityUtils;%0A%0Aimport javax.persistence.*
 ;%0A%0A@
@@ -1025,16 +1025,19 @@
 ing getN
+ome
 () %7B%0A   
@@ -1081,16 +1081,19 @@
 oid setN
+ome
 (String 
@@ -1093,16 +1093,19 @@
 String n
+ome
 ) %7B%0A    
@@ -1121,16 +1121,19 @@
 nome = n
+ome
 ;%0A    %7D%0A
@@ -1427,16 +1427,19 @@
 ing getR
+ole
 () %7B%0A   
@@ -1483,16 +1483,19 @@
 oid setR
+ole
 (String 
@@ -1495,16 +1495,19 @@
 String r
+ole
 ) %7B%0A    
@@ -1523,19 +1523,22 @@
 role = r
+ole
 ;%0A    %7D%0A
 %0A%7D%0A
@@ -1534,11 +1534,10 @@
 ;%0A    %7D%0A
-%0A
 %7D%0A

ajuste simples da classe Usuario