Refactored User / Group / Granted Authority + Auditing properties (#630)
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / common / GrantedAuthorityImpl.java
1 package eu.etaxonomy.cdm.model.common;
2
3 import javax.persistence.Entity;
4 import javax.xml.bind.annotation.XmlAccessType;
5 import javax.xml.bind.annotation.XmlAccessorType;
6 import javax.xml.bind.annotation.XmlElement;
7 import javax.xml.bind.annotation.XmlRootElement;
8 import javax.xml.bind.annotation.XmlType;
9
10 import org.hibernate.annotations.NaturalId;
11 import org.springframework.security.GrantedAuthority;
12
13 @XmlAccessorType(XmlAccessType.FIELD)
14 @XmlType(name = "GrantedAuthority", propOrder = {
15 "authority"
16 })
17 @XmlRootElement(name = "Group")
18 @Entity
19 public class GrantedAuthorityImpl extends CdmBase implements GrantedAuthority {
20
21 /**
22 *
23 */
24 private static final long serialVersionUID = 2651969425860655040L;
25
26 @XmlElement(name = "Authority")
27 @NaturalId
28 private String authority;
29
30 public String getAuthority() {
31 return authority;
32 }
33
34 public void setAuthority(String authority) {
35 this.authority = authority;
36 }
37
38 public int compareTo(Object o) {
39 if(o instanceof GrantedAuthority) {
40 return this.authority.compareTo(((GrantedAuthority)o).getAuthority());
41 }
42 return 0;
43 }
44 }