fix: updating foreign keys when adding new entity to the db
This commit is contained in:
@ -39,4 +39,28 @@ public class Administrator extends User {
|
||||
String phoneNumber) {
|
||||
super(null, userSurname, username, primaryMail, secondaryMail, phoneNumber);
|
||||
}
|
||||
|
||||
public List<Project> getListProject() {
|
||||
return listProject;
|
||||
}
|
||||
|
||||
public void updateListProject(Project project) {
|
||||
listProject.add(project);
|
||||
}
|
||||
|
||||
public List<Annotation> getListAnnotation() {
|
||||
return listAnnotation;
|
||||
}
|
||||
|
||||
public void updateListAnnotation(Annotation annotation) {
|
||||
listAnnotation.add(annotation);
|
||||
}
|
||||
|
||||
public MakeAppointment getMakeAppointment() {
|
||||
return makeAppointment;
|
||||
}
|
||||
|
||||
public void setMakeAppointment(MakeAppointment makeAppointment) {
|
||||
this.makeAppointment = makeAppointment;
|
||||
}
|
||||
}
|
||||
|
@ -34,4 +34,28 @@ public class Annotation {
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public Long getIdAnnotation() {
|
||||
return idAnnotation;
|
||||
}
|
||||
|
||||
public void setIdAnnotation(Long idAnnotation) {
|
||||
this.idAnnotation = idAnnotation;
|
||||
}
|
||||
|
||||
public SectionCell getSectionCellAnnotation() {
|
||||
return sectionCellAnnotation;
|
||||
}
|
||||
|
||||
public void setSectionCellAnnotation(SectionCell sectionCellAnnotation) {
|
||||
this.sectionCellAnnotation = sectionCellAnnotation;
|
||||
}
|
||||
|
||||
public Administrator getAdministratorAnnotation() {
|
||||
return administratorAnnotation;
|
||||
}
|
||||
|
||||
public void setAdministratorAnnotation(Administrator administratorAnnotation) {
|
||||
this.administratorAnnotation = administratorAnnotation;
|
||||
}
|
||||
}
|
||||
|
@ -112,6 +112,10 @@ public class Appointment {
|
||||
return listSectionCell;
|
||||
}
|
||||
|
||||
public void updateListSectionCell(SectionCell sectionCell) {
|
||||
listSectionCell.add(sectionCell);
|
||||
}
|
||||
|
||||
public Report getAppointmentReport() {
|
||||
return report;
|
||||
}
|
||||
|
@ -52,6 +52,28 @@ public class Entrepreneur extends User {
|
||||
this.sneeStatus = sneeStatus;
|
||||
}
|
||||
|
||||
public Entrepreneur(
|
||||
Long idUser,
|
||||
String userSurname,
|
||||
String userName,
|
||||
String primaryMail,
|
||||
String secondaryMail,
|
||||
String phoneNumber,
|
||||
String school,
|
||||
String course,
|
||||
boolean sneeStatus,
|
||||
Project projectParticipation,
|
||||
Project projectProposed,
|
||||
MakeAppointment makeAppointment) {
|
||||
super(idUser, userSurname, userName, primaryMail, secondaryMail, phoneNumber);
|
||||
this.school = school;
|
||||
this.course = course;
|
||||
this.sneeStatus = sneeStatus;
|
||||
this.projectParticipation = projectParticipation;
|
||||
this.projectProposed = projectProposed;
|
||||
this.makeAppointment = makeAppointment;
|
||||
}
|
||||
|
||||
public String getSchool() {
|
||||
return school;
|
||||
}
|
||||
@ -79,4 +101,24 @@ public class Entrepreneur extends User {
|
||||
public Project getProjectParticipation() {
|
||||
return projectParticipation;
|
||||
}
|
||||
|
||||
public void setProjectParticipation(Project projectParticipation) {
|
||||
this.projectParticipation = projectParticipation;
|
||||
}
|
||||
|
||||
public Project getProjectProposed() {
|
||||
return projectProposed;
|
||||
}
|
||||
|
||||
public void setProjectProposed(Project projectProposed) {
|
||||
this.projectProposed = projectProposed;
|
||||
}
|
||||
|
||||
public MakeAppointment getMakeAppointment() {
|
||||
return makeAppointment;
|
||||
}
|
||||
|
||||
public void setMakeAppointment(MakeAppointment makeAppointment) {
|
||||
this.makeAppointment = makeAppointment;
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,21 @@ public class Project {
|
||||
this.projectAdministrator = projectAdministrator;
|
||||
}
|
||||
|
||||
public Project(
|
||||
String projectName,
|
||||
byte[] logo,
|
||||
LocalDate creationDate,
|
||||
ProjectDecisionValue projectStatus,
|
||||
Administrator projectAdministrator,
|
||||
Entrepreneur entrepreneurProposed) {
|
||||
this.projectName = projectName;
|
||||
this.logo = logo;
|
||||
this.creationDate = creationDate;
|
||||
this.projectStatus = projectStatus;
|
||||
this.projectAdministrator = projectAdministrator;
|
||||
this.entrepreneurProposed = entrepreneurProposed;
|
||||
}
|
||||
|
||||
public Long getIdProject() {
|
||||
return idProject;
|
||||
}
|
||||
@ -91,11 +106,35 @@ public class Project {
|
||||
this.projectStatus = projectStatus;
|
||||
}
|
||||
|
||||
public Administrator getAdministrator() {
|
||||
return this.projectAdministrator;
|
||||
public List<Entrepreneur> getListEntrepreneurParticipation() {
|
||||
return listEntrepreneurParticipation;
|
||||
}
|
||||
|
||||
public void setAdministrator(Administrator administrator) {
|
||||
this.projectAdministrator = administrator;
|
||||
public void updateListEntrepreneurParticipation(Entrepreneur projectParticipant) {
|
||||
listEntrepreneurParticipation.add(projectParticipant);
|
||||
}
|
||||
|
||||
public List<SectionCell> getListSectionCell() {
|
||||
return listSectionCell;
|
||||
}
|
||||
|
||||
public void updateListSectionCell(SectionCell projectSectionCell) {
|
||||
listSectionCell.add(projectSectionCell);
|
||||
}
|
||||
|
||||
public Administrator getProjectAdministrator() {
|
||||
return projectAdministrator;
|
||||
}
|
||||
|
||||
public void setProjectAdministrator(Administrator projectAdministrator) {
|
||||
this.projectAdministrator = projectAdministrator;
|
||||
}
|
||||
|
||||
public Entrepreneur getEntrepreneurProposed() {
|
||||
return entrepreneurProposed;
|
||||
}
|
||||
|
||||
public void setEntrepreneurProposed(Entrepreneur entrepreneurProposed) {
|
||||
this.entrepreneurProposed = entrepreneurProposed;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||
public class SectionCell {
|
||||
|
||||
@ManyToMany(mappedBy = "listSectionCell")
|
||||
private final List<Appointment> appointment = new ArrayList<>();
|
||||
private final List<Appointment> listAppointment = new ArrayList<>();
|
||||
|
||||
@OneToMany(mappedBy = "sectionCellAnnotation", fetch = FetchType.LAZY, orphanRemoval = true)
|
||||
private final List<Annotation> listAnnotation = new ArrayList<>();
|
||||
@ -39,11 +39,13 @@ public class SectionCell {
|
||||
Long idSectionCell,
|
||||
Long sectionId,
|
||||
String contentSectionCell,
|
||||
LocalDateTime modificationDate) {
|
||||
LocalDateTime modificationDate,
|
||||
Project projectSectionCell) {
|
||||
this.idSectionCell = idSectionCell;
|
||||
this.sectionId = sectionId;
|
||||
this.contentSectionCell = contentSectionCell;
|
||||
this.modificationDate = modificationDate;
|
||||
this.projectSectionCell = projectSectionCell;
|
||||
}
|
||||
|
||||
public Long getIdSectionCell() {
|
||||
@ -83,6 +85,26 @@ public class SectionCell {
|
||||
}
|
||||
|
||||
public List<Appointment> getAppointmentSectionCell() {
|
||||
return appointment;
|
||||
return listAppointment;
|
||||
}
|
||||
|
||||
public void updateAppointmentSectionCell(Appointment appointment) {
|
||||
listAppointment.add(appointment);
|
||||
}
|
||||
|
||||
public List<Annotation> getListAnnotation() {
|
||||
return listAnnotation;
|
||||
}
|
||||
|
||||
public void updateListAnnotation(Annotation annotation) {
|
||||
listAnnotation.add(annotation);
|
||||
}
|
||||
|
||||
public void setSectionId(long sectionId) {
|
||||
this.sectionId = sectionId;
|
||||
}
|
||||
|
||||
public void setProjectSectionCell(Project projectSectionCell) {
|
||||
this.projectSectionCell = projectSectionCell;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user