Compare commits

..

No commits in common. "3b31fa794fc0f87329e2eaed36dc0dcb0a806003" and "2f2a72bfa0b4f74ca45b17b79150b171160f8764" have entirely different histories.

5 changed files with 47 additions and 64 deletions

View File

@ -8,17 +8,15 @@ public class CursusCourse {
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private int id; private int id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Cursus") @JoinColumn(name = "Cursus")
private Cursus cursus; private int cursusId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Course") @JoinColumn(name = "Course")
private Course course; private int courseId;
public CursusCourse(Cursus cursus, Course course){ public CursusCourse(int cursusId, int courseId){
this.cursus = cursus; this.cursusId = cursusId;
this.course = course; this.courseId = courseId;
} }
public CursusCourse() {} public CursusCourse() {}
@ -27,19 +25,19 @@ public class CursusCourse {
return id; return id;
} }
public Course getCourse() { public int getCourseId() {
return course; return courseId;
} }
public void setCourse(Course course){ public void setCourseId(int courseId){
this.course = course; this.courseId = courseId;
} }
public Cursus getCursus() { public int getCursusId() {
return cursus; return cursusId;
} }
public void setCursus(Cursus cursus) { public void setCursusId(int cursusId) {
this.cursus = cursus; this.cursusId = cursusId;
} }
} }

View File

@ -8,13 +8,12 @@ public class Secretary {
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private int id; private int id;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Users") @JoinColumn(name = "Users")
private User user; private int regNo;
private String faculty; private String faculty;
public Secretary(User user, String faculty){ public Secretary(int regNo, String faculty){
this.user = user; this.regNo = regNo;
this.faculty = faculty; this.faculty = faculty;
} }
@ -24,12 +23,12 @@ public class Secretary {
return id; return id;
} }
public User getUser() { public int getRegNo() {
return user; return regNo;
} }
public void setUser(User user) { public void setRegNo(int regNo) {
this.user = user; this.regNo = regNo;
} }
public String getFaculty() { public String getFaculty() {

View File

@ -8,21 +8,18 @@ public class TeacherGivenCourse {
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private int id; private int id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Users") @JoinColumn(name = "Users")
private User user; private int regNo;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Course") @JoinColumn(name = "Course")
private Course course; private int courseId;
//This flag helps make the difference between an assistant or a Teacher (who owns the course) //This flag helps make the difference between an assistant or a Teacher (who owns the course)
private boolean owned; private boolean owned;
public TeacherGivenCourse(User user, Course course, boolean owned){ public TeacherGivenCourse(int regNo, int courseId, boolean owned){
this.user = user; this.regNo = regNo;
this.course = course; this.courseId = courseId;
this.owned = owned; this.owned = owned;
} }
@ -32,20 +29,20 @@ public class TeacherGivenCourse {
return id; return id;
} }
public User getUser() { public int getRegNo() {
return user; return regNo;
} }
public void setUser(User user) { public void setRegNo(int regNo) {
this.user = user; this.regNo = regNo;
} }
public Course getCourse() { public int getCourseId() {
return course; return courseId;
} }
public void setCourse(Course course) { public void setCourseId(int courseId) {
this.course = course; this.courseId = courseId;
} }
public boolean isOwned() { public boolean isOwned() {

View File

@ -20,17 +20,15 @@ public class User {
private String address; private String address;
private String country; private String country;
private Date birthDate; private Date birthDate;
private String profilePictureUrl;
private ovh.herisson.Clyde.Tables.Role role; private ovh.herisson.Clyde.Tables.Role role;
private String password; private String password;
public User(String lastName, String firstName, String email, String address, String country, Date birthDate, String profilePictureUrl, Role role, String password){ public User(String lastName, String firstName, String email, String address, String country, Date birthDate, Role role, String password){
this.lastName = lastName; this.lastName = lastName;
this.firstName = firstName; this.firstName = firstName;
this.email = email; this.email = email;
this.address = address; this.address = address;
this.country = country; this.country = country;
this.birthDate = birthDate; this.birthDate = birthDate;
this.profilePictureUrl = profilePictureUrl;
this.role = role; this.role = role;
this.password = password; this.password = password;
} }
@ -88,11 +86,6 @@ public class User {
this.birthDate = birthDate; this.birthDate = birthDate;
} }
public String getProfilePictureUrl(){return this.profilePictureUrl;}
public void setProfilePictureUrl(String profilePictureUrl){
this.profilePictureUrl = profilePictureUrl;
}
public ovh.herisson.Clyde.Tables.Role getRole() { public ovh.herisson.Clyde.Tables.Role getRole() {
return role; return role;
} }

View File

@ -7,19 +7,15 @@ public class UserCursus {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private int id; private int id;
//Un étudiant peut avoir plusieurs cursus
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Users") @JoinColumn(name = "Users")
private User user; private int regNo;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Cursus") @JoinColumn(name = "Cursus")
private Cursus cursus; private int cursusId;
public UserCursus(User user, Cursus cursus){ public UserCursus(int regNo, int cursusId){
this.user = user; this.regNo = regNo;
this.cursus = cursus; this.cursusId = cursusId;
} }
public UserCursus() {} public UserCursus() {}
@ -28,19 +24,19 @@ public class UserCursus {
return id; return id;
} }
public User getUser() { public int getRegNo() {
return user; return regNo;
} }
public void setUser(User user) { public void setRegNo(int regNo) {
this.user = user; this.regNo = regNo;
} }
public Cursus getCursus() { public int getCursusId() {
return cursus; return cursusId;
} }
public void setCursus(Cursus cursus) { public void setCursusId(int cursusId) {
this.cursus = cursus; this.cursusId = cursusId;
} }
} }