// Path: src/main/java/io/github/proxyprint/kitchen/models/User.java
// @Entity
// @Table(name = "users")
// @Inheritance(strategy = InheritanceType.JOINED)
// public abstract class User implements Serializable {
// 
//     public static enum Roles {
//         ROLE_USER, ROLE_EMPLOYEE, ROLE_MANAGER, ROLE_ADMIN
//     }
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     protected long id;
//     @Column(name = "username", nullable = false, unique = true)
//     protected String username;
//     @JsonIgnore
//     @Column(name = "password", nullable = false)
//     protected String password;
//     @ElementCollection(fetch = FetchType.EAGER)
//     @CollectionTable(
//             name = "roles",
//             joinColumns = @JoinColumn(name = "user_id")
//     )
//     @Cascade(CascadeType.ALL)
//     protected Set<String> roles;
// 
//     public User() {
//         this.roles = new HashSet<>();
//     }
// 
//     public User(String username, String password) {
//         this.username = username;
//         this.password = password;
//         this.roles = new HashSet<>();
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public void setUsername(String username) {
//         this.username = username;
//     }
// 
//     public String getPassword() {
//         return password;
//     }
// 
//     public void setPassword(String password) {
//         this.password = password;
//     }
// 
//     public long getId() {
//         return id;
//     }
// 
//     public void setId(long id) {
//         this.id = id;
//     }
// 
//     public Collection<GrantedAuthority> getRoles() {
//         List<GrantedAuthority> authorities = new LinkedList<>();
//         for (String a : roles) {
//             authorities.add(new SimpleGrantedAuthority(a));
//         }
//         return authorities;
//     }
// 
//     public Set<String> getRolesSet() { return this.roles; }
// 
//     protected void addRole(String role) {
//         this.roles.add(role);
//     }
// 
//     @Override
//     public String toString() {
//         return "User{" + "id=" + id + ", username=" + username + ", password=" + password + ", roles=" + roles + '}';
//     }
// 
// }


import io.github.proxyprint.kitchen.models.User;
import javax.persistence.*;
package io.github.proxyprint.kitchen.models.printshops;



/**
 * Created by daniel on 09-04-2016.
 */
@Entity
@Table(name = "employees")
public class Employee extends User {

    @Column(name = "name", nullable = false)
    private String name;
    @OneToOne(cascade = CascadeType.DETACH)
    @JoinColumn(name = "printshop_id")
    private PrintShop printShop;

    public Employee() {
        super.addRole(User.Roles.ROLE_EMPLOYEE.name());
    }

    public Employee(String username, String password, String name, PrintShop pshop) {
        super(username, password);
// Path: src/main/java/io/github/proxyprint/kitchen/models/User.java
// @Entity
// @Table(name = "users")
// @Inheritance(strategy = InheritanceType.JOINED)
// public abstract class User implements Serializable {
// 
//     public static enum Roles {
//         ROLE_USER, ROLE_EMPLOYEE, ROLE_MANAGER, ROLE_ADMIN
//     }
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     protected long id;
//     @Column(name = "username", nullable = false, unique = true)
//     protected String username;
//     @JsonIgnore
//     @Column(name = "password", nullable = false)
//     protected String password;
//     @ElementCollection(fetch = FetchType.EAGER)
//     @CollectionTable(
//             name = "roles",
//             joinColumns = @JoinColumn(name = "user_id")
//     )
//     @Cascade(CascadeType.ALL)
//     protected Set<String> roles;
// 
//     public User() {
//         this.roles = new HashSet<>();
//     }
// 
//     public User(String username, String password) {
//         this.username = username;
//         this.password = password;
//         this.roles = new HashSet<>();
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public void setUsername(String username) {
//         this.username = username;
//     }
// 
//     public String getPassword() {
//         return password;
//     }
// 
//     public void setPassword(String password) {
//         this.password = password;
//     }
// 
//     public long getId() {
//         return id;
//     }
// 
//     public void setId(long id) {
//         this.id = id;
//     }
// 
//     public Collection<GrantedAuthority> getRoles() {
//         List<GrantedAuthority> authorities = new LinkedList<>();
//         for (String a : roles) {
//             authorities.add(new SimpleGrantedAuthority(a));
//         }
//         return authorities;
//     }
// 
//     public Set<String> getRolesSet() { return this.roles; }
// 
//     protected void addRole(String role) {
//         this.roles.add(role);
//     }
// 
//     @Override
//     public String toString() {
//         return "User{" + "id=" + id + ", username=" + username + ", password=" + password + ", roles=" + roles + '}';
//     }
// 
// }


// Path: src/main/java/io/github/proxyprint/kitchen/models/printshops/Employee.java
import io.github.proxyprint.kitchen.models.User;
import javax.persistence.*;

package io.github.proxyprint.kitchen.models.printshops;



/**
 * Created by daniel on 09-04-2016.
 */
@Entity
@Table(name = "employees")
public class Employee extends User {

    @Column(name = "name", nullable = false)
    private String name;
    @OneToOne(cascade = CascadeType.DETACH)
    @JoinColumn(name = "printshop_id")
    private PrintShop printShop;

    public Employee() {
        super.addRole(User.Roles.ROLE_EMPLOYEE.name());
    }

    public Employee(String username, String password, String name, PrintShop pshop) {
        super(username, password);
        super.addRole(User.Roles.ROLE_EMPLOYEE.name());