task/3382: Harmonisera tabellnamn #6
|
@ -1,140 +1,164 @@
|
||||||
package se.su.dsv.scipro.activityplan;
|
package se.su.dsv.scipro.activityplan;
|
||||||
|
|
||||||
import com.querydsl.core.annotations.QueryInit;
|
import com.querydsl.core.annotations.QueryInit;
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import se.su.dsv.scipro.checklist.Checklist;
|
|
||||||
import se.su.dsv.scipro.file.FileReference;
|
|
||||||
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import jakarta.persistence.Cacheable;
|
import jakarta.persistence.Cacheable;
|
||||||
import jakarta.persistence.CascadeType;
|
import jakarta.persistence.CascadeType;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.EnumType;
|
import jakarta.persistence.EnumType;
|
||||||
import jakarta.persistence.Enumerated;
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.JoinColumn;
|
import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.OneToOne;
|
import jakarta.persistence.OneToOne;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.checklist.Checklist;
|
||||||
|
import se.su.dsv.scipro.file.FileReference;
|
||||||
|
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.*;
|
import java.util.Comparator;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name = "activity")
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
public class Activity extends LazyDeletableDomainObject {
|
public class Activity extends LazyDeletableDomainObject {
|
||||||
|
|
||||||
|
public static IActivityPlan builder(){
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
//<editor-fold desc="Basic JPA-mappings">
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne(optional=false)
|
@Basic
|
||||||
@JoinColumn (name="activityTemplate_id")
|
@Column(name = "title", nullable=false)
|
||||||
@QueryInit("project")
|
|
||||||
private ActivityPlan activityPlan;
|
|
||||||
|
|
||||||
@Column(nullable=false)
|
|
||||||
private Date date;
|
|
||||||
|
|
||||||
@Column(nullable=false)
|
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "date", nullable=false)
|
||||||
|
private Date date;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@OneToOne(optional = true, cascade = CascadeType.ALL)
|
@Basic
|
||||||
@JoinColumn(name = "file_upload_reference_id")
|
@Column(name = "editable")
|
||||||
private FileReference fileUpload;
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
private Checklist checklist;
|
|
||||||
|
|
||||||
private boolean editable = true;
|
private boolean editable = true;
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(name = "action")
|
||||||
private Action action = Action.NONE;
|
private Action action = Action.NONE;
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="JPA-mappings of foreign keys in this table (activity) referencing other tables.">
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "activity_plan_id", referencedColumnName = "id")
|
||||||
|
@QueryInit("project")
|
||||||
|
private ActivityPlan activityPlan;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "checklist_id", referencedColumnName = "id")
|
||||||
|
private Checklist checklist;
|
||||||
|
|
||||||
|
@OneToOne(optional = true, cascade = CascadeType.ALL)
|
||||||
|
@JoinColumn(name = "upload_file_reference_id", referencedColumnName = "id")
|
||||||
tozh4728 marked this conversation as resolved
Outdated
|
|||||||
|
private FileReference fileUpload;
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="Constructor">
|
||||||
public Activity() {
|
public Activity() {
|
||||||
this.title = "";
|
this.title = "";
|
||||||
this.description = "";
|
this.description = "";
|
||||||
}
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
@Override
|
//<editor-fold desc="Properties (Getters and Setters)">
|
||||||
public String toString(){
|
|
||||||
return "Event: "+ getTitle()+"@"+getDate();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActivityPlan getActivityPlan() {
|
|
||||||
return this.activityPlan;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getDate() {
|
|
||||||
return this.date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return this.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return this.description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileReference getFileUpload() {
|
|
||||||
return this.fileUpload;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Checklist getChecklist() {
|
|
||||||
return this.checklist;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEditable() {
|
|
||||||
return this.editable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action getAction() {
|
|
||||||
return this.action;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActivityPlan(ActivityPlan activityPlan) {
|
public String getTitle() {
|
||||||
this.activityPlan = activityPlan;
|
return this.title;
|
||||||
}
|
|
||||||
|
|
||||||
public void setDate(Date date) {
|
|
||||||
this.date = date;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Date getDate() {
|
||||||
|
return this.date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(Date date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFileUpload(FileReference fileUpload) {
|
public boolean isEditable() {
|
||||||
this.fileUpload = fileUpload;
|
return this.editable;
|
||||||
}
|
|
||||||
|
|
||||||
public void setChecklist(Checklist checklist) {
|
|
||||||
this.checklist = checklist;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEditable(boolean editable) {
|
public void setEditable(boolean editable) {
|
||||||
this.editable = editable;
|
this.editable = editable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action getAction() {
|
||||||
|
return this.action;
|
||||||
|
}
|
||||||
|
|
||||||
public void setAction(Action action) {
|
public void setAction(Action action) {
|
||||||
this.action = action;
|
this.action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActivityPlan getActivityPlan() {
|
||||||
|
return this.activityPlan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivityPlan(ActivityPlan activityPlan) {
|
||||||
|
this.activityPlan = activityPlan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Checklist getChecklist() {
|
||||||
|
return this.checklist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChecklist(Checklist checklist) {
|
||||||
|
this.checklist = checklist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileReference getFileUpload() {
|
||||||
|
return this.fileUpload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFileUpload(FileReference fileUpload) {
|
||||||
|
this.fileUpload = fileUpload;
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="Methods Common To All Objects">
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -144,15 +168,24 @@ public class Activity extends LazyDeletableDomainObject {
|
||||||
&& Objects.equals(this.getId(), other.getId());
|
&& Objects.equals(this.getId(), other.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof Activity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(getId());
|
return Objects.hashCode(getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(){
|
||||||
|
return "Event: "+ getTitle()+"@"+getDate();
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="Other methods">
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof Activity;
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="Nested types">
|
||||||
public static class ByDateComparator implements Comparator<Activity>, Serializable {
|
public static class ByDateComparator implements Comparator<Activity>, Serializable {
|
||||||
@Override
|
@Override
|
||||||
public int compare(Activity o1, Activity o2) {
|
public int compare(Activity o1, Activity o2) {
|
||||||
|
@ -209,10 +242,6 @@ public class Activity extends LazyDeletableDomainObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IActivityPlan builder(){
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IActivityPlan {
|
public interface IActivityPlan {
|
||||||
IDate activityPlan(ActivityPlan activityPlan);
|
IDate activityPlan(ActivityPlan activityPlan);
|
||||||
}
|
}
|
||||||
|
@ -233,4 +262,5 @@ public class Activity extends LazyDeletableDomainObject {
|
||||||
IBuild editable(boolean editable);
|
IBuild editable(boolean editable);
|
||||||
Activity build();
|
Activity build();
|
||||||
}
|
}
|
||||||
|
//</editor-fold>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,67 +1,92 @@
|
||||||
package se.su.dsv.scipro.activityplan;
|
package se.su.dsv.scipro.activityplan;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name ="activity_plan")
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
public class ActivityPlan extends DomainObject {
|
public class ActivityPlan extends DomainObject {
|
||||||
|
|
||||||
|
public static IProject builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
//<editor-fold desc="Basic JPA-mappings">
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "start_date")
|
||||||
|
private Date startDate;
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="JPA-mappings of foreign keys in this table (activity_plan) referencing other tables">
|
||||||
|
@OneToOne(optional=false)
|
||||||
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
|
private Project project;
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="JPA-mappings of other tables referencing to this table "activity_plan">
|
||||||
@OneToMany(mappedBy= "activityPlan",cascade=CascadeType.PERSIST, orphanRemoval = true)
|
@OneToMany(mappedBy= "activityPlan",cascade=CascadeType.PERSIST, orphanRemoval = true)
|
||||||
private Set<Activity> activities = new TreeSet<>(new Activity.ByDateComparator());
|
private Set<Activity> activities = new TreeSet<>(new Activity.ByDateComparator());
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
@OneToOne(optional=false)
|
//<editor-fold desc="Properties (Getters and Setters)">
|
||||||
private Project project;
|
|
||||||
|
|
||||||
private Date startDate;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Activity> getActivities() {
|
|
||||||
return this.activities;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Project getProject() {
|
|
||||||
return this.project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getStartDate() {
|
|
||||||
return this.startDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActivities(Set<Activity> activities) {
|
public Date getStartDate() {
|
||||||
this.activities = activities;
|
return this.startDate;
|
||||||
}
|
|
||||||
|
|
||||||
public void setProject(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartDate(Date startDate) {
|
public void setStartDate(Date startDate) {
|
||||||
this.startDate = startDate;
|
this.startDate = startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public Project getProject() {
|
||||||
public String toString() {
|
return this.project;
|
||||||
return "ActivityPlan(id=" + this.getId() + ", activities=" + this.getActivities() + ", project=" + this.getProject() + ", startDate=" + this.getStartDate() + ")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setProject(Project project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<Activity> getActivities() {
|
||||||
|
return this.activities;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivities(Set<Activity> activities) {
|
||||||
|
this.activities = activities;
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="Methods Common To All Objects">
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -74,15 +99,25 @@ public class ActivityPlan extends DomainObject {
|
||||||
&& Objects.equals(this.getStartDate(), other.getStartDate());
|
&& Objects.equals(this.getStartDate(), other.getStartDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof ActivityPlan;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.getId(), this.getActivities(), this.getProject(), this.getStartDate());
|
return Objects.hash(this.getId(), this.getActivities(), this.getProject(), this.getStartDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ActivityPlan(id=" + this.getId() + ", activities=" + this.getActivities() + ", project=" +
|
||||||
|
this.getProject() + ", startDate=" + this.getStartDate() + ")";
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="Other methods">
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof ActivityPlan;
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="Nested types"
|
||||||
private static class Builder implements IProject, IBuild {
|
private static class Builder implements IProject, IBuild {
|
||||||
private Project project;
|
private Project project;
|
||||||
|
|
||||||
|
@ -100,10 +135,6 @@ public class ActivityPlan extends DomainObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IProject builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IProject {
|
public interface IProject {
|
||||||
IBuild project(Project project);
|
IBuild project(Project project);
|
||||||
}
|
}
|
||||||
|
@ -111,4 +142,5 @@ public class ActivityPlan extends DomainObject {
|
||||||
public interface IBuild {
|
public interface IBuild {
|
||||||
ActivityPlan build();
|
ActivityPlan build();
|
||||||
}
|
}
|
||||||
|
//</editor-fold>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,106 @@
|
||||||
package se.su.dsv.scipro.activityplan;
|
package se.su.dsv.scipro.activityplan;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.Lob;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.OrderColumn;
|
||||||
|
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name = "activity_plan_template")
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
public class ActivityPlanTemplate extends DomainObject {
|
public class ActivityPlanTemplate extends DomainObject {
|
||||||
|
|
||||||
|
//<editor-fold desc="Basic JPA-mappings">
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@OrderColumn(name = "numberInOrder")
|
@Basic
|
||||||
|
@Column(name = "is_sys_admin_template", nullable=false)
|
||||||
|
private boolean isSysAdminTemplate = false;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "title", nullable = false)
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "description")
|
||||||
|
@Lob
|
||||||
|
private String description;
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="JPA-mappings of foreign keys in this table (activity_plan_template) referencing other tables.">
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "creator_user_id", referencedColumnName = "id")
|
||||||
tozh4728 marked this conversation as resolved
Outdated
ansv7779
commented
Again less self describing column name. Again less self describing column name. `creator_id` tells you it is the user who created the template rather than just a generic `user_id`. The referenced table/type is visible from the foreign key/class.
|
|||||||
|
private User creator;
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="JPA-mappings of other tables referencing to this table 'activity_plan_template'">
|
||||||
@OneToMany(mappedBy="activityPlanTemplate", orphanRemoval=true, cascade=CascadeType.ALL)
|
@OneToMany(mappedBy="activityPlanTemplate", orphanRemoval=true, cascade=CascadeType.ALL)
|
||||||
|
@OrderColumn(name = "number_in_order")
|
||||||
private List<ActivityTemplate> activityTemplates = new ArrayList<>();
|
private List<ActivityTemplate> activityTemplates = new ArrayList<>();
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="Properties (Getters and Setters)">
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSysAdminTemplate() {
|
||||||
|
return this.isSysAdminTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSysAdminTemplate(boolean isSysAdminTemplate) {
|
||||||
|
this.isSysAdminTemplate = isSysAdminTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return this.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getCreator() {
|
||||||
|
return this.creator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreator(User creator) {
|
||||||
|
this.creator = creator;
|
||||||
|
}
|
||||||
|
|
||||||
public List<ActivityTemplate> getActivityTemplates(){
|
public List<ActivityTemplate> getActivityTemplates(){
|
||||||
return Collections.unmodifiableList(activityTemplates);
|
return Collections.unmodifiableList(activityTemplates);
|
||||||
|
@ -25,74 +109,9 @@ public class ActivityPlanTemplate extends DomainObject {
|
||||||
public void setActivityTemplates(List<ActivityTemplate> activityTemplates){
|
public void setActivityTemplates(List<ActivityTemplate> activityTemplates){
|
||||||
this.activityTemplates = new ArrayList<>(activityTemplates);
|
this.activityTemplates = new ArrayList<>(activityTemplates);
|
||||||
}
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
@ManyToOne(optional=false)
|
//<editor-fold desc="Methods Common To All Objects">
|
||||||
private User creator;
|
|
||||||
|
|
||||||
@Column(nullable=false)
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
@Lob
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
@Column(nullable=false)
|
|
||||||
private boolean isSysAdminTemplate = false;
|
|
||||||
|
|
||||||
public void addActivity(ActivityTemplate activity){
|
|
||||||
activity.setActivityPlanTemplate(this);
|
|
||||||
activity.setNumberInOrder(activityTemplates.size());
|
|
||||||
activityTemplates.add(activity);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearActivities(){
|
|
||||||
activityTemplates.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addActivities(final Collection<ActivityTemplate> activities){
|
|
||||||
activityTemplates.addAll(activities);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getCreator() {
|
|
||||||
return this.creator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return this.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return this.description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSysAdminTemplate() {
|
|
||||||
return this.isSysAdminTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreator(User creator) {
|
|
||||||
this.creator = creator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSysAdminTemplate(boolean isSysAdminTemplate) {
|
|
||||||
this.isSysAdminTemplate = isSysAdminTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -119,6 +138,25 @@ public class ActivityPlanTemplate extends DomainObject {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ActivityPlanTemplate(id=" + this.getId() + ", creator=" + this.getCreator() + ", title=" + this.getTitle() + ", description=" + this.getDescription() + ", isSysAdminTemplate=" + this.isSysAdminTemplate() + ")";
|
return "ActivityPlanTemplate(id=" + this.getId() + ", creator=" + this.getCreator() +
|
||||||
|
", title=" + this.getTitle() + ", description=" + this.getDescription() +
|
||||||
|
", isSysAdminTemplate=" + this.isSysAdminTemplate() + ")";
|
||||||
}
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="Other methods">
|
||||||
|
public void addActivity(ActivityTemplate activity){
|
||||||
|
activity.setActivityPlanTemplate(this);
|
||||||
|
activity.setNumberInOrder(activityTemplates.size());
|
||||||
|
activityTemplates.add(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearActivities(){
|
||||||
|
activityTemplates.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addActivities(final Collection<ActivityTemplate> activities){
|
||||||
|
activityTemplates.addAll(activities);
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,116 +1,142 @@
|
||||||
package se.su.dsv.scipro.activityplan;
|
package se.su.dsv.scipro.activityplan;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.Lob;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import se.su.dsv.scipro.checklist.ChecklistTemplate;
|
import se.su.dsv.scipro.checklist.ChecklistTemplate;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name = "activity_template")
|
||||||
public class ActivityTemplate extends DomainObject {
|
public class ActivityTemplate extends DomainObject {
|
||||||
|
|
||||||
|
//<editor-fold desc="Basic JPA-mappings">
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Basic
|
||||||
|
@Column(name = "title", nullable = false)
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "description")
|
||||||
@Lob
|
@Lob
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@ManyToOne
|
@Basic
|
||||||
private ActivityPlanTemplate activityPlanTemplate;
|
@Column(name = "days_offset", nullable = false)
|
||||||
|
|
||||||
@Column(nullable = false)
|
|
||||||
private int daysOffset;
|
private int daysOffset;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "action")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private Action action = Action.NONE;
|
private Action action = Action.NONE;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Basic
|
||||||
|
@Column(name = "number_in_order", nullable = false)
|
||||||
private int numberInOrder = Integer.MAX_VALUE;
|
private int numberInOrder = Integer.MAX_VALUE;
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="JPA-mappings of foreign keys in this table (activity_template) referencing other tables.">
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "activity_plan_template_id", referencedColumnName = "id")
|
||||||
|
private ActivityPlanTemplate activityPlanTemplate;
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
@ManyToOne(optional = true)
|
||||||
|
@JoinColumn(name = "checklist_template_id", referencedColumnName = "id")
|
||||||
private ChecklistTemplate checklistTemplate;
|
private ChecklistTemplate checklistTemplate;
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="Constructors">
|
||||||
public ActivityTemplate() {
|
public ActivityTemplate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActivityTemplate(int daysOffset) {
|
public ActivityTemplate(int daysOffset) {
|
||||||
this.daysOffset = daysOffset;
|
this.daysOffset = daysOffset;
|
||||||
}
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
public int getDaysOffset() {
|
//<editor-fold desc="Properties (Getters and Setters">
|
||||||
return daysOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getNumberInOrder() {
|
|
||||||
return numberInOrder;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return this.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return this.description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActivityPlanTemplate getActivityPlanTemplate() {
|
|
||||||
return this.activityPlanTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action getAction() {
|
|
||||||
return this.action;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChecklistTemplate getChecklistTemplate() {
|
|
||||||
return this.checklistTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return this.title;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActivityPlanTemplate(ActivityPlanTemplate activityPlanTemplate) {
|
public int getDaysOffset() {
|
||||||
this.activityPlanTemplate = activityPlanTemplate;
|
return daysOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDaysOffset(int daysOffset) {
|
public void setDaysOffset(int daysOffset) {
|
||||||
this.daysOffset = daysOffset;
|
this.daysOffset = daysOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action getAction() {
|
||||||
|
return this.action;
|
||||||
|
}
|
||||||
|
|
||||||
public void setAction(Action action) {
|
public void setAction(Action action) {
|
||||||
this.action = action;
|
this.action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getNumberInOrder() {
|
||||||
|
return numberInOrder;
|
||||||
|
}
|
||||||
|
|
||||||
public void setNumberInOrder(int numberInOrder) {
|
public void setNumberInOrder(int numberInOrder) {
|
||||||
this.numberInOrder = numberInOrder;
|
this.numberInOrder = numberInOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActivityPlanTemplate getActivityPlanTemplate() {
|
||||||
|
return this.activityPlanTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivityPlanTemplate(ActivityPlanTemplate activityPlanTemplate) {
|
||||||
|
this.activityPlanTemplate = activityPlanTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChecklistTemplate getChecklistTemplate() {
|
||||||
|
return this.checklistTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
public void setChecklistTemplate(ChecklistTemplate checklistTemplate) {
|
public void setChecklistTemplate(ChecklistTemplate checklistTemplate) {
|
||||||
this.checklistTemplate = checklistTemplate;
|
this.checklistTemplate = checklistTemplate;
|
||||||
}
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
@Override
|
//<editor-fold desc="Methods Common To All Objects">
|
||||||
public String toString() {
|
|
||||||
return "ActivityTemplate(id=" + this.getId() + ", title=" + this.getTitle() + ", description=" + this.getDescription() + ", activityPlanTemplate=" + this.getActivityPlanTemplate() + ", daysOffset=" + this.getDaysOffset() + ", action=" + this.getAction() + ", numberInOrder=" + this.getNumberInOrder() + ", checklistTemplate=" + this.getChecklistTemplate() + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -120,12 +146,24 @@ public class ActivityTemplate extends DomainObject {
|
||||||
&& Objects.equals(this.getId(), other.getId());
|
&& Objects.equals(this.getId(), other.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof ActivityTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(this.getId());
|
return Objects.hashCode(this.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ActivityTemplate(id=" + this.getId() + ", title=" + this.getTitle() +
|
||||||
|
", description=" + this.getDescription() + ", activityPlanTemplate=" +
|
||||||
|
this.getActivityPlanTemplate() + ", daysOffset=" + this.getDaysOffset() + ", action=" +
|
||||||
|
this.getAction() + ", numberInOrder=" + this.getNumberInOrder() + ", checklistTemplate=" +
|
||||||
|
this.getChecklistTemplate() + ")";
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="Other methods">
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof ActivityTemplate;
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
}
|
}
|
|
@ -1,12 +1,33 @@
|
||||||
package se.su.dsv.scipro.checklist;
|
package se.su.dsv.scipro.checklist;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.CollectionTable;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.ElementCollection;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.JoinTable;
|
||||||
|
import jakarta.persistence.ManyToMany;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.MapKeyJoinColumn;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import java.util.ArrayList;
|
||||||
import java.util.*;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "checklist")
|
@Table(name = "checklist")
|
||||||
|
@ -17,6 +38,7 @@ public class Checklist extends DomainObject {
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Basic
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -28,15 +50,26 @@ public class Checklist extends DomainObject {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "project_id")
|
||||||
private Project project;
|
private Project project;
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||||
|
@JoinTable(name = "checklist_checklist_question",
|
||||||
|
joinColumns = @JoinColumn(name = "checklist_id", referencedColumnName = "id"),
|
||||||
|
inverseJoinColumns = @JoinColumn(name = "checklist_question_id", referencedColumnName = "id"))
|
||||||
private List<ChecklistQuestion> questions = new ArrayList<>();
|
private List<ChecklistQuestion> questions = new ArrayList<>();
|
||||||
|
|
||||||
@ManyToMany
|
@ManyToMany
|
||||||
|
@JoinTable(name = "checklist_checklist_category",
|
||||||
|
joinColumns = @JoinColumn(name = "checklist_id", referencedColumnName = "id"),
|
||||||
|
inverseJoinColumns = @JoinColumn(name = "checklist_category_id", referencedColumnName = "id"))
|
||||||
private List<se.su.dsv.scipro.checklist.ChecklistCategory> categories = new ArrayList<>();
|
private List<se.su.dsv.scipro.checklist.ChecklistCategory> categories = new ArrayList<>();
|
||||||
|
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
|
@CollectionTable(name = "checklist_user_last_open_date", joinColumns = @JoinColumn(name = "checklist_id"))
|
||||||
|
@Column(name = "last_open_date")
|
||||||
|
@SuppressWarnings("JpaDataSourceORMInspection") // false warning from IntelliJ for the @MapKeyJoinColumn
|
||||||
|
@MapKeyJoinColumn(name = "user_id")
|
||||||
private Map<User, Date> userLastOpenDate = new HashMap<>();
|
private Map<User, Date> userLastOpenDate = new HashMap<>();
|
||||||
|
|
||||||
protected Checklist() {
|
protected Checklist() {
|
||||||
|
|
|
@ -1,29 +1,54 @@
|
||||||
package se.su.dsv.scipro.checklist;
|
package se.su.dsv.scipro.checklist;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.Lob;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "checklist_answer")
|
@Table(name = "checklist_answer")
|
||||||
public class ChecklistAnswer extends DomainObject {
|
public class ChecklistAnswer extends DomainObject {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "answer", nullable = false)
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
@Column(nullable = false)
|
|
||||||
private ChecklistAnswerEnum answer;
|
private ChecklistAnswerEnum answer;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@Basic
|
||||||
private User user;
|
@Column(name = "comment")
|
||||||
|
|
||||||
@Lob
|
@Lob
|
||||||
@Column
|
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (checklist_answer) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "user_id", referencedColumnName = "id")
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
protected ChecklistAnswer() {
|
protected ChecklistAnswer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,44 +61,45 @@ public class ChecklistAnswer extends DomainObject {
|
||||||
this.answer = answer != null ? answer : ChecklistAnswerEnum.NO_ANSWER;
|
this.answer = answer != null ? answer : ChecklistAnswerEnum.NO_ANSWER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChecklistAnswerEnum getAnswer() {
|
|
||||||
return this.answer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getUser() {
|
|
||||||
return this.user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return this.comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ChecklistAnswerEnum getAnswer() {
|
||||||
|
return this.answer;
|
||||||
|
}
|
||||||
|
|
||||||
public void setAnswer(ChecklistAnswerEnum answer) {
|
public void setAnswer(ChecklistAnswerEnum answer) {
|
||||||
this.answer = answer;
|
this.answer = answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUser(User user) {
|
public String getComment() {
|
||||||
this.user = user;
|
return this.comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setComment(String comment) {
|
public void setComment(String comment) {
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public User getUser() {
|
||||||
public String toString() {
|
return this.user;
|
||||||
return "ChecklistAnswer(id=" + this.getId() + ", answer=" + this.getAnswer() + ", user=" + this.getUser() + ", comment=" + this.getComment() + ")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setUser(User user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -83,12 +109,21 @@ public class ChecklistAnswer extends DomainObject {
|
||||||
&& Objects.equals(this.getId(), other.getId());
|
&& Objects.equals(this.getId(), other.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof ChecklistAnswer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(this.getId());
|
return Objects.hashCode(this.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ChecklistAnswer(id=" + this.getId() + ", answer=" + this.getAnswer() + ", user=" + this.getUser() +
|
||||||
|
", comment=" + this.getComment() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof ChecklistAnswer;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -4,6 +4,6 @@ public enum ChecklistAnswerEnum {
|
||||||
RED,
|
RED,
|
||||||
GREEN,
|
GREEN,
|
||||||
YELLOW,
|
YELLOW,
|
||||||
NOT_APLICABLE,
|
NOT_APPLICABLE,
|
||||||
NO_ANSWER
|
NO_ANSWER
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package se.su.dsv.scipro.checklist;
|
package se.su.dsv.scipro.checklist;
|
||||||
|
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="checklist_category")
|
@Table(name="checklist_category")
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
|
@ -16,7 +20,7 @@ public class ChecklistCategory extends DomainObject {
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column(unique=true)
|
@Column(name = "category_name", unique = true)
|
||||||
private String categoryName;
|
private String categoryName;
|
||||||
|
|
||||||
protected ChecklistCategory() {
|
protected ChecklistCategory() {
|
||||||
|
|
|
@ -1,13 +1,26 @@
|
||||||
package se.su.dsv.scipro.checklist;
|
package se.su.dsv.scipro.checklist;
|
||||||
|
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
|
||||||
import se.su.dsv.scipro.system.User;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.JoinTable;
|
||||||
|
import jakarta.persistence.Lob;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "checklist_question")
|
@Table(name = "checklist_question")
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
|
@ -20,13 +33,15 @@ public class ChecklistQuestion extends DomainObject {
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String question;
|
private String question;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Basic
|
||||||
|
@Column(name = "question_number", nullable = false)
|
||||||
private int questionNumber;
|
private int questionNumber;
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||||
@JoinTable(
|
@JoinTable(
|
||||||
joinColumns = @JoinColumn(name = "checklist_question_id")
|
name = "checklist_question_checklist_answer",
|
||||||
)
|
joinColumns = @JoinColumn(name = "checklist_question_id", referencedColumnName = "id"),
|
||||||
|
inverseJoinColumns = @JoinColumn(name = "checklist_answer_id", referencedColumnName = "id"))
|
||||||
private List<ChecklistAnswer> answers = new ArrayList<>();
|
private List<ChecklistAnswer> answers = new ArrayList<>();
|
||||||
|
|
||||||
protected ChecklistQuestion() {
|
protected ChecklistQuestion() {
|
||||||
|
|
|
@ -1,11 +1,27 @@
|
||||||
package se.su.dsv.scipro.checklist;
|
package se.su.dsv.scipro.checklist;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.CollectionTable;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.ElementCollection;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.JoinTable;
|
||||||
|
import jakarta.persistence.ManyToMany;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.ProjectType;
|
import se.su.dsv.scipro.system.ProjectType;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import java.util.ArrayList;
|
||||||
import java.util.*;
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "checklist_template")
|
@Table(name = "checklist_template")
|
||||||
|
@ -17,35 +33,42 @@ public class ChecklistTemplate extends DomainObject {
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Basic
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Basic(optional = true)
|
||||||
|
@Column(name = "description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Column
|
@Basic
|
||||||
|
@Column(name = "template_number")
|
||||||
private int templateNumber = DEFAULT_TEMPLATE_NUMBER;
|
private int templateNumber = DEFAULT_TEMPLATE_NUMBER;
|
||||||
|
|
||||||
@Lob
|
|
||||||
@ElementCollection
|
@ElementCollection
|
||||||
|
@CollectionTable(name = "checklist_template_question",
|
||||||
|
joinColumns = @JoinColumn(name = "checklist_template_id"))
|
||||||
|
@Column(name = "question")
|
||||||
private List<String> questions = new ArrayList<>(1);
|
private List<String> questions = new ArrayList<>(1);
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
tozh4728 marked this conversation as resolved
Outdated
ansv7779
commented
Less self describing column name. Less self describing column name. `creator_id` tells you it is the user who created the template rather than just a generic `user_id`. The referenced table/type is visible from the foreign key/class.
|
|||||||
|
@JoinColumn(name = "creator_user_id", referencedColumnName = "id")
|
||||||
private User creator;
|
private User creator;
|
||||||
|
|
||||||
@ManyToMany
|
@ManyToMany
|
||||||
@JoinTable(
|
@JoinTable(name = "checklist_template_checklist_category",
|
||||||
joinColumns = @JoinColumn(name = "checklist_template_id")
|
joinColumns = @JoinColumn(name = "checklist_template_id", referencedColumnName = "id"),
|
||||||
)
|
inverseJoinColumns = @JoinColumn(name = "checklist_category_id", referencedColumnName = "id"))
|
||||||
private List<ChecklistCategory> categories = new ArrayList<>();
|
private List<ChecklistCategory> categories = new ArrayList<>();
|
||||||
|
|
||||||
@ManyToMany
|
@ManyToMany
|
||||||
@JoinTable(name = "checklist_template_ProjectType",
|
@JoinTable(name = "checklist_template_project_type",
|
||||||
joinColumns = {@JoinColumn(name = "checklist_template_id")},
|
joinColumns = {@JoinColumn(name = "checklist_template_id")},
|
||||||
inverseJoinColumns = {@JoinColumn(name = "projectType_id")})
|
inverseJoinColumns = {@JoinColumn(name = "project_type_id")})
|
||||||
private Collection<ProjectType> projectTypes = new HashSet<>();
|
private Collection<ProjectType> projectTypes = new HashSet<>();
|
||||||
|
|
||||||
public ChecklistTemplate() {
|
public ChecklistTemplate() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChecklistTemplate(String name, User creator) {
|
public ChecklistTemplate(String name, User creator) {
|
||||||
|
|
|
@ -33,25 +33,40 @@ public class FileDescription extends DomainObject {
|
||||||
public static final int FILES_PER_SUBDIRECTORY = 1000;
|
public static final int FILES_PER_SUBDIRECTORY = 1000;
|
||||||
public static final String FILE_ROOT = "/scipro-files";
|
public static final String FILE_ROOT = "/scipro-files";
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column
|
@Basic
|
||||||
|
@Column(name = "name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Column
|
@Basic
|
||||||
|
@Column(name = "mime_type")
|
||||||
private String mimeType;
|
private String mimeType;
|
||||||
|
|
||||||
@Column
|
@Basic
|
||||||
private String identifier;
|
@Column(name = "size")
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "userId")
|
|
||||||
private User uploader;
|
|
||||||
|
|
||||||
private long size;
|
private long size;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "file_identifier")
|
||||||
|
private String identifier;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (file_description) referencing
|
||||||
|
// other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "user_id", referencedColumnName = "id")
|
||||||
|
private User uploader;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA lifecycle methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@PostRemove
|
@PostRemove
|
||||||
void removeActualData() {
|
void removeActualData() {
|
||||||
try {
|
try {
|
||||||
|
@ -63,6 +78,96 @@ public class FileDescription extends DomainObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMimeType() {
|
||||||
|
return this.mimeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMimeType(String mimeType) {
|
||||||
|
this.mimeType = mimeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getSize() {
|
||||||
|
return this.size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSize(long size) {
|
||||||
|
this.size = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdentifier() {
|
||||||
|
return this.identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentifier(String identifier) {
|
||||||
|
this.identifier = identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getUploader() {
|
||||||
|
return this.uploader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUploader(User uploader) {
|
||||||
|
this.uploader = uploader;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object o) {
|
||||||
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof FileDescription)) return false;
|
||||||
|
final FileDescription other = (FileDescription) o;
|
||||||
|
return other.canEqual(this)
|
||||||
|
&& Objects.equals(this.getId(), other.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int PRIME = 59;
|
||||||
|
int result = 1;
|
||||||
|
final Object $id = this.getId();
|
||||||
|
result = result * PRIME + ($id == null ? 43 : $id.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Todo
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
if (name != null) {
|
||||||
|
return name;
|
||||||
|
} else {
|
||||||
|
return super.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof FileDescription;
|
||||||
|
}
|
||||||
|
|
||||||
public Path getPath0() {
|
public Path getPath0() {
|
||||||
return FileSystems.getDefault().getPath(FILE_ROOT, getSubdirectory(), Long.toString(id));
|
return FileSystems.getDefault().getPath(FILE_ROOT, getSubdirectory(), Long.toString(id));
|
||||||
}
|
}
|
||||||
|
@ -78,85 +183,4 @@ public class FileDescription extends DomainObject {
|
||||||
public InputStream getData() throws IOException {
|
public InputStream getData() throws IOException {
|
||||||
return Files.newInputStream(getPath0());
|
return Files.newInputStream(getPath0());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Todo
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
if (name != null) {
|
|
||||||
return name;
|
|
||||||
} else {
|
|
||||||
return super.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMimeType() {
|
|
||||||
return this.mimeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIdentifier() {
|
|
||||||
return this.identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getUploader() {
|
|
||||||
return this.uploader;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getSize() {
|
|
||||||
return this.size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMimeType(String mimeType) {
|
|
||||||
this.mimeType = mimeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIdentifier(String identifier) {
|
|
||||||
this.identifier = identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUploader(User uploader) {
|
|
||||||
this.uploader = uploader;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSize(long size) {
|
|
||||||
this.size = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object o) {
|
|
||||||
if (o == this) return true;
|
|
||||||
if (!(o instanceof FileDescription)) return false;
|
|
||||||
final FileDescription other = (FileDescription) o;
|
|
||||||
return other.canEqual(this)
|
|
||||||
&& Objects.equals(this.getId(), other.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof FileDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int PRIME = 59;
|
|
||||||
int result = 1;
|
|
||||||
final Object $id = this.getId();
|
|
||||||
result = result * PRIME + ($id == null ? 43 : $id.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.*;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A reference to a file.
|
* A reference to a file.
|
||||||
|
@ -29,7 +29,7 @@ public class FileReference implements Serializable {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne(cascade = CascadeType.PERSIST)
|
@ManyToOne(cascade = CascadeType.PERSIST)
|
||||||
@JoinColumn(name = "file_description_id")
|
@JoinColumn(name = "file_description_id", referencedColumnName = "id")
|
||||||
private FileDescription fileDescription;
|
private FileDescription fileDescription;
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
|
|
|
@ -1,71 +1,88 @@
|
||||||
package se.su.dsv.scipro.file;
|
package se.su.dsv.scipro.file;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "project_file")
|
@Table(name = "project_file")
|
||||||
public class ProjectFile extends DomainObject {
|
public class ProjectFile extends DomainObject {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne
|
@Basic
|
||||||
private Project project;
|
@Column(name = "file_source")
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private FileSource fileSource = FileSource.FILES;
|
private FileSource fileSource = FileSource.FILES;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (project_file) referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
|
private Project project;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "file_reference_id")
|
@JoinColumn(name = "file_reference_id", referencedColumnName = "id")
|
||||||
private FileReference fileReference;
|
private FileReference fileReference;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Project getProject() {
|
|
||||||
return this.project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileSource getFileSource() {
|
|
||||||
return this.fileSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileDescription getFileDescription() {
|
|
||||||
return this.fileReference.getFileDescription();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProject(Project project) {
|
public FileSource getFileSource() {
|
||||||
this.project = project;
|
return this.fileSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFileSource(FileSource fileSource) {
|
public void setFileSource(FileSource fileSource) {
|
||||||
this.fileSource = fileSource;
|
this.fileSource = fileSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFileReference(FileReference fileReference) {
|
|
||||||
this.fileReference = fileReference;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileReference getFileReference() {
|
public FileReference getFileReference() {
|
||||||
return this.fileReference;
|
return this.fileReference;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void setFileReference(FileReference fileReference) {
|
||||||
public String toString() {
|
this.fileReference = fileReference;
|
||||||
return "ProjectFile(id=" + this.getId() + ", project=" + this.getProject() + ", fileSource=" + this.getFileSource() + ", fileDescription=" + this.getFileDescription() + ")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Project getProject() {
|
||||||
|
return this.project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProject(Project project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -79,12 +96,24 @@ public class ProjectFile extends DomainObject {
|
||||||
&& Objects.equals(this.getFileDescription(), other.getFileDescription());
|
&& Objects.equals(this.getFileDescription(), other.getFileDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof ProjectFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.getId(), this.getProject(), this.getFileSource(), this.getFileDescription());
|
return Objects.hash(this.getId(), this.getProject(), this.getFileSource(), this.getFileDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ProjectFile(id=" + this.getId() + ", project=" + this.getProject() + ", fileSource=" + this.getFileSource() + ", fileDescription=" + this.getFileDescription() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof ProjectFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileDescription getFileDescription() {
|
||||||
|
return this.fileReference.getFileDescription();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,15 @@ import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.OneToMany;
|
import jakarta.persistence.OneToMany;
|
||||||
import jakarta.persistence.OneToOne;
|
import jakarta.persistence.OneToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import java.util.*;
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "final_seminar")
|
@Table(name = "final_seminar")
|
||||||
|
@ -35,27 +43,69 @@ public class FinalSeminar extends LazyDeletableDomainObject {
|
||||||
public static final int DEFAULT_MAX_PARTICIPANTS = 5;
|
public static final int DEFAULT_MAX_PARTICIPANTS = 5;
|
||||||
public static final String FINAL_SEMINAR = "finalSeminar";
|
public static final String FINAL_SEMINAR = "finalSeminar";
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@OneToOne(optional = false)
|
|
||||||
@QueryInit({"projectType", "headSupervisor"})
|
|
||||||
private Project project;
|
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "start_date")
|
||||||
private Date startDate;
|
private Date startDate;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "room")
|
||||||
private String room;
|
private String room;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "max_opponents")
|
||||||
|
private int maxOpponents = DEFAULT_MAX_OPPONENTS;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "max_participants")
|
||||||
|
private int maxParticipants = DEFAULT_MAX_PARTICIPANTS;
|
||||||
|
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(name = "presentation_lang")
|
||||||
|
private Language presentationLanguage;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "document_upload_date")
|
||||||
|
private Date documentUploadDate;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "extra_info")
|
@Column(name = "extra_info")
|
||||||
private String extraInfo;
|
private String extraInfo;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
@Column(name = "creation_reason")
|
||||||
|
private String creationReason;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "manual_participants")
|
||||||
private Boolean manualParticipants = false;
|
private Boolean manualParticipants = false;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (final_seminar) referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
* Cascading delete, set document to nul will delete the filedescription but
|
||||||
|
* not the actual file. Use FinarSeminarUploadController.deleteSeminarReport
|
||||||
|
* to delete the document
|
||||||
|
*/
|
||||||
|
@OneToOne(cascade = CascadeType.ALL)
|
||||||
|
@JoinColumn(name = "document_file_reference_id", referencedColumnName = "id")
|
||||||
tozh4728 marked this conversation as resolved
Outdated
ansv7779
commented
Less self describing column name. Less self describing column name. `document_reference_id` tells you something extra rather than just a generic `file_reference_id`. The referenced table/type is visible from the foreign key/class. Each seminar also has multiple documents related to it so a better name is useful. Especially since the column `document_upload_date` references some "document" but there is no document file column.
|
|||||||
|
private FileReference document;
|
||||||
|
|
||||||
|
@OneToOne(optional = false)
|
||||||
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
|
@QueryInit({"projectType", "headSupervisor"})
|
||||||
|
private Project project;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of other tables referencing to this table "final_seminar"
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@OneToMany(mappedBy = FINAL_SEMINAR, orphanRemoval = true, cascade = CascadeType.ALL)
|
@OneToMany(mappedBy = FINAL_SEMINAR, orphanRemoval = true, cascade = CascadeType.ALL)
|
||||||
private Set<FinalSeminarActiveParticipation> activeParticipations = new HashSet<>();
|
private Set<FinalSeminarActiveParticipation> activeParticipations = new HashSet<>();
|
||||||
|
|
||||||
|
@ -65,28 +115,10 @@ public class FinalSeminar extends LazyDeletableDomainObject {
|
||||||
@OneToMany(mappedBy = FINAL_SEMINAR, orphanRemoval = true, cascade = CascadeType.ALL)
|
@OneToMany(mappedBy = FINAL_SEMINAR, orphanRemoval = true, cascade = CascadeType.ALL)
|
||||||
private Set<FinalSeminarRespondent> respondents = new HashSet<>();
|
private Set<FinalSeminarRespondent> respondents = new HashSet<>();
|
||||||
|
|
||||||
/*
|
// ----------------------------------------------------------------------------------
|
||||||
* Cascading delete, set document to nul will delete the filedescription but
|
// Constructors
|
||||||
* not the actual file. Use FinarSeminarUploadController.deleteSeminarReport
|
// ----------------------------------------------------------------------------------
|
||||||
* to delete the document
|
|
||||||
*/
|
|
||||||
@OneToOne(cascade = CascadeType.ALL)
|
|
||||||
@JoinColumn(name = "document_reference_id")
|
|
||||||
private FileReference document;
|
|
||||||
|
|
||||||
private Date documentUploadDate;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private Language presentationLanguage;
|
|
||||||
|
|
||||||
private int maxOpponents = DEFAULT_MAX_OPPONENTS;
|
|
||||||
private int maxParticipants = DEFAULT_MAX_PARTICIPANTS;
|
|
||||||
|
|
||||||
@Basic
|
|
||||||
private String creationReason;
|
|
||||||
|
|
||||||
public FinalSeminar() {
|
public FinalSeminar() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public FinalSeminar(int maxOpponents, int maxParticipants) {
|
public FinalSeminar(int maxOpponents, int maxParticipants) {
|
||||||
|
@ -99,6 +131,90 @@ public class FinalSeminar extends LazyDeletableDomainObject {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return isDeleted();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancelled) {
|
||||||
|
setDeleted(cancelled);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getStartDate() {
|
||||||
|
return this.startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartDate(Date startDate) {
|
||||||
|
this.startDate = (Date) startDate.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoom() {
|
||||||
|
return this.room;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoom(String room) {
|
||||||
|
this.room = room;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxOpponents() {
|
||||||
|
return this.maxOpponents;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxOpponents(int maxOpponents) {
|
||||||
|
this.maxOpponents = maxOpponents;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxParticipants() {
|
||||||
|
return this.maxParticipants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxParticipants(int maxParticipants) {
|
||||||
|
this.maxParticipants = maxParticipants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Language getPresentationLanguage() {
|
||||||
|
return this.presentationLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPresentationLanguage(Language presentationLanguage) {
|
||||||
|
this.presentationLanguage = presentationLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDocumentUploadDate() {
|
||||||
|
return this.documentUploadDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDocumentUploadDate(Date documentUploadDate) {
|
||||||
|
this.documentUploadDate = documentUploadDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExtraInfo() {
|
||||||
|
return extraInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtraInfo(String extraInfo) {
|
||||||
|
this.extraInfo = extraInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreationReason() {
|
||||||
|
return this.creationReason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreationReason(String creationReason) {
|
||||||
|
this.creationReason = creationReason;
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean getManualParticipants() {
|
public Boolean getManualParticipants() {
|
||||||
return manualParticipants;
|
return manualParticipants;
|
||||||
}
|
}
|
||||||
|
@ -107,21 +223,83 @@ public class FinalSeminar extends LazyDeletableDomainObject {
|
||||||
this.manualParticipants = manualParticipants;
|
this.manualParticipants = manualParticipants;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartDate(Date startDate) {
|
public FileReference getDocument() {
|
||||||
this.startDate = (Date) startDate.clone();
|
return this.document;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDocument(FileReference document) {
|
||||||
|
this.document = document;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Project getProject() {
|
public Project getProject() {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setProject(Project project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<FinalSeminarActiveParticipation> getActiveParticipations() {
|
||||||
|
return Collections.unmodifiableSet(activeParticipations);
|
||||||
|
}
|
||||||
|
|
||||||
public void setActiveParticipations(Collection<FinalSeminarActiveParticipation> activeParticipations) {
|
public void setActiveParticipations(Collection<FinalSeminarActiveParticipation> activeParticipations) {
|
||||||
this.activeParticipations.clear();
|
this.activeParticipations.clear();
|
||||||
this.activeParticipations.addAll(activeParticipations);
|
this.activeParticipations.addAll(activeParticipations);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<FinalSeminarActiveParticipation> getActiveParticipations() {
|
public Set<FinalSeminarOpposition> getOppositions() {
|
||||||
return Collections.unmodifiableSet(activeParticipations);
|
return Collections.unmodifiableSet(oppositions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOppositions(Collection<FinalSeminarOpposition> oppositions) {
|
||||||
|
this.oppositions.clear();
|
||||||
|
this.oppositions.addAll(oppositions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<FinalSeminarRespondent> getRespondents() {
|
||||||
|
return this.respondents;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRespondents(Set<FinalSeminarRespondent> respondents) {
|
||||||
|
this.respondents = respondents;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object o) {
|
||||||
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof FinalSeminar)) return false;
|
||||||
|
final FinalSeminar other = (FinalSeminar) o;
|
||||||
|
return other.canEqual(this)
|
||||||
|
&& super.equals(o)
|
||||||
|
&& Objects.equals(this.getId(), other.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(this.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "FinalSeminar(id=" + this.getId() + ", project=" + this.getProject() + ", startDate=" +
|
||||||
|
this.getStartDate() + ", room=" + this.getRoom() + ", activeParticipations=" +
|
||||||
|
this.getActiveParticipations() + ", oppositions=" + this.getOppositions() +
|
||||||
|
", respondents=" + this.getRespondents() + ", document=" + this.getDocument() +
|
||||||
|
", documentUploadDate=" + this.getDocumentUploadDate() + ", presentationLanguage=" +
|
||||||
|
this.getPresentationLanguage() + ", maxOpponents=" + this.getMaxOpponents() +
|
||||||
|
", maxParticipants=" + this.getMaxParticipants() + ", creationReason=" +
|
||||||
|
this.getCreationReason() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof FinalSeminar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addActiveParticipant(FinalSeminarActiveParticipation participation) {
|
public void addActiveParticipant(FinalSeminarActiveParticipation participation) {
|
||||||
|
@ -132,25 +310,62 @@ public class FinalSeminar extends LazyDeletableDomainObject {
|
||||||
this.activeParticipations.remove(participation);
|
this.activeParticipations.remove(participation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOppositions(Collection<FinalSeminarOpposition> oppositions) {
|
public void removeActiveParticipant(User user) {
|
||||||
this.oppositions.clear();
|
activeParticipations.removeIf(next -> next.getUser().equals(user));
|
||||||
this.oppositions.addAll(oppositions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<FinalSeminarOpposition> getOppositions() {
|
public Set<User> getActiveParticipants(){
|
||||||
return Collections.unmodifiableSet(oppositions);
|
Set<User> activeParticipants = new HashSet<>();
|
||||||
|
for (FinalSeminarActiveParticipation fsap : activeParticipations){
|
||||||
|
activeParticipants.add(fsap.getUser());
|
||||||
|
}
|
||||||
|
return activeParticipants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<User> getNotGradedActiveParticipations() {
|
||||||
|
return getNotGradedParticipations(activeParticipations);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addOpposition(FinalSeminarOpposition opposition) {
|
public void addOpposition(FinalSeminarOpposition opposition) {
|
||||||
this.oppositions.add(opposition);
|
this.oppositions.add(opposition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeOpposition(FinalSeminarOpposition opposition) {
|
||||||
|
this.oppositions.remove(opposition);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<User> getOpponents(){
|
||||||
|
Set<User> opponents = new HashSet<>();
|
||||||
|
for (FinalSeminarOpposition fso : oppositions){
|
||||||
|
opponents.add(fso.getUser());
|
||||||
|
}
|
||||||
|
return opponents;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<User> getNotGradedOpponents() {
|
||||||
|
return getNotGradedParticipations(oppositions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<User> getNotGradedRespondents() {
|
||||||
|
return getNotGradedParticipations(respondents);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Collection<User> getNotGradedParticipations(Set<? extends FinalSeminarParticipation> participations) {
|
||||||
|
List<User> result = new ArrayList<>();
|
||||||
|
for (FinalSeminarParticipation participation : participations) {
|
||||||
|
if(participation.getGrade() == null) {
|
||||||
|
result.add(participation.getUser());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public int getMinOpponents() {
|
public int getMinOpponents() {
|
||||||
return project.getMinOpponentsOnFinalSeminar();
|
return getProject().getMinOpponentsOnFinalSeminar();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMinActiveParticipants() {
|
public int getMinActiveParticipants() {
|
||||||
return project.getMinFinalSeminarActiveParticipation();
|
return getProject().getMinFinalSeminarActiveParticipation();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Member> getMembers() {
|
public List<Member> getMembers() {
|
||||||
|
@ -172,177 +387,10 @@ public class FinalSeminar extends LazyDeletableDomainObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectType getProjectType() {
|
public ProjectType getProjectType() {
|
||||||
return project.getProjectType();
|
return getProject().getProjectType();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProjectTitle() {
|
public String getProjectTitle() {
|
||||||
return project.getTitle();
|
return getProject().getTitle();
|
||||||
}
|
|
||||||
|
|
||||||
public void setCancelled(boolean cancelled) {
|
|
||||||
setDeleted(cancelled);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCancelled() {
|
|
||||||
return isDeleted();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeOpposition(FinalSeminarOpposition opposition) {
|
|
||||||
this.oppositions.remove(opposition);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<User> getNotGradedOpponents() {
|
|
||||||
return getNotGradedParticipations(oppositions);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<User> getNotGradedActiveParticipations() {
|
|
||||||
return getNotGradedParticipations(activeParticipations);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<User> getNotGradedRespondents() {
|
|
||||||
return getNotGradedParticipations(respondents);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Collection<User> getNotGradedParticipations(Set<? extends FinalSeminarParticipation> participations) {
|
|
||||||
List<User> result = new ArrayList<>();
|
|
||||||
for (FinalSeminarParticipation participation : participations) {
|
|
||||||
if(participation.getGrade() == null) {
|
|
||||||
result.add(participation.getUser());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<User> getOpponents(){
|
|
||||||
Set<User> opponents = new HashSet<>();
|
|
||||||
for (FinalSeminarOpposition fso : oppositions){
|
|
||||||
opponents.add(fso.getUser());
|
|
||||||
}
|
|
||||||
return opponents;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<User> getActiveParticipants(){
|
|
||||||
Set<User> activeParticipants = new HashSet<>();
|
|
||||||
for (FinalSeminarActiveParticipation fsap : activeParticipations){
|
|
||||||
activeParticipants.add(fsap.getUser());
|
|
||||||
}
|
|
||||||
return activeParticipants;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeActiveParticipant(User user) {
|
|
||||||
activeParticipations.removeIf(next -> next.getUser().equals(user));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getStartDate() {
|
|
||||||
return this.startDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRoom() {
|
|
||||||
return this.room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<FinalSeminarRespondent> getRespondents() {
|
|
||||||
return this.respondents;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileReference getDocument() {
|
|
||||||
return this.document;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getDocumentUploadDate() {
|
|
||||||
return this.documentUploadDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Language getPresentationLanguage() {
|
|
||||||
return this.presentationLanguage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMaxOpponents() {
|
|
||||||
return this.maxOpponents;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMaxParticipants() {
|
|
||||||
return this.maxParticipants;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProject(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoom(String room) {
|
|
||||||
this.room = room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRespondents(Set<FinalSeminarRespondent> respondents) {
|
|
||||||
this.respondents = respondents;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDocument(FileReference document) {
|
|
||||||
this.document = document;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDocumentUploadDate(Date documentUploadDate) {
|
|
||||||
this.documentUploadDate = documentUploadDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPresentationLanguage(Language presentationLanguage) {
|
|
||||||
this.presentationLanguage = presentationLanguage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxOpponents(int maxOpponents) {
|
|
||||||
this.maxOpponents = maxOpponents;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxParticipants(int maxParticipants) {
|
|
||||||
this.maxParticipants = maxParticipants;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreationReason(String creationReason) {
|
|
||||||
this.creationReason = creationReason;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getExtraInfo() {
|
|
||||||
return extraInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExtraInfo(String extraInfo) {
|
|
||||||
this.extraInfo = extraInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "FinalSeminar(id=" + this.getId() + ", project=" + this.getProject() + ", startDate=" + this.getStartDate() + ", room=" + this.getRoom() + ", activeParticipations=" + this.getActiveParticipations() + ", oppositions=" + this.getOppositions() + ", respondents=" + this.getRespondents() + ", document=" + this.getDocument() + ", documentUploadDate=" + this.getDocumentUploadDate() + ", presentationLanguage=" + this.getPresentationLanguage() + ", maxOpponents=" + this.getMaxOpponents() + ", maxParticipants=" + this.getMaxParticipants() + ", creationReason=" + this.getCreationReason() + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object o) {
|
|
||||||
if (o == this) return true;
|
|
||||||
if (!(o instanceof FinalSeminar)) return false;
|
|
||||||
final FinalSeminar other = (FinalSeminar) o;
|
|
||||||
return other.canEqual(this)
|
|
||||||
&& super.equals(o)
|
|
||||||
&& Objects.equals(this.getId(), other.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof FinalSeminar;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(this.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreationReason() {
|
|
||||||
return this.creationReason;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package se.su.dsv.scipro.finalseminar;
|
package se.su.dsv.scipro.finalseminar;
|
||||||
|
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
|
|
||||||
import jakarta.persistence.Cacheable;
|
import jakarta.persistence.Cacheable;
|
||||||
|
@ -9,13 +10,20 @@ import jakarta.persistence.Table;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Cacheable(true)
|
|
||||||
@Table(name = "final_seminar_active_participation")
|
@Table(name = "final_seminar_active_participation")
|
||||||
|
@Cacheable(true)
|
||||||
public class FinalSeminarActiveParticipation extends FinalSeminarParticipation {
|
public class FinalSeminarActiveParticipation extends FinalSeminarParticipation {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (final_seminar_active_participation)
|
||||||
|
// referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
private Project project;
|
private Project project;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Project getProject() {
|
public Project getProject() {
|
||||||
return this.project;
|
return this.project;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +32,9 @@ public class FinalSeminarActiveParticipation extends FinalSeminarParticipation {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -34,13 +45,16 @@ public class FinalSeminarActiveParticipation extends FinalSeminarParticipation {
|
||||||
&& Objects.equals(this.project, other.project);
|
&& Objects.equals(this.project, other.project);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof FinalSeminarActiveParticipation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(super.hashCode(), this.getProject());
|
return Objects.hash(super.hashCode(), this.getProject());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof FinalSeminarActiveParticipation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,73 +13,90 @@ import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.OneToOne;
|
import jakarta.persistence.OneToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import java.util.*;
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="final_seminar_opposition")
|
@Table(name="final_seminar_opposition")
|
||||||
public class FinalSeminarOpposition extends FinalSeminarParticipation {
|
public class FinalSeminarOpposition extends FinalSeminarParticipation {
|
||||||
public static final int FEEDBACK_LENGTH = 2000;
|
private static final int FEEDBACK_LENGTH = 2000;
|
||||||
@ManyToOne(optional = false)
|
|
||||||
private Project project;
|
|
||||||
|
|
||||||
@OneToOne
|
|
||||||
@JoinColumn(name = "opponent_report_reference_id")
|
|
||||||
private FileReference opponentReport;
|
|
||||||
|
|
||||||
@OneToOne(optional = true, orphanRemoval = true, cascade = CascadeType.ALL, mappedBy = "finalSeminarOpposition")
|
|
||||||
private OppositionReport oppositionReport;
|
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Basic
|
@Basic
|
||||||
|
@Column(name = "points")
|
||||||
private Integer points;
|
private Integer points;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(length = FEEDBACK_LENGTH)
|
@Column(name = "feedback", length = FEEDBACK_LENGTH)
|
||||||
private String feedback;
|
private String feedback;
|
||||||
|
|
||||||
public ProjectType getProjectType() {
|
// ----------------------------------------------------------------------------------
|
||||||
return getFinalSeminar().getProject().getProjectType();
|
// JPA-mappings of foreign keys in this table (final_seminar_opposition) referencing
|
||||||
}
|
// other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "opponent_report_file_reference_id", referencedColumnName = "id")
|
||||||
|
private FileReference opponentReport;
|
||||||
|
|
||||||
public void setProject(final Project project) {
|
@ManyToOne(optional = false)
|
||||||
this.project = project;
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
}
|
private Project project;
|
||||||
|
|
||||||
public Project getProject() {
|
// ----------------------------------------------------------------------------------
|
||||||
return this.project;
|
// JPA-mappings of other tables referencing to this table (final_seminar_opposition)
|
||||||
}
|
// ----------------------------------------------------------------------------------
|
||||||
|
@OneToOne(optional = true, orphanRemoval = true, cascade = CascadeType.ALL,
|
||||||
public FileReference getOpponentReport() {
|
mappedBy = "finalSeminarOpposition")
|
||||||
return this.opponentReport;
|
private OppositionReport oppositionReport;
|
||||||
}
|
|
||||||
|
|
||||||
public OppositionReport getOppositionReport() {
|
|
||||||
return this.oppositionReport;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Integer getPoints() {
|
public Integer getPoints() {
|
||||||
return this.points;
|
return this.points;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFeedback() {
|
|
||||||
return this.feedback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOpponentReport(FileReference opponentReport) {
|
|
||||||
this.opponentReport = opponentReport;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOppositionReport(OppositionReport oppositionReport) {
|
|
||||||
this.oppositionReport = oppositionReport;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoints(Integer points) {
|
public void setPoints(Integer points) {
|
||||||
this.points = points;
|
this.points = points;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFeedback() {
|
||||||
|
return this.feedback;
|
||||||
|
}
|
||||||
|
|
||||||
public void setFeedback(String feedback) {
|
public void setFeedback(String feedback) {
|
||||||
this.feedback = feedback;
|
this.feedback = feedback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FileReference getOpponentReport() {
|
||||||
|
return this.opponentReport;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpponentReport(FileReference opponentReport) {
|
||||||
|
this.opponentReport = opponentReport;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Project getProject() {
|
||||||
|
return this.project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProject(final Project project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OppositionReport getOppositionReport() {
|
||||||
|
return this.oppositionReport;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOppositionReport(OppositionReport oppositionReport) {
|
||||||
|
this.oppositionReport = oppositionReport;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -90,13 +107,20 @@ public class FinalSeminarOpposition extends FinalSeminarParticipation {
|
||||||
&& Objects.equals(this.getProject(), other.getProject());
|
&& Objects.equals(this.getProject(), other.getProject());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(super.hashCode(), this.getProject());
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
protected boolean canEqual(final Object other) {
|
protected boolean canEqual(final Object other) {
|
||||||
return other instanceof FinalSeminarOpposition;
|
return other instanceof FinalSeminarOpposition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public ProjectType getProjectType() {
|
||||||
public int hashCode() {
|
return getFinalSeminar().getProject().getProjectType();
|
||||||
return Objects.hash(super.hashCode(), this.getProject());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,64 +1,66 @@
|
||||||
package se.su.dsv.scipro.finalseminar;
|
package se.su.dsv.scipro.finalseminar;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.MappedSuperclass;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
public abstract class FinalSeminarParticipation extends DomainObject {
|
public abstract class FinalSeminarParticipation extends DomainObject {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@Basic
|
||||||
private User user;
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(name = "grade")
|
||||||
|
private FinalSeminarGrade grade = null;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in tables whose entity class inherits from
|
||||||
|
// FinalSeminarParticipation class (such as final_seminar_active_participation,
|
||||||
|
// final_seminar_opposition, final_seminar_respondent) referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "final_seminar_id", referencedColumnName = "id")
|
||||||
private FinalSeminar finalSeminar;
|
private FinalSeminar finalSeminar;
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@ManyToOne(optional = false)
|
||||||
private FinalSeminarGrade grade = null;
|
@JoinColumn(name = "user_id", referencedColumnName = "id")
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected FinalSeminarParticipation() {
|
||||||
|
}
|
||||||
|
|
||||||
protected FinalSeminarParticipation(User user, FinalSeminar finalSeminar) {
|
protected FinalSeminarParticipation(User user, FinalSeminar finalSeminar) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.finalSeminar = finalSeminar;
|
this.finalSeminar = finalSeminar;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected FinalSeminarParticipation() {
|
// ----------------------------------------------------------------------------------
|
||||||
}
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public boolean isApproved() {
|
|
||||||
return grade == FinalSeminarGrade.APPROVED;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasGrade() {
|
|
||||||
return (grade != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUser(final User user) {
|
|
||||||
this.user = user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFinalSeminar(final FinalSeminar finalSeminar) {
|
|
||||||
this.finalSeminar = finalSeminar;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getUser() {
|
|
||||||
return this.user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FinalSeminar getFinalSeminar() {
|
|
||||||
return this.finalSeminar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FinalSeminarGrade getGrade() {
|
public FinalSeminarGrade getGrade() {
|
||||||
return this.grade;
|
return this.grade;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +69,29 @@ public abstract class FinalSeminarParticipation extends DomainObject {
|
||||||
this.grade = grade;
|
this.grade = grade;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasGrade() {
|
||||||
|
return (grade != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FinalSeminar getFinalSeminar() {
|
||||||
|
return this.finalSeminar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFinalSeminar(final FinalSeminar finalSeminar) {
|
||||||
|
this.finalSeminar = finalSeminar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getUser() {
|
||||||
|
return this.user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(final User user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -77,12 +102,20 @@ public abstract class FinalSeminarParticipation extends DomainObject {
|
||||||
&& Objects.equals(this.getFinalSeminar(), other.getFinalSeminar());
|
&& Objects.equals(this.getFinalSeminar(), other.getFinalSeminar());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof FinalSeminarParticipation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.getUser(), this.getFinalSeminar());
|
return Objects.hash(this.getUser(), this.getFinalSeminar());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof FinalSeminarParticipation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isApproved() {
|
||||||
|
return grade == FinalSeminarGrade.APPROVED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,17 +8,17 @@ import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Cacheable(true)
|
|
||||||
@Table(name = "final_seminar_respondent")
|
@Table(name = "final_seminar_respondent")
|
||||||
|
@Cacheable(true)
|
||||||
public class FinalSeminarRespondent extends FinalSeminarParticipation {
|
public class FinalSeminarRespondent extends FinalSeminarParticipation {
|
||||||
|
|
||||||
|
protected FinalSeminarRespondent() {
|
||||||
|
}
|
||||||
|
|
||||||
public FinalSeminarRespondent(User student, FinalSeminar finalSeminar) {
|
public FinalSeminarRespondent(User student, FinalSeminar finalSeminar) {
|
||||||
super(student, finalSeminar);
|
super(student, finalSeminar);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected FinalSeminarRespondent() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Project getProject() {
|
public Project getProject() {
|
||||||
return getFinalSeminar().getProject();
|
return getFinalSeminar().getProject();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
|
@Table(name = "final_seminar_settings")
|
||||||
public class FinalSeminarSettings extends DomainObject {
|
public class FinalSeminarSettings extends DomainObject {
|
||||||
public static final int DEFAULT_DAYS_AHEAD_TO_UPLOAD_THESIS = 10;
|
public static final int DEFAULT_DAYS_AHEAD_TO_UPLOAD_THESIS = 10;
|
||||||
public static final int DEFAULT_DAYS_AHEAD_TO_REGISTER_OPPOSITION = 3;
|
public static final int DEFAULT_DAYS_AHEAD_TO_REGISTER_OPPOSITION = 3;
|
||||||
|
@ -22,25 +23,26 @@ public class FinalSeminarSettings extends DomainObject {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "days_ahead_to_create", nullable = false)
|
||||||
private int daysAheadToCreate;
|
private int daysAheadToCreate;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "days_ahead_to_register_participation", nullable = false)
|
||||||
private int daysAheadToRegisterParticipation = DEFAULT_DAYS_AHEAD_TO_REGISTER_PARTICIPATION;
|
private int daysAheadToRegisterParticipation = DEFAULT_DAYS_AHEAD_TO_REGISTER_PARTICIPATION;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "days_ahead_to_register_opposition", nullable = false)
|
||||||
private int daysAheadToRegisterOpposition = DEFAULT_DAYS_AHEAD_TO_REGISTER_OPPOSITION;
|
private int daysAheadToRegisterOpposition = DEFAULT_DAYS_AHEAD_TO_REGISTER_OPPOSITION;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "days_ahead_to_upload_thesis", nullable = false)
|
||||||
private int daysAheadToUploadThesis = DEFAULT_DAYS_AHEAD_TO_UPLOAD_THESIS;
|
private int daysAheadToUploadThesis = DEFAULT_DAYS_AHEAD_TO_UPLOAD_THESIS;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "thesis_must_be_pdf", nullable = false)
|
||||||
private boolean thesisMustBePDF = false;
|
private boolean thesisMustBePDF = false;
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Column(name = "evaluation_url", nullable = true)
|
||||||
private String evaluationURL;
|
private String evaluationURL;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "opposition_priority_days", nullable = false)
|
||||||
private int oppositionPriorityDays;
|
private int oppositionPriorityDays;
|
||||||
|
|
||||||
public boolean getThesisMustBePDF() {
|
public boolean getThesisMustBePDF() {
|
||||||
|
|
|
@ -21,50 +21,67 @@ import jakarta.persistence.Table;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.Date;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table
|
@Table(name = "final_thesis")
|
||||||
public class FinalThesis extends DomainObject {
|
public class FinalThesis extends DomainObject {
|
||||||
|
|
||||||
public enum Status {
|
// ----------------------------------------------------------------------------------
|
||||||
APPROVED, REJECTED, NO_DECISION
|
// Basic JPA-mappings
|
||||||
}
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@Basic
|
||||||
@JoinColumn(name = "document_reference_id")
|
@Column(name = "title_sv")
|
||||||
private FileReference document;
|
private String swedishTitle;
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
@Basic
|
||||||
@JoinColumn(name = "text_matching_document_reference_id")
|
@Column(name = "title_en")
|
||||||
private FileReference textMatchingDocument;
|
private String englishTitle;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "status")
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private Status status = Status.NO_DECISION;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "date_approved")
|
||||||
|
private Date dateApproved;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "date_rejected")
|
||||||
|
private Date dateRejected;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "rejection_comment")
|
||||||
|
private String rejectionComment;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "text_matching_analysis")
|
@Column(name = "text_matching_analysis")
|
||||||
private String textMatchingAnalysis;
|
private String textMatchingAnalysis;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (final_thesis) referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne(optional = true)
|
||||||
|
@JoinColumn(name = "text_matching_document_reference_id", referencedColumnName = "id")
|
||||||
|
private FileReference textMatchingDocument;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
@JoinColumn(name = "project_id")
|
@JoinColumn(name = "document_reference_id", referencedColumnName = "id")
|
||||||
|
private FileReference document;
|
||||||
|
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
private Project project;
|
private Project project;
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
// ----------------------------------------------------------------------------------
|
||||||
private Status status = Status.NO_DECISION;
|
// JPA lifecycle method
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
private Date dateApproved;
|
|
||||||
|
|
||||||
private Date dateRejected;
|
|
||||||
|
|
||||||
private String englishTitle;
|
|
||||||
|
|
||||||
private String swedishTitle;
|
|
||||||
|
|
||||||
@Column(name = "rejection_comment")
|
|
||||||
private String rejectionComment;
|
|
||||||
|
|
||||||
@PrePersist
|
@PrePersist
|
||||||
@PreUpdate
|
@PreUpdate
|
||||||
void cleanTitle() {
|
void cleanTitle() {
|
||||||
|
@ -72,6 +89,126 @@ public class FinalThesis extends DomainObject {
|
||||||
this.swedishTitle = clean(this.swedishTitle);
|
this.swedishTitle = clean(this.swedishTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEnglishTitle() {
|
||||||
|
return this.englishTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnglishTitle(String englishTitle) {
|
||||||
|
this.englishTitle = englishTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSwedishTitle() {
|
||||||
|
return this.swedishTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSwedishTitle(String swedishTitle) {
|
||||||
|
this.swedishTitle = swedishTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Status getStatus() {
|
||||||
|
return this.status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Status status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDateApproved() {
|
||||||
|
return dateApproved;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDateApproved(Date dateApproved) {
|
||||||
|
this.dateApproved = dateApproved;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDateRejected() {
|
||||||
|
return dateRejected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDateRejected(Date dateRejected) {
|
||||||
|
this.dateRejected = dateRejected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRejectionComment() {
|
||||||
|
return rejectionComment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRejectionComment(String rejectionComment) {
|
||||||
|
this.rejectionComment = rejectionComment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTextMatchingAnalysis() {
|
||||||
|
return textMatchingAnalysis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTextMatchingAnalysis(String textMatchingAnalysis) {
|
||||||
|
this.textMatchingAnalysis = textMatchingAnalysis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileReference getTextMatchingDocument() {
|
||||||
|
return this.textMatchingDocument;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTextMatchingDocument(FileReference textMatchingDocument) {
|
||||||
|
this.textMatchingDocument = textMatchingDocument;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileReference getDocument() {
|
||||||
|
return this.document;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDocument(FileReference fileDescription) {
|
||||||
|
this.document = fileDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Project getProject() {
|
||||||
|
return this.project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProject(Project project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object o) {
|
||||||
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof FinalThesis)) return false;
|
||||||
|
final FinalThesis other = (FinalThesis) o;
|
||||||
|
return other.canEqual(this)
|
||||||
|
&& Objects.equals(this.getDocument(), other.getDocument())
|
||||||
|
&& Objects.equals(this.getProject(), other.getProject());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(this.getDocument(), this.getProject());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "FinalThesis(id=" + this.getId() + ", fileDescription=" + this.getDocument() + ", textMatchingDocument=" + this.getTextMatchingDocument() + ", project=" + this.getProject() + ", status=" + this.getStatus() + ", dateApproved=" + this.getDateApproved() + ", dateRejected=" + this.getDateRejected() + ", englishTitle=" + this.getEnglishTitle() + ", swedishTitle=" + this.getSwedishTitle() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
private String clean(String str) {
|
private String clean(String str) {
|
||||||
if (str == null) {
|
if (str == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -83,125 +220,23 @@ public class FinalThesis extends DomainObject {
|
||||||
.trim();
|
.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileReference getDocument() {
|
|
||||||
return this.document;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileReference getTextMatchingDocument() {
|
|
||||||
return this.textMatchingDocument;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Project getProject() {
|
|
||||||
return this.project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Status getStatus() {
|
|
||||||
return this.status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEnglishTitle() {
|
|
||||||
return this.englishTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSwedishTitle() {
|
|
||||||
return this.swedishTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDocument(FileReference fileDescription) {
|
|
||||||
this.document = fileDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTextMatchingDocument(FileReference textMatchingDocument) {
|
|
||||||
this.textMatchingDocument = textMatchingDocument;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProject(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(Status status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDateApproved(Date dateApproved) {
|
|
||||||
this.dateApproved = dateApproved;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDateRejected(Date dateRejected) {
|
|
||||||
this.dateRejected = dateRejected;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEnglishTitle(String englishTitle) {
|
|
||||||
this.englishTitle = englishTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSwedishTitle(String swedishTitle) {
|
|
||||||
this.swedishTitle = swedishTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTextMatchingAnalysis() {
|
|
||||||
return textMatchingAnalysis;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTextMatchingAnalysis(String textMatchingAnalysis) {
|
|
||||||
this.textMatchingAnalysis = textMatchingAnalysis;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRejectionComment() {
|
|
||||||
return rejectionComment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRejectionComment(String rejectionComment) {
|
|
||||||
this.rejectionComment = rejectionComment;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "FinalThesis(id=" + this.getId() + ", fileDescription=" + this.getDocument() + ", textMatchingDocument=" + this.getTextMatchingDocument() + ", project=" + this.getProject() + ", status=" + this.getStatus() + ", dateApproved=" + this.getDateApproved() + ", dateRejected=" + this.getDateRejected() + ", englishTitle=" + this.getEnglishTitle() + ", swedishTitle=" + this.getSwedishTitle() + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object o) {
|
|
||||||
if (o == this) return true;
|
|
||||||
if (!(o instanceof FinalThesis)) return false;
|
|
||||||
final FinalThesis other = (FinalThesis) o;
|
|
||||||
return other.canEqual(this)
|
|
||||||
&& Objects.equals(this.getDocument(), other.getDocument())
|
|
||||||
&& Objects.equals(this.getProject(), other.getProject());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
protected boolean canEqual(final Object other) {
|
||||||
return other instanceof FinalThesis;
|
return other instanceof FinalThesis;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(this.getDocument(), this.getProject());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isRejected() {
|
|
||||||
return getStatus() == Status.REJECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getDateRejected() {
|
|
||||||
return dateRejected;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getDateApproved() {
|
|
||||||
return dateApproved;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDate getUploadDate() {
|
public LocalDate getUploadDate() {
|
||||||
Instant instant = document.getFileDescription().getDateCreated().toInstant();
|
Instant instant = document.getFileDescription().getDateCreated().toInstant();
|
||||||
return instant.atZone(ZoneId.systemDefault()).toLocalDate();
|
return instant.atZone(ZoneId.systemDefault()).toLocalDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRejected() {
|
||||||
|
return getStatus() == Status.REJECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Nested types
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public enum Status {
|
||||||
|
APPROVED, REJECTED, NO_DECISION
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,58 @@
|
||||||
package se.su.dsv.scipro.firstmeeting;
|
package se.su.dsv.scipro.firstmeeting;
|
||||||
|
|
||||||
import com.querydsl.core.annotations.QueryInit;
|
import com.querydsl.core.annotations.QueryInit;
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import se.su.dsv.scipro.activityplan.Activity;
|
import se.su.dsv.scipro.activityplan.Activity;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "project_first_meeting")
|
@Table(name = "project_first_meeting")
|
||||||
public final class ProjectFirstMeeting extends DomainObject {
|
public final class ProjectFirstMeeting extends DomainObject {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@QueryInit("activityPlan.project")
|
|
||||||
@OneToOne(optional = false, cascade = CascadeType.ALL)
|
|
||||||
private Activity activity;
|
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "room")
|
||||||
private String room;
|
private String room;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (project_first_meeting) referencing
|
||||||
|
// other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@OneToOne(optional = false, cascade = CascadeType.ALL)
|
||||||
|
@JoinColumn(name = "activity_id", referencedColumnName = "id")
|
||||||
|
@QueryInit("activityPlan.project")
|
||||||
|
private Activity activity;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// constructor
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
protected ProjectFirstMeeting() {}
|
protected ProjectFirstMeeting() {}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// getters and setters
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDate() {
|
|
||||||
return activity.getDate();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRoom() {
|
public String getRoom() {
|
||||||
return room;
|
return room;
|
||||||
}
|
}
|
||||||
|
@ -40,10 +61,6 @@ public final class ProjectFirstMeeting extends DomainObject {
|
||||||
this.room = room;
|
this.room = room;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return activity.getDescription();
|
|
||||||
}
|
|
||||||
|
|
||||||
Activity getActivity() {
|
Activity getActivity() {
|
||||||
return activity;
|
return activity;
|
||||||
}
|
}
|
||||||
|
@ -51,4 +68,15 @@ public final class ProjectFirstMeeting extends DomainObject {
|
||||||
void setActivity(Activity activity) {
|
void setActivity(Activity activity) {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public Date getDate() {
|
||||||
|
return activity.getDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return activity.getDescription();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package se.su.dsv.scipro.forum.dataobjects;
|
package se.su.dsv.scipro.forum.dataobjects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
import jakarta.persistence.GenerationType;
|
import jakarta.persistence.GenerationType;
|
||||||
import se.su.dsv.scipro.file.FileReference;
|
import se.su.dsv.scipro.file.FileReference;
|
||||||
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
||||||
|
@ -15,54 +16,51 @@ import jakarta.persistence.Lob;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.OneToMany;
|
import jakarta.persistence.OneToMany;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import java.util.*;
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "forum_post")
|
@Table(name = "forum_post")
|
||||||
public class ForumPost extends LazyDeletableDomainObject {
|
public class ForumPost extends LazyDeletableDomainObject {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Lob
|
@Basic
|
||||||
@Column(name = "content", nullable = false)
|
@Column(name = "content", nullable = false)
|
||||||
|
@Lob
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (forum_post) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "user", nullable = true)
|
@JoinColumn(name = "thread_id", nullable = false)
|
||||||
private User postedBy;
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "thread", nullable = false)
|
|
||||||
private ForumThread forumThread;
|
private ForumThread forumThread;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "user_id", nullable = true)
|
||||||
|
private User postedBy;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of other tables referencing to this table "forum_post"
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@OneToMany(orphanRemoval = true)
|
@OneToMany(orphanRemoval = true)
|
||||||
@JoinTable(name = "forum_post_file_description",
|
@JoinTable(name = "forum_post_file_reference",
|
||||||
joinColumns = {@JoinColumn(name = "forum_post_id")},
|
joinColumns = {@JoinColumn(name = "forum_post_id", referencedColumnName = "id")},
|
||||||
inverseJoinColumns = {@JoinColumn(name = "file_reference_id")})
|
inverseJoinColumns = {@JoinColumn(name = "file_reference_id")})
|
||||||
private Set<FileReference> attachments = new HashSet<>();
|
private Set<FileReference> attachments = new HashSet<>();
|
||||||
|
|
||||||
public String getSubject() {
|
// ----------------------------------------------------------------------------------
|
||||||
return forumThread.getSubject();
|
// Properties (Getters and Setters)
|
||||||
}
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
public Set<FileReference> getAttachments() {
|
|
||||||
return attachments;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getPostedBy() {
|
|
||||||
return postedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContent() {
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ForumThread getForumThread() {
|
|
||||||
return forumThread;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
|
@ -72,27 +70,41 @@ public class ForumPost extends LazyDeletableDomainObject {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
public void setContent(String content) {
|
public void setContent(String content) {
|
||||||
this.content = content;
|
this.content = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPostedBy(User postedBy) {
|
public ForumThread getForumThread() {
|
||||||
this.postedBy = postedBy;
|
return forumThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setForumThread(ForumThread forumThread) {
|
public void setForumThread(ForumThread forumThread) {
|
||||||
this.forumThread = forumThread;
|
this.forumThread = forumThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public User getPostedBy() {
|
||||||
|
return postedBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPostedBy(User postedBy) {
|
||||||
|
this.postedBy = postedBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<FileReference> getAttachments() {
|
||||||
|
return attachments;
|
||||||
|
}
|
||||||
|
|
||||||
public void setAttachments(Set<FileReference> attachments) {
|
public void setAttachments(Set<FileReference> attachments) {
|
||||||
this.attachments = attachments;
|
this.attachments = attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// ----------------------------------------------------------------------------------
|
||||||
public String toString() {
|
// Methods Common To All Objects
|
||||||
return "ForumPost(id=" + this.getId() + ", content=" + this.getContent() + ", postedBy=" + this.getPostedBy() + ", forumThread=" + this.getForumThread() + ", attachments=" + this.getAttachments() + ")";
|
// ----------------------------------------------------------------------------------
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -106,10 +118,6 @@ public class ForumPost extends LazyDeletableDomainObject {
|
||||||
&& Objects.equals(this.getAttachments(), other.getAttachments());
|
&& Objects.equals(this.getAttachments(), other.getAttachments());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof ForumPost;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(
|
return Objects.hash(
|
||||||
|
@ -119,4 +127,22 @@ public class ForumPost extends LazyDeletableDomainObject {
|
||||||
this.getForumThread(),
|
this.getForumThread(),
|
||||||
this.getAttachments());
|
this.getAttachments());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ForumPost(id=" + this.getId() + ", content=" + this.getContent() +
|
||||||
|
", postedBy=" + this.getPostedBy() + ", forumThread=" + this.getForumThread() +
|
||||||
|
", attachments=" + this.getAttachments() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof ForumPost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubject() {
|
||||||
|
return forumThread.getSubject();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,21 @@
|
||||||
package se.su.dsv.scipro.forum.dataobjects;
|
package se.su.dsv.scipro.forum.dataobjects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.EmbeddedId;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "forum_post_read")
|
@Table(name = "forum_post_read_state")
|
||||||
public class ForumPostReadState implements Serializable {
|
public class ForumPostReadState implements Serializable {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic and embedded JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@EmbeddedId
|
@EmbeddedId
|
||||||
private ForumPostReadStateId id;
|
private ForumPostReadStateId id;
|
||||||
|
|
||||||
|
@ -16,6 +23,9 @@ public class ForumPostReadState implements Serializable {
|
||||||
@Column(name = "`read`", nullable = false)
|
@Column(name = "`read`", nullable = false)
|
||||||
private boolean read = false;
|
private boolean read = false;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public ForumPostReadState() {
|
public ForumPostReadState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +33,9 @@ public class ForumPostReadState implements Serializable {
|
||||||
id = new ForumPostReadStateId(user, post);
|
id = new ForumPostReadStateId(user, post);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public ForumPostReadStateId getId() {
|
public ForumPostReadStateId getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -39,4 +52,3 @@ public class ForumPostReadState implements Serializable {
|
||||||
this.read = read;
|
this.read = read;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,11 @@ import java.util.Objects;
|
||||||
@Embeddable
|
@Embeddable
|
||||||
public class ForumPostReadStateId implements Serializable {
|
public class ForumPostReadStateId implements Serializable {
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "user", nullable = false)
|
@JoinColumn(name = "user_id", nullable = false)
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "post", nullable = false)
|
@JoinColumn(name = "forum_post_id", nullable = false)
|
||||||
private ForumPost post;
|
private ForumPost post;
|
||||||
|
|
||||||
public ForumPostReadStateId() {
|
public ForumPostReadStateId() {
|
||||||
|
|
|
@ -1,9 +1,21 @@
|
||||||
package se.su.dsv.scipro.forum.dataobjects;
|
package se.su.dsv.scipro.forum.dataobjects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Inheritance;
|
||||||
|
import jakarta.persistence.InheritanceType;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.PostLoad;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -13,17 +25,88 @@ import java.util.Objects;
|
||||||
@Inheritance(strategy = InheritanceType.JOINED)
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
public class ForumThread extends LazyDeletableDomainObject {
|
public class ForumThread extends LazyDeletableDomainObject {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "forumThread", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
|
||||||
private List<ForumPost> posts = new ArrayList<>();
|
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "subject", nullable = false)
|
@Column(name = "subject", nullable = false)
|
||||||
private String subject;
|
private String subject;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of other tables referencing to this table "thread"
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@OneToMany(mappedBy = "forumThread", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||||
|
private List<ForumPost> posts = new ArrayList<>();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-lifecycle method
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@PostLoad
|
||||||
|
void lazyDeletion() {
|
||||||
|
posts.removeIf(LazyDeletableDomainObject::isDeleted);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubject() {
|
||||||
|
return subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubject(String subject) {
|
||||||
|
this.subject = subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ForumPost> getPosts() {
|
||||||
|
return this.posts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPosts(List<ForumPost> posts) {
|
||||||
|
this.posts = posts;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object o) {
|
||||||
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof ForumThread)) return false;
|
||||||
|
final ForumThread other = (ForumThread) o;
|
||||||
|
return other.canEqual(this)
|
||||||
|
&& Objects.equals(this.getId(), other.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(this.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ForumThread(id=" + this.getId() + ", subject=" + this.getSubject() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof ForumThread;
|
||||||
|
}
|
||||||
|
|
||||||
public void addPost(ForumPost post) {
|
public void addPost(ForumPost post) {
|
||||||
posts.add(post);
|
posts.add(post);
|
||||||
}
|
}
|
||||||
|
@ -32,15 +115,6 @@ public class ForumThread extends LazyDeletableDomainObject {
|
||||||
return posts.size();
|
return posts.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostLoad
|
|
||||||
void lazyDeletion() {
|
|
||||||
posts.removeIf(LazyDeletableDomainObject::isDeleted);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubject() {
|
|
||||||
return subject;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getCreatedBy(){
|
public User getCreatedBy(){
|
||||||
return getPosts().get(0).getPostedBy();
|
return getPosts().get(0).getPostedBy();
|
||||||
}
|
}
|
||||||
|
@ -53,48 +127,4 @@ public class ForumThread extends LazyDeletableDomainObject {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ForumPost> getPosts() {
|
|
||||||
return this.posts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPosts(List<ForumPost> posts) {
|
|
||||||
this.posts = posts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubject(String subject) {
|
|
||||||
this.subject = subject;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object o) {
|
|
||||||
if (o == this) return true;
|
|
||||||
if (!(o instanceof ForumThread)) return false;
|
|
||||||
final ForumThread other = (ForumThread) o;
|
|
||||||
return other.canEqual(this)
|
|
||||||
&& Objects.equals(this.getId(), other.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof ForumThread;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(this.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "ForumThread(id=" + this.getId() + ", subject=" + this.getSubject() + ")";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,49 +1,70 @@
|
||||||
package se.su.dsv.scipro.forum.dataobjects;
|
package se.su.dsv.scipro.forum.dataobjects;
|
||||||
|
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.group.Group;
|
import se.su.dsv.scipro.group.Group;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "group_thread")
|
@Table(name = "project_group_thread")
|
||||||
public class GroupThread implements Serializable {
|
public class GroupThread implements Serializable {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (project_group_thread) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "group_id", nullable = false)
|
@JoinColumn(name = "project_group_id", referencedColumnName = "id", nullable = false)
|
||||||
private Group group;
|
private Group group;
|
||||||
|
|
||||||
@OneToOne(cascade = CascadeType.ALL, optional = false)
|
@OneToOne(cascade = CascadeType.ALL, optional = false)
|
||||||
@JoinColumn(name = "thread_id")
|
@JoinColumn(name = "thread_id", referencedColumnName = "id")
|
||||||
private ForumThread forumThread;
|
private ForumThread forumThread;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Long getId() { return id; }
|
public Long getId() { return id; }
|
||||||
|
|
||||||
public Group getGroup() {
|
|
||||||
return group;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ForumThread getForumThread() {
|
|
||||||
return forumThread;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Group getGroup() {
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
public void setGroup(Group group) {
|
public void setGroup(Group group) {
|
||||||
this.group = group;
|
this.group = group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ForumThread getForumThread() {
|
||||||
|
return forumThread;
|
||||||
|
}
|
||||||
|
|
||||||
public void setForumThread(ForumThread forumThread) {
|
public void setForumThread(ForumThread forumThread) {
|
||||||
this.forumThread = forumThread;
|
this.forumThread = forumThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -55,10 +76,6 @@ public class GroupThread implements Serializable {
|
||||||
&& Objects.equals(this.getForumThread(), other.getForumThread());
|
&& Objects.equals(this.getForumThread(), other.getForumThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof GroupThread;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.getId(), this.getGroup(), this.getForumThread());
|
return Objects.hash(this.getId(), this.getGroup(), this.getForumThread());
|
||||||
|
@ -66,6 +83,14 @@ public class GroupThread implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "GroupThread(id=" + this.getId() + ", group=" + this.getGroup() + ", forumThread=" + this.getForumThread() + ")";
|
return "GroupThread(id=" + this.getId() + ", group=" + this.getGroup() + ", forumThread=" +
|
||||||
|
this.getForumThread() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof GroupThread;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,50 +1,70 @@
|
||||||
package se.su.dsv.scipro.forum.dataobjects;
|
package se.su.dsv.scipro.forum.dataobjects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "project_thread")
|
@Table(name = "project_thread")
|
||||||
public class ProjectThread implements Serializable {
|
public class ProjectThread implements Serializable {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@OneToOne(optional = false)
|
// ----------------------------------------------------------------------------------
|
||||||
@JoinColumn(name = "thread_id")
|
// JPA-mappings of foreign keys in this table (project_thread) referencing other
|
||||||
private ForumThread forumThread;
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
@JoinColumn(name = "project_id")
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
private Project project;
|
private Project project;
|
||||||
|
|
||||||
|
@OneToOne(optional = false)
|
||||||
|
@JoinColumn(name = "thread_id", referencedColumnName = "id")
|
||||||
|
private ForumThread forumThread;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Project getProject() {
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ForumThread getForumThread() {
|
|
||||||
return forumThread;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setForumThread(ForumThread forumThread) {
|
public Project getProject() {
|
||||||
this.forumThread = forumThread;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProject(Project project) {
|
public void setProject(Project project) {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ForumThread getForumThread() {
|
||||||
|
return forumThread;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setForumThread(ForumThread forumThread) {
|
||||||
|
this.forumThread = forumThread;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -56,10 +76,6 @@ public class ProjectThread implements Serializable {
|
||||||
&& Objects.equals(this.getProject(), other.getProject());
|
&& Objects.equals(this.getProject(), other.getProject());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof ProjectThread;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.getId(), this.getForumThread(), this.getProject());
|
return Objects.hash(this.getId(), this.getForumThread(), this.getProject());
|
||||||
|
@ -67,6 +83,14 @@ public class ProjectThread implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ProjectThread(id=" + this.getId() + ", forumThread=" + this.getForumThread() + ", project=" + this.getProject() + ")";
|
return "ProjectThread(id=" + this.getId() + ", forumThread=" + this.getForumThread() +
|
||||||
|
", project=" + this.getProject() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof ProjectThread;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,50 +1,69 @@
|
||||||
package se.su.dsv.scipro.forum.dataobjects;
|
package se.su.dsv.scipro.forum.dataobjects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "reviewer_thread")
|
@Table(name = "reviewer_thread")
|
||||||
public class ReviewerThread {
|
public class ReviewerThread {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mapping
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@OneToOne(optional = false)
|
// ----------------------------------------------------------------------------------
|
||||||
@JoinColumn(name = "thread_id")
|
// JPA-mappings of foreign keys in this table (mail_event) referencing other
|
||||||
private ForumThread forumThread;
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "project_id", unique = true)
|
@JoinColumn(name = "project_id", referencedColumnName = "id", unique = true)
|
||||||
private Project project;
|
private Project project;
|
||||||
|
|
||||||
|
@OneToOne(optional = false)
|
||||||
|
@JoinColumn(name = "thread_id", referencedColumnName = "id")
|
||||||
|
private ForumThread forumThread;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForumThread getForumThread() {
|
|
||||||
return this.forumThread;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Project getProject() {
|
|
||||||
return this.project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setForumThread(ForumThread forumThread) {
|
public Project getProject() {
|
||||||
this.forumThread = forumThread;
|
return this.project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProject(Project project) {
|
public void setProject(Project project) {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ForumThread getForumThread() {
|
||||||
|
return this.forumThread;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setForumThread(ForumThread forumThread) {
|
||||||
|
this.forumThread = forumThread;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -56,10 +75,6 @@ public class ReviewerThread {
|
||||||
&& Objects.equals(this.getProject(), other.getProject());
|
&& Objects.equals(this.getProject(), other.getProject());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof ReviewerThread;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.getId(), this.getForumThread(), this.getProject());
|
return Objects.hash(this.getId(), this.getForumThread(), this.getProject());
|
||||||
|
@ -67,6 +82,14 @@ public class ReviewerThread {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ReviewerThread(id=" + this.getId() + ", forumThread=" + this.getForumThread() + ", project=" + this.getProject() + ")";
|
return "ReviewerThread(id=" + this.getId() + ", forumThread=" + this.getForumThread() +
|
||||||
|
", project=" + this.getProject() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof ReviewerThread;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,44 @@
|
||||||
package se.su.dsv.scipro.forum.notifications;
|
package se.su.dsv.scipro.forum.notifications;
|
||||||
|
|
||||||
|
import jakarta.persistence.Embeddable;
|
||||||
|
import jakarta.persistence.EmbeddedId;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.MapsId;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.forum.dataobjects.ForumPost;
|
import se.su.dsv.scipro.forum.dataobjects.ForumPost;
|
||||||
import se.su.dsv.scipro.notifications.dataobject.NotificationEvent;
|
import se.su.dsv.scipro.notifications.dataobject.NotificationEvent;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "forum_notification")
|
@Table(name = "forum_notification")
|
||||||
class ForumNotification {
|
class ForumNotification {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Embedded JPA-mapping
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@EmbeddedId
|
@EmbeddedId
|
||||||
private Id id = new Id();
|
private Id id = new Id();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (forum_notification) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "forum_post_id", referencedColumnName = "id")
|
||||||
@MapsId("forumPostId")
|
@MapsId("forumPostId")
|
||||||
private ForumPost forumPost;
|
private ForumPost forumPost;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "notification_data_id")
|
||||||
@MapsId("notificationEventId")
|
@MapsId("notificationEventId")
|
||||||
private NotificationEvent notificationEvent;
|
private NotificationEvent notificationEvent;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
protected ForumNotification() { } // JPA
|
protected ForumNotification() { } // JPA
|
||||||
|
|
||||||
ForumNotification(final ForumPost forumPost, final NotificationEvent notificationEvent) {
|
ForumNotification(final ForumPost forumPost, final NotificationEvent notificationEvent) {
|
||||||
|
@ -28,6 +46,9 @@ class ForumNotification {
|
||||||
this.notificationEvent = notificationEvent;
|
this.notificationEvent = notificationEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public ForumPost getForumPost() {
|
public ForumPost getForumPost() {
|
||||||
return forumPost;
|
return forumPost;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +57,9 @@ class ForumNotification {
|
||||||
return notificationEvent;
|
return notificationEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -47,10 +71,6 @@ class ForumNotification {
|
||||||
&& Objects.equals(this.getNotificationEvent(), other.getNotificationEvent());
|
&& Objects.equals(this.getNotificationEvent(), other.getNotificationEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof ForumNotification;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.id, this.getForumPost(), this.getNotificationEvent());
|
return Objects.hash(this.id, this.getForumPost(), this.getNotificationEvent());
|
||||||
|
@ -58,9 +78,20 @@ class ForumNotification {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ForumNotification(id=" + this.id + ", forumPost=" + this.getForumPost() + ", notificationEvent=" + this.getNotificationEvent() + ")";
|
return "ForumNotification(id=" + this.id + ", forumPost=" + this.getForumPost() +
|
||||||
|
", notificationEvent=" + this.getNotificationEvent() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other method
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof ForumNotification;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Nested type
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Embeddable
|
@Embeddable
|
||||||
static class Id implements Serializable {
|
static class Id implements Serializable {
|
||||||
private Long forumPostId;
|
private Long forumPostId;
|
||||||
|
@ -103,7 +134,8 @@ class ForumNotification {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ForumNotification.Id(forumPostId=" + this.getForumPostId() + ", notificationEventId=" + this.getNotificationEventId() + ")";
|
return "ForumNotification.Id(forumPostId=" + this.getForumPostId() + ", notificationEventId=" +
|
||||||
|
this.getNotificationEventId() + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,81 +14,86 @@ public class GeneralSystemSettings extends DomainObject {
|
||||||
@Id
|
@Id
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
|
|
||||||
@Basic
|
@Column(name = "daisy_profile_link_base_url")
|
||||||
private String daisyProfileLinkBaseURL;
|
private String daisyProfileLinkBaseURL;
|
||||||
|
|
||||||
@Basic
|
@Column(name = "daisy_select_research_area_url")
|
||||||
private String daisySelectResearchAreaURL;
|
private String daisySelectResearchAreaURL;
|
||||||
|
|
||||||
@ElementCollection
|
@ElementCollection
|
||||||
@CollectionTable(name = "general_system_settings_alarm_recipients")
|
@CollectionTable(name = "general_system_settings_alarm_recipient",
|
||||||
|
joinColumns = @JoinColumn(name = "general_system_settings_id", referencedColumnName = "id"))
|
||||||
@Column(name = "mail")
|
@Column(name = "mail")
|
||||||
private List<String> alarmMails = new ArrayList<>();
|
private List<String> alarmMails = new ArrayList<>();
|
||||||
|
|
||||||
@ElementCollection
|
@ElementCollection
|
||||||
@CollectionTable(name = "general_system_settings_supervisor_change_recipients")
|
@CollectionTable(name = "general_system_settings_supervisor_change_recipient",
|
||||||
|
joinColumns = @JoinColumn(name = "general_system_settings_id", referencedColumnName = "id"))
|
||||||
@Column(name = "mail")
|
@Column(name = "mail")
|
||||||
private List<String> supervisorChangeMails = new ArrayList<>();
|
private List<String> supervisorChangeMails = new ArrayList<>();
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Column(name = "project_partner_days_to_live", nullable = true)
|
||||||
private int projectPartnerDaysToLive;
|
private int projectPartnerDaysToLive;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "mail_notifications", nullable = false)
|
||||||
private boolean mailNotifications = true;
|
private boolean mailNotifications = true;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "mail_from_name", nullable = false)
|
||||||
private String mailFromName = "SciPro";
|
private String mailFromName = "SciPro";
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "system_from_mail", nullable = false)
|
||||||
private String systemFromMail = "noreply-scipro@dsv.su.se";
|
private String systemFromMail = "noreply-scipro@dsv.su.se";
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "smtp_server", nullable = false)
|
||||||
private String smtpServer = "localhost";
|
private String smtpServer = "localhost";
|
||||||
|
|
||||||
|
@Column(name = "peer_display_latest_reviews")
|
||||||
private boolean peerDisplayLatestReviews = true;
|
private boolean peerDisplayLatestReviews = true;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "number_of_latest_reviews_displayed", nullable = false)
|
||||||
private int numberOfLatestReviewsDisplayed = DEFAULT_NUMER_OF_LATEST_REVIEWS_DISPLAYED;
|
private int numberOfLatestReviewsDisplayed = DEFAULT_NUMER_OF_LATEST_REVIEWS_DISPLAYED;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "public_reviews_activated", nullable = false)
|
||||||
private boolean publicReviewsActivated = true;
|
private boolean publicReviewsActivated = true;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "peer_download_enabled", nullable = false)
|
||||||
private boolean peerDownloadEnabled = true;
|
private boolean peerDownloadEnabled = true;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "scipro_url", nullable = false)
|
||||||
private String sciproURL = "http://localhost:8080/";
|
private String sciproURL = "http://localhost:8080/";
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "show_single_sign_on", nullable = false)
|
||||||
private boolean showSingleSignOn = true;
|
private boolean showSingleSignOn = true;
|
||||||
|
|
||||||
@ElementCollection
|
@ElementCollection
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
@JoinTable(name = "general_system_settings_system_modules")
|
@CollectionTable(name = "general_system_settings_system_module",
|
||||||
|
joinColumns = @JoinColumn(name = "general_system_settings_id", referencedColumnName = "id"))
|
||||||
|
@Column(name = "system_module")
|
||||||
private Set<SystemModule> systemModules = EnumSet.allOf(SystemModule.class);
|
private Set<SystemModule> systemModules = EnumSet.allOf(SystemModule.class);
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Column(name = "match_responsible_mail", nullable = true)
|
||||||
private String matchResponsibleMail = "";
|
private String matchResponsibleMail = "";
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Column(name = "reviewer_support_mail", nullable = true)
|
||||||
private String reviewerSupportMail;
|
private String reviewerSupportMail;
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Column(name = "thesis_support_mail", nullable = true)
|
||||||
private String thesisSupportMail;
|
private String thesisSupportMail;
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Column(name = "external_room_booking_url", nullable = true)
|
||||||
private String externalRoomBookingURL;
|
private String externalRoomBookingURL;
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Column(name = "external_getting_started_with_idea_url", nullable = true)
|
||||||
private String externalGettingStartedWithIdeaURL;
|
private String externalGettingStartedWithIdeaURL;
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Column(name = "external_grading_url", nullable = true)
|
||||||
private String externalGradingURL;
|
private String externalGradingURL;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "final_survey_available", nullable = false)
|
||||||
private boolean finalSurveyAvailable = false;
|
private boolean finalSurveyAvailable = false;
|
||||||
|
|
||||||
@Basic
|
@Column(name = "active_project_idea_support_mail")
|
||||||
private String activeProjectIdeaSupportMail;
|
private String activeProjectIdeaSupportMail;
|
||||||
|
|
||||||
public GeneralSystemSettings() {
|
public GeneralSystemSettings() {
|
||||||
|
|
|
@ -16,20 +16,31 @@ import java.time.Instant;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "grading_history_approvals")
|
@Table(name = "grading_history_approval")
|
||||||
public class ApprovedEvent {
|
public class ApprovedEvent {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "project_id")
|
|
||||||
private Project project;
|
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
@Column(name = "`when`")
|
@Column(name = "`when`")
|
||||||
private Instant when;
|
private Instant when;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (grading_history_rejections) referencing
|
||||||
|
// other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "project_id")
|
||||||
|
private Project project;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -38,14 +49,6 @@ public class ApprovedEvent {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Project getProject() {
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProject(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getWhen() {
|
public Instant getWhen() {
|
||||||
return when;
|
return when;
|
||||||
}
|
}
|
||||||
|
@ -54,6 +57,17 @@ public class ApprovedEvent {
|
||||||
this.when = when;
|
this.when = when;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Project getProject() {
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProject(Project project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
|
@ -70,10 +84,7 @@ public class ApprovedEvent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ApprovedEvent{" +
|
return "ApprovedEvent{" + "id=" + id + ", project=" + project +
|
||||||
"id=" + id +
|
", when=" + when + '}';
|
||||||
", project=" + project +
|
|
||||||
", when=" + when +
|
|
||||||
'}';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,21 +12,20 @@ import java.util.Objects;
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "national_subject_category")
|
@Table(name = "national_subject_category")
|
||||||
public class NationalSubjectCategory {
|
public class NationalSubjectCategory {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = jakarta.persistence.GenerationType.IDENTITY)
|
@GeneratedValue(strategy = jakarta.persistence.GenerationType.IDENTITY)
|
||||||
@Column(name = "id")
|
@Column(name = "id")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "external_id")
|
@Column(name = "name_sv")
|
||||||
private Integer externalId;
|
|
||||||
|
|
||||||
@Basic
|
|
||||||
@Column(name = "swedish_name")
|
|
||||||
private String swedishName;
|
private String swedishName;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "english_name")
|
@Column(name = "name_en")
|
||||||
private String englishName;
|
private String englishName;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
@ -37,9 +36,19 @@ public class NationalSubjectCategory {
|
||||||
@Column(name = "preselected")
|
@Column(name = "preselected")
|
||||||
private boolean preselected;
|
private boolean preselected;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "external_id")
|
||||||
|
private Integer externalId;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructor
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public NationalSubjectCategory() {
|
public NationalSubjectCategory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -48,14 +57,6 @@ public class NationalSubjectCategory {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getExternalId() {
|
|
||||||
return externalId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExternalId(Integer externalId) {
|
|
||||||
this.externalId = externalId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSwedishName() {
|
public String getSwedishName() {
|
||||||
return swedishName;
|
return swedishName;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +89,17 @@ public class NationalSubjectCategory {
|
||||||
this.preselected = preselected;
|
this.preselected = preselected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getExternalId() {
|
||||||
|
return externalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExternalId(Integer externalId) {
|
||||||
|
this.externalId = externalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) {
|
if (this == o) {
|
||||||
|
|
|
@ -17,34 +17,44 @@ import java.util.Objects;
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "publication_metadata")
|
@Table(name = "publication_metadata")
|
||||||
public class PublicationMetadata {
|
public class PublicationMetadata {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@OneToOne(optional = false)
|
|
||||||
private Project project;
|
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "abstract_swedish")
|
@Column(name = "abstract_sv")
|
||||||
private String abstractSwedish;
|
private String abstractSwedish;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "abstract_english")
|
@Column(name = "abstract_en")
|
||||||
private String abstractEnglish;
|
private String abstractEnglish;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "keywords_swedish")
|
@Column(name = "keywords_sv")
|
||||||
private String keywordsSwedish;
|
private String keywordsSwedish;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "keywords_english")
|
@Column(name = "keywords_en")
|
||||||
private String keywordsEnglish;
|
private String keywordsEnglish;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (publication_metadata) referencing
|
||||||
|
// other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "national_subject_category_id")
|
@JoinColumn(name = "national_subject_category_id")
|
||||||
private NationalSubjectCategory nationalSubjectCategory;;
|
private NationalSubjectCategory nationalSubjectCategory;;
|
||||||
|
|
||||||
|
@OneToOne(optional = false)
|
||||||
|
@JoinColumn(name = "project_id")
|
||||||
|
private Project project;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -53,14 +63,6 @@ public class PublicationMetadata {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Project getProject() {
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProject(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAbstractSwedish() {
|
public String getAbstractSwedish() {
|
||||||
return abstractSwedish;
|
return abstractSwedish;
|
||||||
}
|
}
|
||||||
|
@ -101,19 +103,17 @@ public class PublicationMetadata {
|
||||||
this.nationalSubjectCategory = nationalSubjectCategory;
|
this.nationalSubjectCategory = nationalSubjectCategory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public Project getProject() {
|
||||||
public String toString() {
|
return project;
|
||||||
return "PublicationMetadata{" +
|
|
||||||
"id=" + id +
|
|
||||||
", project=" + project +
|
|
||||||
", abstractSwedish='" + abstractSwedish + '\'' +
|
|
||||||
", abstractEnglish='" + abstractEnglish + '\'' +
|
|
||||||
", keywordsSwedish='" + keywordsSwedish + '\'' +
|
|
||||||
", keywordsEnglish='" + keywordsEnglish + '\'' +
|
|
||||||
", nationalSubjectCategory=" + nationalSubjectCategory + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setProject(Project project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
return o instanceof PublicationMetadata that &&
|
return o instanceof PublicationMetadata that &&
|
||||||
|
@ -124,4 +124,15 @@ public class PublicationMetadata {
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(id);
|
return Objects.hashCode(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "PublicationMetadata{" + "id=" + id + ", project=" + project +
|
||||||
|
", abstractSwedish='" + abstractSwedish + '\'' +
|
||||||
|
", abstractEnglish='" + abstractEnglish + '\'' +
|
||||||
|
", keywordsSwedish='" + keywordsSwedish + '\'' +
|
||||||
|
", keywordsEnglish='" + keywordsEnglish + '\'' +
|
||||||
|
", nationalSubjectCategory=" + nationalSubjectCategory + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,23 +17,35 @@ import java.time.Instant;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "grading_history_rejections")
|
@Table(name = "grading_history_rejection")
|
||||||
public class RejectionEvent {
|
public class RejectionEvent {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne
|
@Basic
|
||||||
@JoinColumn(name = "project_id")
|
@Column(name = "reason")
|
||||||
private Project project;
|
private String reason;
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
@Column(name = "`when`")
|
@Column(name = "`when`")
|
||||||
private Instant when;
|
private Instant when;
|
||||||
|
|
||||||
@Basic
|
// ----------------------------------------------------------------------------------
|
||||||
private String reason;
|
// JPA-mappings of foreign keys in this table (grading_history_rejections) referencing
|
||||||
|
// other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "project_id")
|
||||||
|
private Project project;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -42,22 +54,6 @@ public class RejectionEvent {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Project getProject() {
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProject(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getWhen() {
|
|
||||||
return when;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWhen(Instant when) {
|
|
||||||
this.when = when;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReason() {
|
public String getReason() {
|
||||||
return reason;
|
return reason;
|
||||||
}
|
}
|
||||||
|
@ -66,6 +62,25 @@ public class RejectionEvent {
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Instant getWhen() {
|
||||||
|
return when;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWhen(Instant when) {
|
||||||
|
this.when = when;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Project getProject() {
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProject(Project project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
|
|
|
@ -18,27 +18,38 @@ import java.time.Instant;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "grading_history_submissions")
|
@Table(name = "grading_history_submission")
|
||||||
public class SubmissionEvent {
|
public class SubmissionEvent {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "project_id")
|
|
||||||
private Project project;
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "author_id")
|
|
||||||
private User author;
|
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
@Column(name = "`when`")
|
@Column(name = "`when`")
|
||||||
private Instant when;
|
private Instant when;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
@Column(name = "corrections")
|
||||||
private String corrections;
|
private String corrections;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (grading_history_submission) referencing
|
||||||
|
// other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
|
private Project project;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "author_user_id", referencedColumnName = "id")
|
||||||
|
private User author;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -47,22 +58,6 @@ public class SubmissionEvent {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Project getProject() {
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProject(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getAuthor() {
|
|
||||||
return author;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuthor(User user) {
|
|
||||||
this.author = user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getWhen() {
|
public Instant getWhen() {
|
||||||
return when;
|
return when;
|
||||||
}
|
}
|
||||||
|
@ -79,6 +74,25 @@ public class SubmissionEvent {
|
||||||
this.corrections = corrections;
|
this.corrections = corrections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Project getProject() {
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProject(Project project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getAuthor() {
|
||||||
|
return author;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuthor(User user) {
|
||||||
|
this.author = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
|
@ -97,11 +111,8 @@ public class SubmissionEvent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "RejectionEvent{" +
|
return "RejectionEvent{" + "id=" + id + ", project=" + project +
|
||||||
"id=" + id +
|
", author=" + author + ", when=" + when +
|
||||||
", project=" + project +
|
|
||||||
", author=" + author +
|
|
||||||
", when=" + when +
|
|
||||||
", corrections='" + corrections + '\'' +
|
", corrections='" + corrections + '\'' +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,30 +18,124 @@ public class Group extends DomainObject {
|
||||||
|
|
||||||
public static final int STRING_MAX_LENGTH = 255;
|
public static final int STRING_MAX_LENGTH = 255;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column(length = STRING_MAX_LENGTH)
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "title", length = STRING_MAX_LENGTH)
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Basic(optional = true)
|
||||||
|
@Column(name = "description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "active")
|
||||||
|
private boolean active = true;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (project_group) referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
//Creator, should be a supervisor
|
//Creator, should be a supervisor
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
@JoinColumn(name = "user_id")
|
@JoinColumn(name = "user_id", referencedColumnName = "id")
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// @ManyToMany JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToMany
|
@ManyToMany
|
||||||
@JoinTable(
|
@JoinTable(name = "project_group_project",
|
||||||
name = "project_group_project",
|
joinColumns = @JoinColumn(name = "project_group_id", referencedColumnName = "id"),
|
||||||
joinColumns = @JoinColumn(name = "project_group_id"),
|
inverseJoinColumns = @JoinColumn(name = "project_id", referencedColumnName = "id"))
|
||||||
inverseJoinColumns = @JoinColumn(name = "project_id"))
|
|
||||||
private Set<Project> projects = new HashSet<>();
|
private Set<Project> projects = new HashSet<>();
|
||||||
|
|
||||||
private boolean active = true;
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
return this.active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActive(boolean active) {
|
||||||
|
this.active = active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getUser() {
|
||||||
|
return this.user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(User user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<Project> getProjects() {
|
||||||
|
return projects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProjects(Set<Project> projects) {
|
||||||
|
this.projects = projects;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object o) {
|
||||||
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof Group)) return false;
|
||||||
|
final Group other = (Group) o;
|
||||||
|
return other.canEqual(this)
|
||||||
|
&& Objects.equals(this.getId(), other.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(this.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Group(id=" + this.getId() + ", title=" + this.getTitle() + ", description=" +
|
||||||
|
this.getDescription() + ", user=" + this.getUser() + ", projects=" +
|
||||||
|
this.getProjects() + ", active=" + this.isActive() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof Group;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isAuthor(final User user) {
|
public boolean isAuthor(final User user) {
|
||||||
for (Project project : projects) {
|
for (Project project : projects) {
|
||||||
|
@ -58,76 +152,4 @@ public class Group extends DomainObject {
|
||||||
.filter(member -> member.getType() != Member.Type.REVIEWER)
|
.filter(member -> member.getType() != Member.Type.REVIEWER)
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Project> getProjects() {
|
|
||||||
return projects;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return this.description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getUser() {
|
|
||||||
return this.user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isActive() {
|
|
||||||
return this.active;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUser(User user) {
|
|
||||||
this.user = user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProjects(Set<Project> projects) {
|
|
||||||
this.projects = projects;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setActive(boolean active) {
|
|
||||||
this.active = active;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Group(id=" + this.getId() + ", title=" + this.getTitle() + ", description=" + this.getDescription() + ", user=" + this.getUser() + ", projects=" + this.getProjects() + ", active=" + this.isActive() + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object o) {
|
|
||||||
if (o == this) return true;
|
|
||||||
if (!(o instanceof Group)) return false;
|
|
||||||
final Group other = (Group) o;
|
|
||||||
return other.canEqual(this)
|
|
||||||
&& Objects.equals(this.getId(), other.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof Group;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(this.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,30 +1,49 @@
|
||||||
package se.su.dsv.scipro.integration.activityfinalseminar;
|
package se.su.dsv.scipro.integration.activityfinalseminar;
|
||||||
|
|
||||||
|
import jakarta.persistence.AttributeOverride;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Embeddable;
|
||||||
|
import jakarta.persistence.EmbeddedId;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.MapsId;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import se.su.dsv.scipro.activityplan.Activity;
|
import se.su.dsv.scipro.activityplan.Activity;
|
||||||
import se.su.dsv.scipro.finalseminar.FinalSeminar;
|
import se.su.dsv.scipro.finalseminar.FinalSeminar;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "activity_final_seminar")
|
@Table(name = "activity_final_seminar")
|
||||||
class ActivityFinalSeminar {
|
class ActivityFinalSeminar {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// embedded JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@EmbeddedId
|
@EmbeddedId
|
||||||
@AttributeOverride(name = "activityId", column = @Column(name = "activity_id"))
|
@AttributeOverride(name = "activityId", column = @Column(name = "activity_id"))
|
||||||
@AttributeOverride(name = "finalSeminarId", column = @Column(name = "final_seminar_id"))
|
@AttributeOverride(name = "finalSeminarId", column = @Column(name = "final_seminar_id"))
|
||||||
private Id id = new Id();
|
private Id id = new Id();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (activity_final_seminiar) referencing
|
||||||
|
// other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@MapsId("activityId")
|
@MapsId("activityId")
|
||||||
@JoinColumn(name = "activity_id")
|
@JoinColumn(name = "activity_id", referencedColumnName = "id")
|
||||||
private Activity activity;
|
private Activity activity;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@MapsId("finalSeminarId")
|
@MapsId("finalSeminarId")
|
||||||
@JoinColumn(name = "final_seminar_id")
|
@JoinColumn(name = "final_seminar_id", referencedColumnName = "id")
|
||||||
private FinalSeminar finalSeminar;
|
private FinalSeminar finalSeminar;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// constructor
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
protected ActivityFinalSeminar() {
|
protected ActivityFinalSeminar() {
|
||||||
// JPA
|
// JPA
|
||||||
}
|
}
|
||||||
|
@ -34,6 +53,9 @@ class ActivityFinalSeminar {
|
||||||
this.finalSeminar = finalSeminar;
|
this.finalSeminar = finalSeminar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// getters
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Id getId() {
|
public Id getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
@ -46,6 +68,9 @@ class ActivityFinalSeminar {
|
||||||
return this.finalSeminar;
|
return this.finalSeminar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -57,10 +82,6 @@ class ActivityFinalSeminar {
|
||||||
&& Objects.equals(this.getFinalSeminar(), other.getFinalSeminar());
|
&& Objects.equals(this.getFinalSeminar(), other.getFinalSeminar());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof ActivityFinalSeminar;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.getId(), this.getActivity(), this.getFinalSeminar());
|
return Objects.hash(this.getId(), this.getActivity(), this.getFinalSeminar());
|
||||||
|
@ -71,6 +92,13 @@ class ActivityFinalSeminar {
|
||||||
return "ActivityFinalSeminar(id=" + this.getId() + ", activity=" + this.getActivity() + ", finalSeminar=" + this.getFinalSeminar() + ")";
|
return "ActivityFinalSeminar(id=" + this.getId() + ", activity=" + this.getActivity() + ", finalSeminar=" + this.getFinalSeminar() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof ActivityFinalSeminar;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// nested class
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Embeddable
|
@Embeddable
|
||||||
static class Id implements Serializable {
|
static class Id implements Serializable {
|
||||||
private Long activityId;
|
private Long activityId;
|
||||||
|
|
|
@ -1,27 +1,44 @@
|
||||||
package se.su.dsv.scipro.integration.activityforum;
|
package se.su.dsv.scipro.integration.activityforum;
|
||||||
|
|
||||||
|
import jakarta.persistence.Embeddable;
|
||||||
|
import jakarta.persistence.EmbeddedId;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.MapsId;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import se.su.dsv.scipro.activityplan.Activity;
|
import se.su.dsv.scipro.activityplan.Activity;
|
||||||
import se.su.dsv.scipro.forum.dataobjects.ProjectThread;
|
import se.su.dsv.scipro.forum.dataobjects.ProjectThread;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "activity_thread")
|
@Table(name = "activity_thread")
|
||||||
class ActivityThread {
|
class ActivityThread {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// basic and embedded JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@EmbeddedId
|
@EmbeddedId
|
||||||
private Id id = new Id();
|
private Id id = new Id();
|
||||||
|
|
||||||
@ManyToOne
|
// ----------------------------------------------------------------------------------
|
||||||
@MapsId("threadId")
|
// JPA-mappings of foreign keys in this table (activity_thread) referencing other tables.
|
||||||
@JoinColumn(name = "project_thread_id")
|
// ----------------------------------------------------------------------------------
|
||||||
private ProjectThread thread;
|
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@MapsId("activityId")
|
@MapsId("activityId")
|
||||||
|
@JoinColumn(name = "activity_id", referencedColumnName = "id")
|
||||||
private Activity activity;
|
private Activity activity;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@MapsId("threadId")
|
||||||
|
@JoinColumn(name = "project_thread_id", referencedColumnName = "id")
|
||||||
|
private ProjectThread thread;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// constructor
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
protected ActivityThread() {
|
protected ActivityThread() {
|
||||||
// JPA
|
// JPA
|
||||||
}
|
}
|
||||||
|
@ -31,6 +48,9 @@ class ActivityThread {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// getters and setters
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Id getId() {
|
public Id getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +63,9 @@ class ActivityThread {
|
||||||
return this.activity;
|
return this.activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -54,10 +77,6 @@ class ActivityThread {
|
||||||
&& Objects.equals(this.getActivity(), other.getActivity());
|
&& Objects.equals(this.getActivity(), other.getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof ActivityThread;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.getId(), this.getThread(), this.getActivity());
|
return Objects.hash(this.getId(), this.getThread(), this.getActivity());
|
||||||
|
@ -68,6 +87,13 @@ class ActivityThread {
|
||||||
return "ActivityThread(id=" + this.getId() + ", thread=" + this.getThread() + ", activity=" + this.getActivity() + ")";
|
return "ActivityThread(id=" + this.getId() + ", thread=" + this.getThread() + ", activity=" + this.getActivity() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof ActivityThread;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// nested class
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Embeddable
|
@Embeddable
|
||||||
static class Id implements Serializable {
|
static class Id implements Serializable {
|
||||||
private Long threadId;
|
private Long threadId;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package se.su.dsv.scipro.mail;
|
package se.su.dsv.scipro.mail;
|
||||||
|
|
||||||
|
import jakarta.persistence.CollectionTable;
|
||||||
import jakarta.persistence.GenerationType;
|
import jakarta.persistence.GenerationType;
|
||||||
import se.su.dsv.scipro.file.FileReference;
|
import se.su.dsv.scipro.file.FileReference;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
@ -19,61 +20,80 @@ import jakarta.persistence.Lob;
|
||||||
import jakarta.persistence.ManyToMany;
|
import jakarta.persistence.ManyToMany;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import java.util.*;
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "mail_event")
|
@Table(name = "mail_event")
|
||||||
@Cacheable(false)
|
@Cacheable(false)
|
||||||
public class MailEvent extends DomainObject {
|
public class MailEvent extends DomainObject {
|
||||||
public static final int STRING_MAX_LENGTH = 255;
|
public static final int STRING_MAX_LENGTH = 255;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@JoinTable(
|
|
||||||
name = "mail_event_recipients",
|
|
||||||
joinColumns = @JoinColumn(name = "mail_event_id"),
|
|
||||||
inverseJoinColumns = @JoinColumn(name = "recipients_id"))
|
|
||||||
@ManyToMany(fetch = FetchType.EAGER)
|
|
||||||
private Set<User> recipients = new HashSet<>();
|
|
||||||
|
|
||||||
@ElementCollection
|
|
||||||
private Set<String> nonUserRecipients = new HashSet<>();
|
|
||||||
|
|
||||||
@Column(length = STRING_MAX_LENGTH)
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "subject", length = STRING_MAX_LENGTH)
|
||||||
private String subject;
|
private String subject;
|
||||||
|
|
||||||
@Column(length = STRING_MAX_LENGTH)
|
|
||||||
@Basic(optional = true)
|
@Basic(optional = true)
|
||||||
|
@Column(name = "from_name", length = STRING_MAX_LENGTH)
|
||||||
private String fromName;
|
private String fromName;
|
||||||
|
|
||||||
@Column(length = STRING_MAX_LENGTH)
|
|
||||||
@Basic(optional = true)
|
@Basic(optional = true)
|
||||||
|
@Column(name = "from_email", length = STRING_MAX_LENGTH)
|
||||||
private String fromEmail;
|
private String fromEmail;
|
||||||
|
|
||||||
@Lob
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "message_body")
|
||||||
|
@Lob
|
||||||
private String messageBody;
|
private String messageBody;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "sent")
|
||||||
private boolean sent = false;
|
private boolean sent = false;
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Basic(optional = true)
|
||||||
|
@Column(name = "message_id")
|
||||||
private String messageID;
|
private String messageID;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (mail_event) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne(optional = true)
|
@ManyToOne(optional = true)
|
||||||
@JoinColumn(name = "attachment_reference_id")
|
@JoinColumn(name = "attachment_file_reference_id", referencedColumnName = "id")
|
||||||
private FileReference attachment;
|
private FileReference attachment;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// @ManyToMany JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToMany(fetch = FetchType.EAGER)
|
||||||
|
@JoinTable(name = "mail_event_recipient",
|
||||||
|
joinColumns = @JoinColumn(name = "mail_event_id", referencedColumnName = "id"),
|
||||||
|
inverseJoinColumns = @JoinColumn(name = "recipient_id", referencedColumnName = "id"))
|
||||||
|
private Set<User> recipients = new HashSet<>();
|
||||||
|
|
||||||
|
@ElementCollection
|
||||||
|
@CollectionTable(name = "mail_event_non_user_recipient",
|
||||||
|
joinColumns = @JoinColumn(name = "mail_event_id", referencedColumnName = "id"))
|
||||||
|
@Column(name = "non_user_recipient")
|
||||||
|
private Set<String> nonUserRecipients = new HashSet<>();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public MailEvent() {
|
public MailEvent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public MailEvent(
|
public MailEvent(final String subject, final String messageBody, final User recipient, final String fromName,
|
||||||
final String subject,
|
|
||||||
final String messageBody,
|
|
||||||
final User recipient,
|
|
||||||
final String fromName,
|
|
||||||
final String fromEmail) {
|
final String fromEmail) {
|
||||||
this.subject = subject;
|
this.subject = subject;
|
||||||
this.messageBody = messageBody;
|
this.messageBody = messageBody;
|
||||||
|
@ -82,13 +102,8 @@ public class MailEvent extends DomainObject {
|
||||||
this.fromEmail = fromEmail;
|
this.fromEmail = fromEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MailEvent(
|
public MailEvent(final String subject, final String messageBody, final Collection<User> recipients,
|
||||||
final String subject,
|
final String fromName, final String fromEmail) {
|
||||||
final String messageBody,
|
|
||||||
final Collection<User> recipients,
|
|
||||||
final String fromName,
|
|
||||||
final String fromEmail
|
|
||||||
) {
|
|
||||||
this.subject = subject;
|
this.subject = subject;
|
||||||
this.messageBody = messageBody;
|
this.messageBody = messageBody;
|
||||||
this.recipients.addAll(recipients);
|
this.recipients.addAll(recipients);
|
||||||
|
@ -96,35 +111,124 @@ public class MailEvent extends DomainObject {
|
||||||
this.fromEmail = fromEmail;
|
this.fromEmail = fromEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSent() {
|
// ----------------------------------------------------------------------------------
|
||||||
return sent;
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markSent(final String messageID) {
|
public void setId(Long id) {
|
||||||
this.messageID = messageID;
|
this.id = id;
|
||||||
this.sent = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<User> getRecipients() {
|
public String getSubject() {
|
||||||
return recipients;
|
return this.subject;
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessageBody(String messageBody) {
|
|
||||||
this.messageBody = messageBody;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSubject(String subject) {
|
public void setSubject(String subject) {
|
||||||
this.subject = subject;
|
this.subject = subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFromName() {
|
||||||
|
return this.fromName;
|
||||||
|
}
|
||||||
|
|
||||||
public void setFromName(String fromName) {
|
public void setFromName(String fromName) {
|
||||||
this.fromName = fromName;
|
this.fromName = fromName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFromEmail() {
|
||||||
|
return this.fromEmail;
|
||||||
|
}
|
||||||
|
|
||||||
public void setFromEmail(String fromEmail) {
|
public void setFromEmail(String fromEmail) {
|
||||||
this.fromEmail = fromEmail;
|
this.fromEmail = fromEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getMessageBody() {
|
||||||
|
return this.messageBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageBody(String messageBody) {
|
||||||
|
this.messageBody = messageBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSent() {
|
||||||
|
return sent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSent(boolean sent) {
|
||||||
|
this.sent = sent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessageID() {
|
||||||
|
return this.messageID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageID(String messageID) {
|
||||||
|
this.messageID = messageID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileReference getAttachment() {
|
||||||
|
return this.attachment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttachment(FileReference attachment) {
|
||||||
|
this.attachment = attachment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<User> getRecipients() {
|
||||||
|
return recipients;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecipients(Set<User> recipients) {
|
||||||
|
this.recipients = recipients;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<String> getNonUserRecipients() {
|
||||||
|
return this.nonUserRecipients;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNonUserRecipients(Set<String> nonUserRecipients) {
|
||||||
|
this.nonUserRecipients = nonUserRecipients;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object o) {
|
||||||
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof MailEvent)) return false;
|
||||||
|
final MailEvent other = (MailEvent) o;
|
||||||
|
return other.canEqual(this)
|
||||||
|
&& Objects.equals(this.getId(), other.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(this.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "MailEvent(id=" + this.getId() + ", recipients=" + this.getRecipients() +
|
||||||
|
", nonUserRecipients=" + this.getNonUserRecipients() + ", subject=" +
|
||||||
|
this.getSubject() + ", fromName=" + this.getFromName() +
|
||||||
|
", fromEmail=" + this.getFromEmail() + ", messageBody=" + this.getMessageBody() +
|
||||||
|
", sent=" + this.isSent() + ", messageID=" + this.getMessageID() +
|
||||||
|
", attachment=" + this.getAttachment() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof MailEvent;
|
||||||
|
}
|
||||||
|
|
||||||
public void addRecipients(final Iterable<Recipient> recipients) {
|
public void addRecipients(final Iterable<Recipient> recipients) {
|
||||||
for (Recipient recipient : recipients) {
|
for (Recipient recipient : recipients) {
|
||||||
recipient.accept(new RecipientVisitor<Boolean>() {
|
recipient.accept(new RecipientVisitor<Boolean>() {
|
||||||
|
@ -141,83 +245,8 @@ public class MailEvent extends DomainObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void markSent(final String messageID) {
|
||||||
public Long getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<String> getNonUserRecipients() {
|
|
||||||
return this.nonUserRecipients;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubject() {
|
|
||||||
return this.subject;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFromName() {
|
|
||||||
return this.fromName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFromEmail() {
|
|
||||||
return this.fromEmail;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessageBody() {
|
|
||||||
return this.messageBody;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessageID() {
|
|
||||||
return this.messageID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileReference getAttachment() {
|
|
||||||
return this.attachment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRecipients(Set<User> recipients) {
|
|
||||||
this.recipients = recipients;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNonUserRecipients(Set<String> nonUserRecipients) {
|
|
||||||
this.nonUserRecipients = nonUserRecipients;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSent(boolean sent) {
|
|
||||||
this.sent = sent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessageID(String messageID) {
|
|
||||||
this.messageID = messageID;
|
this.messageID = messageID;
|
||||||
}
|
this.sent = true;
|
||||||
|
|
||||||
public void setAttachment(FileReference attachment) {
|
|
||||||
this.attachment = attachment;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "MailEvent(id=" + this.getId() + ", recipients=" + this.getRecipients() + ", nonUserRecipients=" + this.getNonUserRecipients() + ", subject=" + this.getSubject() + ", fromName=" + this.getFromName() + ", fromEmail=" + this.getFromEmail() + ", messageBody=" + this.getMessageBody() + ", sent=" + this.isSent() + ", messageID=" + this.getMessageID() + ", attachment=" + this.getAttachment() + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object o) {
|
|
||||||
if (o == this) return true;
|
|
||||||
if (!(o instanceof MailEvent)) return false;
|
|
||||||
final MailEvent other = (MailEvent) o;
|
|
||||||
return other.canEqual(this)
|
|
||||||
&& Objects.equals(this.getId(), other.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof MailEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(this.getId());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,30 @@
|
||||||
package se.su.dsv.scipro.match;
|
package se.su.dsv.scipro.match;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.ProjectType;
|
import se.su.dsv.scipro.system.ProjectType;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
@Table(name="ApplicationPeriod")
|
@Table(name="application_period")
|
||||||
public class ApplicationPeriod extends DomainObject {
|
public class ApplicationPeriod extends DomainObject {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@ -23,17 +36,16 @@ public class ApplicationPeriod extends DomainObject {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Basic
|
@Column(name = "start_date")
|
||||||
private LocalDate startDate = LocalDate.now();
|
private LocalDate startDate = LocalDate.now();
|
||||||
|
|
||||||
@Basic
|
@Column(name = "end_date")
|
||||||
private LocalDate endDate = LocalDate.now();
|
private LocalDate endDate = LocalDate.now();
|
||||||
|
|
||||||
@Basic
|
@Column(name = "course_start_date")
|
||||||
@Column(name = "courseStartDate")
|
|
||||||
private LocalDateTime courseStartDateTime = LocalDate.now().atTime(8, 0);
|
private LocalDateTime courseStartDateTime = LocalDate.now().atTime(8, 0);
|
||||||
|
|
||||||
@Basic
|
@Column(name = "course_end_date")
|
||||||
private LocalDate courseEndDate;
|
private LocalDate courseEndDate;
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "applicationPeriod", cascade=CascadeType.ALL, orphanRemoval=true)
|
@OneToMany(fetch = FetchType.LAZY, mappedBy = "applicationPeriod", cascade=CascadeType.ALL, orphanRemoval=true)
|
||||||
|
|
|
@ -1,15 +1,23 @@
|
||||||
package se.su.dsv.scipro.match;
|
package se.su.dsv.scipro.match;
|
||||||
|
|
||||||
import se.su.dsv.scipro.system.User;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import jakarta.persistence.AttributeOverride;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.EmbeddedId;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.MapsId;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "applicationperiodexemption")
|
@Table(name = "application_period_exemption")
|
||||||
public class ApplicationPeriodExemption implements Serializable {
|
public class ApplicationPeriodExemption implements Serializable {
|
||||||
public enum Type {
|
public enum Type {
|
||||||
SUBMIT_STUDENT_IDEA(true),
|
SUBMIT_STUDENT_IDEA(true),
|
||||||
|
@ -39,16 +47,19 @@ public class ApplicationPeriodExemption implements Serializable {
|
||||||
|
|
||||||
@MapsId("applicationPeriodId")
|
@MapsId("applicationPeriodId")
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
@JoinColumn(name = "applicationPeriodId")
|
@JoinColumn(name = "application_period_id")
|
||||||
private ApplicationPeriod applicationPeriod;
|
private ApplicationPeriod applicationPeriod;
|
||||||
|
|
||||||
|
@Column(name = "end_date")
|
||||||
private LocalDate endDate;
|
private LocalDate endDate;
|
||||||
|
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "granted_by_id")
|
||||||
private User grantedBy;
|
private User grantedBy;
|
||||||
|
|
||||||
|
@Column(name = "granted_on")
|
||||||
private LocalDateTime grantedOn;
|
private LocalDateTime grantedOn;
|
||||||
|
|
||||||
public ApplicationPeriodExemptionId getApplicationperiodexemptionId() {
|
public ApplicationPeriodExemptionId getApplicationperiodexemptionId() {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package se.su.dsv.scipro.match;
|
package se.su.dsv.scipro.match;
|
||||||
|
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.activityplan.ActivityPlanTemplate;
|
import se.su.dsv.scipro.activityplan.ActivityPlanTemplate;
|
||||||
import se.su.dsv.scipro.system.ProjectType;
|
import se.su.dsv.scipro.system.ProjectType;
|
||||||
|
|
||||||
|
@ -10,19 +12,23 @@ import jakarta.persistence.MapsId;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name = "application_period_project_type")
|
||||||
public class ApplicationPeriodProjectType implements Serializable {
|
public class ApplicationPeriodProjectType implements Serializable {
|
||||||
@EmbeddedId
|
@EmbeddedId
|
||||||
private ApplicationPeriodProjectTypeId applicationPeriodProjectTypeId = new ApplicationPeriodProjectTypeId();
|
private ApplicationPeriodProjectTypeId applicationPeriodProjectTypeId = new ApplicationPeriodProjectTypeId();
|
||||||
|
|
||||||
@MapsId("applicationPeriodId")
|
@MapsId("applicationPeriodId")
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "application_period_id")
|
||||||
private ApplicationPeriod applicationPeriod;
|
private ApplicationPeriod applicationPeriod;
|
||||||
|
|
||||||
@MapsId("projectTypeId")
|
@MapsId("projectTypeId")
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "project_type_id")
|
||||||
private ProjectType projectType;
|
private ProjectType projectType;
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
@ManyToOne(optional = true)
|
||||||
|
@JoinColumn(name = "activity_plan_template_id")
|
||||||
private ActivityPlanTemplate activityPlanTemplate;
|
private ActivityPlanTemplate activityPlanTemplate;
|
||||||
|
|
||||||
protected ApplicationPeriodProjectType() {}
|
protected ApplicationPeriodProjectType() {}
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
package se.su.dsv.scipro.match;
|
package se.su.dsv.scipro.match;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -9,72 +19,92 @@ import java.util.Objects;
|
||||||
@Table(name = "idea_first_meeting")
|
@Table(name = "idea_first_meeting")
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
public class FirstMeeting implements Serializable {
|
public class FirstMeeting implements Serializable {
|
||||||
public static final int LENGTH = 1024;
|
private static final int LENGTH = 1024;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic
|
||||||
private Date firstMeetingDate;
|
@Column(name = "description", nullable = true, length = LENGTH)
|
||||||
|
|
||||||
@Column(nullable = false, length = LENGTH)
|
|
||||||
private String room;
|
|
||||||
|
|
||||||
@Column(nullable = true, length = LENGTH)
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "first_meeting_date")
|
||||||
|
private Date firstMeetingDate;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "room", nullable = false, length = LENGTH)
|
||||||
|
private String room;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (idea_first_meeting) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@OneToOne(optional = false)
|
@OneToOne(optional = false)
|
||||||
|
@JoinColumn(name = "idea_id", referencedColumnName = "id")
|
||||||
private Idea idea;
|
private Idea idea;
|
||||||
|
|
||||||
public FirstMeeting() {
|
// ----------------------------------------------------------------------------------
|
||||||
|
// constructors
|
||||||
}
|
// ----------------------------------------------------------------------------------
|
||||||
|
public FirstMeeting() { }
|
||||||
|
|
||||||
public FirstMeeting(Date firstMeetingDate, Idea idea) {
|
public FirstMeeting(Date firstMeetingDate, Idea idea) {
|
||||||
this.firstMeetingDate = firstMeetingDate;
|
this.firstMeetingDate = firstMeetingDate;
|
||||||
this.idea = idea;
|
this.idea = idea;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// getters and setters
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getFirstMeetingDate() {
|
|
||||||
return this.firstMeetingDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRoom() {
|
|
||||||
return this.room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return this.description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Idea getIdea() {
|
|
||||||
return this.idea;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFirstMeetingDate(Date firstMeetingDate) {
|
public String getDescription() {
|
||||||
this.firstMeetingDate = firstMeetingDate;
|
return this.description;
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoom(String room) {
|
|
||||||
this.room = room;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Date getFirstMeetingDate() {
|
||||||
|
return this.firstMeetingDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstMeetingDate(Date firstMeetingDate) {
|
||||||
|
this.firstMeetingDate = firstMeetingDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoom() {
|
||||||
|
return this.room;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoom(String room) {
|
||||||
|
this.room = room;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Idea getIdea() {
|
||||||
|
return this.idea;
|
||||||
|
}
|
||||||
|
|
||||||
public void setIdea(Idea idea) {
|
public void setIdea(Idea idea) {
|
||||||
this.idea = idea;
|
this.idea = idea;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -94,11 +124,13 @@ public class FirstMeeting implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.getId(), this.getFirstMeetingDate(), this.getRoom(), this.getDescription(), this.getIdea());
|
return Objects.hash(this.getId(), this.getFirstMeetingDate(), this.getRoom(), this.getDescription(),
|
||||||
|
this.getIdea());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "FirstMeeting(id=" + this.getId() + ", firstMeetingDate=" + this.getFirstMeetingDate() + ", room=" + this.getRoom() + ", description=" + this.getDescription() + ", idea=" + this.getIdea() + ")";
|
return "FirstMeeting(id=" + this.getId() + ", firstMeetingDate=" + this.getFirstMeetingDate() + ", room=" +
|
||||||
|
this.getRoom() + ", description=" + this.getDescription() + ", idea=" + this.getIdea() + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,103 +1,190 @@
|
||||||
package se.su.dsv.scipro.match;
|
package se.su.dsv.scipro.match;
|
||||||
|
|
||||||
import com.querydsl.core.annotations.QueryInit;
|
import com.querydsl.core.annotations.QueryInit;
|
||||||
|
import jakarta.persistence.AttributeOverride;
|
||||||
|
import jakarta.persistence.AttributeOverrides;
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.CollectionTable;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.ElementCollection;
|
||||||
|
import jakarta.persistence.Embedded;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.JoinTable;
|
||||||
|
import jakarta.persistence.ManyToMany;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.OrderBy;
|
||||||
|
import jakarta.persistence.PostLoad;
|
||||||
|
import jakarta.persistence.PostPersist;
|
||||||
|
import jakarta.persistence.PostUpdate;
|
||||||
|
import jakarta.persistence.PrePersist;
|
||||||
|
import jakarta.persistence.PreUpdate;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Member;
|
import se.su.dsv.scipro.data.dataobjects.Member;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.*;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
import se.su.dsv.scipro.system.Language;
|
||||||
|
import se.su.dsv.scipro.system.ProjectType;
|
||||||
|
import se.su.dsv.scipro.system.ResearchArea;
|
||||||
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "idea")
|
@Table(name = "idea")
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
public class Idea extends DomainObject {
|
public class Idea extends DomainObject {
|
||||||
|
private static final int DESCRIPTION_LENGTH = 4000;
|
||||||
|
private static final int PREREQUISITES_LENGTH = 4000;
|
||||||
|
private static final int TITLE_LENGTH = 1024;
|
||||||
|
|
||||||
public static final int DESCRIPTION_LENGTH = 4000;
|
// ----------------------------------------------------------------------------------
|
||||||
public static final int PREREQUISITES_LENGTH = 4000;
|
// basic and embedded JPA-mappings
|
||||||
public static final int TITLE_LENGTH = 1024;
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@Basic
|
||||||
private ProjectType projectType;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private Type type;
|
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
|
||||||
private User creator;
|
|
||||||
|
|
||||||
@Column(nullable = true, length = DESCRIPTION_LENGTH)
|
@Column(nullable = true, length = DESCRIPTION_LENGTH)
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@Basic
|
||||||
@Column(nullable = true, length = PREREQUISITES_LENGTH)
|
@Column(nullable = true, length = PREREQUISITES_LENGTH)
|
||||||
private String prerequisites;
|
private String prerequisites;
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "idea", cascade = CascadeType.ALL, orphanRemoval = true)
|
@Basic
|
||||||
@QueryInit({"user", "program"})
|
|
||||||
private Set<IdeaParticipation> ideaParticipations = new HashSet<>();
|
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
|
||||||
private ApplicationPeriod applicationPeriod;
|
|
||||||
|
|
||||||
@Column(nullable = false, length = TITLE_LENGTH)
|
@Column(nullable = false, length = TITLE_LENGTH)
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
@Basic
|
||||||
private ResearchArea researchArea;
|
|
||||||
|
|
||||||
@ElementCollection
|
|
||||||
@CollectionTable(name = "idea_language")
|
|
||||||
@Column(name = "language")
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private Set<Language> languages = EnumSet.noneOf(Language.class);
|
private Type type;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "published")
|
||||||
|
private boolean published = true;
|
||||||
|
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(name = "cached_status")
|
||||||
|
private Status cachedStatus;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "inactive")
|
||||||
|
private boolean inactive = false;
|
||||||
|
|
||||||
@Embedded
|
@Embedded
|
||||||
@AttributeOverrides({
|
@AttributeOverrides({
|
||||||
@AttributeOverride(name = "practicalHow", column = @Column(insertable = false, updatable = false)),
|
@AttributeOverride(name = "practicalHow", column = @Column(name = "practical_how", insertable = false, updatable = false)),
|
||||||
@AttributeOverride(name = "literature", column = @Column(insertable = false, updatable = false)),
|
@AttributeOverride(name = "theoryHow", column = @Column(name = "theory_how", insertable = false, updatable = false)),
|
||||||
@AttributeOverride(name = "theoryHow", column = @Column(insertable = false, updatable = false)),
|
@AttributeOverride(name = "what", column = @Column(name = "what", insertable = false, updatable = false)),
|
||||||
@AttributeOverride(name = "why", column = @Column(insertable = false, updatable = false)),
|
@AttributeOverride(name = "why", column = @Column(name = "why", insertable = false, updatable = false)),
|
||||||
@AttributeOverride(name = "what", column = @Column(insertable = false, updatable = false))
|
@AttributeOverride(name = "literature", column = @Column(name = "literature", insertable = false, updatable = false))
|
||||||
})
|
})
|
||||||
private Watson watson;
|
private Watson watson;
|
||||||
|
|
||||||
@Embedded
|
@Embedded
|
||||||
|
@AttributeOverrides({
|
||||||
|
@AttributeOverride(name = "literature", column = @Column(name = "literature", insertable = false, updatable = false)),
|
||||||
|
@AttributeOverride(name = "background", column = @Column(name = "background", insertable = false, updatable = false)),
|
||||||
|
@AttributeOverride(name = "problem", column = @Column(name = "problem", insertable = false, updatable = false)),
|
||||||
|
@AttributeOverride(name = "method", column = @Column(name = "method", insertable = false, updatable = false)),
|
||||||
|
@AttributeOverride(name = "interests", column = @Column(name = "interests", insertable = false, updatable = false))
|
||||||
|
})
|
||||||
private TholanderBox tholanderBox = new TholanderBox();
|
private TholanderBox tholanderBox = new TholanderBox();
|
||||||
|
|
||||||
@ManyToMany
|
// ----------------------------------------------------------------------------------
|
||||||
private Set<Keyword> keywords = new HashSet<>();
|
// JPA-mappings of foreign keys in this table (idea) referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne(optional = true)
|
||||||
|
@JoinColumn(name = "application_period_id", referencedColumnName = "id")
|
||||||
|
private ApplicationPeriod applicationPeriod;
|
||||||
|
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "creator_user_id", referencedColumnName = "id")
|
||||||
|
private User creator;
|
||||||
|
|
||||||
|
@OneToOne(optional = true, cascade = CascadeType.ALL)
|
||||||
|
@JoinColumn(name = "latest_match_id", referencedColumnName = "id")
|
||||||
|
@QueryInit({"supervisor.user", "supervisor.unit"})
|
||||||
|
private Match match;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
private Project project;
|
private Project project;
|
||||||
|
|
||||||
@OneToOne(mappedBy = "idea", orphanRemoval = true, optional = true)
|
@ManyToOne(optional = false)
|
||||||
private FirstMeeting firstMeeting;
|
@JoinColumn(name = "project_type_id", referencedColumnName = "id")
|
||||||
|
private ProjectType projectType;
|
||||||
|
|
||||||
|
@ManyToOne(optional = true)
|
||||||
|
@JoinColumn(name = "research_area_id", referencedColumnName = "id")
|
||||||
|
private ResearchArea researchArea;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// @ManyToMany JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// many-to-many from table "keyword" through table "idea_keyword"
|
||||||
|
@ManyToMany
|
||||||
|
@JoinTable(name="idea_keyword",
|
||||||
|
joinColumns = @JoinColumn(name = "idea_id", referencedColumnName = "id"),
|
||||||
|
inverseJoinColumns = @JoinColumn(name = "keyword_id", referencedColumnName = "id"))
|
||||||
|
private Set<Keyword> keywords = new HashSet<>();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of other tables referencing to this table "idea"
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// from table idea_language
|
||||||
|
@ElementCollection
|
||||||
|
@CollectionTable(name = "idea_language",
|
||||||
|
joinColumns = @JoinColumn(name = "idea_id", referencedColumnName = "id"))
|
||||||
|
@Column(name = "language")
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private Set<Language> languages = EnumSet.noneOf(Language.class);
|
||||||
|
|
||||||
|
// from table idea_export
|
||||||
|
@OneToMany(mappedBy = "idea", cascade = CascadeType.ALL)
|
||||||
|
private List<IdeaExport> exports = new ArrayList<>();
|
||||||
|
|
||||||
|
// from table idea_student
|
||||||
|
@OneToMany(fetch = FetchType.LAZY, mappedBy = "idea", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||||
|
@QueryInit({"user", "program"})
|
||||||
|
private Set<IdeaParticipation> ideaParticipations = new HashSet<>();
|
||||||
|
|
||||||
|
// from table "idea_match"
|
||||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "idea", cascade = CascadeType.ALL)
|
@OneToMany(fetch = FetchType.LAZY, mappedBy = "idea", cascade = CascadeType.ALL)
|
||||||
@OrderBy("dateCreated DESC")
|
@OrderBy("dateCreated DESC")
|
||||||
private List<Match> matchHistory = new ArrayList<>();
|
private List<Match> matchHistory = new ArrayList<>();
|
||||||
|
|
||||||
@OneToOne(optional = true, cascade = CascadeType.ALL)
|
// from table "idea_first_meeting"
|
||||||
@QueryInit({"supervisor.user", "supervisor.unit"})
|
@OneToOne(mappedBy = "idea", orphanRemoval = true, optional = true)
|
||||||
private Match match;
|
private FirstMeeting firstMeeting;
|
||||||
|
|
||||||
@Column(name = "published")
|
|
||||||
private boolean published = true;
|
|
||||||
|
|
||||||
@OneToMany(mappedBy = "idea", cascade = CascadeType.ALL)
|
|
||||||
private List<IdeaExport> exports = new ArrayList<>();
|
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private Status cachedStatus;
|
|
||||||
|
|
||||||
@Basic
|
|
||||||
private boolean inactive = false;
|
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// methods...
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Idea copy(User supervisor) {
|
public Idea copy(User supervisor) {
|
||||||
Idea copy = new Idea();
|
Idea copy = new Idea();
|
||||||
copy.projectType = this.projectType;
|
copy.projectType = this.projectType;
|
||||||
|
@ -448,7 +535,9 @@ public class Idea extends DomainObject {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Student idea";
|
return "Student idea";
|
||||||
}
|
}
|
||||||
}, SUPERVISOR {
|
},
|
||||||
|
|
||||||
|
SUPERVISOR {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Supervisor idea";
|
return "Supervisor idea";
|
||||||
|
@ -463,18 +552,21 @@ public class Idea extends DomainObject {
|
||||||
return "Unmatched";
|
return "Unmatched";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
MATCHED {
|
MATCHED {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Matched, no project";
|
return "Matched, no project";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
COMPLETED {
|
COMPLETED {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Matched, has project";
|
return "Matched, has project";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
INACTIVE {
|
INACTIVE {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
@ -1,8 +1,18 @@
|
||||||
package se.su.dsv.scipro.match;
|
package se.su.dsv.scipro.match;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -11,56 +21,69 @@ public class IdeaExport extends DomainObject {
|
||||||
|
|
||||||
public enum Result { FAIL, SUCCESS }
|
public enum Result { FAIL, SUCCESS }
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// basic and embedded JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private Result result;
|
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
private String reason;
|
private String reason;
|
||||||
|
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private Result result;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (idea_export) referencing other tables
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "idea_id", referencedColumnName = "id")
|
||||||
private Idea idea;
|
private Idea idea;
|
||||||
|
|
||||||
public boolean wasSuccessful() {
|
// ----------------------------------------------------------------------------------
|
||||||
return result == Result.SUCCESS;
|
// getters and setters
|
||||||
}
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result getResult() {
|
|
||||||
return this.result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReason() {
|
|
||||||
return this.reason;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Idea getIdea() {
|
|
||||||
return this.idea;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResult(Result result) {
|
public String getReason() {
|
||||||
this.result = result;
|
return this.reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReason(String reason) {
|
public void setReason(String reason) {
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Result getResult() {
|
||||||
|
return this.result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResult(Result result) {
|
||||||
|
this.result = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Idea getIdea() {
|
||||||
|
return this.idea;
|
||||||
|
}
|
||||||
|
|
||||||
public void setIdea(Idea idea) {
|
public void setIdea(Idea idea) {
|
||||||
this.idea = idea;
|
this.idea = idea;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public boolean wasSuccessful() {
|
||||||
|
return result == Result.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
|
|
@ -1,83 +1,114 @@
|
||||||
package se.su.dsv.scipro.match;
|
package se.su.dsv.scipro.match;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.system.Program;
|
import se.su.dsv.scipro.system.Program;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "idea_student")
|
@Table(name = "idea_student")
|
||||||
@AssociationOverrides({
|
|
||||||
@AssociationOverride(name = "idea",
|
|
||||||
joinColumns = @JoinColumn(name = "idea_id")) })
|
|
||||||
public class IdeaParticipation implements Serializable {
|
public class IdeaParticipation implements Serializable {
|
||||||
protected IdeaParticipation() {
|
|
||||||
|
|
||||||
}
|
// ----------------------------------------------------------------------------------
|
||||||
|
// basic and embedded JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "date_created")
|
||||||
|
private Date dateCreated = new Date();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (idea_student) referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "idea_id", referencedColumnName = "id")
|
||||||
|
private Idea idea;
|
||||||
|
|
||||||
|
@ManyToOne(optional = true)
|
||||||
|
@JoinColumn(name = "program_id", referencedColumnName = "id")
|
||||||
|
private Program program;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "user_id", referencedColumnName = "id")
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// JPA/Hibernate works by create a child class of your entity class with all database
|
||||||
|
// tricks in it, it therefore requires no-arg constructor to be able to instantiate
|
||||||
|
// a new instance.
|
||||||
|
// By creating a protected constructor, JPA/Hibernate still works as expected, but it
|
||||||
|
// declares the intention that parameters need to be provided when new instances are
|
||||||
|
// created.
|
||||||
|
protected IdeaParticipation() { }
|
||||||
|
|
||||||
public IdeaParticipation(User student, Idea idea) {
|
public IdeaParticipation(User student, Idea idea) {
|
||||||
this.user = student;
|
this.user = student;
|
||||||
this.idea = idea;
|
this.idea = idea;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Id
|
// ----------------------------------------------------------------------------
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
// getters and setters
|
||||||
private Long id;
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
private User user;
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
private Idea idea;
|
|
||||||
|
|
||||||
private Date dateCreated = new Date();
|
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
|
||||||
private Program program;
|
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getUser() {
|
|
||||||
return this.user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Idea getIdea() {
|
|
||||||
return this.idea;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getDateCreated() {
|
|
||||||
return this.dateCreated;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Program getProgram() {
|
|
||||||
return this.program;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUser(User user) {
|
public Date getDateCreated() {
|
||||||
this.user = user;
|
return this.dateCreated;
|
||||||
}
|
|
||||||
|
|
||||||
public void setIdea(Idea idea) {
|
|
||||||
this.idea = idea;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDateCreated(Date dateCreated) {
|
public void setDateCreated(Date dateCreated) {
|
||||||
this.dateCreated = dateCreated;
|
this.dateCreated = dateCreated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Idea getIdea() {
|
||||||
|
return this.idea;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdea(Idea idea) {
|
||||||
|
this.idea = idea;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Program getProgram() {
|
||||||
|
return this.program;
|
||||||
|
}
|
||||||
|
|
||||||
public void setProgram(Program program) {
|
public void setProgram(Program program) {
|
||||||
this.program = program;
|
this.program = program;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public User getUser() {
|
||||||
|
return this.user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(User user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// methods
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "IdeaParticipation(id=" + this.getId() + ", user=" + this.getUser() + ", idea=" + this.getIdea() + ", dateCreated=" + this.getDateCreated() + ", program=" + this.getProgram() + ")";
|
return "IdeaParticipation(id=" + this.getId() + ", user=" + this.getUser() + ", idea=" + this.getIdea() + ", dateCreated=" + this.getDateCreated() + ", program=" + this.getProgram() + ")";
|
||||||
|
|
|
@ -1,15 +1,25 @@
|
||||||
package se.su.dsv.scipro.match;
|
package se.su.dsv.scipro.match;
|
||||||
|
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.JoinTable;
|
||||||
|
import jakarta.persistence.ManyToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
||||||
import se.su.dsv.scipro.system.ResearchArea;
|
import se.su.dsv.scipro.system.ResearchArea;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name = "keyword")
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
public class Keyword extends LazyDeletableDomainObject {
|
public class Keyword extends LazyDeletableDomainObject {
|
||||||
|
|
||||||
|
@ -19,8 +29,10 @@ public class Keyword extends LazyDeletableDomainObject {
|
||||||
|
|
||||||
private String keyword;
|
private String keyword;
|
||||||
|
|
||||||
@ManyToMany(fetch = FetchType.EAGER,targetEntity=ResearchArea.class)
|
@ManyToMany(fetch = FetchType.EAGER, targetEntity = ResearchArea.class)
|
||||||
@JoinTable(name="Keyword_researcharea")
|
@JoinTable(name="keyword_research_area",
|
||||||
|
joinColumns = @JoinColumn(name = "keyword_id", referencedColumnName = "id"),
|
||||||
|
inverseJoinColumns = @JoinColumn(name = "research_area_id", referencedColumnName = "id"))
|
||||||
private Set<ResearchArea> researchAreas = new HashSet<>();
|
private Set<ResearchArea> researchAreas = new HashSet<>();
|
||||||
|
|
||||||
public Keyword() {
|
public Keyword() {
|
||||||
|
|
|
@ -1,56 +1,85 @@
|
||||||
package se.su.dsv.scipro.match;
|
package se.su.dsv.scipro.match;
|
||||||
|
|
||||||
import com.querydsl.core.annotations.QueryInit;
|
import com.querydsl.core.annotations.QueryInit;
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Cacheable(true)
|
|
||||||
@Table(name = "idea_match")
|
@Table(name = "idea_match")
|
||||||
|
@Cacheable(true)
|
||||||
public class Match extends DomainObject {
|
public class Match extends DomainObject {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@Basic
|
||||||
private Idea idea;
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
@QueryInit({"unit"})
|
|
||||||
private User supervisor;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private Idea.Status status;
|
private Idea.Status status;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (idea_match) referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne(optional = true)
|
@ManyToOne(optional = true)
|
||||||
|
@JoinColumn(name = "changed_by_user_id", referencedColumnName = "id")
|
||||||
private User changedBy;
|
private User changedBy;
|
||||||
|
|
||||||
public User getSupervisor() {
|
@ManyToOne(optional = false)
|
||||||
return supervisor;
|
@JoinColumn(name = "idea_id", referencedColumnName = "id")
|
||||||
}
|
private Idea idea;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "supervisor_user_id", referencedColumnName = "id")
|
||||||
|
@QueryInit({"unit"})
|
||||||
|
private User supervisor;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// getters and setters
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Idea getIdea() {
|
public void setId(Long id) {
|
||||||
return this.idea;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Idea.Status getStatus() {
|
public Idea.Status getStatus() {
|
||||||
return this.status;
|
return this.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setStatus(Idea.Status status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
public User getChangedBy() {
|
public User getChangedBy() {
|
||||||
return this.changedBy;
|
return this.changedBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setChangedBy(User changedBy) {
|
||||||
this.id = id;
|
this.changedBy = changedBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Idea getIdea() {
|
||||||
|
return this.idea;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIdea(Idea idea) {
|
public void setIdea(Idea idea) {
|
||||||
|
@ -61,14 +90,13 @@ public class Match extends DomainObject {
|
||||||
this.supervisor = supervisor;
|
this.supervisor = supervisor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(Idea.Status status) {
|
public User getSupervisor() {
|
||||||
this.status = status;
|
return supervisor;
|
||||||
}
|
|
||||||
|
|
||||||
public void setChangedBy(User changedBy) {
|
|
||||||
this.changedBy = changedBy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -93,6 +121,7 @@ public class Match extends DomainObject {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Match(id=" + this.getId() + ", supervisor=" + this.getSupervisor() + ", status=" + this.getStatus() + ", changedBy=" + this.getChangedBy() + ")";
|
return "Match(id=" + this.getId() + ", supervisor=" + this.getSupervisor() + ", status=" + this.getStatus() +
|
||||||
|
", changedBy=" + this.getChangedBy() + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,70 +1,98 @@
|
||||||
package se.su.dsv.scipro.match;
|
package se.su.dsv.scipro.match;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "preliminary_match")
|
@Table(name = "preliminary_match")
|
||||||
public class PreliminaryMatch extends DomainObject {
|
public class PreliminaryMatch extends DomainObject {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "comment")
|
||||||
|
private String comment;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (idea_first_meeting) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "idea_id", referencedColumnName = "id")
|
||||||
private Idea idea;
|
private Idea idea;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "supervisor_user_id", referencedColumnName = "id")
|
||||||
private User supervisor;
|
private User supervisor;
|
||||||
|
|
||||||
private String comment;
|
// ----------------------------------------------------------------------------------
|
||||||
|
// constructors
|
||||||
// JPA
|
// ----------------------------------------------------------------------------------
|
||||||
public PreliminaryMatch() {
|
public PreliminaryMatch() { }
|
||||||
}
|
|
||||||
|
|
||||||
public PreliminaryMatch(final Idea idea) {
|
public PreliminaryMatch(final Idea idea) {
|
||||||
this.idea = idea;
|
this.idea = idea;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// getters and setters
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Idea getIdea() {
|
|
||||||
return this.idea;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getSupervisor() {
|
|
||||||
return this.supervisor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return this.comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIdea(Idea idea) {
|
public String getComment() {
|
||||||
this.idea = idea;
|
return this.comment;
|
||||||
}
|
|
||||||
|
|
||||||
public void setSupervisor(User supervisor) {
|
|
||||||
this.supervisor = supervisor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setComment(String comment) {
|
public void setComment(String comment) {
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Idea getIdea() {
|
||||||
|
return this.idea;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdea(Idea idea) {
|
||||||
|
this.idea = idea;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getSupervisor() {
|
||||||
|
return this.supervisor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSupervisor(User supervisor) {
|
||||||
|
this.supervisor = supervisor;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "PreliminaryMatch(id=" + this.getId() + ", idea=" + this.getIdea() + ", supervisor=" + this.getSupervisor() + ", comment=" + this.getComment() + ")";
|
return "PreliminaryMatch(id=" + this.getId() + ", idea=" + this.getIdea() + ", supervisor=" +
|
||||||
|
this.getSupervisor() + ", comment=" + this.getComment() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,12 +20,12 @@ public class Target implements Serializable {
|
||||||
|
|
||||||
@MapsId("applicationPeriodId")
|
@MapsId("applicationPeriodId")
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "applicationPeriodId")
|
@JoinColumn(name = "application_period_id")
|
||||||
private ApplicationPeriod applicationPeriod;
|
private ApplicationPeriod applicationPeriod;
|
||||||
|
|
||||||
@MapsId("projectTypeId")
|
@MapsId("projectTypeId")
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "projectTypeId")
|
@JoinColumn(name = "project_type_id")
|
||||||
private ProjectType projectType;
|
private ProjectType projectType;
|
||||||
|
|
||||||
private int target;
|
private int target;
|
||||||
|
|
|
@ -1,39 +1,54 @@
|
||||||
package se.su.dsv.scipro.milestones.dataobjects;
|
package se.su.dsv.scipro.milestones.dataobjects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Member;
|
import se.su.dsv.scipro.data.dataobjects.Member;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "milestone")
|
@Table(name = "milestone")
|
||||||
public class Milestone extends DomainObject {
|
public class Milestone extends DomainObject {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
protected long id;
|
protected long id;
|
||||||
|
|
||||||
@ManyToOne
|
@Basic
|
||||||
private Project project;
|
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
|
||||||
private User user;
|
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
|
||||||
private MilestoneActivityTemplate activity;
|
|
||||||
|
|
||||||
@Column(name = "confirmed", nullable = false)
|
@Column(name = "confirmed", nullable = false)
|
||||||
private boolean confirmed = false;
|
private boolean confirmed = false;
|
||||||
|
|
||||||
@Override
|
// ----------------------------------------------------------------------------------
|
||||||
public Long getId() {
|
// JPA-mappings of foreign keys in this table (milestone) referencing other tables.
|
||||||
return id;
|
// ----------------------------------------------------------------------------------
|
||||||
}
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "milestone_activity_template_id", referencedColumnName = "id")
|
||||||
|
private MilestoneActivityTemplate activity;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
|
private Project project;
|
||||||
|
|
||||||
|
@ManyToOne(optional = true)
|
||||||
|
@JoinColumn(name = "user_id", referencedColumnName = "id")
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
protected Milestone() {
|
protected Milestone() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,6 +64,15 @@ public class Milestone extends DomainObject {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
@ -61,14 +85,6 @@ public class Milestone extends DomainObject {
|
||||||
this.confirmed = confirmed;
|
this.confirmed = confirmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Project getProject() {
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProject(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MilestoneActivityTemplate getActivity() {
|
public MilestoneActivityTemplate getActivity() {
|
||||||
return activity;
|
return activity;
|
||||||
}
|
}
|
||||||
|
@ -77,11 +93,22 @@ public class Milestone extends DomainObject {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Member> getMembers() {
|
public Project getProject() {
|
||||||
return Collections.singletonList(new Member(user, Member.Type.MILESTONE_INDIVIDUAL));
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProject(Project project) {
|
||||||
|
this.project = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getUser() {
|
public User getUser() {
|
||||||
return this.user;
|
return this.user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public List<Member> getMembers() {
|
||||||
|
return Collections.singletonList(new Member(user, Member.Type.MILESTONE_INDIVIDUAL));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,23 @@
|
||||||
package se.su.dsv.scipro.milestones.dataobjects;
|
package se.su.dsv.scipro.milestones.dataobjects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.JoinTable;
|
||||||
|
import jakarta.persistence.ManyToMany;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.system.Event;
|
import se.su.dsv.scipro.system.Event;
|
||||||
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
||||||
import se.su.dsv.scipro.system.ProjectType;
|
import se.su.dsv.scipro.system.ProjectType;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -18,42 +31,66 @@ public class MilestoneActivityTemplate extends LazyDeletableDomainObject {
|
||||||
public static final String PEER_REVIEW_ONE = "PEER_REVIEW_ONE";
|
public static final String PEER_REVIEW_ONE = "PEER_REVIEW_ONE";
|
||||||
public static final String PEER_REVIEW_TWO = "PEER_REVIEW_TWO";
|
public static final String PEER_REVIEW_TWO = "PEER_REVIEW_TWO";
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "title")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Basic(optional = true)
|
||||||
|
@Column(name = "description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(name = "type")
|
||||||
private Type type;
|
private Type type;
|
||||||
|
|
||||||
@Column(unique = true)
|
@Basic
|
||||||
|
@Column(name = "code", unique = true)
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "sort_order")
|
||||||
|
private int sortOrder;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "editable_by_students")
|
||||||
|
private boolean editableByStudents = false;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (milestone_activity_template)
|
||||||
|
// referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "milestone_phase_template_id", referencedColumnName = "id", nullable = false)
|
||||||
|
private MilestonePhaseTemplate milestonePhaseTemplate;
|
||||||
|
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "activated_by_event_name", referencedColumnName = "name")
|
||||||
|
private Event activatedBy;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// @ManyToMany JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Many-to-Many between table milestone_activity_template and project_type through
|
||||||
|
// table "milestone_activity_template_project_type".
|
||||||
@ManyToMany
|
@ManyToMany
|
||||||
@JoinTable(
|
@JoinTable(
|
||||||
joinColumns = @JoinColumn(name = "milestone_activity_template_id")
|
name = "milestone_activity_template_project_type",
|
||||||
|
joinColumns = @JoinColumn(name = "milestone_activity_template_id"),
|
||||||
|
inverseJoinColumns = @JoinColumn(name = "project_type_id")
|
||||||
)
|
)
|
||||||
private Set<ProjectType> projectTypes = new HashSet<>();
|
private Set<ProjectType> projectTypes = new HashSet<>();
|
||||||
|
|
||||||
@ManyToOne
|
// ----------------------------------------------------------------------------------
|
||||||
@JoinColumn(name = "phase", nullable = false)
|
// Constructors
|
||||||
private MilestonePhaseTemplate milestonePhaseTemplate;
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
@Column
|
|
||||||
private int sortOrder;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
private boolean editableByStudents = false;
|
|
||||||
|
|
||||||
@OneToOne
|
|
||||||
@JoinColumn(name = "activatedBy")
|
|
||||||
private Event activatedBy;
|
|
||||||
|
|
||||||
public MilestoneActivityTemplate() {
|
public MilestoneActivityTemplate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,10 +104,9 @@ public class MilestoneActivityTemplate extends LazyDeletableDomainObject {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addProjectType(ProjectType projectType) {
|
// ----------------------------------------------------------------------------------
|
||||||
projectTypes.add(projectType);
|
// Properties (Getters and Setters)
|
||||||
}
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
|
@ -80,79 +116,95 @@ public class MilestoneActivityTemplate extends LazyDeletableDomainObject {
|
||||||
return this.title;
|
return this.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return this.description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Type getType() {
|
|
||||||
return this.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode() {
|
|
||||||
return this.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<ProjectType> getProjectTypes() {
|
|
||||||
return this.projectTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MilestonePhaseTemplate getMilestonePhaseTemplate() {
|
|
||||||
return this.milestonePhaseTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSortOrder() {
|
|
||||||
return this.sortOrder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEditableByStudents() {
|
|
||||||
return this.editableByStudents;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Event getActivatedBy() {
|
|
||||||
return this.activatedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Type getType() {
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
|
||||||
public void setType(Type type) {
|
public void setType(Type type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
|
||||||
public void setCode(String code) {
|
public void setCode(String code) {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMilestonePhaseTemplate(MilestonePhaseTemplate milestonePhaseTemplate) {
|
public int getSortOrder() {
|
||||||
this.milestonePhaseTemplate = milestonePhaseTemplate;
|
return this.sortOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSortOrder(int sortOrder) {
|
public void setSortOrder(int sortOrder) {
|
||||||
this.sortOrder = sortOrder;
|
this.sortOrder = sortOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEditableByStudents() {
|
||||||
|
return this.editableByStudents;
|
||||||
|
}
|
||||||
|
|
||||||
public void setEditableByStudents(boolean editableByStudents) {
|
public void setEditableByStudents(boolean editableByStudents) {
|
||||||
this.editableByStudents = editableByStudents;
|
this.editableByStudents = editableByStudents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MilestonePhaseTemplate getMilestonePhaseTemplate() {
|
||||||
|
return this.milestonePhaseTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMilestonePhaseTemplate(MilestonePhaseTemplate milestonePhaseTemplate) {
|
||||||
|
this.milestonePhaseTemplate = milestonePhaseTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Event getActivatedBy() {
|
||||||
|
return this.activatedBy;
|
||||||
|
}
|
||||||
|
|
||||||
public void setActivatedBy(Event activatedBy) {
|
public void setActivatedBy(Event activatedBy) {
|
||||||
this.activatedBy = activatedBy;
|
this.activatedBy = activatedBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<ProjectType> getProjectTypes() {
|
||||||
|
return this.projectTypes;
|
||||||
|
}
|
||||||
|
|
||||||
public void setProjectTypes(Set<ProjectType> projectTypes) {
|
public void setProjectTypes(Set<ProjectType> projectTypes) {
|
||||||
this.projectTypes = projectTypes;
|
this.projectTypes = projectTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BySortOrderComparator implements Comparator<MilestoneActivityTemplate>, Serializable {
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public void addProjectType(ProjectType projectType) {
|
||||||
|
projectTypes.add(projectType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAutomatic() {
|
||||||
|
return code != null || activatedBy != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Nested classes and types
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public static class BySortOrderComparator implements Comparator<MilestoneActivityTemplate>,
|
||||||
|
Serializable {
|
||||||
@Override
|
@Override
|
||||||
public int compare(MilestoneActivityTemplate o1, MilestoneActivityTemplate o2) {
|
public int compare(MilestoneActivityTemplate o1, MilestoneActivityTemplate o2) {
|
||||||
int sortOrderResult = o1.sortOrder - o2.sortOrder;
|
int sortOrderResult = o1.sortOrder - o2.sortOrder;
|
||||||
int phaseSortOrderResult = o1.milestonePhaseTemplate.getSortOrder() - o2.getMilestonePhaseTemplate().getSortOrder();
|
int phaseSortOrderResult = o1.milestonePhaseTemplate.getSortOrder() -
|
||||||
|
o2.getMilestonePhaseTemplate().getSortOrder();
|
||||||
|
|
||||||
if (phaseSortOrderResult == 0) {
|
if (phaseSortOrderResult == 0) {
|
||||||
return sortOrderResult;
|
return sortOrderResult;
|
||||||
|
@ -175,8 +227,4 @@ public class MilestoneActivityTemplate extends LazyDeletableDomainObject {
|
||||||
return asString;
|
return asString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAutomatic() {
|
|
||||||
return code != null || activatedBy != null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +1,41 @@
|
||||||
package se.su.dsv.scipro.milestones.dataobjects;
|
package se.su.dsv.scipro.milestones.dataobjects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "milestone_phase_template")
|
@Table(name = "milestone_phase_template")
|
||||||
public class MilestonePhaseTemplate extends LazyDeletableDomainObject {
|
public class MilestonePhaseTemplate extends LazyDeletableDomainObject {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
protected long id;
|
protected long id;
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "title")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Basic(optional = true)
|
||||||
|
@Column(name = "description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Column(name = "sortOrder")
|
@Basic
|
||||||
|
@Column(name = "sort_order")
|
||||||
private int sortOrder;
|
private int sortOrder;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public MilestonePhaseTemplate() {
|
public MilestonePhaseTemplate() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,37 +51,47 @@ public class MilestonePhaseTemplate extends LazyDeletableDomainObject {
|
||||||
this.sortOrder = sortOrder;
|
this.sortOrder = sortOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
// ----------------------------------------------------------------------------------
|
||||||
return this.title;
|
// Properties (Getters and Setters)
|
||||||
}
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
public String getDescription() {
|
public Long getId() {
|
||||||
return this.description;
|
return id;
|
||||||
}
|
|
||||||
|
|
||||||
public int getSortOrder() {
|
|
||||||
return this.sortOrder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(long id) {
|
public void setId(long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return this.title;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSortOrder() {
|
||||||
|
return this.sortOrder;
|
||||||
|
}
|
||||||
|
|
||||||
public void setSortOrder(int sortOrder) {
|
public void setSortOrder(int sortOrder) {
|
||||||
this.sortOrder = sortOrder;
|
this.sortOrder = sortOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// ----------------------------------------------------------------------------------
|
||||||
public String toString() {
|
// Methods
|
||||||
return "MilestonePhaseTemplate(id=" + this.getId() + ", title=" + this.getTitle() + ", description=" + this.getDescription() + ", sortOrder=" + this.getSortOrder() + ")";
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof MilestonePhaseTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -86,12 +106,13 @@ public class MilestonePhaseTemplate extends LazyDeletableDomainObject {
|
||||||
&& this.getSortOrder() == other.getSortOrder();
|
&& this.getSortOrder() == other.getSortOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof MilestonePhaseTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.getId(), this.getTitle(), this.getDescription(), this.getSortOrder());
|
return Objects.hash(this.getId(), this.getTitle(), this.getDescription(), this.getSortOrder());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "MilestonePhaseTemplate(id=" + this.getId() + ", title=" + this.getTitle() + ", description=" + this.getDescription() + ", sortOrder=" + this.getSortOrder() + ")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class MilestoneActivator {
|
||||||
int minimumActiveParticipationsToBeGraded = event.getProject()
|
int minimumActiveParticipationsToBeGraded = event.getProject()
|
||||||
.getProjectType()
|
.getProjectType()
|
||||||
.getProjectTypeSettings()
|
.getProjectTypeSettings()
|
||||||
.getMinimumActiveParticipationsToBeGraded();
|
.getMinActiveParticipationsToBeGraded();
|
||||||
if (completedParticipations >= minimumActiveParticipationsToBeGraded) {
|
if (completedParticipations >= minimumActiveParticipationsToBeGraded) {
|
||||||
activateIndividualMilestone(Set.of("ParticipationGradingEvent"), event.getProject(), event.getStudent());
|
activateIndividualMilestone(Set.of("ParticipationGradingEvent"), event.getProject(), event.getStudent());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,24 +1,29 @@
|
||||||
package se.su.dsv.scipro.nonworkperiod;
|
package se.su.dsv.scipro.nonworkperiod;
|
||||||
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
|
||||||
|
|
||||||
import jakarta.persistence.Cacheable;
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
|
@Table(name = "non_work_day_period")
|
||||||
public class NonWorkDayPeriod extends DomainObject {
|
public class NonWorkDayPeriod extends DomainObject {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "start_date")
|
||||||
private LocalDate startDate;
|
private LocalDate startDate;
|
||||||
|
|
||||||
|
@Column(name = "end_date")
|
||||||
private LocalDate endDate;
|
private LocalDate endDate;
|
||||||
|
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package se.su.dsv.scipro.notifications.dataobject;
|
package se.su.dsv.scipro.notifications.dataobject;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
@ -13,6 +15,8 @@ public class CustomEvent extends NotificationEvent {
|
||||||
IDEA_DELETED
|
IDEA_DELETED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "event")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private CustomEvent.Event event;
|
private CustomEvent.Event event;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package se.su.dsv.scipro.notifications.dataobject;
|
package se.su.dsv.scipro.notifications.dataobject;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
import se.su.dsv.scipro.group.Group;
|
import se.su.dsv.scipro.group.Group;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
|
||||||
|
@ -11,37 +14,40 @@ import jakarta.persistence.ManyToOne;
|
||||||
@Entity
|
@Entity
|
||||||
public class GroupEvent extends NotificationEvent {
|
public class GroupEvent extends NotificationEvent {
|
||||||
|
|
||||||
public void setEvent(Event event) {
|
|
||||||
this.event = event;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Event {
|
public enum Event {
|
||||||
MESSAGE_THREAD_CREATED, MESSAGE_THREAD_REPLY
|
MESSAGE_THREAD_CREATED, MESSAGE_THREAD_REPLY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "event")
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private Event event;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "project_group_id", referencedColumnName = "id")
|
||||||
|
private Group group;
|
||||||
|
|
||||||
|
public GroupEvent() {
|
||||||
|
super(Notification.Type.GROUP);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Enum getEvent() {
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEvent(Event event) {
|
||||||
|
this.event = event;
|
||||||
|
}
|
||||||
|
|
||||||
public Group getGroup() {
|
public Group getGroup() {
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
private Group group;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private Event event;
|
|
||||||
|
|
||||||
public GroupEvent() {
|
|
||||||
super(Notification.Type.GROUP);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGroup(Group group) {
|
public void setGroup(Group group) {
|
||||||
this.group = group;
|
this.group = group;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Enum getEvent() {
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getEntityTitle() {
|
protected String getEntityTitle() {
|
||||||
return group.getTitle();
|
return group.getTitle();
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package se.su.dsv.scipro.notifications.dataobject;
|
package se.su.dsv.scipro.notifications.dataobject;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
import se.su.dsv.scipro.match.Idea;
|
import se.su.dsv.scipro.match.Idea;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
|
||||||
|
@ -11,18 +14,29 @@ import jakarta.persistence.ManyToOne;
|
||||||
@Entity
|
@Entity
|
||||||
public class IdeaEvent extends NotificationEvent {
|
public class IdeaEvent extends NotificationEvent {
|
||||||
|
|
||||||
|
|
||||||
public enum Event {
|
public enum Event {
|
||||||
STATUS_CHANGE, PARTNER_ACCEPT,
|
STATUS_CHANGE, PARTNER_ACCEPT,
|
||||||
ADDED_AS_PARTNER, FIRST_MEETING, REMOVED_AS_PARTNER, EXPORTED_FAIL
|
ADDED_AS_PARTNER, FIRST_MEETING, REMOVED_AS_PARTNER, EXPORTED_FAIL
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne
|
@Basic
|
||||||
private Idea idea;
|
@Column(name = "event")
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private Event event;
|
private Event event;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "idea_id", referencedColumnName = "id")
|
||||||
|
private Idea idea;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Event getEvent() {
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEvent(Event event) {
|
||||||
|
this.event = event;
|
||||||
|
}
|
||||||
|
|
||||||
public IdeaEvent() {
|
public IdeaEvent() {
|
||||||
super(Notification.Type.IDEA);
|
super(Notification.Type.IDEA);
|
||||||
}
|
}
|
||||||
|
@ -35,15 +49,6 @@ public class IdeaEvent extends NotificationEvent {
|
||||||
this.idea = idea;
|
this.idea = idea;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Event getEvent() {
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEvent(Event event) {
|
|
||||||
this.event = event;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEntityTitle() {
|
public String getEntityTitle() {
|
||||||
return idea.getTitle();
|
return idea.getTitle();
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package se.su.dsv.scipro.notifications.dataobject;
|
package se.su.dsv.scipro.notifications.dataobject;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
import se.su.dsv.scipro.milestones.dataobjects.Milestone;
|
import se.su.dsv.scipro.milestones.dataobjects.Milestone;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
@ -17,24 +20,64 @@ public class MileStoneEvent extends NotificationEvent {
|
||||||
MILESTONE_CONFIRMED, MILESTONE_REVOKED
|
MILESTONE_CONFIRMED, MILESTONE_REVOKED
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne
|
@Basic
|
||||||
private Milestone milestone;
|
@Column(name = "event")
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private Event event;
|
private Event event;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "milestone_id", referencedColumnName = "id")
|
||||||
|
private Milestone milestone;
|
||||||
|
|
||||||
public MileStoneEvent() {
|
public MileStoneEvent() {
|
||||||
super(Notification.Type.MILESTONE);
|
super(Notification.Type.MILESTONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Project getProject() {
|
public Enum getEvent() {
|
||||||
return milestone.getProject();
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEvent(Event event) {
|
||||||
|
this.event = event;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Milestone getMilestone() {
|
||||||
|
return this.milestone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMilestone(Milestone milestone) {
|
||||||
|
this.milestone = milestone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getEvent() {
|
public boolean equals(final Object o) {
|
||||||
return event;
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof MileStoneEvent)) return false;
|
||||||
|
final MileStoneEvent other = (MileStoneEvent) o;
|
||||||
|
return other.canEqual(this)
|
||||||
|
&& super.equals(o)
|
||||||
|
&& Objects.equals(this.getMilestone(), other.getMilestone())
|
||||||
|
&& Objects.equals(this.getEvent(), other.getEvent());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(this.getMilestone(), this.getEvent());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "MileStoneEvent(milestone=" + this.getMilestone() + ", event=" + this.getEvent() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof MileStoneEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Project getProject() {
|
||||||
|
return milestone.getProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -51,41 +94,4 @@ public class MileStoneEvent extends NotificationEvent {
|
||||||
public DomainObject getEntity() {
|
public DomainObject getEntity() {
|
||||||
return milestone;
|
return milestone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Milestone getMilestone() {
|
|
||||||
return this.milestone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMilestone(Milestone milestone) {
|
|
||||||
this.milestone = milestone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEvent(Event event) {
|
|
||||||
this.event = event;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "MileStoneEvent(milestone=" + this.getMilestone() + ", event=" + this.getEvent() + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object o) {
|
|
||||||
if (o == this) return true;
|
|
||||||
if (!(o instanceof MileStoneEvent)) return false;
|
|
||||||
final MileStoneEvent other = (MileStoneEvent) o;
|
|
||||||
return other.canEqual(this)
|
|
||||||
&& super.equals(o)
|
|
||||||
&& Objects.equals(this.getMilestone(), other.getMilestone())
|
|
||||||
&& Objects.equals(this.getEvent(), other.getEvent());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof MileStoneEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(this.getMilestone(), this.getEvent());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,59 @@
|
||||||
package se.su.dsv.scipro.notifications.dataobject;
|
package se.su.dsv.scipro.notifications.dataobject;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name = "notification")
|
||||||
public class Notification extends DomainObject {
|
public class Notification extends DomainObject {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public enum Type {
|
// Basic JPA-mappings
|
||||||
PROJECT, IDEA, FINAL_SEMINAR, PEER, MILESTONE,
|
// ----------------------------------------------------------------------------------
|
||||||
GROUP, FORUM, CUSTOM
|
|
||||||
}
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
private boolean unread = true;
|
@Column(name = "mailed")
|
||||||
|
|
||||||
@Basic(optional = false)
|
|
||||||
private boolean mailed = false;
|
private boolean mailed = false;
|
||||||
|
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "unread")
|
||||||
|
private boolean unread = true;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (notification) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne(cascade = CascadeType.ALL)
|
@ManyToOne(cascade = CascadeType.ALL)
|
||||||
@JoinColumn(name = "notificationData_id")
|
@JoinColumn(name = "notification_data_id", referencedColumnName = "id")
|
||||||
private NotificationEvent notificationEvent;
|
private NotificationEvent notificationEvent;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "user_id", referencedColumnName = "id")
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructor
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Notification() {
|
public Notification() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -45,6 +63,14 @@ public class Notification extends DomainObject {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isMailed() {
|
||||||
|
return mailed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMailed(boolean mailed) {
|
||||||
|
this.mailed = mailed;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isUnread() {
|
public boolean isUnread() {
|
||||||
return unread;
|
return unread;
|
||||||
}
|
}
|
||||||
|
@ -69,14 +95,9 @@ public class Notification extends DomainObject {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMailed() {
|
// ----------------------------------------------------------------------------------
|
||||||
return mailed;
|
// Other methods
|
||||||
}
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
public void setMailed(boolean mailed) {
|
|
||||||
this.mailed = mailed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return getNotificationEvent().getTitle();
|
return getNotificationEvent().getTitle();
|
||||||
}
|
}
|
||||||
|
@ -108,4 +129,12 @@ public class Notification extends DomainObject {
|
||||||
public User getCausedBy() {
|
public User getCausedBy() {
|
||||||
return getNotificationEvent().getCausedBy();
|
return getNotificationEvent().getCausedBy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Nested type
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public enum Type {
|
||||||
|
PROJECT, IDEA, FINAL_SEMINAR, PEER, MILESTONE,
|
||||||
|
GROUP, FORUM, CUSTOM
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,55 +1,70 @@
|
||||||
package se.su.dsv.scipro.notifications.dataobject;
|
package se.su.dsv.scipro.notifications.dataobject;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.DiscriminatorColumn;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Inheritance;
|
||||||
|
import jakarta.persistence.InheritanceType;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name = "notification_data")
|
||||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||||
@Table(name = "NotificationData")
|
@DiscriminatorColumn(name = "subclass")
|
||||||
public abstract class NotificationEvent extends DomainObject {
|
public abstract class NotificationEvent extends DomainObject {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
protected long id;
|
protected long id;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "type")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
protected Notification.Type type;
|
protected Notification.Type type;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "notificationEvent", cascade = CascadeType.ALL, orphanRemoval = true)
|
|
||||||
private Collection<Notification> notifications;
|
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Basic(optional = true)
|
||||||
|
@Column(name = "source")
|
||||||
private String source;
|
private String source;
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Basic(optional = true)
|
||||||
|
@Column(name = "additional_source")
|
||||||
private String additionalSource;
|
private String additionalSource;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (notification_data) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne(optional = true)
|
@ManyToOne(optional = true)
|
||||||
|
@JoinColumn(name = "caused_by_user_id", referencedColumnName = "id")
|
||||||
private User causedBy;
|
private User causedBy;
|
||||||
|
|
||||||
public abstract Enum getEvent();
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of other tables referencing to this table "notification_data"
|
||||||
/**
|
// ----------------------------------------------------------------------------------
|
||||||
* The title of the entity this event is about.
|
@OneToMany(mappedBy = "notificationEvent", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||||
*
|
private Collection<Notification> notifications;
|
||||||
* @return a human readable title
|
|
||||||
*/
|
|
||||||
protected abstract String getEntityTitle();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if there is an entity backing this event.
|
|
||||||
* Used to determine if this event was about a deletion, or has since been deleted.
|
|
||||||
*/
|
|
||||||
public abstract boolean hasEntity();
|
|
||||||
|
|
||||||
public abstract DomainObject getEntity();
|
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
protected NotificationEvent() {
|
protected NotificationEvent() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -58,6 +73,9 @@ public abstract class NotificationEvent extends DomainObject {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -75,14 +93,6 @@ public abstract class NotificationEvent extends DomainObject {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Notification> getNotifications() {
|
|
||||||
return notifications;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNotifications(Collection<Notification> notifications) {
|
|
||||||
this.notifications = notifications;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSource() {
|
public String getSource() {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
@ -91,8 +101,12 @@ public abstract class NotificationEvent extends DomainObject {
|
||||||
this.source = source;
|
this.source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getAdditionalSource() {
|
||||||
return hasEntity() ? getEntityTitle() : "[Deleted entity]";
|
return additionalSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdditionalSource(String additionalSource) {
|
||||||
|
this.additionalSource = additionalSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getCausedBy() {
|
public User getCausedBy() {
|
||||||
|
@ -103,6 +117,41 @@ public abstract class NotificationEvent extends DomainObject {
|
||||||
this.causedBy = user;
|
this.causedBy = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<Notification> getNotifications() {
|
||||||
|
return notifications;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNotifications(Collection<Notification> notifications) {
|
||||||
|
this.notifications = notifications;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Abstract methods to be implemented by subclasses
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* The title of the entity this event is about.
|
||||||
|
*
|
||||||
|
* @return a human readable title
|
||||||
|
*/
|
||||||
|
protected abstract String getEntityTitle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if there is an entity backing this event.
|
||||||
|
* Used to determine if this event was about a deletion, or has since been deleted.
|
||||||
|
*/
|
||||||
|
public abstract boolean hasEntity();
|
||||||
|
|
||||||
|
public abstract DomainObject getEntity();
|
||||||
|
|
||||||
|
public abstract Enum getEvent();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public String getTitle() {
|
||||||
|
return hasEntity() ? getEntityTitle() : "[Deleted entity]";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override this method if the event has an association with a {@link Project}.
|
* Override this method if the event has an association with a {@link Project}.
|
||||||
*
|
*
|
||||||
|
@ -111,12 +160,4 @@ public abstract class NotificationEvent extends DomainObject {
|
||||||
public Project getProject() {
|
public Project getProject() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAdditionalSource() {
|
|
||||||
return additionalSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAdditionalSource(String additionalSource) {
|
|
||||||
this.additionalSource = additionalSource;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package se.su.dsv.scipro.notifications.dataobject;
|
package se.su.dsv.scipro.notifications.dataobject;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
import se.su.dsv.scipro.peer.PeerReview;
|
import se.su.dsv.scipro.peer.PeerReview;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
@ -12,22 +15,31 @@ import jakarta.persistence.ManyToOne;
|
||||||
@Entity
|
@Entity
|
||||||
public class PeerEvent extends NotificationEvent {
|
public class PeerEvent extends NotificationEvent {
|
||||||
|
|
||||||
public enum Event { REVIEW_COMPLETED, REVIEW_COMMENT, REVIEW_ACCEPTED, REQUEST_DELETED,
|
public enum Event {
|
||||||
REQUEST_EXPIRED }
|
REVIEW_COMPLETED, REVIEW_COMMENT, REVIEW_ACCEPTED, REQUEST_DELETED,
|
||||||
|
REQUEST_EXPIRED
|
||||||
@ManyToOne
|
}
|
||||||
private PeerReview review;
|
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "event")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private Event event;
|
private Event event;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "peer_review_id", referencedColumnName = "id")
|
||||||
|
private PeerReview review;
|
||||||
|
|
||||||
public PeerEvent() {
|
public PeerEvent() {
|
||||||
super(Notification.Type.PEER);
|
super(Notification.Type.PEER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Project getProject() {
|
public Event getEvent() {
|
||||||
return review.getProject();
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEvent(Event event) {
|
||||||
|
this.event = event;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PeerReview getReview() {
|
public PeerReview getReview() {
|
||||||
|
@ -39,12 +51,8 @@ public class PeerEvent extends NotificationEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Event getEvent() {
|
public Project getProject() {
|
||||||
return event;
|
return review.getProject();
|
||||||
}
|
|
||||||
|
|
||||||
public void setEvent(Event event) {
|
|
||||||
this.event = event;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package se.su.dsv.scipro.notifications.dataobject;
|
package se.su.dsv.scipro.notifications.dataobject;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
import se.su.dsv.scipro.peer.PeerRequest;
|
import se.su.dsv.scipro.peer.PeerRequest;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
@ -12,10 +15,13 @@ import jakarta.persistence.ManyToOne;
|
||||||
@Entity
|
@Entity
|
||||||
public class PeerRequestEvent extends NotificationEvent {
|
public class PeerRequestEvent extends NotificationEvent {
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "event")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private PeerEvent.Event event;
|
private PeerEvent.Event event;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "peer_request_id", referencedColumnName = "id")
|
||||||
private PeerRequest request;
|
private PeerRequest request;
|
||||||
|
|
||||||
public PeerRequestEvent() {
|
public PeerRequestEvent() {
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package se.su.dsv.scipro.notifications.dataobject;
|
package se.su.dsv.scipro.notifications.dataobject;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
|
||||||
|
@ -19,29 +22,23 @@ public class ProjectEvent extends NotificationEvent {
|
||||||
FINAL_SEMINAR_APPROVAL_APPROVED, FINAL_SEMINAR_APPROVAL_REJECTED, ROUGH_DRAFT_APPROVAL_REQUESTED,
|
FINAL_SEMINAR_APPROVAL_APPROVED, FINAL_SEMINAR_APPROVAL_REJECTED, ROUGH_DRAFT_APPROVAL_REQUESTED,
|
||||||
ROUGH_DRAFT_APPROVAL_APPROVED, ROUGH_DRAFT_APPROVAL_REJECTED, REVIEWER_GRADING_REPORT_SUBMITTED,
|
ROUGH_DRAFT_APPROVAL_APPROVED, ROUGH_DRAFT_APPROVAL_REJECTED, REVIEWER_GRADING_REPORT_SUBMITTED,
|
||||||
ONE_YEAR_PASSED_FROM_LATEST_ANNUAL_REVIEW, SUPERVISOR_GRADING_INITIAL_ASSESSMENT_DONE,
|
ONE_YEAR_PASSED_FROM_LATEST_ANNUAL_REVIEW, SUPERVISOR_GRADING_INITIAL_ASSESSMENT_DONE,
|
||||||
EXPORTED_SUCCESS, REVIEWER_GRADING_INITIAL_ASSESSMENT_DONE, FIRST_MEETING, OPPOSITION_FAILED, PARTICIPATION_APPROVED, COMPLETED,
|
EXPORTED_SUCCESS, REVIEWER_GRADING_INITIAL_ASSESSMENT_DONE, FIRST_MEETING, OPPOSITION_FAILED,
|
||||||
PARTICIPATION_FAILED
|
PARTICIPATION_APPROVED, COMPLETED, PARTICIPATION_FAILED
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne
|
@Basic
|
||||||
private Project project;
|
@Column(name = "event")
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private Event event;
|
private Event event;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
|
private Project project;
|
||||||
|
|
||||||
public ProjectEvent() {
|
public ProjectEvent() {
|
||||||
super(Notification.Type.PROJECT);
|
super(Notification.Type.PROJECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Project getProject() {
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProject(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Event getEvent() {
|
public Event getEvent() {
|
||||||
return event;
|
return event;
|
||||||
|
@ -51,6 +48,15 @@ public class ProjectEvent extends NotificationEvent {
|
||||||
this.event = event;
|
this.event = event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Project getProject() {
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProject(Project project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEntityTitle() {
|
public String getEntityTitle() {
|
||||||
return project.getTitle();
|
return project.getTitle();
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package se.su.dsv.scipro.notifications.dataobject;
|
package se.su.dsv.scipro.notifications.dataobject;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
|
||||||
|
@ -10,29 +13,24 @@ import jakarta.persistence.ManyToOne;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class ProjectForumEvent extends NotificationEvent {
|
public class ProjectForumEvent extends NotificationEvent {
|
||||||
@ManyToOne
|
|
||||||
private Project project;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private Event event;
|
|
||||||
|
|
||||||
public void setProject(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Event {
|
public enum Event {
|
||||||
NEW_FORUM_POST, NEW_FORUM_POST_COMMENT, NEW_REVIEWER_INTERACTION
|
NEW_FORUM_POST, NEW_FORUM_POST_COMMENT, NEW_REVIEWER_INTERACTION
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "event")
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private Event event;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
|
private Project project;
|
||||||
|
|
||||||
public ProjectForumEvent() {
|
public ProjectForumEvent() {
|
||||||
super(Notification.Type.FORUM);
|
super(Notification.Type.FORUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Project getProject() {
|
|
||||||
return this.project;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Event getEvent() {
|
public Event getEvent() {
|
||||||
return event;
|
return event;
|
||||||
|
@ -42,6 +40,15 @@ public class ProjectForumEvent extends NotificationEvent {
|
||||||
this.event = event;
|
this.event = event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Project getProject() {
|
||||||
|
return this.project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProject(Project project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getEntityTitle() {
|
protected String getEntityTitle() {
|
||||||
return project.getTitle();
|
return project.getTitle();
|
||||||
|
@ -56,5 +63,4 @@ public class ProjectForumEvent extends NotificationEvent {
|
||||||
public DomainObject getEntity() {
|
public DomainObject getEntity() {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package se.su.dsv.scipro.notifications.dataobject;
|
package se.su.dsv.scipro.notifications.dataobject;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
import se.su.dsv.scipro.finalseminar.FinalSeminar;
|
import se.su.dsv.scipro.finalseminar.FinalSeminar;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
@ -12,27 +15,24 @@ import jakarta.persistence.ManyToOne;
|
||||||
@Entity
|
@Entity
|
||||||
public class SeminarEvent extends NotificationEvent {
|
public class SeminarEvent extends NotificationEvent {
|
||||||
|
|
||||||
public enum Event { CREATED, ROOM_CHANGED, DATE_CHANGED, OPPOSITION_CHANGED, PARTICIPATION_CHANGED, THESIS_UPLOADED, THESIS_UPLOADED_OPPONENT,
|
public enum Event { CREATED, ROOM_CHANGED, DATE_CHANGED, OPPOSITION_CHANGED,
|
||||||
OPPOSITION_REPORT_UPLOADED, THESIS_DELETED, THESIS_UPLOAD_REMIND, CANCELLED}
|
PARTICIPATION_CHANGED, THESIS_UPLOADED, THESIS_UPLOADED_OPPONENT,
|
||||||
|
OPPOSITION_REPORT_UPLOADED, THESIS_DELETED, THESIS_UPLOAD_REMIND, CANCELLED
|
||||||
@ManyToOne
|
}
|
||||||
private FinalSeminar seminar;
|
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "event")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private Event event;
|
private Event event;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "final_seminar_id", referencedColumnName = "id")
|
||||||
|
private FinalSeminar seminar;
|
||||||
|
|
||||||
public SeminarEvent() {
|
public SeminarEvent() {
|
||||||
super(Notification.Type.FINAL_SEMINAR);
|
super(Notification.Type.FINAL_SEMINAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FinalSeminar getSeminar() {
|
|
||||||
return seminar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeminar(FinalSeminar seminar) {
|
|
||||||
this.seminar = seminar;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Event getEvent() {
|
public Event getEvent() {
|
||||||
return event;
|
return event;
|
||||||
|
@ -42,6 +42,14 @@ public class SeminarEvent extends NotificationEvent {
|
||||||
this.event = event;
|
this.event = event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FinalSeminar getSeminar() {
|
||||||
|
return seminar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeminar(FinalSeminar seminar) {
|
||||||
|
this.seminar = seminar;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEntityTitle() {
|
public String getEntityTitle() {
|
||||||
return seminar.getProject().getTitle();
|
return seminar.getProject().getTitle();
|
||||||
|
|
|
@ -1,14 +1,21 @@
|
||||||
package se.su.dsv.scipro.notifications.settings.entities;
|
package se.su.dsv.scipro.notifications.settings.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.persistence.UniqueConstraint;
|
||||||
|
|
||||||
import se.su.dsv.scipro.notifications.dataobject.Notification;
|
import se.su.dsv.scipro.notifications.dataobject.Notification;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "notification_delivery_configuration",
|
@Table(name = "notification_delivery_configuration",
|
||||||
uniqueConstraints = {
|
uniqueConstraints = {
|
||||||
@UniqueConstraint(name = "one_setting_per_user", columnNames = {"type", "event", "method", "user_id"})
|
@UniqueConstraint(name = "uk_one_setting_per_user", columnNames = {"type", "event", "method", "user_id"})
|
||||||
})
|
})
|
||||||
public class DeliveryConfiguration extends Configuration {
|
public class DeliveryConfiguration extends Configuration {
|
||||||
|
|
||||||
|
|
|
@ -1,80 +1,115 @@
|
||||||
package se.su.dsv.scipro.peer;
|
package se.su.dsv.scipro.peer;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.Lob;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.checklist.ChecklistAnswerEnum;
|
import se.su.dsv.scipro.checklist.ChecklistAnswerEnum;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="answer")
|
@Table(name="answer")
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
public class Answer extends DomainObject {
|
public class Answer extends DomainObject {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne(optional=false)
|
|
||||||
private PeerReview peerReview;
|
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "question")
|
||||||
private String question;
|
private String question;
|
||||||
|
|
||||||
@Lob
|
|
||||||
@Basic(optional=true)
|
|
||||||
private String motivation;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
@Column(nullable=false)
|
@Column(name = "answer", nullable=false)
|
||||||
private ChecklistAnswerEnum answer = ChecklistAnswerEnum.NO_ANSWER;
|
private ChecklistAnswerEnum answer = ChecklistAnswerEnum.NO_ANSWER;
|
||||||
|
|
||||||
|
@Basic(optional=true)
|
||||||
|
@Lob
|
||||||
|
@Column(name = "motivation")
|
||||||
|
private String motivation;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (answer) referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne(optional=false)
|
||||||
|
@JoinColumn(name = "peer_review_id", referencedColumnName = "id")
|
||||||
|
private PeerReview peerReview;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Answer() {}
|
public Answer() {}
|
||||||
|
|
||||||
public Answer(PeerReview peerReview, String question){
|
public Answer(PeerReview peerReview, String question){
|
||||||
this.peerReview = peerReview;
|
this.peerReview = peerReview;
|
||||||
this.question = question;
|
this.question = question;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// getters and setters
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PeerReview getPeerReview() {
|
|
||||||
return this.peerReview;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getQuestion() {
|
|
||||||
return this.question;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMotivation() {
|
|
||||||
return this.motivation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChecklistAnswerEnum getAnswer() {
|
|
||||||
return this.answer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPeerReview(PeerReview peerReview) {
|
public String getQuestion() {
|
||||||
this.peerReview = peerReview;
|
return this.question;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQuestion(String question) {
|
public void setQuestion(String question) {
|
||||||
this.question = question;
|
this.question = question;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMotivation(String motivation) {
|
public ChecklistAnswerEnum getAnswer() {
|
||||||
this.motivation = motivation;
|
return this.answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAnswer(ChecklistAnswerEnum answer) {
|
public void setAnswer(ChecklistAnswerEnum answer) {
|
||||||
this.answer = answer;
|
this.answer = answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getMotivation() {
|
||||||
|
return this.motivation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotivation(String motivation) {
|
||||||
|
this.motivation = motivation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PeerReview getPeerReview() {
|
||||||
|
return this.peerReview;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPeerReview(PeerReview peerReview) {
|
||||||
|
this.peerReview = peerReview;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof Answer;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -84,10 +119,6 @@ public class Answer extends DomainObject {
|
||||||
&& Objects.equals(this.getId(), other.getId());
|
&& Objects.equals(this.getId(), other.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof Answer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(this.getId());
|
return Objects.hashCode(this.getId());
|
||||||
|
@ -95,6 +126,7 @@ public class Answer extends DomainObject {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Answer(id=" + this.getId() + ", question=" + this.getQuestion() + ", motivation=" + this.getMotivation() + ", answer=" + this.getAnswer() + ")";
|
return "Answer(id=" + this.getId() + ", question=" + this.getQuestion() + ", motivation=" +
|
||||||
|
this.getMotivation() + ", answer=" + this.getAnswer() + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
package se.su.dsv.scipro.peer;
|
package se.su.dsv.scipro.peer;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.Lob;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
tozh4728 marked this conversation as resolved
Outdated
ansv7779
commented
The renaming of some user foreign key columns seem a bit weird. In some places it was a loss of information by going to just The renaming of some user foreign key columns seem a bit weird. In some places it was a loss of information by going to just `user_id` while others they got `_user_id` appended to them and some were left as-is. Out of the three options just `user_id` is the worst one when there is additional context to be had. In this case "creator", so I think the column should be `creator_id` or `creator_user_id` to convey as much information as possible. It is also consistent with other foreign keys that use the `<context>_user_id` naming scheme. See for example `core/src/main/java/se/su/dsv/scipro/peer/PeerRequest.java` and its `requester_user_id`.
|
|||||||
|
@ -16,12 +26,16 @@ public class Comment extends DomainObject {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "creator_user_id", referencedColumnName = "id")
|
||||||
private User creator;
|
private User creator;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "comment")
|
||||||
@Lob
|
@Lob
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "comment_thread_id", referencedColumnName = "id")
|
||||||
private CommentThread commentThread;
|
private CommentThread commentThread;
|
||||||
|
|
||||||
protected Comment() {
|
protected Comment() {
|
||||||
|
|
|
@ -8,7 +8,9 @@ import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "comment_thread", uniqueConstraints = {@UniqueConstraint(columnNames = {"commentableKey", "commentableId"})})
|
@Table(name = "comment_thread",
|
||||||
|
uniqueConstraints = {@UniqueConstraint(name = "uk_comment_thread_id_key",
|
||||||
|
columnNames = {"commentable_key", "commentable_id"})})
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
public class CommentThread extends DomainObject {
|
public class CommentThread extends DomainObject {
|
||||||
|
|
||||||
|
@ -16,11 +18,10 @@ public class CommentThread extends DomainObject {
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "commentable_key", length = 191, nullable = false)
|
||||||
@Column(length = 191)
|
|
||||||
private String commentableKey;
|
private String commentableKey;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "commentable_id", nullable = false)
|
||||||
private Long commentableId;
|
private Long commentableId;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "commentThread", orphanRemoval = true, cascade = CascadeType.ALL, targetEntity = Comment.class)
|
@OneToMany(mappedBy = "commentThread", orphanRemoval = true, cascade = CascadeType.ALL, targetEntity = Comment.class)
|
||||||
|
|
|
@ -1,7 +1,20 @@
|
||||||
package se.su.dsv.scipro.peer;
|
package se.su.dsv.scipro.peer;
|
||||||
|
|
||||||
import com.querydsl.core.annotations.QueryInit;
|
import com.querydsl.core.annotations.QueryInit;
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
import jakarta.persistence.GenerationType;
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.Lob;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.checklist.ChecklistTemplate;
|
import se.su.dsv.scipro.checklist.ChecklistTemplate;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Member;
|
import se.su.dsv.scipro.data.dataobjects.Member;
|
||||||
import se.su.dsv.scipro.file.FileReference;
|
import se.su.dsv.scipro.file.FileReference;
|
||||||
|
@ -10,57 +23,138 @@ import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.Language;
|
import se.su.dsv.scipro.system.Language;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.Basic;
|
import java.util.ArrayList;
|
||||||
import jakarta.persistence.Cacheable;
|
import java.util.List;
|
||||||
import jakarta.persistence.Column;
|
import java.util.Objects;
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.EnumType;
|
|
||||||
import jakarta.persistence.Enumerated;
|
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.JoinColumn;
|
|
||||||
import jakarta.persistence.Lob;
|
|
||||||
import jakarta.persistence.ManyToOne;
|
|
||||||
import jakarta.persistence.OneToMany;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "peer_request")
|
@Table(name = "peer_request")
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
public class PeerRequest extends DomainObject {
|
public class PeerRequest extends DomainObject {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Lob
|
|
||||||
@Basic(optional = true)
|
@Basic(optional = true)
|
||||||
|
@Lob
|
||||||
|
@Column(name = "comment")
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@Enumerated(EnumType.STRING)
|
||||||
@QueryInit({"headSupervisor", "projectType"})
|
@Column(name = "status", nullable = false)
|
||||||
private Project project;
|
private RequestStatus status = RequestStatus.WAITING;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
|
||||||
private User requester;
|
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
|
||||||
@JoinColumn(name = "file_reference_id")
|
|
||||||
private FileReference file;
|
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
|
||||||
private ChecklistTemplate checklistTemplate;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private Language language;
|
private Language language;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (peer_request) referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne(optional = true)
|
||||||
|
@JoinColumn(name = "checklist_template_id", referencedColumnName = "id")
|
||||||
|
private ChecklistTemplate checklistTemplate;
|
||||||
|
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "file_reference_id", referencedColumnName = "id")
|
||||||
|
private FileReference file;
|
||||||
|
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
|
@QueryInit({"headSupervisor", "projectType"})
|
||||||
|
private Project project;
|
||||||
|
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "requester_user_id", referencedColumnName = "id")
|
||||||
|
private User requester;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of other tables referencing to this table "peer_request"
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@OneToMany(mappedBy = "peerRequest")
|
@OneToMany(mappedBy = "peerRequest")
|
||||||
private List<PeerReview> peerReviews = new ArrayList<>(1);
|
private List<PeerReview> peerReviews = new ArrayList<>(1);
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
// ----------------------------------------------------------------------------------
|
||||||
@Column(nullable = false)
|
// getters and setters
|
||||||
private RequestStatus status = RequestStatus.WAITING;
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getComment() {
|
||||||
|
return this.comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComment(String comment) {
|
||||||
|
this.comment = comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RequestStatus getStatus() {
|
||||||
|
return this.status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(RequestStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Language getLanguage() {
|
||||||
|
return this.language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguage(Language language) {
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChecklistTemplate getChecklistTemplate() {
|
||||||
|
return this.checklistTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChecklistTemplate(ChecklistTemplate checklistTemplate) {
|
||||||
|
this.checklistTemplate = checklistTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileReference getFile() {
|
||||||
|
return this.file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFile(FileReference file) {
|
||||||
|
this.file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Project getProject() {
|
||||||
|
return this.project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProject(Project project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getRequester() {
|
||||||
|
return this.requester;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRequester(User requester) {
|
||||||
|
this.requester = requester;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PeerReview> getPeerReviews() {
|
||||||
|
return this.peerReviews;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPeerReviews(List<PeerReview> peerReviews) {
|
||||||
|
this.peerReviews = peerReviews;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public List<Member> getMembers() {
|
public List<Member> getMembers() {
|
||||||
List<Member> members = project.getMembers();
|
List<Member> members = project.getMembers();
|
||||||
|
|
||||||
|
@ -80,77 +174,8 @@ public class PeerRequest extends DomainObject {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
protected boolean canEqual(final Object other) {
|
||||||
public Long getId() {
|
return other instanceof PeerRequest;
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return this.comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Project getProject() {
|
|
||||||
return this.project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getRequester() {
|
|
||||||
return this.requester;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileReference getFile() {
|
|
||||||
return this.file;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChecklistTemplate getChecklistTemplate() {
|
|
||||||
return this.checklistTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Language getLanguage() {
|
|
||||||
return this.language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PeerReview> getPeerReviews() {
|
|
||||||
return this.peerReviews;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RequestStatus getStatus() {
|
|
||||||
return this.status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String comment) {
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProject(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRequester(User requester) {
|
|
||||||
this.requester = requester;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFile(FileReference file) {
|
|
||||||
this.file = file;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChecklistTemplate(ChecklistTemplate checklistTemplate) {
|
|
||||||
this.checklistTemplate = checklistTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLanguage(Language language) {
|
|
||||||
this.language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPeerReviews(List<PeerReview> peerReviews) {
|
|
||||||
this.peerReviews = peerReviews;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(RequestStatus status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -162,10 +187,6 @@ public class PeerRequest extends DomainObject {
|
||||||
&& Objects.equals(this.getId(), other.getId());
|
&& Objects.equals(this.getId(), other.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof PeerRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(this.getId());
|
return Objects.hashCode(this.getId());
|
||||||
|
@ -173,6 +194,9 @@ public class PeerRequest extends DomainObject {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "PeerRequest(id=" + this.getId() + ", comment=" + this.getComment() + ", project=" + this.getProject() + ", requester=" + this.getRequester() + ", file=" + this.getFile() + ", checklistTemplate=" + this.getChecklistTemplate() + ", language=" + this.getLanguage() + ", status=" + this.getStatus() + ")";
|
return "PeerRequest(id=" + this.getId() + ", comment=" + this.getComment() + ", project=" +
|
||||||
|
this.getProject() + ", requester=" + this.getRequester() + ", file=" + this.getFile() +
|
||||||
|
", checklistTemplate=" + this.getChecklistTemplate() + ", language=" + this.getLanguage() +
|
||||||
|
", status=" + this.getStatus() + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,24 @@
|
||||||
package se.su.dsv.scipro.peer;
|
package se.su.dsv.scipro.peer;
|
||||||
|
|
||||||
import com.querydsl.core.annotations.QueryInit;
|
import com.querydsl.core.annotations.QueryInit;
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.Lob;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.OrderBy;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import se.su.dsv.scipro.checklist.ChecklistAnswerEnum;
|
import se.su.dsv.scipro.checklist.ChecklistAnswerEnum;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Member;
|
import se.su.dsv.scipro.data.dataobjects.Member;
|
||||||
import se.su.dsv.scipro.file.FileReference;
|
import se.su.dsv.scipro.file.FileReference;
|
||||||
|
@ -8,7 +26,6 @@ import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -24,39 +41,138 @@ public class PeerReview extends DomainObject implements Commentable {
|
||||||
IN_PROGRESS, COMPLETED, EXPIRED
|
IN_PROGRESS, COMPLETED, EXPIRED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne(optional=false)
|
@Basic
|
||||||
@QueryInit("*.*")
|
@Lob
|
||||||
private User reviewer;
|
@Column(name = "comment")
|
||||||
|
private String comment;
|
||||||
|
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(name = "status")
|
||||||
|
private ReviewStatus status = ReviewStatus.IN_PROGRESS;
|
||||||
|
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "deadline")
|
||||||
|
private Date deadline;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (peer_review) referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@OneToOne(optional=true, orphanRemoval = true, cascade = CascadeType.ALL)
|
||||||
|
@JoinColumn(name = "file_reference_id", referencedColumnName = "id")
|
||||||
|
private FileReference file;
|
||||||
|
|
||||||
@ManyToOne(optional=false)
|
@ManyToOne(optional=false)
|
||||||
|
@JoinColumn(name = "peer_request_id", referencedColumnName = "id")
|
||||||
|
@QueryInit({"project.headSupervisor", "requester.user", "language", "checklistTemplate"})
|
||||||
|
private PeerRequest peerRequest;
|
||||||
|
|
||||||
|
@ManyToOne(optional=false)
|
||||||
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
@QueryInit({"headSupervisor", "projectType"})
|
@QueryInit({"headSupervisor", "projectType"})
|
||||||
private Project project;
|
private Project project;
|
||||||
|
|
||||||
@ManyToOne(optional=false)
|
@ManyToOne(optional=false)
|
||||||
@QueryInit({"project.headSupervisor","requester.user", "language", "checklistTemplate"})
|
@JoinColumn(name = "reviewer_user_id", referencedColumnName = "id")
|
||||||
private PeerRequest peerRequest;
|
@QueryInit("*.*")
|
||||||
|
private User reviewer;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of other tables referencing to this table "peer_review"
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@OneToMany(mappedBy="peerReview", orphanRemoval=true, cascade=CascadeType.ALL)
|
@OneToMany(mappedBy="peerReview", orphanRemoval=true, cascade=CascadeType.ALL)
|
||||||
@OrderBy("id")
|
@OrderBy("id")
|
||||||
private List<Answer> answers = new ArrayList<>();
|
private List<Answer> answers = new ArrayList<>();
|
||||||
|
|
||||||
@OneToOne(optional=true, orphanRemoval = true, cascade = CascadeType.ALL)
|
// ----------------------------------------------------------------------------------
|
||||||
@JoinColumn(name = "file_reference_id")
|
// getters and setters
|
||||||
private FileReference file;
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
@Lob
|
public void setId(Long id) {
|
||||||
private String comment;
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
public String getComment() {
|
||||||
private ReviewStatus status = ReviewStatus.IN_PROGRESS;
|
return this.comment;
|
||||||
|
}
|
||||||
|
|
||||||
@Basic(optional = false)
|
public void setComment(String comment) {
|
||||||
private Date deadline;
|
this.comment = comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReviewStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(ReviewStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDeadline() {
|
||||||
|
return this.deadline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeadline(Date deadline) {
|
||||||
|
this.deadline = deadline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileReference getFile() {
|
||||||
|
return this.file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFile(FileReference file) {
|
||||||
|
this.file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PeerRequest getPeerRequest() {
|
||||||
|
return this.peerRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPeerRequest(PeerRequest peerRequest) {
|
||||||
|
this.peerRequest = peerRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Project getProject() {
|
||||||
|
return this.project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProject(Project project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getReviewer() {
|
||||||
|
return this.reviewer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReviewer(User reviewer) {
|
||||||
|
this.reviewer = reviewer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Answer> getAnswers() {
|
||||||
|
return this.answers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnswers(List<Answer> answers) {
|
||||||
|
this.answers = answers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addAnswer(String question) {
|
||||||
|
this.answers.add(new Answer(this, question));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public final String getCommentKey() {
|
public final String getCommentKey() {
|
||||||
return PeerReview.class.getCanonicalName();
|
return PeerReview.class.getCanonicalName();
|
||||||
|
@ -73,10 +189,6 @@ public class PeerReview extends DomainObject implements Commentable {
|
||||||
return new Date().after(getDeadline());
|
return new Date().after(getDeadline());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReviewStatus getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isExpired() {
|
public boolean isExpired() {
|
||||||
return status == ReviewStatus.EXPIRED;
|
return status == ReviewStatus.EXPIRED;
|
||||||
}
|
}
|
||||||
|
@ -97,90 +209,12 @@ public class PeerReview extends DomainObject implements Commentable {
|
||||||
setStatus(isLate() ? ReviewStatus.EXPIRED : ReviewStatus.COMPLETED);
|
setStatus(isLate() ? ReviewStatus.EXPIRED : ReviewStatus.COMPLETED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isEmpty(String s) {
|
|
||||||
return s == null || s.isBlank();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void expire() {
|
public void expire() {
|
||||||
status = ReviewStatus.EXPIRED;
|
status = ReviewStatus.EXPIRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addAnswer(String question) {
|
protected boolean canEqual(final Object other) {
|
||||||
this.answers.add(new Answer(this, question));
|
return other instanceof PeerReview;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getReviewer() {
|
|
||||||
return this.reviewer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Project getProject() {
|
|
||||||
return this.project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PeerRequest getPeerRequest() {
|
|
||||||
return this.peerRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Answer> getAnswers() {
|
|
||||||
return this.answers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileReference getFile() {
|
|
||||||
return this.file;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return this.comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getDeadline() {
|
|
||||||
return this.deadline;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReviewer(User reviewer) {
|
|
||||||
this.reviewer = reviewer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProject(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPeerRequest(PeerRequest peerRequest) {
|
|
||||||
this.peerRequest = peerRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAnswers(List<Answer> answers) {
|
|
||||||
this.answers = answers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFile(FileReference file) {
|
|
||||||
this.file = file;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String comment) {
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(ReviewStatus status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeadline(Date deadline) {
|
|
||||||
this.deadline = deadline;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "PeerReview(id=" + this.getId() + ", reviewer=" + this.getReviewer() + ", project=" + this.getProject() + ", peerRequest=" + this.getPeerRequest() + ", answers=" + this.getAnswers() + ", file=" + this.getFile() + ", comment=" + this.getComment() + ", status=" + this.getStatus() + ", deadline=" + this.getDeadline() + ")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -192,12 +226,23 @@ public class PeerReview extends DomainObject implements Commentable {
|
||||||
&& Objects.equals(this.getId(), other.getId());
|
&& Objects.equals(this.getId(), other.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof PeerReview;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(this.getId());
|
return Objects.hashCode(this.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "PeerReview(id=" + this.getId() + ", reviewer=" + this.getReviewer() + ", project=" +
|
||||||
|
this.getProject() + ", peerRequest=" + this.getPeerRequest() + ", answers=" + this.getAnswers() +
|
||||||
|
", file=" + this.getFile() + ", comment=" + this.getComment() + ", status=" + this.getStatus() +
|
||||||
|
", deadline=" + this.getDeadline() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Static helper methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
private static boolean isEmpty(String s) {
|
||||||
|
return s == null || s.isBlank();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,46 +11,61 @@ import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.OneToOne;
|
import jakarta.persistence.OneToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import java.util.*;
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "plagiarism_request")
|
@Table(name = "plagiarism_request")
|
||||||
class PlagiarismRequest {
|
class PlagiarismRequest {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (plagiarism_request) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@OneToOne(optional = false)
|
@OneToOne(optional = false)
|
||||||
@JoinColumn(name = "document_reference_id")
|
@JoinColumn(name = "document_file_reference_id", referencedColumnName = "id")
|
||||||
private FileReference document;
|
private FileReference document;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "receiver_user_id", referencedColumnName = "id")
|
||||||
private User receiver;
|
private User receiver;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileReference getDocument() {
|
|
||||||
return this.document;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getReceiver() {
|
|
||||||
return this.receiver;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FileReference getDocument() {
|
||||||
|
return this.document;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDocument(FileReference fileDescription) {
|
public void setDocument(FileReference fileDescription) {
|
||||||
this.document = fileDescription;
|
this.document = fileDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public User getReceiver() {
|
||||||
|
return this.receiver;
|
||||||
|
}
|
||||||
|
|
||||||
public void setReceiver(User receiver) {
|
public void setReceiver(User receiver) {
|
||||||
this.receiver = receiver;
|
this.receiver = receiver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -62,10 +77,6 @@ class PlagiarismRequest {
|
||||||
&& Objects.equals(this.getReceiver(), other.getReceiver());
|
&& Objects.equals(this.getReceiver(), other.getReceiver());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof PlagiarismRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.getId(), this.getDocument(), this.getReceiver());
|
return Objects.hash(this.getId(), this.getDocument(), this.getReceiver());
|
||||||
|
@ -73,6 +84,14 @@ class PlagiarismRequest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "PlagiarismRequest(id=" + this.getId() + ", fileDescription=" + this.getDocument() + ", receiver=" + this.getReceiver() + ")";
|
return "PlagiarismRequest(id=" + this.getId() + ", fileDescription=" + this.getDocument() +
|
||||||
|
", receiver=" + this.getReceiver() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other method
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof PlagiarismRequest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package se.su.dsv.scipro.plagiarism.urkund;
|
package se.su.dsv.scipro.plagiarism.urkund;
|
||||||
|
|
||||||
import jakarta.persistence.Basic;
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -15,12 +17,15 @@ public class UrkundSettings {
|
||||||
private long id = ID;
|
private long id = ID;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
@Column(name = "enabled")
|
||||||
private boolean enabled = false;
|
private boolean enabled = false;
|
||||||
|
|
||||||
tozh4728 marked this conversation as resolved
Outdated
ansv7779
commented
Username is one word. "User name" is the user's name (as in John Doe) while username is the unique Username is one word. "User name" is the user's name (as in John Doe) while username is the unique `john@doe.example`.
|
|||||||
@Basic
|
@Basic
|
||||||
|
@Column(name = "username")
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
@Column(name = "password")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
|
@ -70,6 +75,7 @@ public class UrkundSettings {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "UrkundSettings(id=" + this.id + ", enabled=" + this.isEnabled() + ", username=" + this.getUsername() + ", password=" + this.getPassword() + ")";
|
return "UrkundSettings(id=" + this.id + ", enabled=" + this.isEnabled() + ", username=" +
|
||||||
|
this.getUsername() + ", password=" + this.getPassword() + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,139 +17,159 @@ import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.OneToOne;
|
import jakarta.persistence.OneToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "urkund_submission")
|
@Table(name = "urkund_submission")
|
||||||
public class UrkundSubmission extends DomainObject {
|
public class UrkundSubmission extends DomainObject {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public enum State {
|
// Basic JPA-mappings
|
||||||
SUBMISSION_FAILED, SUBMITTED, REJECTED, ACCEPTED, ANALYZED, ERROR;
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
public boolean isFinal() {
|
|
||||||
return !(this == SUBMITTED || this == ACCEPTED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne
|
@Basic
|
||||||
private User receiver;
|
@Column(name = "submitted_date", nullable = false)
|
||||||
|
private Instant submitted;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
private String analysisAddress;
|
@Column(name = "state", nullable = false)
|
||||||
|
|
||||||
@Column(nullable = false)
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private State state;
|
private State state;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Basic
|
||||||
private Instant submitted;
|
@Column(name = "next_poll_date", nullable = false)
|
||||||
|
|
||||||
@Column(nullable = false)
|
|
||||||
private Instant nextPoll;
|
private Instant nextPoll;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Basic
|
||||||
|
@Column(name = "polling_delay", nullable = false)
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private PollingDelay pollingDelay = PollingDelay.FIRST;
|
private PollingDelay pollingDelay = PollingDelay.FIRST;
|
||||||
|
|
||||||
@OneToOne(optional = false)
|
|
||||||
@JoinColumn(name = "document_reference_id")
|
|
||||||
private FileReference document;
|
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "message")
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
@Column(name = "report_url")
|
||||||
private String reportUrl;
|
private String reportUrl;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
@Column(name = "significance")
|
||||||
private Float significance;
|
private Float significance;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "analysis_address")
|
||||||
|
private String analysisAddress;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (urkund_submission) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@OneToOne(optional = false)
|
||||||
|
@JoinColumn(name = "document_file_reference_id", referencedColumnName = "id")
|
||||||
|
private FileReference document;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "receiver_user_id", referencedColumnName = "id")
|
||||||
|
private User receiver;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAnalysisAddress() {
|
|
||||||
return this.analysisAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public State getState() {
|
|
||||||
return this.state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getSubmitted() {
|
|
||||||
return this.submitted;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileReference getDocument() {
|
|
||||||
return this.document;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return this.message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReportUrl() {
|
|
||||||
return this.reportUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Float getSignificance() {
|
|
||||||
return this.significance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "UrkundSubmission(id=" + this.getId() + ", receiver=" + this.getReceiver() + ", analysisAddress=" + this.getAnalysisAddress() + ", state=" + this.getState() + ", submitted=" + this.getSubmitted() + ", nextPoll=" + this.getNextPoll() + ", pollingDelay=" + this.getPollingDelay() + ", fileDescription=" + this.getDocument() + ", message=" + this.getMessage() + ", reportUrl=" + this.getReportUrl() + ", significance=" + this.getSignificance() + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
void setId(Long id) {
|
void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setReceiver(User receiver) {
|
public Instant getSubmitted() {
|
||||||
this.receiver = receiver;
|
return this.submitted;
|
||||||
}
|
|
||||||
|
|
||||||
void setAnalysisAddress(String analysisAddress) {
|
|
||||||
this.analysisAddress = analysisAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setState(State state) {
|
|
||||||
this.state = state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSubmitted(Instant submitted) {
|
void setSubmitted(Instant submitted) {
|
||||||
this.submitted = submitted;
|
this.submitted = submitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public State getState() {
|
||||||
|
return this.state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setState(State state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
Instant getNextPoll() {
|
||||||
|
return this.nextPoll;
|
||||||
|
}
|
||||||
|
|
||||||
void setNextPoll(Instant nextPoll) {
|
void setNextPoll(Instant nextPoll) {
|
||||||
this.nextPoll = nextPoll;
|
this.nextPoll = nextPoll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PollingDelay getPollingDelay() {
|
||||||
|
return this.pollingDelay;
|
||||||
|
}
|
||||||
|
|
||||||
void setPollingDelay(PollingDelay pollingDelay) {
|
void setPollingDelay(PollingDelay pollingDelay) {
|
||||||
this.pollingDelay = pollingDelay;
|
this.pollingDelay = pollingDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDocument(FileReference fileDescription) {
|
public String getMessage() {
|
||||||
this.document = fileDescription;
|
return this.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMessage(String message) {
|
void setMessage(String message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getReportUrl() {
|
||||||
|
return this.reportUrl;
|
||||||
|
}
|
||||||
|
|
||||||
void setReportUrl(String reportUrl) {
|
void setReportUrl(String reportUrl) {
|
||||||
this.reportUrl = reportUrl;
|
this.reportUrl = reportUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Float getSignificance() {
|
||||||
|
return this.significance;
|
||||||
|
}
|
||||||
|
|
||||||
void setSignificance(Float significance) {
|
void setSignificance(Float significance) {
|
||||||
this.significance = significance;
|
this.significance = significance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAnalysisAddress() {
|
||||||
|
return this.analysisAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setAnalysisAddress(String analysisAddress) {
|
||||||
|
this.analysisAddress = analysisAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileReference getDocument() {
|
||||||
|
return this.document;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDocument(FileReference fileDescription) {
|
||||||
|
this.document = fileDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
User getReceiver() {
|
||||||
|
return this.receiver;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setReceiver(User receiver) {
|
||||||
|
this.receiver = receiver;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -170,10 +190,6 @@ public class UrkundSubmission extends DomainObject {
|
||||||
&& Objects.equals(this.getSignificance(), other.getSignificance());
|
&& Objects.equals(this.getSignificance(), other.getSignificance());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof UrkundSubmission;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(
|
return Objects.hash(
|
||||||
|
@ -190,15 +206,31 @@ public class UrkundSubmission extends DomainObject {
|
||||||
this.getSignificance());
|
this.getSignificance());
|
||||||
}
|
}
|
||||||
|
|
||||||
User getReceiver() {
|
@Override
|
||||||
return this.receiver;
|
public String toString() {
|
||||||
|
return "UrkundSubmission(id=" + this.getId() + ", receiver=" + this.getReceiver() +
|
||||||
|
", analysisAddress=" + this.getAnalysisAddress() + ", state=" +
|
||||||
|
this.getState() + ", submitted=" + this.getSubmitted() +
|
||||||
|
", nextPoll=" + this.getNextPoll() + ", pollingDelay=" + this.getPollingDelay() +
|
||||||
|
", fileDescription=" + this.getDocument() + ", message=" + this.getMessage() +
|
||||||
|
", reportUrl=" + this.getReportUrl() + ", significance=" + this.getSignificance() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
Instant getNextPoll() {
|
// ----------------------------------------------------------------------------------
|
||||||
return this.nextPoll;
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof UrkundSubmission;
|
||||||
}
|
}
|
||||||
|
|
||||||
PollingDelay getPollingDelay() {
|
// ----------------------------------------------------------------------------------
|
||||||
return this.pollingDelay;
|
// Nested type
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public enum State {
|
||||||
|
SUBMISSION_FAILED, SUBMITTED, REJECTED, ACCEPTED, ANALYZED, ERROR;
|
||||||
|
|
||||||
|
public boolean isFinal() {
|
||||||
|
return !(this == SUBMITTED || this == ACCEPTED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,34 @@
|
||||||
package se.su.dsv.scipro.project;
|
package se.su.dsv.scipro.project;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Embeddable;
|
||||||
|
import jakarta.persistence.EmbeddedId;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.MapsId;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "project_user")
|
@Table(name = "project_user")
|
||||||
public class Author {
|
public class Author {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Embedded JPA-mapping
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@EmbeddedId
|
@EmbeddedId
|
||||||
private AuthorPK authorPK;
|
private AuthorPK authorPK;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
// ----------------------------------------------------------------------------------
|
||||||
@JoinColumn(name = "project_id", nullable = false)
|
// Basic JPA-mappings
|
||||||
@MapsId("projectId")
|
// ----------------------------------------------------------------------------------
|
||||||
private Project project;
|
@Basic(optional = true)
|
||||||
|
@Column(name = "reflection")
|
||||||
@ManyToOne(optional = false)
|
private String reflection;
|
||||||
@JoinColumn(name = "user_id", nullable = false)
|
|
||||||
@MapsId("userId")
|
|
||||||
private User user;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this author wants to be notified when a final seminar created
|
* If this author wants to be notified when a final seminar created
|
||||||
|
@ -36,15 +44,29 @@ public class Author {
|
||||||
@Column(name = "subscribed_to_final_seminar_notifications", nullable = false, columnDefinition = "BOOLEAN DEFAULT FALSE")
|
@Column(name = "subscribed_to_final_seminar_notifications", nullable = false, columnDefinition = "BOOLEAN DEFAULT FALSE")
|
||||||
private boolean subscribedToFinalSeminarNotifications;
|
private boolean subscribedToFinalSeminarNotifications;
|
||||||
|
|
||||||
@Basic(optional = true)
|
// ----------------------------------------------------------------------------------
|
||||||
private String reflection;
|
// JPA-mappings of foreign keys in this table (project_user) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "project_id", nullable = false)
|
||||||
|
@MapsId("projectId")
|
||||||
|
private Project project;
|
||||||
|
|
||||||
public Project getProject() {
|
@ManyToOne(optional = false)
|
||||||
return project;
|
@JoinColumn(name = "user_id", nullable = false)
|
||||||
|
@MapsId("userId")
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public String getReflection() {
|
||||||
|
return reflection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getUser() {
|
public void setReflection(String reflection) {
|
||||||
return user;
|
this.reflection = reflection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSubscribedToFinalSeminarNotifications() {
|
public boolean isSubscribedToFinalSeminarNotifications() {
|
||||||
|
@ -55,14 +77,17 @@ public class Author {
|
||||||
this.subscribedToFinalSeminarNotifications = subscribedToFinalSeminarNotifications;
|
this.subscribedToFinalSeminarNotifications = subscribedToFinalSeminarNotifications;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReflection() {
|
public Project getProject() {
|
||||||
return reflection;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReflection(String reflection) {
|
public User getUser() {
|
||||||
this.reflection = reflection;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Nested class
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Embeddable
|
@Embeddable
|
||||||
public static class AuthorPK implements Serializable {
|
public static class AuthorPK implements Serializable {
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
|
|
@ -1,13 +1,51 @@
|
||||||
package se.su.dsv.scipro.project;
|
package se.su.dsv.scipro.project;
|
||||||
|
|
||||||
import com.querydsl.core.annotations.QueryInit;
|
import com.querydsl.core.annotations.QueryInit;
|
||||||
|
import jakarta.persistence.AttributeOverride;
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.CollectionTable;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.ElementCollection;
|
||||||
|
import jakarta.persistence.Embedded;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.JoinTable;
|
||||||
|
import jakarta.persistence.ManyToMany;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.MapKeyJoinColumn;
|
||||||
|
import jakarta.persistence.PrePersist;
|
||||||
|
import jakarta.persistence.PreUpdate;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Member;
|
import se.su.dsv.scipro.data.dataobjects.Member;
|
||||||
import se.su.dsv.scipro.reusable.SciProUtilities;
|
import se.su.dsv.scipro.reusable.SciProUtilities;
|
||||||
import se.su.dsv.scipro.system.*;
|
import se.su.dsv.scipro.system.DegreeType;
|
||||||
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
import se.su.dsv.scipro.system.Language;
|
||||||
|
import se.su.dsv.scipro.system.ProjectModule;
|
||||||
|
import se.su.dsv.scipro.system.ProjectType;
|
||||||
|
import se.su.dsv.scipro.system.ResearchArea;
|
||||||
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.SortedSet;
|
||||||
|
import java.util.TreeSet;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -18,17 +56,30 @@ public class Project extends DomainObject {
|
||||||
public static final String NO_CO_SUPERVISOR = "No co-supervisor";
|
public static final String NO_CO_SUPERVISOR = "No co-supervisor";
|
||||||
public static final int TITLE_MAX_LENGTH = 255;
|
public static final int TITLE_MAX_LENGTH = 255;
|
||||||
|
|
||||||
|
public static ITitle builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column(unique = true)
|
|
||||||
private Integer identifier;
|
|
||||||
|
|
||||||
@Column(length = TITLE_MAX_LENGTH)
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "title", length = TITLE_MAX_LENGTH)
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "credits")
|
||||||
|
private int credits;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "language")
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private Language language;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
@Column(name = "start_date", nullable = false)
|
@Column(name = "start_date", nullable = false)
|
||||||
private LocalDate startDate;
|
private LocalDate startDate;
|
||||||
|
@ -37,61 +88,91 @@ public class Project extends DomainObject {
|
||||||
@Column(name = "expected_end_date")
|
@Column(name = "expected_end_date")
|
||||||
private LocalDate expectedEndDate;
|
private LocalDate expectedEndDate;
|
||||||
|
|
||||||
@ManyToMany
|
@Basic
|
||||||
@JoinTable(name = "project_user", inverseJoinColumns = @JoinColumn(name = "user_id"))
|
@Column(name = "project_status")
|
||||||
private Set<User> projectParticipants = new TreeSet<>(new User.ByNameComparator());
|
|
||||||
|
|
||||||
@ManyToMany
|
|
||||||
@JoinTable(name = "project_reviewer", inverseJoinColumns = @JoinColumn(name = "user_id"))
|
|
||||||
private Set<User> reviewers = new TreeSet<>(new User.ByNameComparator());
|
|
||||||
|
|
||||||
@ManyToMany
|
|
||||||
@JoinTable(name = "project_cosupervisor", inverseJoinColumns = @JoinColumn(name = "user_id"))
|
|
||||||
private Set<User> coSupervisors = new TreeSet<>(new User.ByNameComparator());
|
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
|
||||||
@QueryInit({"unit"})
|
|
||||||
@JoinColumn(name = "supervisor_id")
|
|
||||||
private User headSupervisor;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private ProjectStatus projectStatus = ProjectStatus.ACTIVE;
|
private ProjectStatus projectStatus = ProjectStatus.ACTIVE;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "final_seminar_rule_exmpt")
|
||||||
|
private boolean finalSeminarRuleExempted = false;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "state_of_mind")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private StateOfMind stateOfMind = StateOfMind.FINE;
|
private StateOfMind stateOfMind = StateOfMind.FINE;
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Basic(optional = true)
|
||||||
private Date stateOfMindDate;
|
@Column(name = "state_of_mind_reason")
|
||||||
|
|
||||||
@Basic(optional = true)
|
|
||||||
private String stateOfMindReason;
|
private String stateOfMindReason;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@Basic(optional = true)
|
||||||
private ProjectType projectType;
|
@Column(name = "state_of_mind_date")
|
||||||
|
private Date stateOfMindDate;
|
||||||
@Embedded
|
|
||||||
@AttributeOverride(name = "name", column = @Column(name = "externalOrganization"))
|
|
||||||
private ExternalOrganization externalOrganization;
|
|
||||||
|
|
||||||
@Column(name = "fs_rule_exmpt")
|
|
||||||
private boolean finalSeminarRuleExempted = false;
|
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
private int credits;
|
@Column(name = "daisy_identifier", unique = true)
|
||||||
|
private Integer identifier;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Embedded JPA-mapping
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Embedded
|
||||||
|
@AttributeOverride(name = "name", column = @Column(name = "external_organization"))
|
||||||
|
private ExternalOrganization externalOrganization;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (opposition_report) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "project_type_id", referencedColumnName = "id")
|
||||||
|
private ProjectType projectType;
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
@ManyToOne(optional = true)
|
||||||
|
@JoinColumn(name = "research_area_id", referencedColumnName = "id")
|
||||||
private ResearchArea researchArea;
|
private ResearchArea researchArea;
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@ManyToOne(optional = false)
|
||||||
private Language language;
|
@JoinColumn(name = "supervisor_id", referencedColumnName = "id")
|
||||||
|
@QueryInit({"unit"})
|
||||||
|
private User headSupervisor;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// @ManyToMany JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToMany
|
||||||
|
@JoinTable(name = "project_user",
|
||||||
|
joinColumns = @JoinColumn(name = "project_id", referencedColumnName = "id"),
|
||||||
|
inverseJoinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"))
|
||||||
|
private Set<User> projectParticipants = new TreeSet<>(new User.ByNameComparator());
|
||||||
|
|
||||||
|
@ManyToMany
|
||||||
|
@JoinTable(name = "project_reviewer",
|
||||||
|
joinColumns = @JoinColumn(name = "project_id", referencedColumnName = "id"),
|
||||||
|
inverseJoinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"))
|
||||||
|
private Set<User> reviewers = new TreeSet<>(new User.ByNameComparator());
|
||||||
|
|
||||||
|
@ManyToMany
|
||||||
|
@JoinTable(name = "project_cosupervisor",
|
||||||
|
joinColumns = @JoinColumn(name = "project_id", referencedColumnName = "id"),
|
||||||
|
inverseJoinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"))
|
||||||
|
private Set<User> coSupervisors = new TreeSet<>(new User.ByNameComparator());
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of other tables referencing to this table "project"
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ElementCollection(fetch = FetchType.LAZY)
|
@ElementCollection(fetch = FetchType.LAZY)
|
||||||
@CollectionTable(name = "project_user_note", joinColumns = @JoinColumn(name = "project_id"))
|
@CollectionTable(name = "project_user_note",
|
||||||
|
joinColumns = @JoinColumn(name = "project_id", referencedColumnName = "id"))
|
||||||
@Column(name = "note")
|
@Column(name = "note")
|
||||||
@SuppressWarnings("JpaDataSourceORMInspection") // false warning from IntelliJ for the @MapKeyJoinColumn
|
@SuppressWarnings("JpaDataSourceORMInspection") // false warning from IntelliJ for the @MapKeyJoinColumn
|
||||||
@MapKeyJoinColumn(name = "user_id")
|
@MapKeyJoinColumn(name = "user_id")
|
||||||
private Map<User, String> userNotes = new HashMap<>();
|
private Map<User, String> userNotes = new HashMap<>();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA Lifecycle Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@PrePersist
|
@PrePersist
|
||||||
@PreUpdate
|
@PreUpdate
|
||||||
void cleanTitle() {
|
void cleanTitle() {
|
||||||
|
@ -101,12 +182,67 @@ public class Project extends DomainObject {
|
||||||
title = title.trim();
|
title = title.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<User, String> getUserNotes() {
|
// ----------------------------------------------------------------------------------
|
||||||
return userNotes;
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserNotes(Map<User, String> userNotes) {
|
public void setId(Long id) {
|
||||||
this.userNotes = userNotes;
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return SciProUtilities.cleanString(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCredits() {
|
||||||
|
return this.credits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCredits(int credits) {
|
||||||
|
this.credits = credits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Language getLanguage() {
|
||||||
|
return this.language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguage(Language language) {
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getStartDate() {
|
||||||
|
return startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartDate(LocalDate startDate) {
|
||||||
|
this.startDate = startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getExpectedEndDate() {
|
||||||
|
return this.expectedEndDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpectedEndDate(LocalDate expectedEndDate) {
|
||||||
|
this.expectedEndDate = expectedEndDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectStatus getProjectStatus() {
|
||||||
|
return this.projectStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProjectStatus(ProjectStatus projectStatus) {
|
||||||
|
this.projectStatus = projectStatus;
|
||||||
|
if (projectStatus == ProjectStatus.COMPLETED) {
|
||||||
|
this.stateOfMind = StateOfMind.FINE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFinalSeminarRuleExempted() {
|
public boolean isFinalSeminarRuleExempted() {
|
||||||
|
@ -117,53 +253,20 @@ public class Project extends DomainObject {
|
||||||
this.finalSeminarRuleExempted = finalSeminarRuleExempted;
|
this.finalSeminarRuleExempted = finalSeminarRuleExempted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getHeadSupervisor() {
|
public StateOfMind getStateOfMind() {
|
||||||
return headSupervisor;
|
return this.stateOfMind;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectType getProjectType() {
|
public void setStateOfMind(StateOfMind stateOfMind) {
|
||||||
return projectType;
|
this.stateOfMind = stateOfMind;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortedSet<User> getCoSupervisors() {
|
public String getStateOfMindReason() {
|
||||||
TreeSet<User> s = new TreeSet<>(new User.ByNameComparator());
|
return this.stateOfMindReason;
|
||||||
s.addAll(coSupervisors);
|
|
||||||
return Collections.unmodifiableSortedSet(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCoSupervisors(Collection<User> coSupervisors) {
|
public void setStateOfMindReason(String stateOfMindReason) {
|
||||||
this.coSupervisors.clear();
|
this.stateOfMindReason = stateOfMindReason;
|
||||||
this.coSupervisors.addAll(coSupervisors);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addCoSupervisor(User coSupervisor) {
|
|
||||||
coSupervisors.add(coSupervisor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SortedSet<User> getReviewers() {
|
|
||||||
TreeSet<User> s = new TreeSet<>(new User.ByNameComparator());
|
|
||||||
s.addAll(reviewers);
|
|
||||||
return Collections.unmodifiableSortedSet(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReviewers(Collection<User> reviewers) {
|
|
||||||
this.reviewers.clear();
|
|
||||||
this.reviewers.addAll(reviewers);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addReviewer(User reviewer) {
|
|
||||||
reviewers.add(reviewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeReviewer(User reviewer) {
|
|
||||||
reviewers.remove(reviewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProjectStatus(ProjectStatus projectStatus) {
|
|
||||||
this.projectStatus = projectStatus;
|
|
||||||
if (projectStatus == ProjectStatus.COMPLETED) {
|
|
||||||
this.stateOfMind = StateOfMind.FINE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getStateOfMindDate() {
|
public Date getStateOfMindDate() {
|
||||||
|
@ -176,8 +279,44 @@ public class Project extends DomainObject {
|
||||||
: new Date(stateOfMindDate.getTime());
|
: new Date(stateOfMindDate.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public Integer getIdentifier() {
|
||||||
return SciProUtilities.cleanString(title);
|
return this.identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentifier(Integer identifier) {
|
||||||
|
this.identifier = identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExternalOrganization getExternalOrganization() {
|
||||||
|
return this.externalOrganization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExternalOrganization(ExternalOrganization externalOrganization) {
|
||||||
|
this.externalOrganization = externalOrganization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectType getProjectType() {
|
||||||
|
return projectType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProjectType(ProjectType projectType) {
|
||||||
|
this.projectType = projectType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResearchArea getResearchArea() {
|
||||||
|
return this.researchArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResearchArea(ResearchArea researchArea) {
|
||||||
|
this.researchArea = researchArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getHeadSupervisor() {
|
||||||
|
return headSupervisor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeadSupervisor(User headSupervisor) {
|
||||||
|
this.headSupervisor = headSupervisor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortedSet<User> getProjectParticipants() {
|
public SortedSet<User> getProjectParticipants() {
|
||||||
|
@ -191,11 +330,91 @@ public class Project extends DomainObject {
|
||||||
this.projectParticipants.addAll(projectParticipants);
|
this.projectParticipants.addAll(projectParticipants);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SortedSet<User> getReviewers() {
|
||||||
|
TreeSet<User> s = new TreeSet<>(new User.ByNameComparator());
|
||||||
|
s.addAll(reviewers);
|
||||||
|
return Collections.unmodifiableSortedSet(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReviewers(Collection<User> reviewers) {
|
||||||
|
this.reviewers.clear();
|
||||||
|
this.reviewers.addAll(reviewers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SortedSet<User> getCoSupervisors() {
|
||||||
|
TreeSet<User> s = new TreeSet<>(new User.ByNameComparator());
|
||||||
|
s.addAll(coSupervisors);
|
||||||
|
return Collections.unmodifiableSortedSet(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCoSupervisors(Collection<User> coSupervisors) {
|
||||||
|
this.coSupervisors.clear();
|
||||||
|
this.coSupervisors.addAll(coSupervisors);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<User, String> getUserNotes() {
|
||||||
|
return userNotes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserNotes(Map<User, String> userNotes) {
|
||||||
|
this.userNotes = userNotes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object o) {
|
||||||
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof Project)) return false;
|
||||||
|
final Project other = (Project) o;
|
||||||
|
return other.canEqual(this)
|
||||||
|
&& Objects.equals(this.getId(), other.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(this.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Project(id=" + this.getId() + ", identifier=" + this.getIdentifier() +
|
||||||
|
", title=" + this.getTitle() + ", projectParticipants=" + this.getProjectParticipants() +
|
||||||
|
", headSupervisor=" + this.getHeadSupervisor() + ", projectType=" +
|
||||||
|
this.getProjectType() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof Project;
|
||||||
|
}
|
||||||
|
|
||||||
public void addProjectParticipant(User s) {
|
public void addProjectParticipant(User s) {
|
||||||
projectParticipants.add(s);
|
projectParticipants.add(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO remove this method
|
public boolean isParticipant(User user) {
|
||||||
|
for (User s : projectParticipants) {
|
||||||
|
if (s.equals(user)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addReviewer(User reviewer) {
|
||||||
|
reviewers.add(reviewer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeReviewer(User reviewer) {
|
||||||
|
reviewers.remove(reviewer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO remove this method
|
||||||
public User getReviewer() {
|
public User getReviewer() {
|
||||||
if (reviewers.isEmpty()) {
|
if (reviewers.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -204,6 +423,14 @@ public class Project extends DomainObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getReviewerName() {
|
||||||
|
return getReviewer() != null ? getReviewer().getFullName() : NO_REVIEWER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addCoSupervisor(User coSupervisor) {
|
||||||
|
coSupervisors.add(coSupervisor);
|
||||||
|
}
|
||||||
|
|
||||||
public List<Member> getMembers() {
|
public List<Member> getMembers() {
|
||||||
List<Member> members = new ArrayList<>();
|
List<Member> members = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -240,23 +467,10 @@ public class Project extends DomainObject {
|
||||||
return externalOrganization != null;
|
return externalOrganization != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isParticipant(User user) {
|
|
||||||
for (User s : projectParticipants) {
|
|
||||||
if (s.equals(user)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSupervisorName() {
|
public String getSupervisorName() {
|
||||||
return getHeadSupervisor().getFullName();
|
return getHeadSupervisor().getFullName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReviewerName() {
|
|
||||||
return getReviewer() != null ? getReviewer().getFullName() : NO_REVIEWER;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DegreeType getProjectTypeDegreeType() {
|
public DegreeType getProjectTypeDegreeType() {
|
||||||
return getProjectType().getDegreeType();
|
return getProjectType().getDegreeType();
|
||||||
}
|
}
|
||||||
|
@ -289,10 +503,6 @@ public class Project extends DomainObject {
|
||||||
return getProjectType().hasModule(projectModule);
|
return getProjectType().hasModule(projectModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ITitle builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSupervisor(User user) {
|
public boolean isSupervisor(User user) {
|
||||||
return headSupervisor != null && headSupervisor.equals(user);
|
return headSupervisor != null && headSupervisor.equals(user);
|
||||||
}
|
}
|
||||||
|
@ -319,125 +529,9 @@ public class Project extends DomainObject {
|
||||||
return Objects.requireNonNullElse(language, getProjectType().getDefaultLanguage());
|
return Objects.requireNonNullElse(language, getProjectType().getDefaultLanguage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// ----------------------------------------------------------------------------------
|
||||||
public Long getId() {
|
// Nested classes and interfaces
|
||||||
return this.id;
|
// ----------------------------------------------------------------------------------
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getIdentifier() {
|
|
||||||
return this.identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDate getExpectedEndDate() {
|
|
||||||
return this.expectedEndDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProjectStatus getProjectStatus() {
|
|
||||||
return this.projectStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public StateOfMind getStateOfMind() {
|
|
||||||
return this.stateOfMind;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStateOfMindReason() {
|
|
||||||
return this.stateOfMindReason;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ExternalOrganization getExternalOrganization() {
|
|
||||||
return this.externalOrganization;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCredits() {
|
|
||||||
return this.credits;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResearchArea getResearchArea() {
|
|
||||||
return this.researchArea;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Language getLanguage() {
|
|
||||||
return this.language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIdentifier(Integer identifier) {
|
|
||||||
this.identifier = identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExpectedEndDate(LocalDate expectedEndDate) {
|
|
||||||
this.expectedEndDate = expectedEndDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeadSupervisor(User headSupervisor) {
|
|
||||||
this.headSupervisor = headSupervisor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStateOfMind(StateOfMind stateOfMind) {
|
|
||||||
this.stateOfMind = stateOfMind;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStateOfMindReason(String stateOfMindReason) {
|
|
||||||
this.stateOfMindReason = stateOfMindReason;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProjectType(ProjectType projectType) {
|
|
||||||
this.projectType = projectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExternalOrganization(ExternalOrganization externalOrganization) {
|
|
||||||
this.externalOrganization = externalOrganization;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCredits(int credits) {
|
|
||||||
this.credits = credits;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResearchArea(ResearchArea researchArea) {
|
|
||||||
this.researchArea = researchArea;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLanguage(Language language) {
|
|
||||||
this.language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDate getStartDate() {
|
|
||||||
return startDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStartDate(LocalDate startDate) {
|
|
||||||
this.startDate = startDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object o) {
|
|
||||||
if (o == this) return true;
|
|
||||||
if (!(o instanceof Project)) return false;
|
|
||||||
final Project other = (Project) o;
|
|
||||||
return other.canEqual(this)
|
|
||||||
&& Objects.equals(this.getId(), other.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof Project;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(this.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Project(id=" + this.getId() + ", identifier=" + this.getIdentifier() + ", title=" + this.getTitle() + ", projectParticipants=" + this.getProjectParticipants() + ", headSupervisor=" + this.getHeadSupervisor() + ", projectType=" + this.getProjectType() + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class Builder implements ITitle, IProjectType, IStartDate, IBuild {
|
private static class Builder implements ITitle, IProjectType, IStartDate, IBuild {
|
||||||
private final Project instance = new Project();
|
private final Project instance = new Project();
|
||||||
|
|
|
@ -1,15 +1,26 @@
|
||||||
package se.su.dsv.scipro.projectpartner;
|
package se.su.dsv.scipro.projectpartner;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.Lob;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import se.su.dsv.scipro.match.ApplicationPeriod;
|
import se.su.dsv.scipro.match.ApplicationPeriod;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.ProjectType;
|
import se.su.dsv.scipro.system.ProjectType;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="projectPartner")
|
@Table(name="project_partner")
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
public class ProjectPartner extends DomainObject {
|
public class ProjectPartner extends DomainObject {
|
||||||
@Id
|
@Id
|
||||||
|
@ -20,17 +31,19 @@ public class ProjectPartner extends DomainObject {
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "project_type_id")
|
||||||
private ProjectType projectType;
|
private ProjectType projectType;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "application_period_id")
|
||||||
private ApplicationPeriod applicationPeriod;
|
private ApplicationPeriod applicationPeriod;
|
||||||
|
|
||||||
@Lob
|
@Lob
|
||||||
@Basic(optional=false)
|
@Column(name = "info_text", nullable=false)
|
||||||
private String infotext;
|
private String infotext;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
@Column(nullable = false, name = "active")
|
@Column(name = "active", nullable = false)
|
||||||
private boolean active = true;
|
private boolean active = true;
|
||||||
|
|
||||||
public ProjectPartner(User user){
|
public ProjectPartner(User user){
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package se.su.dsv.scipro.report;
|
package se.su.dsv.scipro.report;
|
||||||
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
|
||||||
|
|
||||||
import jakarta.persistence.Basic;
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.MappedSuperclass;
|
import jakarta.persistence.MappedSuperclass;
|
||||||
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.Language;
|
import se.su.dsv.scipro.system.Language;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
@ -15,19 +15,28 @@ import java.util.Objects;
|
||||||
|
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
public abstract class AbstractCriterion extends DomainObject {
|
public abstract class AbstractCriterion extends DomainObject {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic
|
||||||
|
@Column(name = "title_sv", nullable = false)
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic
|
||||||
|
@Column(name = "title_en", nullable = false)
|
||||||
private String titleEn;
|
private String titleEn;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic
|
||||||
|
@Column(name = "sort_order", nullable = false)
|
||||||
private Integer sortOrder;
|
private Integer sortOrder;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
protected AbstractCriterion() {
|
protected AbstractCriterion() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +46,9 @@ public abstract class AbstractCriterion extends DomainObject {
|
||||||
this.sortOrder = sortOrder;
|
this.sortOrder = sortOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
|
@ -50,14 +62,13 @@ public abstract class AbstractCriterion extends DomainObject {
|
||||||
return titleEn;
|
return titleEn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle(Language language) {
|
|
||||||
return language == Language.ENGLISH ? getTitleEn() : getTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSortOrder() {
|
public Integer getSortOrder() {
|
||||||
return this.sortOrder;
|
return this.sortOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -71,10 +82,6 @@ public abstract class AbstractCriterion extends DomainObject {
|
||||||
&& Objects.equals(this.getSortOrder(), other.getSortOrder());
|
&& Objects.equals(this.getSortOrder(), other.getSortOrder());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof AbstractCriterion;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.getId(), this.getTitle(), this.getTitleEn(), this.getSortOrder());
|
return Objects.hash(this.getId(), this.getTitle(), this.getTitleEn(), this.getSortOrder());
|
||||||
|
@ -85,6 +92,20 @@ public abstract class AbstractCriterion extends DomainObject {
|
||||||
return "AbstractCriterion(id=" + this.getId() + ", title=" + this.getTitle() + ", titleEn=" + this.getTitleEn() + ", sortOrder=" + this.getSortOrder() + ")";
|
return "AbstractCriterion(id=" + this.getId() + ", title=" + this.getTitle() + ", titleEn=" + this.getTitleEn() + ", sortOrder=" + this.getSortOrder() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof AbstractCriterion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle(Language language) {
|
||||||
|
return language == Language.ENGLISH ? getTitleEn() : getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Embedded class
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public static class BySortOrderComparator implements Comparator<AbstractCriterion>, Serializable {
|
public static class BySortOrderComparator implements Comparator<AbstractCriterion>, Serializable {
|
||||||
@Override
|
@Override
|
||||||
public int compare(AbstractCriterion o1, AbstractCriterion o2) {
|
public int compare(AbstractCriterion o1, AbstractCriterion o2) {
|
||||||
|
|
|
@ -8,7 +8,109 @@ import jakarta.persistence.MappedSuperclass;
|
||||||
|
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
public abstract class AbstractGradingCriterion extends AbstractCriterion {
|
public abstract class AbstractGradingCriterion extends AbstractCriterion {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "points_required_to_pass", nullable = false)
|
||||||
|
protected int pointsRequiredToPass;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "fx")
|
||||||
|
private boolean fx = true;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "flag")
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private Flag flag;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected AbstractGradingCriterion() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AbstractGradingCriterion(String title, String titleEn, int sortOrder, int pointsRequiredToPass) {
|
||||||
|
super(title, titleEn, sortOrder);
|
||||||
|
this.pointsRequiredToPass = pointsRequiredToPass;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AbstractGradingCriterion(String title, String titleEn, Integer sortOrder, int pointsRequiredToPass,
|
||||||
|
Flag flag) {
|
||||||
|
this(title, titleEn, sortOrder, pointsRequiredToPass);
|
||||||
|
this.flag = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public int getPointsRequiredToPass() {
|
||||||
|
return this.pointsRequiredToPass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFx() {
|
||||||
|
return this.fx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFx(boolean fx) {
|
||||||
|
this.fx = fx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Flag getFlag() {
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlag(Flag flag) {
|
||||||
|
this.flag = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object o) {
|
||||||
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof AbstractGradingCriterion)) return false;
|
||||||
|
final AbstractGradingCriterion other = (AbstractGradingCriterion) o;
|
||||||
|
return other.canEqual(this)
|
||||||
|
&& super.equals(o)
|
||||||
|
&& this.getPointsRequiredToPass() == other.getPointsRequiredToPass()
|
||||||
|
&& this.isFx() == other.isFx();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int PRIME = 59;
|
||||||
|
int result = super.hashCode();
|
||||||
|
result = result * PRIME + this.getPointsRequiredToPass();
|
||||||
|
result = result * PRIME + (this.isFx() ? 79 : 97);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AbstractGradingCriterion(pointsRequiredToPass=" + this.getPointsRequiredToPass() +
|
||||||
|
", fx=" + this.isFx() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof AbstractGradingCriterion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract boolean isProjectCriterion();
|
||||||
|
|
||||||
|
public abstract boolean isIndividualCriterion();
|
||||||
|
|
||||||
|
public abstract int getMaxPoints();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Nested type
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public enum Flag {
|
public enum Flag {
|
||||||
/**
|
/**
|
||||||
* Criterion marked with this flag will add extra functionality related
|
* Criterion marked with this flag will add extra functionality related
|
||||||
|
@ -25,91 +127,4 @@ public abstract class AbstractGradingCriterion extends AbstractCriterion {
|
||||||
*/
|
*/
|
||||||
OPPOSITION
|
OPPOSITION
|
||||||
}
|
}
|
||||||
|
|
||||||
@Basic(optional = false)
|
|
||||||
protected int pointsRequiredToPass;
|
|
||||||
|
|
||||||
@Basic
|
|
||||||
private boolean fx = true;
|
|
||||||
|
|
||||||
@Basic
|
|
||||||
@Column(name = "flag")
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private Flag flag;
|
|
||||||
|
|
||||||
protected AbstractGradingCriterion() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected AbstractGradingCriterion(String title, String titleEn, int sortOrder, int pointsRequiredToPass) {
|
|
||||||
super(title, titleEn, sortOrder);
|
|
||||||
this.pointsRequiredToPass = pointsRequiredToPass;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected AbstractGradingCriterion(
|
|
||||||
String title,
|
|
||||||
String titleEn,
|
|
||||||
Integer sortOrder,
|
|
||||||
int pointsRequiredToPass,
|
|
||||||
Flag flag)
|
|
||||||
{
|
|
||||||
this(title, titleEn, sortOrder, pointsRequiredToPass);
|
|
||||||
this.flag = flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract boolean isProjectCriterion();
|
|
||||||
|
|
||||||
public abstract boolean isIndividualCriterion();
|
|
||||||
|
|
||||||
public abstract int getMaxPoints();
|
|
||||||
|
|
||||||
public int getPointsRequiredToPass() {
|
|
||||||
return this.pointsRequiredToPass;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFx() {
|
|
||||||
return this.fx;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Flag getFlag() {
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFlag(Flag flag) {
|
|
||||||
this.flag = flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object o) {
|
|
||||||
if (o == this) return true;
|
|
||||||
if (!(o instanceof AbstractGradingCriterion)) return false;
|
|
||||||
final AbstractGradingCriterion other = (AbstractGradingCriterion) o;
|
|
||||||
return other.canEqual(this)
|
|
||||||
&& super.equals(o)
|
|
||||||
&& this.getPointsRequiredToPass() == other.getPointsRequiredToPass()
|
|
||||||
&& this.isFx() == other.isFx();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof AbstractGradingCriterion;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int PRIME = 59;
|
|
||||||
int result = super.hashCode();
|
|
||||||
result = result * PRIME + this.getPointsRequiredToPass();
|
|
||||||
result = result * PRIME + (this.isFx() ? 79 : 97);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "AbstractGradingCriterion(pointsRequiredToPass=" + this.getPointsRequiredToPass() + ", fx=" + this.isFx() + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFx(boolean fx) {
|
|
||||||
this.fx = fx;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,70 +1,86 @@
|
||||||
package se.su.dsv.scipro.report;
|
package se.su.dsv.scipro.report;
|
||||||
|
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import se.su.dsv.scipro.system.Language;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.MappedSuperclass;
|
||||||
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
|
||||||
|
import se.su.dsv.scipro.system.Language;
|
||||||
|
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
public abstract class AbstractGradingCriterionPoint extends DomainObject implements Comparable<AbstractGradingCriterionPoint> {
|
public abstract class AbstractGradingCriterionPoint extends DomainObject
|
||||||
|
implements Comparable<AbstractGradingCriterionPoint> {
|
||||||
public static final int DESCRIPTION_LENGTH = 600;
|
public static final int DESCRIPTION_LENGTH = 600;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "point")
|
||||||
private Integer point;
|
private Integer point;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(length = DESCRIPTION_LENGTH)
|
@Column(name = "description_sv", length = DESCRIPTION_LENGTH)
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(length = DESCRIPTION_LENGTH)
|
@Column(name = "description_en", length = DESCRIPTION_LENGTH)
|
||||||
private String descriptionEn;
|
private String descriptionEn;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public AbstractGradingCriterionPoint() {
|
public AbstractGradingCriterionPoint() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getPoint() {
|
|
||||||
return this.point;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return this.description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescriptionEn() {
|
|
||||||
return descriptionEn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription(Language language) {
|
|
||||||
return language == Language.ENGLISH ? getDescriptionEn() : getDescription();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getPoint() {
|
||||||
|
return this.point;
|
||||||
|
}
|
||||||
|
|
||||||
public void setPoint(Integer point) {
|
public void setPoint(Integer point) {
|
||||||
this.point = point;
|
this.point = point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescriptionEn() {
|
||||||
|
return descriptionEn;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDescriptionEn(String descriptionEn) {
|
public void setDescriptionEn(String descriptionEn) {
|
||||||
this.descriptionEn = descriptionEn;
|
this.descriptionEn = descriptionEn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects and Comparable
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -78,10 +94,6 @@ public abstract class AbstractGradingCriterionPoint extends DomainObject impleme
|
||||||
&& Objects.equals(this.getDescriptionEn(), other.getDescriptionEn());
|
&& Objects.equals(this.getDescriptionEn(), other.getDescriptionEn());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof AbstractGradingCriterionPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(super.hashCode(), this.getId(), this.getPoint(), this.getDescription(), this.getDescriptionEn());
|
return Objects.hash(super.hashCode(), this.getId(), this.getPoint(), this.getDescription(), this.getDescriptionEn());
|
||||||
|
@ -91,4 +103,15 @@ public abstract class AbstractGradingCriterionPoint extends DomainObject impleme
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "AbstractGradingCriterionPoint(id=" + this.getId() + ", point=" + this.getPoint() + ", description=" + this.getDescription() + ", descriptionEn=" + this.getDescriptionEn() + ")";
|
return "AbstractGradingCriterionPoint(id=" + this.getId() + ", point=" + this.getPoint() + ", description=" + this.getDescription() + ", descriptionEn=" + this.getDescriptionEn() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof AbstractGradingCriterionPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription(Language language) {
|
||||||
|
return language == Language.ENGLISH ? getDescriptionEn() : getDescription();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,23 @@ import jakarta.persistence.CascadeType;
|
||||||
import jakarta.persistence.JoinColumn;
|
import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.MappedSuperclass;
|
import jakarta.persistence.MappedSuperclass;
|
||||||
import jakarta.persistence.OneToOne;
|
import jakarta.persistence.OneToOne;
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
public abstract class AttachmentReport extends Report {
|
public abstract class AttachmentReport extends Report {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in table of children class (OppositionReport)
|
||||||
|
// referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@OneToOne(optional = true, cascade = CascadeType.ALL)
|
@OneToOne(optional = true, cascade = CascadeType.ALL)
|
||||||
@JoinColumn(name = "attachment_reference_id")
|
@JoinColumn(name = "attachment_file_reference_id", referencedColumnName = "id")
|
||||||
private FileReference attachment;
|
private FileReference attachment;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public FileReference getAttachment() {
|
public FileReference getAttachment() {
|
||||||
return this.attachment;
|
return this.attachment;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +31,9 @@ public abstract class AttachmentReport extends Report {
|
||||||
this.attachment = attachment;
|
this.attachment = attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -34,14 +44,16 @@ public abstract class AttachmentReport extends Report {
|
||||||
&& Objects.equals(this.attachment, other.attachment);
|
&& Objects.equals(this.attachment, other.attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof AttachmentReport;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(super.hashCode(), this.attachment);
|
return Objects.hash(super.hashCode(), this.attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof AttachmentReport;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
package se.su.dsv.scipro.report;
|
package se.su.dsv.scipro.report;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.system.Language;
|
import se.su.dsv.scipro.system.Language;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -8,26 +13,34 @@ import java.util.Objects;
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "criterion")
|
@Table(name = "criterion")
|
||||||
public class Criterion extends AbstractCriterion {
|
public class Criterion extends AbstractCriterion {
|
||||||
|
|
||||||
public static final int DESCRIPTION_LENGTH = 2000;
|
public static final int DESCRIPTION_LENGTH = 2000;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
// ----------------------------------------------------------------------------------
|
||||||
private Report report;
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Basic
|
@Basic
|
||||||
@Column
|
@Column(name = "description_sv", length = DESCRIPTION_LENGTH)
|
||||||
private String feedback;
|
|
||||||
|
|
||||||
@Basic
|
|
||||||
@Column(length = DESCRIPTION_LENGTH)
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(length = DESCRIPTION_LENGTH)
|
@Column(name = "description_en", length = DESCRIPTION_LENGTH)
|
||||||
private String descriptionEn;
|
private String descriptionEn;
|
||||||
|
|
||||||
protected Criterion() {
|
@Basic
|
||||||
|
@Column(name = "feedback")
|
||||||
|
private String feedback;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (criterion) referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name ="report_id", referencedColumnName = "id")
|
||||||
|
private Report report;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected Criterion() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Criterion(Report report, String title, String titleEn, String description, String descriptionEn, int sortOrder) {
|
Criterion(Report report, String title, String titleEn, String description, String descriptionEn, int sortOrder) {
|
||||||
|
@ -41,22 +54,9 @@ public class Criterion extends AbstractCriterion {
|
||||||
this(report, gradingCriterionTemplate.getTitle(), gradingCriterionTemplate.getTitleEn(), gradingCriterionTemplate.getDescription(), gradingCriterionTemplate.getDescriptionEn(), gradingCriterionTemplate.getSortOrder());
|
this(report, gradingCriterionTemplate.getTitle(), gradingCriterionTemplate.getTitleEn(), gradingCriterionTemplate.getDescription(), gradingCriterionTemplate.getDescriptionEn(), gradingCriterionTemplate.getSortOrder());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFeedback(final String feedback) {
|
// ----------------------------------------------------------------------------------
|
||||||
this.feedback = feedback;
|
// Properties (Getters and Setters)
|
||||||
}
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
public boolean isFilledOut() {
|
|
||||||
return feedback != null && !feedback.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Report getReport() {
|
|
||||||
return this.report;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFeedback() {
|
|
||||||
return this.feedback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return this.description;
|
return this.description;
|
||||||
}
|
}
|
||||||
|
@ -65,10 +65,21 @@ public class Criterion extends AbstractCriterion {
|
||||||
return this.descriptionEn;
|
return this.descriptionEn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription(Language language) {
|
public String getFeedback() {
|
||||||
return language == Language.ENGLISH ? getDescriptionEn() : getDescription();
|
return this.feedback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFeedback(final String feedback) {
|
||||||
|
this.feedback = feedback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Report getReport() {
|
||||||
|
return this.report;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -82,11 +93,6 @@ public class Criterion extends AbstractCriterion {
|
||||||
&& Objects.equals(this.getDescriptionEn(), other.getDescriptionEn());
|
&& Objects.equals(this.getDescriptionEn(), other.getDescriptionEn());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof Criterion;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.getReport(), this.getFeedback(), this.getDescription(), this.getDescriptionEn());
|
return Objects.hash(this.getReport(), this.getFeedback(), this.getDescription(), this.getDescriptionEn());
|
||||||
|
@ -94,6 +100,24 @@ public class Criterion extends AbstractCriterion {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Criterion(report=" + this.getReport() + ", feedback=" + this.getFeedback() + ", description=" + this.getDescription() + ", descriptionEn=" + this.getDescriptionEn() + ")";
|
return "Criterion(report=" + this.getReport() + ", feedback=" + this.getFeedback() +
|
||||||
|
", description=" + this.getDescription() + ", descriptionEn=" +
|
||||||
|
this.getDescriptionEn() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof Criterion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription(Language language) {
|
||||||
|
return language == Language.ENGLISH ? getDescriptionEn() : getDescription();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFilledOut() {
|
||||||
|
return feedback != null && !feedback.isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package se.su.dsv.scipro.report;
|
package se.su.dsv.scipro.report;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
@ -8,18 +9,26 @@ import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "grading_report_template_grade_limits")
|
@Table(name = "grading_report_template_grade_limit")
|
||||||
public class GradeLimit {
|
public class GradeLimit {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Basic
|
||||||
@Column(name = "grade")
|
@Column(name = "grade")
|
||||||
private String grade;
|
private String grade;
|
||||||
|
|
||||||
|
@Basic
|
||||||
@Column(name = "lower_limit")
|
@Column(name = "lower_limit")
|
||||||
private int lowerLimit;
|
private int lowerLimit;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +1,57 @@
|
||||||
package se.su.dsv.scipro.report;
|
package se.su.dsv.scipro.report;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.DiscriminatorColumn;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.Inheritance;
|
||||||
|
import jakarta.persistence.InheritanceType;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@DiscriminatorColumn(name = "type")
|
@Table(name = "grading_criterion")
|
||||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||||
|
@DiscriminatorColumn(name = "type")
|
||||||
public abstract class GradingCriterion extends AbstractGradingCriterion {
|
public abstract class GradingCriterion extends AbstractGradingCriterion {
|
||||||
public static final int FEEDBACK_LENGTH = 2000;
|
public static final int FEEDBACK_LENGTH = 2000;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
// ----------------------------------------------------------------------------------
|
||||||
private GradingReport gradingReport;
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@OneToMany(mappedBy = "gradingCriterion", orphanRemoval = true, cascade = CascadeType.PERSIST)
|
|
||||||
private List<GradingCriterionPoint> gradingCriterionPoints = new ArrayList<>();
|
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
@Column(name = "points")
|
||||||
private Integer points;
|
private Integer points;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(length = FEEDBACK_LENGTH)
|
@Column(name = "feedback", length = FEEDBACK_LENGTH)
|
||||||
private String feedback;
|
private String feedback;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (grading_criterion) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "grading_report_id", referencedColumnName = "id")
|
||||||
|
private GradingReport gradingReport;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of other tables referencing to this table "grading_criterion"
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@OneToMany(mappedBy = "gradingCriterion", orphanRemoval = true, cascade = CascadeType.PERSIST)
|
||||||
|
private List<GradingCriterionPoint> gradingCriterionPoints = new ArrayList<>();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
protected GradingCriterion() {
|
protected GradingCriterion() {
|
||||||
// JPA
|
// JPA
|
||||||
}
|
}
|
||||||
|
@ -41,6 +68,71 @@ public abstract class GradingCriterion extends AbstractGradingCriterion {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public Integer getPoints() {
|
||||||
|
return this.points;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPoints(Integer points) {
|
||||||
|
this.points = points;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFeedback() {
|
||||||
|
return this.feedback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFeedback(String feedback) {
|
||||||
|
this.feedback = feedback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GradingCriterionPoint> getGradingCriterionPoints() {
|
||||||
|
return this.gradingCriterionPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GradingReport getGradingReport() {
|
||||||
|
return this.gradingReport;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object o) {
|
||||||
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof GradingCriterion)) return false;
|
||||||
|
final GradingCriterion other = (GradingCriterion) o;
|
||||||
|
return other.canEqual(this)
|
||||||
|
&& super.equals(o)
|
||||||
|
&& Objects.equals(this.getGradingReport(), other.getGradingReport())
|
||||||
|
&& Objects.equals(this.getPoints(), other.getPoints())
|
||||||
|
&& Objects.equals(this.getFeedback(), other.getFeedback());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(super.hashCode(), this.getGradingReport(), this.getPoints(), this.getFeedback());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "GradingCriterion(gradingReport=" + this.getGradingReport() + ", points=" + this.getPoints() +
|
||||||
|
", feedback=" + this.getFeedback() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof GradingCriterion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPassFail() {
|
||||||
|
return getMaxPoints() == 1 && getPointsRequiredToPass() == 1;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean meetsMinimumPointRequirement() {
|
public boolean meetsMinimumPointRequirement() {
|
||||||
return Objects.requireNonNullElse(getPoints(), 0) >= getPointsRequiredToPass();
|
return Objects.requireNonNullElse(getPoints(), 0) >= getPointsRequiredToPass();
|
||||||
}
|
}
|
||||||
|
@ -57,59 +149,4 @@ public abstract class GradingCriterion extends AbstractGradingCriterion {
|
||||||
public int getMaxPoints() {
|
public int getMaxPoints() {
|
||||||
return Collections.max(gradingCriterionPoints).getPoint();
|
return Collections.max(gradingCriterionPoints).getPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GradingReport getGradingReport() {
|
|
||||||
return this.gradingReport;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPoints() {
|
|
||||||
return this.points;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFeedback() {
|
|
||||||
return this.feedback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<GradingCriterionPoint> getGradingCriterionPoints() {
|
|
||||||
return this.gradingCriterionPoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoints(Integer points) {
|
|
||||||
this.points = points;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFeedback(String feedback) {
|
|
||||||
this.feedback = feedback;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object o) {
|
|
||||||
if (o == this) return true;
|
|
||||||
if (!(o instanceof GradingCriterion)) return false;
|
|
||||||
final GradingCriterion other = (GradingCriterion) o;
|
|
||||||
return other.canEqual(this)
|
|
||||||
&& super.equals(o)
|
|
||||||
&& Objects.equals(this.getGradingReport(), other.getGradingReport())
|
|
||||||
&& Objects.equals(this.getPoints(), other.getPoints())
|
|
||||||
&& Objects.equals(this.getFeedback(), other.getFeedback());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof GradingCriterion;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(super.hashCode(), this.getGradingReport(), this.getPoints(), this.getFeedback());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "GradingCriterion(gradingReport=" + this.getGradingReport() + ", points=" + this.getPoints() + ", feedback=" + this.getFeedback() + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPassFail() {
|
|
||||||
return getMaxPoints() == 1 && getPointsRequiredToPass() == 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,39 @@
|
||||||
package se.su.dsv.scipro.report;
|
package se.su.dsv.scipro.report;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "GradingCriterionPoint")
|
@Table(name = "grading_criterion_point")
|
||||||
public class GradingCriterionPoint extends AbstractGradingCriterionPoint {
|
public class GradingCriterionPoint extends AbstractGradingCriterionPoint {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (grading_criterion_point) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "grading_criterion_id", referencedColumnName = "id")
|
||||||
private GradingCriterion gradingCriterion;
|
private GradingCriterion gradingCriterion;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public GradingCriterionPoint() {
|
public GradingCriterionPoint() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GradingCriterionPoint(
|
public GradingCriterionPoint(final Integer point, final String description,
|
||||||
final Integer point,
|
final String descriptionEn, final GradingCriterion gradingCriterion) {
|
||||||
final String description,
|
|
||||||
final String descriptionEn,
|
|
||||||
final GradingCriterion gradingCriterion)
|
|
||||||
{
|
|
||||||
setPoint(point);
|
setPoint(point);
|
||||||
setDescription(description);
|
setDescription(description);
|
||||||
setDescriptionEn(descriptionEn);
|
setDescriptionEn(descriptionEn);
|
||||||
this.gradingCriterion = gradingCriterion;
|
this.gradingCriterion = gradingCriterion;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// ----------------------------------------------------------------------------------
|
||||||
public int compareTo(AbstractGradingCriterionPoint abstractGradingCriterionPoint) {
|
// Properties (Getters and Setters)
|
||||||
return this.getPoint().compareTo(abstractGradingCriterionPoint.getPoint());
|
// ----------------------------------------------------------------------------------
|
||||||
}
|
|
||||||
|
|
||||||
public GradingCriterion getGradingCriterion() {
|
public GradingCriterion getGradingCriterion() {
|
||||||
return this.gradingCriterion;
|
return this.gradingCriterion;
|
||||||
}
|
}
|
||||||
|
@ -40,9 +42,12 @@ public class GradingCriterionPoint extends AbstractGradingCriterionPoint {
|
||||||
this.gradingCriterion = gradingCriterion;
|
this.gradingCriterion = gradingCriterion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects and Comparable
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public int compareTo(AbstractGradingCriterionPoint abstractGradingCriterionPoint) {
|
||||||
return "GradingCriterionPoint(gradingCriterion=" + this.getGradingCriterion() + ")";
|
return this.getPoint().compareTo(abstractGradingCriterionPoint.getPoint());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,13 +60,22 @@ public class GradingCriterionPoint extends AbstractGradingCriterionPoint {
|
||||||
&& Objects.equals(this.getGradingCriterion(), other.getGradingCriterion());
|
&& Objects.equals(this.getGradingCriterion(), other.getGradingCriterion());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(this.getGradingCriterion());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "GradingCriterionPoint(gradingCriterion=" + this.getGradingCriterion() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
protected boolean canEqual(final Object other) {
|
protected boolean canEqual(final Object other) {
|
||||||
return other instanceof GradingCriterionPoint;
|
return other instanceof GradingCriterionPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(this.getGradingCriterion());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package se.su.dsv.scipro.report;
|
package se.su.dsv.scipro.report;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -10,6 +12,7 @@ import java.util.Objects;
|
||||||
public class GradingCriterionPointTemplate extends AbstractGradingCriterionPoint {
|
public class GradingCriterionPointTemplate extends AbstractGradingCriterionPoint {
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "grading_criterion_template_id", nullable = false)
|
||||||
private GradingCriterionTemplate gradingCriterionTemplate;
|
private GradingCriterionTemplate gradingCriterionTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,18 +1,29 @@
|
||||||
package se.su.dsv.scipro.report;
|
package se.su.dsv.scipro.report;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.DiscriminatorColumn;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.Inheritance;
|
||||||
|
import jakarta.persistence.InheritanceType;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@DiscriminatorColumn(name = "type", length = GradingCriterionTemplate.LENGTH)
|
|
||||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
|
||||||
@Table(name = "grading_criterion_template")
|
@Table(name = "grading_criterion_template")
|
||||||
|
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||||
|
@DiscriminatorColumn(name = "type", length = GradingCriterionTemplate.LENGTH)
|
||||||
public abstract class GradingCriterionTemplate extends AbstractGradingCriterion {
|
public abstract class GradingCriterionTemplate extends AbstractGradingCriterion {
|
||||||
public static final int LENGTH = 64;
|
public static final int LENGTH = 64;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "grading_report_template_id")
|
||||||
private GradingReportTemplate gradingReportTemplate;
|
private GradingReportTemplate gradingReportTemplate;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "gradingCriterionTemplate", orphanRemoval = true, cascade = CascadeType.ALL)
|
@OneToMany(mappedBy = "gradingCriterionTemplate", orphanRemoval = true, cascade = CascadeType.ALL)
|
||||||
|
|
|
@ -1,11 +1,19 @@
|
||||||
package se.su.dsv.scipro.report;
|
package se.su.dsv.scipro.report;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.Language;
|
import se.su.dsv.scipro.system.Language;
|
||||||
import se.su.dsv.scipro.system.ProjectType;
|
import se.su.dsv.scipro.system.ProjectType;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -13,6 +21,7 @@ import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name = "grading_report")
|
||||||
public abstract class GradingReport extends Report {
|
public abstract class GradingReport extends Report {
|
||||||
|
|
||||||
public record Grade(String name) {
|
public record Grade(String name) {
|
||||||
|
@ -27,40 +36,51 @@ public abstract class GradingReport extends Report {
|
||||||
|
|
||||||
public enum State { INITIAL, REVIEWING, FINALIZED }
|
public enum State { INITIAL, REVIEWING, FINALIZED }
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Basic
|
||||||
|
@Column(name = "state")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private State state = State.INITIAL;
|
private State state = State.INITIAL;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
|
||||||
private Project project;
|
|
||||||
|
|
||||||
@OneToMany(mappedBy = "gradingReport", cascade = {CascadeType.ALL})
|
|
||||||
private List<GradingCriterion> gradingCriteria = new ArrayList<>();
|
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "date_submitted_to_examiner")
|
@Column(name = "date_submitted_to_examiner")
|
||||||
private Instant dateSubmittedToExaminer;
|
private Instant dateSubmittedToExaminer;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (grading_report) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
private Project project;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of other tables referencing to this table "grading_report"
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@OneToMany(mappedBy = "gradingReport", cascade = {CascadeType.ALL})
|
||||||
|
private List<GradingCriterion> gradingCriteria = new ArrayList<>();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
protected GradingReport() {
|
protected GradingReport() {
|
||||||
// JPA
|
// JPA
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void submit() {
|
|
||||||
super.submit();
|
|
||||||
setState(State.FINALIZED);
|
|
||||||
setDateSubmittedToExaminer(Instant.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Project getProject() {
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
|
|
||||||
GradingReport(Project project) {
|
GradingReport(Project project) {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addCriterion(GradingCriterion criterion) {
|
// ----------------------------------------------------------------------------------
|
||||||
gradingCriteria.add(criterion);
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public State getState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setState(final State state) {
|
||||||
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getDateSubmittedToExaminer(){
|
public Instant getDateSubmittedToExaminer(){
|
||||||
|
@ -71,12 +91,8 @@ public abstract class GradingReport extends Report {
|
||||||
this.dateSubmittedToExaminer = dateSubmittedToExaminer;
|
this.dateSubmittedToExaminer = dateSubmittedToExaminer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public State getState() {
|
public Project getProject() {
|
||||||
return state;
|
return project;
|
||||||
}
|
|
||||||
|
|
||||||
public void setState(final State state) {
|
|
||||||
this.state = state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GradingCriterion> getGradingCriteria() {
|
public List<GradingCriterion> getGradingCriteria() {
|
||||||
|
@ -84,6 +100,21 @@ public abstract class GradingReport extends Report {
|
||||||
return Collections.unmodifiableList(gradingCriteria);
|
return Collections.unmodifiableList(gradingCriteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "GradingReport(state=" + this.getState() + ", project=" + this.getProject() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
void addCriterion(GradingCriterion criterion) {
|
||||||
|
gradingCriteria.add(criterion);
|
||||||
|
}
|
||||||
|
|
||||||
public String getProjectTitle() {
|
public String getProjectTitle() {
|
||||||
return project.getTitle();
|
return project.getTitle();
|
||||||
}
|
}
|
||||||
|
@ -112,7 +143,9 @@ public abstract class GradingReport extends Report {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public void submit() {
|
||||||
return "GradingReport(state=" + this.getState() + ", project=" + this.getProject() + ")";
|
super.submit();
|
||||||
|
setState(State.FINALIZED);
|
||||||
|
setDateSubmittedToExaminer(Instant.now());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,24 @@
|
||||||
package se.su.dsv.scipro.report;
|
package se.su.dsv.scipro.report;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.persistence.Temporal;
|
||||||
|
import jakarta.persistence.TemporalType;
|
||||||
import se.su.dsv.scipro.finalseminar.FinalSeminarOpposition;
|
import se.su.dsv.scipro.finalseminar.FinalSeminarOpposition;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.ProjectType;
|
import se.su.dsv.scipro.system.ProjectType;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -19,18 +30,16 @@ import java.util.Objects;
|
||||||
@Table(name = "grading_report_template")
|
@Table(name = "grading_report_template")
|
||||||
public class GradingReportTemplate extends DomainObject {
|
public class GradingReportTemplate extends DomainObject {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@OneToOne(optional = false)
|
@Basic
|
||||||
private ProjectType projectType;
|
|
||||||
|
|
||||||
@OneToMany(mappedBy = "gradingReportTemplate", cascade = {CascadeType.ALL}, orphanRemoval = true)
|
|
||||||
private Collection<GradingCriterionTemplate> criteria = new HashSet<>();
|
|
||||||
|
|
||||||
@Temporal(TemporalType.DATE)
|
|
||||||
@Column(name = "valid_from")
|
@Column(name = "valid_from")
|
||||||
|
@Temporal(TemporalType.DATE)
|
||||||
private LocalDate validFrom;
|
private LocalDate validFrom;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
@ -41,10 +50,27 @@ public class GradingReportTemplate extends DomainObject {
|
||||||
@Column(name = "failing_grade")
|
@Column(name = "failing_grade")
|
||||||
private String failingGrade;
|
private String failingGrade;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (grading_report_template) referencing
|
||||||
|
// other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@OneToOne(optional = false)
|
||||||
|
@JoinColumn(name = "project_type_id", referencedColumnName = "id")
|
||||||
|
private ProjectType projectType;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of other tables referencing to this table "grading_report_template"
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@OneToMany(mappedBy = "gradingReportTemplate", cascade = {CascadeType.ALL}, orphanRemoval = true)
|
||||||
|
private Collection<GradingCriterionTemplate> criteria = new HashSet<>();
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||||
@JoinColumn(name = "grading_report_template_id")
|
@JoinColumn(name = "grading_report_template_id", referencedColumnName = "id")
|
||||||
private Collection<GradeLimit> gradeLimits = new ArrayList<>();
|
private Collection<GradeLimit> gradeLimits = new ArrayList<>();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
protected GradingReportTemplate() {
|
protected GradingReportTemplate() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,43 +83,9 @@ public class GradingReportTemplate extends DomainObject {
|
||||||
this.validFrom = validFrom;
|
this.validFrom = validFrom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SupervisorGradingReport createSupervisorReport(Project project, User student) {
|
// ----------------------------------------------------------------------------------
|
||||||
if (!this.projectType.equals(project.getProjectType())) {
|
// Properties (Getters and Setters)
|
||||||
throw new IllegalArgumentException("Project has a different project class than this template");
|
// ----------------------------------------------------------------------------------
|
||||||
}
|
|
||||||
return new SupervisorGradingReportFactory().using(criteria).create(project, student);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OppositionReport createOppositionReport(FinalSeminarOpposition finalSeminarOpposition) {
|
|
||||||
return new OppositionReport(this, finalSeminarOpposition);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GradingCriterionTemplate addProjectCriterion(String title, String titleEn, int pointsRequiredToPass, List<GradingCriterionPointTemplate> gradingCriterionPointTemplates) {
|
|
||||||
return addProjectCriterion(title, titleEn, pointsRequiredToPass, gradingCriterionPointTemplates, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GradingCriterionTemplate addProjectCriterion(String title, String titleEn, int pointsRequiredToPass, List<GradingCriterionPointTemplate> gradingCriterionPointTemplates, AbstractGradingCriterion.Flag flag) {
|
|
||||||
GradingCriterionTemplate gradingCriterionTemplate = new ProjectGradingCriterionTemplate(this, criteria.size(), title, titleEn, pointsRequiredToPass, gradingCriterionPointTemplates);
|
|
||||||
gradingCriterionTemplate.setFlag(flag);
|
|
||||||
criteria.add(gradingCriterionTemplate);
|
|
||||||
return gradingCriterionTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GradingCriterionTemplate addIndividualCriterion(String title, String titleEn, int pointsRequiredToPass, List<GradingCriterionPointTemplate> gradingCriterionPointTemplates) {
|
|
||||||
return addIndividualCriterion(title, titleEn, pointsRequiredToPass, gradingCriterionPointTemplates, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GradingCriterionTemplate addIndividualCriterion(String title, String titleEn, int pointsRequiredToPass, List<GradingCriterionPointTemplate> gradingCriterionPointTemplates, AbstractGradingCriterion.Flag flag) {
|
|
||||||
GradingCriterionTemplate gradingCriterionTemplate = new IndividualGradingCriterionTemplate(this, criteria.size(), title, titleEn, pointsRequiredToPass, gradingCriterionPointTemplates);
|
|
||||||
gradingCriterionTemplate.setFlag(flag);
|
|
||||||
criteria.add(gradingCriterionTemplate);
|
|
||||||
return gradingCriterionTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<GradingCriterionTemplate> getCriteria() {
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
|
@ -107,14 +99,6 @@ public class GradingReportTemplate extends DomainObject {
|
||||||
this.validFrom = validFrom;
|
this.validFrom = validFrom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectType getProjectType() {
|
|
||||||
return projectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProjectType(ProjectType projectType) {
|
|
||||||
this.projectType = projectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNote() {
|
public String getNote() {
|
||||||
return note;
|
return note;
|
||||||
}
|
}
|
||||||
|
@ -131,6 +115,18 @@ public class GradingReportTemplate extends DomainObject {
|
||||||
this.failingGrade = failingGrade;
|
this.failingGrade = failingGrade;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProjectType getProjectType() {
|
||||||
|
return projectType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProjectType(ProjectType projectType) {
|
||||||
|
this.projectType = projectType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<GradingCriterionTemplate> getCriteria() {
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
public Collection<GradeLimit> getGradeLimits() {
|
public Collection<GradeLimit> getGradeLimits() {
|
||||||
return gradeLimits;
|
return gradeLimits;
|
||||||
}
|
}
|
||||||
|
@ -139,6 +135,9 @@ public class GradingReportTemplate extends DomainObject {
|
||||||
this.gradeLimits = gradeLimits;
|
this.gradeLimits = gradeLimits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -148,10 +147,6 @@ public class GradingReportTemplate extends DomainObject {
|
||||||
&& Objects.equals(this.id, other.id);
|
&& Objects.equals(this.id, other.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof GradingReportTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(this.id);
|
return Objects.hashCode(this.id);
|
||||||
|
@ -159,6 +154,56 @@ public class GradingReportTemplate extends DomainObject {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "GradingReportTemplate(id=" + this.id + ", projectType=" + this.projectType + ", validFrom=" + this.validFrom + ")";
|
return "GradingReportTemplate(id=" + this.id + ", projectType=" + this.projectType + ", validFrom=" +
|
||||||
|
this.validFrom + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public SupervisorGradingReport createSupervisorReport(Project project, User student) {
|
||||||
|
if (!this.projectType.equals(project.getProjectType())) {
|
||||||
|
throw new IllegalArgumentException("Project has a different project class than this template");
|
||||||
|
}
|
||||||
|
return new SupervisorGradingReportFactory().using(criteria).create(project, student);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OppositionReport createOppositionReport(FinalSeminarOpposition finalSeminarOpposition) {
|
||||||
|
return new OppositionReport(this, finalSeminarOpposition);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GradingCriterionTemplate addProjectCriterion(String title, String titleEn, int pointsRequiredToPass,
|
||||||
|
List<GradingCriterionPointTemplate> gradingCriterionPointTemplates) {
|
||||||
|
return addProjectCriterion(title, titleEn, pointsRequiredToPass, gradingCriterionPointTemplates, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GradingCriterionTemplate addProjectCriterion(String title, String titleEn, int pointsRequiredToPass,
|
||||||
|
List<GradingCriterionPointTemplate> gradingCriterionPointTemplates,
|
||||||
|
AbstractGradingCriterion.Flag flag) {
|
||||||
|
GradingCriterionTemplate gradingCriterionTemplate = new ProjectGradingCriterionTemplate(this,
|
||||||
|
criteria.size(), title, titleEn, pointsRequiredToPass, gradingCriterionPointTemplates);
|
||||||
|
gradingCriterionTemplate.setFlag(flag);
|
||||||
|
criteria.add(gradingCriterionTemplate);
|
||||||
|
return gradingCriterionTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GradingCriterionTemplate addIndividualCriterion(String title, String titleEn, int pointsRequiredToPass,
|
||||||
|
List<GradingCriterionPointTemplate> gradingCriterionPointTemplates) {
|
||||||
|
return addIndividualCriterion(title, titleEn, pointsRequiredToPass, gradingCriterionPointTemplates, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GradingCriterionTemplate addIndividualCriterion(String title, String titleEn, int pointsRequiredToPass,
|
||||||
|
List<GradingCriterionPointTemplate> gradingCriterionPointTemplates,
|
||||||
|
AbstractGradingCriterion.Flag flag) {
|
||||||
|
GradingCriterionTemplate gradingCriterionTemplate = new IndividualGradingCriterionTemplate(this,
|
||||||
|
criteria.size(), title, titleEn, pointsRequiredToPass, gradingCriterionPointTemplates);
|
||||||
|
gradingCriterionTemplate.setFlag(flag);
|
||||||
|
criteria.add(gradingCriterionTemplate);
|
||||||
|
return gradingCriterionTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof GradingReportTemplate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
package se.su.dsv.scipro.report;
|
package se.su.dsv.scipro.report;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.finalseminar.FinalSeminarOpposition;
|
import se.su.dsv.scipro.finalseminar.FinalSeminarOpposition;
|
||||||
import se.su.dsv.scipro.system.Language;
|
import se.su.dsv.scipro.system.Language;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -15,56 +22,57 @@ import java.util.stream.Collectors;
|
||||||
@Table(name = "opposition_report")
|
@Table(name = "opposition_report")
|
||||||
public class OppositionReport extends AttachmentReport {
|
public class OppositionReport extends AttachmentReport {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Basic
|
||||||
|
@Column(name = "thesis_summary")
|
||||||
|
private String thesisSummary;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (opposition_report) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@OneToOne(optional = false)
|
@OneToOne(optional = false)
|
||||||
|
@JoinColumn(name = "final_seminar_opposition_id", referencedColumnName = "id")
|
||||||
private FinalSeminarOpposition finalSeminarOpposition;
|
private FinalSeminarOpposition finalSeminarOpposition;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of other tables referencing to this table "opposition_report"
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@OneToMany(mappedBy = "report", cascade = {CascadeType.ALL})
|
@OneToMany(mappedBy = "report", cascade = {CascadeType.ALL})
|
||||||
private List<Criterion> oppositionCriteria = new ArrayList<>();
|
private List<Criterion> oppositionCriteria = new ArrayList<>();
|
||||||
|
|
||||||
@Basic
|
// ----------------------------------------------------------------------------------
|
||||||
@Column
|
// Constructors
|
||||||
private String thesisSummary;
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
protected OppositionReport() {
|
protected OppositionReport() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OppositionReport(GradingReportTemplate gradingReportTemplate, FinalSeminarOpposition finalSeminarOpposition) {
|
public OppositionReport(GradingReportTemplate gradingReportTemplate,
|
||||||
|
FinalSeminarOpposition finalSeminarOpposition) {
|
||||||
this.finalSeminarOpposition = finalSeminarOpposition;
|
this.finalSeminarOpposition = finalSeminarOpposition;
|
||||||
createCriteriaFromTemplate(gradingReportTemplate);
|
createCriteriaFromTemplate(gradingReportTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createCriteriaFromTemplate(GradingReportTemplate gradingReportTemplate) {
|
// ----------------------------------------------------------------------------------
|
||||||
for (GradingCriterionTemplate template : gradingReportTemplate.getCriteria()) {
|
// Properties (Getters and Setters)
|
||||||
if (template.isProjectCriterion()) {
|
// ----------------------------------------------------------------------------------
|
||||||
oppositionCriteria.add(new Criterion(this, template));
|
public String getThesisSummary() {
|
||||||
}
|
return this.thesisSummary;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Criterion> getCriteria() {
|
public void setThesisSummary(String thesisSummary) {
|
||||||
oppositionCriteria.sort(new AbstractCriterion.BySortOrderComparator());
|
this.thesisSummary = thesisSummary;
|
||||||
return Collections.unmodifiableList(oppositionCriteria);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public FinalSeminarOpposition getFinalSeminarOpposition() {
|
||||||
public boolean isFinished() {
|
return this.finalSeminarOpposition;
|
||||||
if (thesisSummaryIsEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (Criterion criterion : oppositionCriteria) {
|
|
||||||
if (!criterion.isFilledOut()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean thesisSummaryIsEmpty() {
|
|
||||||
return thesisSummary == null || thesisSummary.isEmpty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public User getUser() {
|
public User getUser() {
|
||||||
return finalSeminarOpposition.getUser();
|
return finalSeminarOpposition.getUser();
|
||||||
}
|
}
|
||||||
|
@ -110,15 +118,33 @@ public class OppositionReport extends AttachmentReport {
|
||||||
return finalSeminarOpposition.getUser().getLastName();
|
return finalSeminarOpposition.getUser().getLastName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FinalSeminarOpposition getFinalSeminarOpposition() {
|
private void createCriteriaFromTemplate(GradingReportTemplate gradingReportTemplate) {
|
||||||
return this.finalSeminarOpposition;
|
for (GradingCriterionTemplate template : gradingReportTemplate.getCriteria()) {
|
||||||
|
if (template.isProjectCriterion()) {
|
||||||
|
oppositionCriteria.add(new Criterion(this, template));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getThesisSummary() {
|
public List<Criterion> getCriteria() {
|
||||||
return this.thesisSummary;
|
oppositionCriteria.sort(new AbstractCriterion.BySortOrderComparator());
|
||||||
|
return Collections.unmodifiableList(oppositionCriteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setThesisSummary(String thesisSummary) {
|
@Override
|
||||||
this.thesisSummary = thesisSummary;
|
public boolean isFinished() {
|
||||||
|
if (thesisSummaryIsEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (Criterion criterion : oppositionCriteria) {
|
||||||
|
if (!criterion.isFilledOut()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean thesisSummaryIsEmpty() {
|
||||||
|
return thesisSummary == null || thesisSummary.isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +1,36 @@
|
||||||
package se.su.dsv.scipro.report;
|
package se.su.dsv.scipro.report;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Inheritance;
|
||||||
|
import jakarta.persistence.InheritanceType;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "report")
|
@Table(name = "report")
|
||||||
@Inheritance(strategy = InheritanceType.JOINED)
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
public abstract class Report extends DomainObject {
|
public abstract class Report extends DomainObject {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "submitted")
|
||||||
private boolean submitted = false;
|
private boolean submitted = false;
|
||||||
|
|
||||||
public abstract boolean isFinished();
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
public void submit() {
|
// ----------------------------------------------------------------------------------
|
||||||
if (!isFinished()) {
|
|
||||||
throw new IllegalStateException("Report is not finished: you need to score and give feedback to every criteria");
|
|
||||||
}
|
|
||||||
submitted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object o) {
|
|
||||||
if (o == this) return true;
|
|
||||||
if (!(o instanceof Report)) return false;
|
|
||||||
final Report other = (Report) o;
|
|
||||||
return other.canEqual(this)
|
|
||||||
&& Objects.equals(this.id, other.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof Report;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(this.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
|
@ -55,4 +43,37 @@ public abstract class Report extends DomainObject {
|
||||||
public void setSubmitted(boolean submitted) {
|
public void setSubmitted(boolean submitted) {
|
||||||
this.submitted = submitted;
|
this.submitted = submitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Methods Common To All Objects
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object o) {
|
||||||
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof Report)) return false;
|
||||||
|
final Report other = (Report) o;
|
||||||
|
return other.canEqual(this)
|
||||||
|
&& Objects.equals(this.id, other.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(this.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof Report;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract boolean isFinished();
|
||||||
|
|
||||||
|
public void submit() {
|
||||||
|
if (!isFinished()) {
|
||||||
|
throw new IllegalStateException("Report is not finished: you need to score and give feedback to every criteria");
|
||||||
|
}
|
||||||
|
submitted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,24 @@
|
||||||
package se.su.dsv.scipro.report;
|
package se.su.dsv.scipro.report;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import se.su.dsv.scipro.project.Project;
|
|
||||||
import se.su.dsv.scipro.system.User;
|
|
||||||
|
|
||||||
import jakarta.persistence.Basic;
|
import jakarta.persistence.Basic;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import se.su.dsv.scipro.project.Project;
|
||||||
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name = "supervisor_grading_report")
|
||||||
public class SupervisorGradingReport extends GradingReport {
|
public class SupervisorGradingReport extends GradingReport {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(SupervisorGradingReport.class);
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@ManyToOne(optional = false)
|
|
||||||
private User user;
|
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "rejection_comment")
|
@Column(name = "rejection_comment")
|
||||||
private String rejectionComment;
|
private String rejectionComment;
|
||||||
|
@ -33,6 +31,17 @@ public class SupervisorGradingReport extends GradingReport {
|
||||||
@Column(name = "motivation")
|
@Column(name = "motivation")
|
||||||
private String motivation;
|
private String motivation;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (grading_criterion) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "user_id", referencedColumnName = "id")
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
protected SupervisorGradingReport() {
|
protected SupervisorGradingReport() {
|
||||||
// JPA
|
// JPA
|
||||||
}
|
}
|
||||||
|
@ -42,6 +51,40 @@ public class SupervisorGradingReport extends GradingReport {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public User getUser() {
|
||||||
|
return this.user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRejectionComment() {
|
||||||
|
return rejectionComment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRejectionComment(String rejectionComment) {
|
||||||
|
this.rejectionComment = rejectionComment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRejectionCommentFeedback() {
|
||||||
|
return rejectionCommentFeedback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRejectionCommentFeedback(String rejectionCommentFeedback) {
|
||||||
|
this.rejectionCommentFeedback = rejectionCommentFeedback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMotivation() {
|
||||||
|
return motivation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotivation(String motivation) {
|
||||||
|
this.motivation = motivation;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public List<GradingCriterion> getProjectCriteria() {
|
public List<GradingCriterion> getProjectCriteria() {
|
||||||
List<GradingCriterion> result = new ArrayList<>();
|
List<GradingCriterion> result = new ArrayList<>();
|
||||||
for (GradingCriterion criterion : getGradingCriteria()) {
|
for (GradingCriterion criterion : getGradingCriteria()) {
|
||||||
|
@ -82,34 +125,6 @@ public class SupervisorGradingReport extends GradingReport {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getUser() {
|
|
||||||
return this.user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRejectionComment() {
|
|
||||||
return rejectionComment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRejectionComment(String rejectionComment) {
|
|
||||||
this.rejectionComment = rejectionComment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRejectionCommentFeedback() {
|
|
||||||
return rejectionCommentFeedback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRejectionCommentFeedback(String rejectionCommentFeedback) {
|
|
||||||
this.rejectionCommentFeedback = rejectionCommentFeedback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMotivation() {
|
|
||||||
return motivation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMotivation(String motivation) {
|
|
||||||
this.motivation = motivation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasProvidedOverallMotivation() {
|
public boolean hasProvidedOverallMotivation() {
|
||||||
return getMotivation() != null && !getMotivation().isBlank();
|
return getMotivation() != null && !getMotivation().isBlank();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,51 +20,73 @@ import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.Date;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "Decision")
|
@Table(name = "decision")
|
||||||
public class Decision {
|
public class Decision {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "status")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private Status status = Status.UNDECIDED;
|
private Status status = Status.UNDECIDED;
|
||||||
|
|
||||||
@OneToOne(optional = false)
|
|
||||||
@JoinColumn(name = "thesis_reference_id")
|
|
||||||
private FileReference thesis;
|
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
@Column(name = "reason")
|
||||||
private String reason;
|
private String reason;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
@Column(name = "comment")
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
@OneToOne(optional = true)
|
@Basic
|
||||||
@JoinColumn(name = "attachment_reference_id")
|
@Column(name = "requested_date")
|
||||||
private FileReference attachment;
|
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private Date requested;
|
private Date requested;
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Basic
|
||||||
private Date deadline;
|
@Column(name = "decision_date")
|
||||||
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private Date decisionDate;
|
private Date decisionDate;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@Basic
|
||||||
private ReviewerApproval reviewerApproval;
|
@Column(name = "deadline")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
@ManyToOne
|
private Date deadline;
|
||||||
@JoinColumn(name = "assigned_reviewer_id")
|
|
||||||
private User assignedReviewer;
|
|
||||||
|
|
||||||
|
@Basic
|
||||||
@Column(name = "assigned_reviewer_date")
|
@Column(name = "assigned_reviewer_date")
|
||||||
private LocalDate reviewerAssignedAt;
|
private LocalDate reviewerAssignedAt;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (decision) referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "assigned_reviewer_id", referencedColumnName = "id")
|
||||||
|
private User assignedReviewer;
|
||||||
|
|
||||||
|
@OneToOne(optional = true)
|
||||||
|
@JoinColumn(name = "attachment_reference_id", referencedColumnName = "id")
|
||||||
|
private FileReference attachment;
|
||||||
|
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "reviewer_approval_id", referencedColumnName = "id")
|
||||||
|
private ReviewerApproval reviewerApproval;
|
||||||
|
|
||||||
|
@OneToOne(optional = false)
|
||||||
|
@JoinColumn(name = "thesis_reference_id", referencedColumnName = "id")
|
||||||
|
private FileReference thesis;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
protected Decision() {} // JPA
|
protected Decision() {} // JPA
|
||||||
|
|
||||||
Decision(ReviewerApproval reviewerApproval, final FileReference thesis, final String comment, final Date deadline) {
|
Decision(ReviewerApproval reviewerApproval, final FileReference thesis, final String comment, final Date deadline) {
|
||||||
|
@ -79,6 +101,9 @@ public class Decision {
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -87,14 +112,6 @@ public class Decision {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileReference getThesis() {
|
|
||||||
return thesis;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReviewerApproval getReviewerApproval() {
|
|
||||||
return reviewerApproval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Status getStatus() {
|
public Status getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -107,10 +124,6 @@ public class Decision {
|
||||||
return comment;
|
return comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<FileReference> getAttachment() {
|
|
||||||
return Optional.ofNullable(attachment);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getRequested() {
|
public Date getRequested() {
|
||||||
return requested;
|
return requested;
|
||||||
}
|
}
|
||||||
|
@ -127,14 +140,6 @@ public class Decision {
|
||||||
this.deadline = deadline;
|
this.deadline = deadline;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getAssignedReviewer() {
|
|
||||||
return assignedReviewer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAssignedReviewer(User assignedReviewer) {
|
|
||||||
this.assignedReviewer = assignedReviewer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDate getReviewerAssignedAt() {
|
public LocalDate getReviewerAssignedAt() {
|
||||||
return reviewerAssignedAt;
|
return reviewerAssignedAt;
|
||||||
}
|
}
|
||||||
|
@ -143,6 +148,29 @@ public class Decision {
|
||||||
this.reviewerAssignedAt = reviewerAssignedAt;
|
this.reviewerAssignedAt = reviewerAssignedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public User getAssignedReviewer() {
|
||||||
|
return assignedReviewer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAssignedReviewer(User assignedReviewer) {
|
||||||
|
this.assignedReviewer = assignedReviewer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<FileReference> getAttachment() {
|
||||||
|
return Optional.ofNullable(attachment);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReviewerApproval getReviewerApproval() {
|
||||||
|
return reviewerApproval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileReference getThesis() {
|
||||||
|
return thesis;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
void approve(final String reason, final Optional<FileReference> attachment) {
|
void approve(final String reason, final Optional<FileReference> attachment) {
|
||||||
decide(Status.APPROVED, reason, attachment);
|
decide(Status.APPROVED, reason, attachment);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package se.su.dsv.scipro.reviewing;
|
package se.su.dsv.scipro.reviewing;
|
||||||
|
|
||||||
import jakarta.persistence.GenerationType;
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.file.FileReference;
|
import se.su.dsv.scipro.file.FileReference;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
@ -13,31 +15,61 @@ import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.OneToMany;
|
import jakarta.persistence.OneToMany;
|
||||||
import jakarta.persistence.OneToOne;
|
import jakarta.persistence.OneToOne;
|
||||||
import jakarta.persistence.OrderBy;
|
import jakarta.persistence.OrderBy;
|
||||||
import java.util.*;
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name = "reviewer_approval")
|
||||||
@DiscriminatorColumn(name = "type", length = 64)
|
@DiscriminatorColumn(name = "type", length = 64)
|
||||||
public abstract class ReviewerApproval extends DomainObject {
|
public abstract class ReviewerApproval extends DomainObject {
|
||||||
@OneToOne(optional = false)
|
// ----------------------------------------------------------------------------------
|
||||||
protected Project project;
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@OneToMany(mappedBy = "reviewerApproval", cascade = CascadeType.ALL)
|
|
||||||
@OrderBy("requested desc")
|
|
||||||
protected List<Decision> decisions = new LinkedList<>();
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
public abstract Step getStep();
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (reviewer_approval) referencing other
|
||||||
|
// tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@OneToOne(optional = false)
|
||||||
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
|
protected Project project;
|
||||||
|
|
||||||
public FileReference getCurrentThesis() {
|
// ----------------------------------------------------------------------------------
|
||||||
return getCurrentDecision().getThesis();
|
// JPA-mappings of other tables referencing to this table "reviewer_approval"
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@OneToMany(mappedBy = "reviewerApproval", cascade = CascadeType.ALL)
|
||||||
|
@OrderBy("requested desc")
|
||||||
|
protected List<Decision> decisions = new LinkedList<>();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Project getProject(){return this.project;}
|
public Project getProject(){return this.project;}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public abstract Step getStep();
|
||||||
|
|
||||||
|
public Decision getCurrentDecision() {
|
||||||
|
return decisions.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileReference getCurrentThesis() {
|
||||||
|
return getCurrentDecision().getThesis();
|
||||||
|
}
|
||||||
|
|
||||||
public Status getCurrentStatus() {
|
public Status getCurrentStatus() {
|
||||||
return getCurrentDecision().getStatus();
|
return getCurrentDecision().getStatus();
|
||||||
|
@ -63,10 +95,6 @@ public abstract class ReviewerApproval extends DomainObject {
|
||||||
getCurrentDecision().reject(reason, attachment);
|
getCurrentDecision().reject(reason, attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Decision getCurrentDecision() {
|
|
||||||
return decisions.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addNewThesis(final FileReference thesis, final String comment, final Date deadline) {
|
public void addNewThesis(final FileReference thesis, final String comment, final Date deadline) {
|
||||||
if (getCurrentStatus() != Status.REJECTED) {
|
if (getCurrentStatus() != Status.REJECTED) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
|
@ -86,17 +114,15 @@ public abstract class ReviewerApproval extends DomainObject {
|
||||||
return getCurrentStatus() == Status.APPROVED;
|
return getCurrentStatus() == Status.APPROVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public Date getCurrentDeadline() {
|
||||||
public Long getId() {
|
return getCurrentDecision().getDeadline();
|
||||||
return this.id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Nested types.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public enum Step {
|
public enum Step {
|
||||||
ROUGH_DRAFT_APPROVAL,
|
ROUGH_DRAFT_APPROVAL,
|
||||||
FINAL_SEMINAR_APPROVAL
|
FINAL_SEMINAR_APPROVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCurrentDeadline() {
|
|
||||||
return getCurrentDecision().getDeadline();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,13 +13,13 @@ public class ReviewerDeadlineSettings extends DomainObject {
|
||||||
@Id
|
@Id
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "rough_draft_approval", nullable = false)
|
||||||
private int roughDraftApproval = 5;
|
private int roughDraftApproval = 5;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "final_seminar_approval", nullable = false)
|
||||||
private int finalSeminarApproval = 2;
|
private int finalSeminarApproval = 2;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "final_grading", nullable = false)
|
||||||
private int finalGrading = 5;
|
private int finalGrading = 5;
|
||||||
|
|
||||||
public ReviewerDeadlineSettings() {
|
public ReviewerDeadlineSettings() {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package se.su.dsv.scipro.reviewing;
|
package se.su.dsv.scipro.reviewing;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
@ -10,7 +11,6 @@ import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -20,22 +20,26 @@ public class ReviewerTarget extends DomainObject {
|
||||||
@GeneratedValue(strategy = jakarta.persistence.GenerationType.IDENTITY)
|
@GeneratedValue(strategy = jakarta.persistence.GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@Basic
|
||||||
tozh4728 marked this conversation as resolved
Outdated
ansv7779
commented
Loss of information in the column name, should be Loss of information in the column name, should be `reviewer_user_id`.
|
|||||||
@JoinColumn(name = "reviewer_id", nullable = false)
|
|
||||||
private User reviewer;
|
|
||||||
|
|
||||||
@Column(name = "year", nullable = false)
|
@Column(name = "year", nullable = false)
|
||||||
private int year;
|
private int year;
|
||||||
|
|
||||||
|
@Basic
|
||||||
@Column(name = "spring", nullable = false)
|
@Column(name = "spring", nullable = false)
|
||||||
private int spring;
|
private int spring;
|
||||||
|
|
||||||
|
@Basic
|
||||||
@Column(name = "autumn", nullable = false)
|
@Column(name = "autumn", nullable = false)
|
||||||
private int autumn;
|
private int autumn;
|
||||||
|
|
||||||
|
@Basic
|
||||||
@Column(name = "note")
|
@Column(name = "note")
|
||||||
private String note;
|
private String note;
|
||||||
|
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "reviewer_user_id", referencedColumnName = "id", nullable = false)
|
||||||
|
private User reviewer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
|
|
|
@ -1,5 +1,26 @@
|
||||||
package se.su.dsv.scipro.settings.dataobjects;
|
package se.su.dsv.scipro.settings.dataobjects;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.CollectionTable;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.ElementCollection;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.JoinTable;
|
||||||
|
import jakarta.persistence.ManyToMany;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import se.su.dsv.scipro.project.ProjectStatus;
|
import se.su.dsv.scipro.project.ProjectStatus;
|
||||||
import se.su.dsv.scipro.project.ProjectTeamMemberRoles;
|
import se.su.dsv.scipro.project.ProjectTeamMemberRoles;
|
||||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||||
|
@ -7,12 +28,6 @@ import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.ProjectType;
|
import se.su.dsv.scipro.system.ProjectType;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "user_profile")
|
@Table(name = "user_profile")
|
||||||
public class UserProfile extends DomainObject {
|
public class UserProfile extends DomainObject {
|
||||||
|
@ -24,40 +39,46 @@ public class UserProfile extends DomainObject {
|
||||||
@OneToOne(optional = false)
|
@OneToOne(optional = false)
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Column(name = "other_info", nullable = true)
|
||||||
private String skypeId;
|
|
||||||
|
|
||||||
@Basic(optional = true)
|
|
||||||
private String phoneNumber;
|
|
||||||
|
|
||||||
@Basic(optional = true)
|
|
||||||
private String otherInfo;
|
private String otherInfo;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Column(name = "phone_number", nullable = true)
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
|
@Column(name = "skype_id", nullable = true)
|
||||||
|
private String skypeId;
|
||||||
|
|
||||||
|
@Column(name = "mail_compilation", nullable = false)
|
||||||
private boolean mailCompilation = false;
|
private boolean mailCompilation = false;
|
||||||
|
|
||||||
|
@Column(name = "default_supervisor_filter", nullable = false)
|
||||||
|
private boolean defaultSupervisorFilter = true;
|
||||||
|
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(name = "selected_role")
|
||||||
|
private Roles selectedRole;
|
||||||
|
|
||||||
@ElementCollection
|
@ElementCollection
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
|
@CollectionTable(name = "user_profile_default_project_status_filter",
|
||||||
|
joinColumns = @JoinColumn(name = "user_profile_id", referencedColumnName = "id"))
|
||||||
|
@Column(name = "default_project_status_filter")
|
||||||
private Collection<ProjectStatus> defaultProjectStatusFilter = EnumSet.of(ProjectStatus.ACTIVE);
|
private Collection<ProjectStatus> defaultProjectStatusFilter = EnumSet.of(ProjectStatus.ACTIVE);
|
||||||
|
|
||||||
@ElementCollection
|
@ElementCollection
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
|
@CollectionTable(name = "user_profile_default_project_team_member_roles_filter",
|
||||||
|
joinColumns = @JoinColumn(name = "user_profile_id", referencedColumnName = "id"))
|
||||||
|
@Column(name = "default_project_team_member_roles_filter")
|
||||||
private Collection<ProjectTeamMemberRoles> defaultProjectTeamMemberRolesFilter = EnumSet.of(ProjectTeamMemberRoles.CO_SUPERVISOR);
|
private Collection<ProjectTeamMemberRoles> defaultProjectTeamMemberRolesFilter = EnumSet.of(ProjectTeamMemberRoles.CO_SUPERVISOR);
|
||||||
|
|
||||||
@Basic(optional = false)
|
|
||||||
private boolean defaultSupervisorFilter = true;
|
|
||||||
|
|
||||||
@ManyToMany
|
@ManyToMany
|
||||||
@JoinTable(
|
@JoinTable(name = "user_profile_project_type",
|
||||||
name = "user_profile_ProjectType",
|
joinColumns = @JoinColumn(name = "user_profile_id", referencedColumnName = "id"),
|
||||||
joinColumns = {@JoinColumn(name = "user_profile_id")}
|
inverseJoinColumns = @JoinColumn(name = "project_type_id", referencedColumnName = "id")
|
||||||
)
|
)
|
||||||
private Collection<ProjectType> defaultProjectTypeFilter = new ArrayList<>();
|
private Collection<ProjectType> defaultProjectTypeFilter = new ArrayList<>();
|
||||||
|
|
||||||
@Basic
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private Roles selectedRole;
|
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
@Column(name = "supervisor_project_note_display")
|
@Column(name = "supervisor_project_note_display")
|
||||||
|
|
|
@ -1,11 +1,23 @@
|
||||||
package se.su.dsv.scipro.survey;
|
package se.su.dsv.scipro.survey;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.CollectionTable;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.ElementCollection;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name = "question")
|
||||||
public class Question implements Serializable {
|
public class Question implements Serializable {
|
||||||
public enum Type { TEXT, SINGLE_CHOICE, MULTIPLE_CHOICE, GROUP_HEADING }
|
public enum Type { TEXT, SINGLE_CHOICE, MULTIPLE_CHOICE, GROUP_HEADING }
|
||||||
|
|
||||||
|
@ -20,6 +32,9 @@ public class Question implements Serializable {
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
|
@CollectionTable(name = "question_choices",
|
||||||
|
joinColumns = @JoinColumn(name = "question_id", referencedColumnName = "id"))
|
||||||
|
@Column(name = "choices")
|
||||||
private List<String> choices = new LinkedList<>();
|
private List<String> choices = new LinkedList<>();
|
||||||
|
|
||||||
private Type type = Type.TEXT;
|
private Type type = Type.TEXT;
|
||||||
|
|
|
@ -1,14 +1,23 @@
|
||||||
package se.su.dsv.scipro.survey;
|
package se.su.dsv.scipro.survey;
|
||||||
|
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name = "survey")
|
||||||
public class Survey implements Serializable {
|
public class Survey implements Serializable {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
|
This feels like a downgrade in terms of documentation from the column name.
file_upload_reference_id
tells you that it is an uploaded file to the activity whilefile_reference_id
conveys no such information.It's renamed to 'upload_file_reference_id', following the same scheme _user_id. "file_reference" is the table name.