1 22 43 package org.jboss.test.hibernate.model; 44 45 import java.io.Serializable ; 46 import java.util.ArrayList ; 47 import java.util.Calendar ; 48 import java.util.List ; 49 50 53 public class Role implements Serializable { 54 private Long id; 55 private String name; 56 private String description; 57 private Calendar timeOfCreation; 58 private List users= new ArrayList (); 59 public String getDescription() { 60 return description; 61 } 62 63 public void setDescription(String description) { 64 this.description = description; 65 } 66 67 public Long getId() { 68 return id; 69 } 70 71 private void setId(Long id) { 72 this.id = id; 73 } 74 75 public String getName() { 76 return name; 77 } 78 79 public void setName(String name) { 80 this.name = name; 81 } 82 83 public List getUsers() { 84 return users; 85 } 86 87 private void setUsers(List users) { 88 this.users = users; 89 } 90 91 public void addUser(User user) { 92 users.add(user); 93 user.getRoles().add(this); 94 } 95 96 public Calendar getTimeOfCreation() { 97 return timeOfCreation; 98 } 99 100 public void setTimeOfCreation(Calendar timeOfCreation) { 101 this.timeOfCreation = timeOfCreation; 102 } 103 104 109 public boolean equals(Object other) { 110 if (other==null) return false; 111 if ( !(other instanceof Role) ) return false; 112 return ( (Role) other ).getName().equals(name); 113 } 114 115 public int hashCode() { 116 return name.hashCode(); 117 } 118 119 } 120 121 | Popular Tags |