Commit 9fe3835f by Juho Juopperi

OrgRole to Role mapping

1 parent 4109b346
......@@ -9,6 +9,7 @@ import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
......@@ -50,6 +51,9 @@ public class OrgRole extends GenericEntity {
@ManyToOne()
private EventOrganiser eventOrganizer;
@OneToMany
private List<Role> eventRoles;
public OrgRole() {
super();
}
......@@ -94,4 +98,12 @@ public class OrgRole extends GenericEntity {
this.eventOrganizer = eventOrganizer;
}
public List<Role> getEventRoles() {
return eventRoles;
}
public void setEventRoles(List<Role> eventRoles) {
this.eventRoles = eventRoles;
}
}
......@@ -32,6 +32,8 @@ public class Role extends GenericEntity {
protected static final String EVENT_ID_COLUMN = "event_id";
protected static final String ORG_ROLE_ID_COLUMN = "org_role_id";
public static final Role EMPTY_ROLE = new Role("----");
@Column(name = NAME_COLUMN, nullable = false)
......@@ -75,6 +77,10 @@ public class Role extends GenericEntity {
@JoinColumn(name = EVENT_ID_COLUMN, nullable = false)
private LanEvent event;
@ManyToOne
@JoinColumn(name = ORG_ROLE_ID_COLUMN)
private OrgRole orgRole;
public Role() {
super();
}
......@@ -190,4 +196,12 @@ public class Role extends GenericEntity {
this.users = users;
}
public OrgRole getOrgRole() {
return orgRole;
}
public void setOrgRole(OrgRole orgRole) {
this.orgRole = orgRole;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!