| 1 package org.appfuse.model; 2 3 import java.io.Serializable ; 4 5 import org.acegisecurity.GrantedAuthority; 6 import org.apache.commons.lang.builder.ToStringBuilder; 7 import org.apache.commons.lang.builder.ToStringStyle; 8 9 22 public class Role extends BaseObject implements Serializable , GrantedAuthority { 23 private static final long serialVersionUID = 3690197650654049848L; 24 private Long id; 25 private String name; 26 private String description; 27 28 public Role() {} 29 30 public Role(String name) { 31 this.name = name; 32 } 33 34 37 public Long getId() { 38 return id; 39 } 40 41 44 public String getAuthority() { 45 return getName(); 46 } 47 48 51 public String getName() { 52 return this.name; 53 } 54 55 58 public String getDescription() { 59 return this.description; 60 } 61 62 public void setId(Long id) { 63 this.id = id; 64 } 65 66 public void setName(String name) { 67 this.name = name; 68 } 69 70 public void setDescription(String description) { 71 this.description = description; 72 } 73 74 public boolean equals(Object o) { 75 if (this == o) return true; 76 if (!(o instanceof Role)) return false; 77 78 final Role role = (Role) o; 79 80 return !(name != null ? !name.equals(role.name) : role.name != null); 81 82 } 83 84 public int hashCode() { 85 return (name != null ? name.hashCode() : 0); 86 } 87 88 public String toString() { 89 return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE) 90 .append(this.name) 91 .toString(); 92 } 93 94 } 95 | Popular Tags |