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
.Entity
;
13 import javax
.xml
.bind
.annotation
.XmlAccessType
;
14 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
15 import javax
.xml
.bind
.annotation
.XmlElement
;
16 import javax
.xml
.bind
.annotation
.XmlRootElement
;
17 import javax
.xml
.bind
.annotation
.XmlType
;
19 import org
.apache
.log4j
.Logger
;
20 import org
.hibernate
.annotations
.NaturalId
;
21 import org
.springframework
.security
.core
.GrantedAuthority
;
23 @XmlAccessorType(XmlAccessType
.FIELD
)
24 @XmlType(name
= "GrantedAuthority", propOrder
= { "authority" })
25 @XmlRootElement(name
= "Group")
27 public class GrantedAuthorityImpl
extends CdmBase
implements GrantedAuthority
{
29 private static final long serialVersionUID
= 2651969425860655040L;
30 private static final Logger logger
= Logger
31 .getLogger(GrantedAuthority
.class);
33 @XmlElement(name
= "Authority")
35 private String authority
;
37 protected GrantedAuthorityImpl() {
41 public static GrantedAuthorityImpl
NewInstance() {
42 return new GrantedAuthorityImpl();
46 * @see org.springframework.security.core.GrantedAuthority#getAuthority()
49 public String
getAuthority() {
53 public void setAuthority(String authority
) {
54 this.authority
= authority
;
61 public int compareTo(Object o
) {
62 if (o
instanceof GrantedAuthority
) {
63 return this.authority
.compareTo(((GrantedAuthority
) o
).getAuthority());
69 public boolean equals(Object o
) {
70 if (o
instanceof GrantedAuthority
) {
71 if(this.authority
== null && ((GrantedAuthority
) o
).getAuthority() == null) {
74 return this.authority
.equals(((GrantedAuthority
) o
).getAuthority());
81 * @see eu.etaxonomy.cdm.model.common.CdmBase#toString()
84 public String
toString() {
85 return getAuthority();
88 // *********** CLONE **********************************/
91 * Clones <i>this</i> Granted Authority. This is a shortcut that enables to
92 * create a new instance that differs only slightly from <i>this</i> Granted
93 * Authority by modifying only some of the attributes.<BR>
97 * @see eu.etaxonomy.cdm.model.common.CdmBase#clone()
98 * @see java.lang.Object#clone()
101 public Object
clone() {
102 GrantedAuthority result
;
104 result
= (GrantedAuthority
) super.clone();
105 // no changes to authority
107 } catch (CloneNotSupportedException e
) {
108 logger
.warn("Object does not implement cloneable");