View Javadoc
1   package org.oxerr.commons.user.domain;
2   
3   import javax.persistence.Access;
4   import javax.persistence.AccessType;
5   import javax.persistence.Cacheable;
6   import javax.persistence.Column;
7   import javax.persistence.Entity;
8   import javax.persistence.Table;
9   import javax.persistence.UniqueConstraint;
10  
11  @Entity
12  @Cacheable
13  @Access(AccessType.PROPERTY)
14  @Table(
15  	name = "\"role\"",
16  	uniqueConstraints = {
17  		@UniqueConstraint(
18  			name = "uk_role_name",
19  			columnNames = "name"
20  		),
21  	}
22  )
23  public class Role extends BaseEntity {
24  
25  	private static final long serialVersionUID = 2019062401L;
26  
27  	public static final String USER = "USER";
28  	public static final String ADMIN = "ADMIN";
29  
30  	private static final String ROLE_PREFIX = "ROLE_";
31  
32  	public static final String ROLE_USER = ROLE_PREFIX + USER;
33  	public static final String ROLE_ADMIN = ROLE_PREFIX + ADMIN;
34  
35  	private String name;
36  
37  	public Role() {
38  	}
39  
40  	public Role(String name) {
41  		this.name = name;
42  	}
43  
44  	@Column(nullable = false, length = 32)
45  	public String getName() {
46  		return name;
47  	}
48  
49  	public void setName(String name) {
50  		this.name = name;
51  	}
52  
53  }