2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.model
.common
;
12 import javax
.persistence
.Column
;
13 import javax
.persistence
.Entity
;
14 import javax
.validation
.constraints
.NotNull
;
15 import javax
.xml
.bind
.annotation
.XmlAccessType
;
16 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
17 import javax
.xml
.bind
.annotation
.XmlElement
;
18 import javax
.xml
.bind
.annotation
.XmlRootElement
;
19 import javax
.xml
.bind
.annotation
.XmlType
;
21 import org
.apache
.log4j
.Logger
;
22 import org
.springframework
.security
.core
.GrantedAuthority
;
24 @XmlAccessorType(XmlAccessType
.FIELD
)
25 @XmlType(name
= "GrantedAuthority", propOrder
= { "authority" })
26 @XmlRootElement(name
= "Group")
28 public class GrantedAuthorityImpl
extends CdmBase
implements GrantedAuthority
{
30 private static final long serialVersionUID
= 2651969425860655040L;
31 private static final Logger logger
= Logger
.getLogger(GrantedAuthority
.class);
33 @XmlElement(name
= "Authority")
34 @Column(unique
= true)
36 private String authority
;
38 protected GrantedAuthorityImpl() {
42 public static GrantedAuthorityImpl
NewInstance() {
43 return new GrantedAuthorityImpl();
47 public String
getAuthority() {
51 public void setAuthority(String authority
) {
52 this.authority
= authority
;
59 public int compareTo(Object o
) {
60 if (o
instanceof GrantedAuthority
) {
61 return this.authority
.compareTo(((GrantedAuthority
) o
).getAuthority());
67 public boolean equals(Object o
) {
68 if (o
instanceof GrantedAuthority
) {
69 if(this.authority
== null && ((GrantedAuthority
) o
).getAuthority() == null) {
72 return this.authority
.equals(((GrantedAuthority
) o
).getAuthority());
79 * @see eu.etaxonomy.cdm.model.common.CdmBase#toString()
82 public String
toString() {
83 return getAuthority();
86 // *********** CLONE **********************************/
89 * Clones <i>this</i> Granted Authority. This is a shortcut that enables to
90 * create a new instance that differs only slightly from <i>this</i> Granted
91 * Authority by modifying only some of the attributes.<BR>
95 * @see eu.etaxonomy.cdm.model.common.CdmBase#clone()
96 * @see java.lang.Object#clone()
99 public Object
clone() {
100 GrantedAuthority result
;
102 result
= (GrantedAuthority
) super.clone();
103 // no changes to authority
105 } catch (CloneNotSupportedException e
) {
106 logger
.warn("Object does not implement cloneable");