|
|
|
@ -4,6 +4,7 @@ import java.io.Serializable; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.Collection; |
|
|
|
|
|
|
|
import java.util.Collections; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
|
@ -58,21 +59,25 @@ public class Person extends BaseEntity implements Serializable { |
|
|
|
|
|
|
|
|
|
|
|
// bi-directional many-to-one association to Adress
|
|
|
|
// bi-directional many-to-one association to Adress
|
|
|
|
@OneToMany(mappedBy = "person", cascade = { CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, |
|
|
|
@OneToMany(mappedBy = "person", cascade = { CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, |
|
|
|
|
|
|
|
CascadeType.REMOVE, |
|
|
|
CascadeType.REFRESH }) |
|
|
|
CascadeType.REFRESH }) |
|
|
|
private List<Adress> adresses; |
|
|
|
private List<Adress> adresses; |
|
|
|
|
|
|
|
|
|
|
|
// bi-directional many-to-one association to Attendance
|
|
|
|
// bi-directional many-to-one association to Attendance
|
|
|
|
@OneToMany(mappedBy = "person", cascade = { CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, |
|
|
|
@OneToMany(mappedBy = "person", cascade = { CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, |
|
|
|
|
|
|
|
CascadeType.REMOVE, |
|
|
|
CascadeType.REFRESH }) |
|
|
|
CascadeType.REFRESH }) |
|
|
|
private List<Attendance> attendances; |
|
|
|
private List<Attendance> attendances; |
|
|
|
|
|
|
|
|
|
|
|
// bi-directional many-to-one association to Contact
|
|
|
|
// bi-directional many-to-one association to Contact
|
|
|
|
@OneToMany(mappedBy = "person", cascade = { CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, |
|
|
|
@OneToMany(mappedBy = "person", cascade = { CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, |
|
|
|
|
|
|
|
CascadeType.REMOVE, |
|
|
|
CascadeType.REFRESH }) |
|
|
|
CascadeType.REFRESH }) |
|
|
|
private List<Contact> contacts; |
|
|
|
private List<Contact> contacts; |
|
|
|
|
|
|
|
|
|
|
|
// bi-directional many-to-many association to Persongroup
|
|
|
|
// bi-directional many-to-many association to Persongroup
|
|
|
|
@ManyToMany(targetEntity = GroupDef.class, fetch = FetchType.EAGER, cascade = { CascadeType.REFRESH }) |
|
|
|
@ManyToMany(targetEntity = GroupDef.class, fetch = FetchType.EAGER, cascade = { CascadeType.MERGE, |
|
|
|
|
|
|
|
CascadeType.REFRESH }) |
|
|
|
@JoinTable(name = "persongroup", joinColumns = { @JoinColumn(name = "person_id") }, inverseJoinColumns = { |
|
|
|
@JoinTable(name = "persongroup", joinColumns = { @JoinColumn(name = "person_id") }, inverseJoinColumns = { |
|
|
|
@JoinColumn(name = "group_id") }) |
|
|
|
@JoinColumn(name = "group_id") }) |
|
|
|
private Set<GroupDef> groups; |
|
|
|
private Set<GroupDef> groups; |
|
|
|
@ -113,6 +118,12 @@ public class Person extends BaseEntity implements Serializable { |
|
|
|
this.groups.add(group); |
|
|
|
this.groups.add(group); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void remove(GroupDef g) { |
|
|
|
|
|
|
|
if (this.groups != null) { |
|
|
|
|
|
|
|
this.groups.remove(g); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void add(ClubEvent ev) { |
|
|
|
public void add(ClubEvent ev) { |
|
|
|
if (this.events == null) { |
|
|
|
if (this.events == null) { |
|
|
|
this.events = new HashSet<>(); |
|
|
|
this.events = new HashSet<>(); |
|
|
|
@ -173,6 +184,9 @@ public class Person extends BaseEntity implements Serializable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<Adress> getAdresses() { |
|
|
|
public List<Adress> getAdresses() { |
|
|
|
|
|
|
|
if (adresses == null) { |
|
|
|
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
|
|
|
} |
|
|
|
return adresses; |
|
|
|
return adresses; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -181,6 +195,9 @@ public class Person extends BaseEntity implements Serializable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<Attendance> getAttendances() { |
|
|
|
public List<Attendance> getAttendances() { |
|
|
|
|
|
|
|
if (attendances == null) { |
|
|
|
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
|
|
|
} |
|
|
|
return attendances; |
|
|
|
return attendances; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -189,6 +206,9 @@ public class Person extends BaseEntity implements Serializable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<Contact> getContacts() { |
|
|
|
public List<Contact> getContacts() { |
|
|
|
|
|
|
|
if (contacts == null) { |
|
|
|
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
|
|
|
} |
|
|
|
return contacts; |
|
|
|
return contacts; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -197,6 +217,9 @@ public class Person extends BaseEntity implements Serializable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Set<GroupDef> getGroups() { |
|
|
|
public Set<GroupDef> getGroups() { |
|
|
|
|
|
|
|
if (groups == null) { |
|
|
|
|
|
|
|
return Collections.emptySet(); |
|
|
|
|
|
|
|
} |
|
|
|
return groups; |
|
|
|
return groups; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -205,6 +228,9 @@ public class Person extends BaseEntity implements Serializable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<Relative> getRelatives1() { |
|
|
|
public List<Relative> getRelatives1() { |
|
|
|
|
|
|
|
if (relatives1 == null) { |
|
|
|
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
|
|
|
} |
|
|
|
return relatives1; |
|
|
|
return relatives1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -213,6 +239,9 @@ public class Person extends BaseEntity implements Serializable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<Relative> getRelatives2() { |
|
|
|
public List<Relative> getRelatives2() { |
|
|
|
|
|
|
|
if (relatives2 == null) { |
|
|
|
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
|
|
|
} |
|
|
|
return relatives2; |
|
|
|
return relatives2; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -221,6 +250,9 @@ public class Person extends BaseEntity implements Serializable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Set<ClubEvent> getEvents() { |
|
|
|
public Set<ClubEvent> getEvents() { |
|
|
|
|
|
|
|
if (events == null) { |
|
|
|
|
|
|
|
return Collections.emptySet(); |
|
|
|
|
|
|
|
} |
|
|
|
return events; |
|
|
|
return events; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -496,4 +528,21 @@ public class Person extends BaseEntity implements Serializable { |
|
|
|
return "Person [id=" + getId() + ", prename=" + prename + ", surname=" + surname + "]"; |
|
|
|
return "Person [id=" + getId() + ", prename=" + prename + ", surname=" + surname + "]"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean hasGroup(GroupDef g) { |
|
|
|
|
|
|
|
return groups != null && groups.contains(g); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean hasAnyGroup() { |
|
|
|
|
|
|
|
return groups != null && !groups.isEmpty(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean hasGroup(String value) { |
|
|
|
|
|
|
|
for (GroupDef g : groups) { |
|
|
|
|
|
|
|
if (g.getName().equalsIgnoreCase(value)) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|