1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
| @Entity
@Table(name = "PERSONNES")
@Access(AccessType.FIELD)
public class Personne implements Serializable, Comparable<Personne> {
private static final long serialVersionUID = -8863656538935308776L;
public static final int NAME_MAX_LENGTH = 50;
public static final int EMAIL_MAX_LENGTH = 120;
public static final int ADDRESS_MAX_LENGTH = 120;
public static final int PHONE_MAX_LENGTH = 10;
public static final int POSTAL_CODE_MAX_LENGTH = 4;
public static final int MEMBER_NUMBER_MAX_LENGTH = 4;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PERSONNES_SEQ")
@SequenceGenerator(name = "PERSONNES_SEQ", sequenceName = "PERSONNES_SEQ")
@Column(name = "PERSONNE_ID")
private long personneId;
@Column(name = "NOM", length = Personne.NAME_MAX_LENGTH)
private String name;
@Column(name = "PRENOM", length = Personne.NAME_MAX_LENGTH)
private String firstname;
@Column(name = "ADRESSE", length = Personne.ADDRESS_MAX_LENGTH)
private String address;
@Column(name = "CODE_POSTAL", length = Personne.POSTAL_CODE_MAX_LENGTH)
private String postalCode;
@Column(name = "VILLE")
private String city;
@Column(name = "DATE_NAISSANCE")
@Temporal(TemporalType.DATE)
private Date birthdate;
@Column(name = "EMAIL", length = Personne.EMAIL_MAX_LENGTH)
private String email;
@Column(name = "GSM", length = Personne.PHONE_MAX_LENGTH)
private String mobilePhone;
@Column(name = "TELEPHONE", length = Personne.PHONE_MAX_LENGTH)
private String phone;
@Column(name = "VALIDITE_CARTE_IDENTITE")
@Temporal(TemporalType.DATE)
private Date passportValidity;
@Column(name = "CARTE_IDENTITE")
private String identityCardNumber;
@OneToMany(mappedBy = "personne")
private List<Abonnement> abonnementList;
@OneToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST }, orphanRemoval = true)
private List<Benevolat> benevolatList;
@OneToMany(mappedBy = "personne", cascade = CascadeType.ALL)
private List<PersonneCotisation> personnesCotisations;
@Column(name = "NUMERO_MEMBRE")
private long memberNumber;
@Column(name = "ETUDIANT")
private Boolean student;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "personne")
private Collection<PersonnesMatch> personnesMatchCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "personne")
private Collection<CommandePlace> commandePlaceCollection;
public long getPersonneId() {
return this.personneId;
}
public void setPersonneId(final long personneId) {
this.personneId = personneId;
}
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
public String getFirstname() {
return this.firstname;
}
public void setFirstname(final String firstname) {
this.firstname = firstname;
}
public String getAddress() {
return this.address;
}
public void setAddress(final String address) {
this.address = address;
}
public String getPostalCode() {
return this.postalCode;
}
public void setPostalCode(final String postalCode) {
this.postalCode = postalCode;
}
public String getCity() {
return this.city;
}
public void setCity(final String city) {
this.city = city;
}
public Date getBirthdate() {
return this.birthdate;
}
public void setBirthdate(final Date birthdate) {
this.birthdate = birthdate;
}
public String getEmail() {
return this.email;
}
public void setEmail(final String email) {
this.email = email;
}
public Boolean getStudent() {
return this.student;
}
public void setStudent(final Boolean student) {
this.student = student;
}
public String getMobilePhone() {
return this.mobilePhone;
}
public void setMobilePhone(final String mobilePhone) {
this.mobilePhone = mobilePhone;
}
public String getPhone() {
return this.phone;
}
public void setPhone(final String phone) {
this.phone = phone;
}
public Date getPassportValidity() {
return this.passportValidity;
}
public void setPassportValidity(final Date passportValidity) {
this.passportValidity = passportValidity;
}
public String getIdentityCardNumber() {
return this.identityCardNumber;
}
public void setIdentityCardNumber(final String identityCardNumber) {
this.identityCardNumber = identityCardNumber;
}
public long getMemberNumber() {
return this.memberNumber;
}
public void setMemberNumber(final long memberNumber) {
this.memberNumber = memberNumber;
}
public List<Abonnement> getAbonnementList() {
return this.abonnementList;
}
public void setAbonnementList(final List<Abonnement> abonnementList) {
this.abonnementList = abonnementList;
}
public List<Benevolat> getBenevolatList() {
return this.benevolatList;
}
public void setBenevolatList(final List<Benevolat> benevolatList) {
this.benevolatList = benevolatList;
}
public List<PersonneCotisation> getPersonnesCotisations() {
return this.personnesCotisations;
}
public void setPersonnesCotisations(
final List<PersonneCotisation> personnesCotisations) {
this.personnesCotisations = personnesCotisations;
}
@Override
public int compareTo(final Personne otherPerson) {
long memberNumber1 = this.getMemberNumber();
long memberNumber2 = otherPerson.getMemberNumber();
return (memberNumber1 < memberNumber2 ? -1
: (memberNumber1 == memberNumber2 ? 0 : 1));
}
public Personne() {
}
public Collection<PersonnesMatch> getPersonnesMatchCollection() {
return this.personnesMatchCollection;
}
public void setPersonnesMatchCollection(
final Collection<PersonnesMatch> personnesMatchCollection) {
this.personnesMatchCollection = personnesMatchCollection;
}
public Collection<CommandePlace> getCommandePlaceCollection() {
return this.commandePlaceCollection;
}
public void setCommandePlaceCollection(
final Collection<CommandePlace> commandePlaceCollection) {
this.commandePlaceCollection = commandePlaceCollection;
}
} |
Partager