Commit 9fe3835f by Juho Juopperi

OrgRole to Role mapping

1 parent 4109b346
...@@ -9,6 +9,7 @@ import javax.persistence.JoinColumn; ...@@ -9,6 +9,7 @@ import javax.persistence.JoinColumn;
import javax.persistence.JoinTable; import javax.persistence.JoinTable;
import javax.persistence.ManyToMany; import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
...@@ -49,6 +50,9 @@ public class OrgRole extends GenericEntity { ...@@ -49,6 +50,9 @@ public class OrgRole extends GenericEntity {
@Column(nullable = false) @Column(nullable = false)
@ManyToOne() @ManyToOne()
private EventOrganiser eventOrganizer; private EventOrganiser eventOrganizer;
@OneToMany
private List<Role> eventRoles;
public OrgRole() { public OrgRole() {
super(); super();
...@@ -94,4 +98,12 @@ public class OrgRole extends GenericEntity { ...@@ -94,4 +98,12 @@ public class OrgRole extends GenericEntity {
this.eventOrganizer = eventOrganizer; this.eventOrganizer = eventOrganizer;
} }
public List<Role> getEventRoles() {
return eventRoles;
}
public void setEventRoles(List<Role> eventRoles) {
this.eventRoles = eventRoles;
}
} }
...@@ -31,6 +31,8 @@ public class Role extends GenericEntity { ...@@ -31,6 +31,8 @@ public class Role extends GenericEntity {
protected static final String NAME_COLUMN = "role_name"; protected static final String NAME_COLUMN = "role_name";
protected static final String EVENT_ID_COLUMN = "event_id"; 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("----"); public static final Role EMPTY_ROLE = new Role("----");
...@@ -74,6 +76,10 @@ public class Role extends GenericEntity { ...@@ -74,6 +76,10 @@ public class Role extends GenericEntity {
@ManyToOne @ManyToOne
@JoinColumn(name = EVENT_ID_COLUMN, nullable = false) @JoinColumn(name = EVENT_ID_COLUMN, nullable = false)
private LanEvent event; private LanEvent event;
@ManyToOne
@JoinColumn(name = ORG_ROLE_ID_COLUMN)
private OrgRole orgRole;
public Role() { public Role() {
super(); super();
...@@ -190,4 +196,12 @@ public class Role extends GenericEntity { ...@@ -190,4 +196,12 @@ public class Role extends GenericEntity {
this.users = users; 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!