task/3382: Harmonisera tabellnamn #6
|
@ -1,140 +1,164 @@
|
|||
package se.su.dsv.scipro.activityplan;
|
||||
|
||||
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.CascadeType;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
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.util.*;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "activity")
|
||||
@Cacheable(true)
|
||||
public class Activity extends LazyDeletableDomainObject {
|
||||
|
||||
public static IActivityPlan builder(){
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
//<editor-fold desc="Basic JPA-mappings">
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(optional=false)
|
||||
@JoinColumn (name="activityTemplate_id")
|
||||
@QueryInit("project")
|
||||
private ActivityPlan activityPlan;
|
||||
|
||||
@Column(nullable=false)
|
||||
private Date date;
|
||||
|
||||
@Column(nullable=false)
|
||||
@Basic
|
||||
@Column(name = "title", nullable=false)
|
||||
private String title;
|
||||
|
||||
@Basic
|
||||
@Column(name = "date", nullable=false)
|
||||
private Date date;
|
||||
|
||||
@Basic
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
|
||||
@OneToOne(optional = true, cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "file_upload_reference_id")
|
||||
private FileReference fileUpload;
|
||||
|
||||
@ManyToOne
|
||||
private Checklist checklist;
|
||||
|
||||
@Basic
|
||||
@Column(name = "editable")
|
||||
private boolean editable = true;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "action")
|
||||
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() {
|
||||
this.title = "";
|
||||
this.description = "";
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return "Event: "+ getTitle()+"@"+getDate();
|
||||
}
|
||||
|
||||
//<editor-fold desc="Properties (Getters and Setters)">
|
||||
@Override
|
||||
public Long getId() {
|
||||
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) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setActivityPlan(ActivityPlan activityPlan) {
|
||||
this.activityPlan = activityPlan;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public void setTitle(String 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) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setFileUpload(FileReference fileUpload) {
|
||||
this.fileUpload = fileUpload;
|
||||
}
|
||||
|
||||
public void setChecklist(Checklist checklist) {
|
||||
this.checklist = checklist;
|
||||
public boolean isEditable() {
|
||||
return this.editable;
|
||||
}
|
||||
|
||||
public void setEditable(boolean editable) {
|
||||
this.editable = editable;
|
||||
}
|
||||
|
||||
public Action getAction() {
|
||||
return this.action;
|
||||
}
|
||||
|
||||
public void setAction(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
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -144,15 +168,24 @@ public class Activity extends LazyDeletableDomainObject {
|
|||
&& Objects.equals(this.getId(), other.getId());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof Activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
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 {
|
||||
@Override
|
||||
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 {
|
||||
IDate activityPlan(ActivityPlan activityPlan);
|
||||
}
|
||||
|
@ -233,4 +262,5 @@ public class Activity extends LazyDeletableDomainObject {
|
|||
IBuild editable(boolean editable);
|
||||
Activity build();
|
||||
}
|
||||
//</editor-fold>
|
||||
}
|
||||
|
|
|
@ -1,67 +1,92 @@
|
|||
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.system.DomainObject;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
@Entity
|
||||
@Table(name ="activity_plan")
|
||||
@Cacheable(true)
|
||||
public class ActivityPlan extends DomainObject {
|
||||
|
||||
public static IProject builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
//<editor-fold desc="Basic JPA-mappings">
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
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)
|
||||
private Set<Activity> activities = new TreeSet<>(new Activity.ByDateComparator());
|
||||
//</editor-fold>
|
||||
|
||||
@OneToOne(optional=false)
|
||||
private Project project;
|
||||
|
||||
private Date startDate;
|
||||
|
||||
//<editor-fold desc="Properties (Getters and Setters)">
|
||||
@Override
|
||||
public Long getId() {
|
||||
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) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setActivities(Set<Activity> activities) {
|
||||
this.activities = activities;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
public Date getStartDate() {
|
||||
return this.startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ActivityPlan(id=" + this.getId() + ", activities=" + this.getActivities() + ", project=" + this.getProject() + ", startDate=" + this.getStartDate() + ")";
|
||||
public Project getProject() {
|
||||
return this.project;
|
||||
}
|
||||
|
||||
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
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -74,15 +99,25 @@ public class ActivityPlan extends DomainObject {
|
|||
&& Objects.equals(this.getStartDate(), other.getStartDate());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof ActivityPlan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
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 Project project;
|
||||
|
||||
|
@ -100,10 +135,6 @@ public class ActivityPlan extends DomainObject {
|
|||
}
|
||||
}
|
||||
|
||||
public static IProject builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public interface IProject {
|
||||
IBuild project(Project project);
|
||||
}
|
||||
|
@ -111,4 +142,5 @@ public class ActivityPlan extends DomainObject {
|
|||
public interface IBuild {
|
||||
ActivityPlan build();
|
||||
}
|
||||
//</editor-fold>
|
||||
}
|
||||
|
|
|
@ -1,22 +1,106 @@
|
|||
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.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "activity_plan_template")
|
||||
@Cacheable(true)
|
||||
public class ActivityPlanTemplate extends DomainObject {
|
||||
|
||||
//<editor-fold desc="Basic JPA-mappings">
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
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)
|
||||
@OrderColumn(name = "number_in_order")
|
||||
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(){
|
||||
return Collections.unmodifiableList(activityTemplates);
|
||||
|
@ -25,74 +109,9 @@ public class ActivityPlanTemplate extends DomainObject {
|
|||
public void setActivityTemplates(List<ActivityTemplate> activityTemplates){
|
||||
this.activityTemplates = new ArrayList<>(activityTemplates);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
@ManyToOne(optional=false)
|
||||
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;
|
||||
}
|
||||
|
||||
//<editor-fold desc="Methods Common To All Objects">
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -119,6 +138,25 @@ public class ActivityPlanTemplate extends DomainObject {
|
|||
|
||||
@Override
|
||||
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;
|
||||
|
||||
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.system.DomainObject;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "activity_template")
|
||||
public class ActivityTemplate extends DomainObject {
|
||||
|
||||
//<editor-fold desc="Basic JPA-mappings">
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(nullable = false)
|
||||
@Basic
|
||||
@Column(name = "title", nullable = false)
|
||||
private String title;
|
||||
|
||||
@Basic
|
||||
@Column(name = "description")
|
||||
@Lob
|
||||
private String description;
|
||||
|
||||
@ManyToOne
|
||||
private ActivityPlanTemplate activityPlanTemplate;
|
||||
|
||||
@Column(nullable = false)
|
||||
@Basic
|
||||
@Column(name = "days_offset", nullable = false)
|
||||
private int daysOffset;
|
||||
|
||||
@Basic
|
||||
@Column(name = "action")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Action action = Action.NONE;
|
||||
|
||||
@Column(nullable = false)
|
||||
@Basic
|
||||
@Column(name = "number_in_order", nullable = false)
|
||||
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)
|
||||
@JoinColumn(name = "checklist_template_id", referencedColumnName = "id")
|
||||
private ChecklistTemplate checklistTemplate;
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold desc="Constructors">
|
||||
public ActivityTemplate() {
|
||||
}
|
||||
|
||||
public ActivityTemplate(int daysOffset) {
|
||||
this.daysOffset = daysOffset;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
public int getDaysOffset() {
|
||||
return daysOffset;
|
||||
}
|
||||
|
||||
public int getNumberInOrder() {
|
||||
return numberInOrder;
|
||||
}
|
||||
|
||||
//<editor-fold desc="Properties (Getters and Setters">
|
||||
@Override
|
||||
public Long getId() {
|
||||
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) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
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 void setActivityPlanTemplate(ActivityPlanTemplate activityPlanTemplate) {
|
||||
this.activityPlanTemplate = activityPlanTemplate;
|
||||
public int getDaysOffset() {
|
||||
return daysOffset;
|
||||
}
|
||||
|
||||
public void setDaysOffset(int daysOffset) {
|
||||
this.daysOffset = daysOffset;
|
||||
}
|
||||
|
||||
public Action getAction() {
|
||||
return this.action;
|
||||
}
|
||||
|
||||
public void setAction(Action action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public int getNumberInOrder() {
|
||||
return numberInOrder;
|
||||
}
|
||||
|
||||
public void setNumberInOrder(int 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) {
|
||||
this.checklistTemplate = checklistTemplate;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
@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 desc="Methods Common To All Objects">
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -120,12 +146,24 @@ public class ActivityTemplate extends DomainObject {
|
|||
&& Objects.equals(this.getId(), other.getId());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof ActivityTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
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;
|
||||
|
||||
|
||||
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.system.DomainObject;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "checklist")
|
||||
|
@ -17,6 +38,7 @@ public class Checklist extends DomainObject {
|
|||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Basic
|
||||
@Column(nullable = false)
|
||||
private String name;
|
||||
|
||||
|
@ -28,15 +50,26 @@ public class Checklist extends DomainObject {
|
|||
*/
|
||||
@Deprecated
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "project_id")
|
||||
private Project project;
|
||||
|
||||
@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<>();
|
||||
|
||||
@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<>();
|
||||
|
||||
@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<>();
|
||||
|
||||
protected Checklist() {
|
||||
|
|
|
@ -1,29 +1,54 @@
|
|||
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.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "checklist_answer")
|
||||
public class ChecklistAnswer extends DomainObject {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Basic
|
||||
@Column(name = "answer", nullable = false)
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable = false)
|
||||
private ChecklistAnswerEnum answer;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
private User user;
|
||||
|
||||
@Basic
|
||||
@Column(name = "comment")
|
||||
@Lob
|
||||
@Column
|
||||
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() {
|
||||
}
|
||||
|
||||
|
@ -36,44 +61,45 @@ public class ChecklistAnswer extends DomainObject {
|
|||
this.answer = answer != null ? answer : ChecklistAnswerEnum.NO_ANSWER;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
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) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public ChecklistAnswerEnum getAnswer() {
|
||||
return this.answer;
|
||||
}
|
||||
|
||||
public void setAnswer(ChecklistAnswerEnum answer) {
|
||||
this.answer = answer;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
public String getComment() {
|
||||
return this.comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ChecklistAnswer(id=" + this.getId() + ", answer=" + this.getAnswer() + ", user=" + this.getUser() + ", comment=" + this.getComment() + ")";
|
||||
public User getUser() {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -83,12 +109,21 @@ public class ChecklistAnswer extends DomainObject {
|
|||
&& Objects.equals(this.getId(), other.getId());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof ChecklistAnswer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
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,
|
||||
GREEN,
|
||||
YELLOW,
|
||||
NOT_APLICABLE,
|
||||
NOT_APPLICABLE,
|
||||
NO_ANSWER
|
||||
}
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package se.su.dsv.scipro.checklist;
|
||||
|
||||
import se.su.dsv.scipro.system.DomainObject;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
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
|
||||
@Table(name="checklist_category")
|
||||
@Cacheable(true)
|
||||
|
@ -16,7 +20,7 @@ public class ChecklistCategory extends DomainObject {
|
|||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(unique=true)
|
||||
@Column(name = "category_name", unique = true)
|
||||
private String categoryName;
|
||||
|
||||
protected ChecklistCategory() {
|
||||
|
|
|
@ -1,13 +1,26 @@
|
|||
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.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.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
|
||||
@Table(name = "checklist_question")
|
||||
@Cacheable(true)
|
||||
|
@ -20,13 +33,15 @@ public class ChecklistQuestion extends DomainObject {
|
|||
@Column(nullable = false)
|
||||
private String question;
|
||||
|
||||
@Column(nullable = false)
|
||||
@Basic
|
||||
@Column(name = "question_number", nullable = false)
|
||||
private int questionNumber;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@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<>();
|
||||
|
||||
protected ChecklistQuestion() {
|
||||
|
|
|
@ -1,11 +1,27 @@
|
|||
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.ProjectType;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "checklist_template")
|
||||
|
@ -17,35 +33,42 @@ public class ChecklistTemplate extends DomainObject {
|
|||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Basic
|
||||
@Column(nullable = false)
|
||||
private String name;
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
|
||||
@Column
|
||||
@Basic
|
||||
@Column(name = "template_number")
|
||||
private int templateNumber = DEFAULT_TEMPLATE_NUMBER;
|
||||
|
||||
@Lob
|
||||
@ElementCollection
|
||||
@CollectionTable(name = "checklist_template_question",
|
||||
joinColumns = @JoinColumn(name = "checklist_template_id"))
|
||||
@Column(name = "question")
|
||||
private List<String> questions = new ArrayList<>(1);
|
||||
|
||||
@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;
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(
|
||||
joinColumns = @JoinColumn(name = "checklist_template_id")
|
||||
)
|
||||
@JoinTable(name = "checklist_template_checklist_category",
|
||||
joinColumns = @JoinColumn(name = "checklist_template_id", referencedColumnName = "id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "checklist_category_id", referencedColumnName = "id"))
|
||||
private List<ChecklistCategory> categories = new ArrayList<>();
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name = "checklist_template_ProjectType",
|
||||
@JoinTable(name = "checklist_template_project_type",
|
||||
joinColumns = {@JoinColumn(name = "checklist_template_id")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "projectType_id")})
|
||||
inverseJoinColumns = {@JoinColumn(name = "project_type_id")})
|
||||
private Collection<ProjectType> projectTypes = new HashSet<>();
|
||||
|
||||
public ChecklistTemplate() {
|
||||
|
||||
}
|
||||
|
||||
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 String FILE_ROOT = "/scipro-files";
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column
|
||||
@Basic
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Basic
|
||||
@Column(name = "mime_type")
|
||||
private String mimeType;
|
||||
|
||||
@Column
|
||||
private String identifier;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "userId")
|
||||
private User uploader;
|
||||
|
||||
@Basic
|
||||
@Column(name = "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
|
||||
void removeActualData() {
|
||||
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() {
|
||||
return FileSystems.getDefault().getPath(FILE_ROOT, getSubdirectory(), Long.toString(id));
|
||||
}
|
||||
|
@ -78,85 +183,4 @@ public class FileDescription extends DomainObject {
|
|||
public InputStream getData() throws IOException {
|
||||
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.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A reference to a file.
|
||||
|
@ -29,7 +29,7 @@ public class FileReference implements Serializable {
|
|||
private Long id;
|
||||
|
||||
@ManyToOne(cascade = CascadeType.PERSIST)
|
||||
@JoinColumn(name = "file_description_id")
|
||||
@JoinColumn(name = "file_description_id", referencedColumnName = "id")
|
||||
private FileDescription fileDescription;
|
||||
|
||||
public Long getId() {
|
||||
|
|
|
@ -1,71 +1,88 @@
|
|||
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.system.DomainObject;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "project_file")
|
||||
public class ProjectFile extends DomainObject {
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne
|
||||
private Project project;
|
||||
|
||||
@Basic
|
||||
@Column(name = "file_source")
|
||||
@Enumerated(EnumType.STRING)
|
||||
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
|
||||
@JoinColumn(name = "file_reference_id")
|
||||
@JoinColumn(name = "file_reference_id", referencedColumnName = "id")
|
||||
private FileReference fileReference;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
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) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
public FileSource getFileSource() {
|
||||
return this.fileSource;
|
||||
}
|
||||
|
||||
public void setFileSource(FileSource fileSource) {
|
||||
this.fileSource = fileSource;
|
||||
}
|
||||
|
||||
public void setFileReference(FileReference fileReference) {
|
||||
this.fileReference = fileReference;
|
||||
}
|
||||
|
||||
public FileReference getFileReference() {
|
||||
return this.fileReference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProjectFile(id=" + this.getId() + ", project=" + this.getProject() + ", fileSource=" + this.getFileSource() + ", fileDescription=" + this.getFileDescription() + ")";
|
||||
public void setFileReference(FileReference fileReference) {
|
||||
this.fileReference = fileReference;
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -79,12 +96,24 @@ public class ProjectFile extends DomainObject {
|
|||
&& Objects.equals(this.getFileDescription(), other.getFileDescription());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof ProjectFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
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.OneToOne;
|
||||
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
|
||||
@Table(name = "final_seminar")
|
||||
|
@ -35,27 +43,69 @@ public class FinalSeminar extends LazyDeletableDomainObject {
|
|||
public static final int DEFAULT_MAX_PARTICIPANTS = 5;
|
||||
public static final String FINAL_SEMINAR = "finalSeminar";
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@OneToOne(optional = false)
|
||||
@QueryInit({"projectType", "headSupervisor"})
|
||||
private Project project;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "start_date")
|
||||
private Date startDate;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "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
|
||||
@Column(name = "extra_info")
|
||||
private String extraInfo;
|
||||
|
||||
@Basic
|
||||
@Column(name = "creation_reason")
|
||||
private String creationReason;
|
||||
|
||||
@Basic
|
||||
@Column(name = "manual_participants")
|
||||
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)
|
||||
private Set<FinalSeminarActiveParticipation> activeParticipations = new HashSet<>();
|
||||
|
||||
|
@ -65,28 +115,10 @@ public class FinalSeminar extends LazyDeletableDomainObject {
|
|||
@OneToMany(mappedBy = FINAL_SEMINAR, orphanRemoval = true, cascade = CascadeType.ALL)
|
||||
private Set<FinalSeminarRespondent> respondents = new HashSet<>();
|
||||
|
||||
/*
|
||||
* 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_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;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------------------
|
||||
public FinalSeminar() {
|
||||
|
||||
}
|
||||
|
||||
public FinalSeminar(int maxOpponents, int maxParticipants) {
|
||||
|
@ -99,6 +131,90 @@ public class FinalSeminar extends LazyDeletableDomainObject {
|
|||
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() {
|
||||
return manualParticipants;
|
||||
}
|
||||
|
@ -107,21 +223,83 @@ public class FinalSeminar extends LazyDeletableDomainObject {
|
|||
this.manualParticipants = manualParticipants;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = (Date) startDate.clone();
|
||||
public FileReference getDocument() {
|
||||
return this.document;
|
||||
}
|
||||
|
||||
public void setDocument(FileReference document) {
|
||||
this.document = document;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public Set<FinalSeminarActiveParticipation> getActiveParticipations() {
|
||||
return Collections.unmodifiableSet(activeParticipations);
|
||||
}
|
||||
|
||||
public void setActiveParticipations(Collection<FinalSeminarActiveParticipation> activeParticipations) {
|
||||
this.activeParticipations.clear();
|
||||
this.activeParticipations.addAll(activeParticipations);
|
||||
}
|
||||
|
||||
public Set<FinalSeminarActiveParticipation> getActiveParticipations() {
|
||||
return Collections.unmodifiableSet(activeParticipations);
|
||||
public Set<FinalSeminarOpposition> getOppositions() {
|
||||
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) {
|
||||
|
@ -132,25 +310,62 @@ public class FinalSeminar extends LazyDeletableDomainObject {
|
|||
this.activeParticipations.remove(participation);
|
||||
}
|
||||
|
||||
public void setOppositions(Collection<FinalSeminarOpposition> oppositions) {
|
||||
this.oppositions.clear();
|
||||
this.oppositions.addAll(oppositions);
|
||||
public void removeActiveParticipant(User user) {
|
||||
activeParticipations.removeIf(next -> next.getUser().equals(user));
|
||||
}
|
||||
|
||||
public Set<FinalSeminarOpposition> getOppositions() {
|
||||
return Collections.unmodifiableSet(oppositions);
|
||||
public Set<User> getActiveParticipants(){
|
||||
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) {
|
||||
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() {
|
||||
return project.getMinOpponentsOnFinalSeminar();
|
||||
return getProject().getMinOpponentsOnFinalSeminar();
|
||||
}
|
||||
|
||||
public int getMinActiveParticipants() {
|
||||
return project.getMinFinalSeminarActiveParticipation();
|
||||
return getProject().getMinFinalSeminarActiveParticipation();
|
||||
}
|
||||
|
||||
public List<Member> getMembers() {
|
||||
|
@ -172,177 +387,10 @@ public class FinalSeminar extends LazyDeletableDomainObject {
|
|||
}
|
||||
|
||||
public ProjectType getProjectType() {
|
||||
return project.getProjectType();
|
||||
return getProject().getProjectType();
|
||||
}
|
||||
|
||||
public String getProjectTitle() {
|
||||
return project.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;
|
||||
return getProject().getTitle();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package se.su.dsv.scipro.finalseminar;
|
||||
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import se.su.dsv.scipro.project.Project;
|
||||
|
||||
import jakarta.persistence.Cacheable;
|
||||
|
@ -9,13 +10,20 @@ import jakarta.persistence.Table;
|
|||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Cacheable(true)
|
||||
@Table(name = "final_seminar_active_participation")
|
||||
@Cacheable(true)
|
||||
public class FinalSeminarActiveParticipation extends FinalSeminarParticipation {
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of foreign keys in this table (final_seminar_active_participation)
|
||||
// referencing other tables.
|
||||
// ----------------------------------------------------------------------------------
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||
private Project project;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public Project getProject() {
|
||||
return this.project;
|
||||
}
|
||||
|
@ -24,6 +32,9 @@ public class FinalSeminarActiveParticipation extends FinalSeminarParticipation {
|
|||
this.project = project;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -34,13 +45,16 @@ public class FinalSeminarActiveParticipation extends FinalSeminarParticipation {
|
|||
&& Objects.equals(this.project, other.project);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof FinalSeminarActiveParticipation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
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.OneToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import java.util.*;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name="final_seminar_opposition")
|
||||
public class FinalSeminarOpposition extends FinalSeminarParticipation {
|
||||
public 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;
|
||||
private static final int FEEDBACK_LENGTH = 2000;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Basic
|
||||
@Column(name = "points")
|
||||
private Integer points;
|
||||
|
||||
@Basic
|
||||
@Column(length = FEEDBACK_LENGTH)
|
||||
@Column(name = "feedback", length = FEEDBACK_LENGTH)
|
||||
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) {
|
||||
this.project = project;
|
||||
}
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||
private Project project;
|
||||
|
||||
public Project getProject() {
|
||||
return this.project;
|
||||
}
|
||||
|
||||
public FileReference getOpponentReport() {
|
||||
return this.opponentReport;
|
||||
}
|
||||
|
||||
public OppositionReport getOppositionReport() {
|
||||
return this.oppositionReport;
|
||||
}
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of other tables referencing to this table (final_seminar_opposition)
|
||||
// ----------------------------------------------------------------------------------
|
||||
@OneToOne(optional = true, orphanRemoval = true, cascade = CascadeType.ALL,
|
||||
mappedBy = "finalSeminarOpposition")
|
||||
private OppositionReport oppositionReport;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public Integer getPoints() {
|
||||
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) {
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
public String getFeedback() {
|
||||
return this.feedback;
|
||||
}
|
||||
|
||||
public void setFeedback(String 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
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -90,13 +107,20 @@ public class FinalSeminarOpposition extends FinalSeminarParticipation {
|
|||
&& Objects.equals(this.getProject(), other.getProject());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), this.getProject());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Other Methods
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof FinalSeminarOpposition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), this.getProject());
|
||||
public ProjectType getProjectType() {
|
||||
return getFinalSeminar().getProject().getProjectType();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,64 +1,66 @@
|
|||
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.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@MappedSuperclass
|
||||
public abstract class FinalSeminarParticipation extends DomainObject {
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
private User user;
|
||||
@Basic
|
||||
@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)
|
||||
@JoinColumn(name = "final_seminar_id", referencedColumnName = "id")
|
||||
private FinalSeminar finalSeminar;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private FinalSeminarGrade grade = null;
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "user_id", referencedColumnName = "id")
|
||||
private User user;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------------------
|
||||
protected FinalSeminarParticipation() {
|
||||
}
|
||||
|
||||
protected FinalSeminarParticipation(User user, FinalSeminar finalSeminar) {
|
||||
this.user = user;
|
||||
this.finalSeminar = finalSeminar;
|
||||
}
|
||||
|
||||
protected FinalSeminarParticipation() {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
public FinalSeminar getFinalSeminar() {
|
||||
return this.finalSeminar;
|
||||
}
|
||||
|
||||
public FinalSeminarGrade getGrade() {
|
||||
return this.grade;
|
||||
}
|
||||
|
@ -67,6 +69,29 @@ public abstract class FinalSeminarParticipation extends DomainObject {
|
|||
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
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -77,12 +102,20 @@ public abstract class FinalSeminarParticipation extends DomainObject {
|
|||
&& Objects.equals(this.getFinalSeminar(), other.getFinalSeminar());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof FinalSeminarParticipation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
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;
|
||||
|
||||
@Entity
|
||||
@Cacheable(true)
|
||||
@Table(name = "final_seminar_respondent")
|
||||
@Cacheable(true)
|
||||
public class FinalSeminarRespondent extends FinalSeminarParticipation {
|
||||
|
||||
protected FinalSeminarRespondent() {
|
||||
}
|
||||
|
||||
public FinalSeminarRespondent(User student, FinalSeminar finalSeminar) {
|
||||
super(student, finalSeminar);
|
||||
}
|
||||
|
||||
protected FinalSeminarRespondent() {
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return getFinalSeminar().getProject();
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Objects;
|
|||
|
||||
@Entity
|
||||
@Cacheable(true)
|
||||
@Table(name = "final_seminar_settings")
|
||||
public class FinalSeminarSettings extends DomainObject {
|
||||
public static final int DEFAULT_DAYS_AHEAD_TO_UPLOAD_THESIS = 10;
|
||||
public static final int DEFAULT_DAYS_AHEAD_TO_REGISTER_OPPOSITION = 3;
|
||||
|
@ -22,25 +23,26 @@ public class FinalSeminarSettings extends DomainObject {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "days_ahead_to_create", nullable = false)
|
||||
private int daysAheadToCreate;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "days_ahead_to_register_participation", nullable = false)
|
||||
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;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "days_ahead_to_upload_thesis", nullable = false)
|
||||
private int daysAheadToUploadThesis = DEFAULT_DAYS_AHEAD_TO_UPLOAD_THESIS;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "thesis_must_be_pdf", nullable = false)
|
||||
private boolean thesisMustBePDF = false;
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "evaluation_url", nullable = true)
|
||||
private String evaluationURL;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "opposition_priority_days", nullable = false)
|
||||
private int oppositionPriorityDays;
|
||||
|
||||
public boolean getThesisMustBePDF() {
|
||||
|
|
|
@ -21,50 +21,67 @@ import jakarta.persistence.Table;
|
|||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table
|
||||
@Table(name = "final_thesis")
|
||||
public class FinalThesis extends DomainObject {
|
||||
|
||||
public enum Status {
|
||||
APPROVED, REJECTED, NO_DECISION
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "document_reference_id")
|
||||
private FileReference document;
|
||||
@Basic
|
||||
@Column(name = "title_sv")
|
||||
private String swedishTitle;
|
||||
|
||||
@ManyToOne(optional = true)
|
||||
@JoinColumn(name = "text_matching_document_reference_id")
|
||||
private FileReference textMatchingDocument;
|
||||
@Basic
|
||||
@Column(name = "title_en")
|
||||
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
|
||||
@Column(name = "text_matching_analysis")
|
||||
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)
|
||||
@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;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Status status = Status.NO_DECISION;
|
||||
|
||||
private Date dateApproved;
|
||||
|
||||
private Date dateRejected;
|
||||
|
||||
private String englishTitle;
|
||||
|
||||
private String swedishTitle;
|
||||
|
||||
@Column(name = "rejection_comment")
|
||||
private String rejectionComment;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA lifecycle method
|
||||
// ----------------------------------------------------------------------------------
|
||||
@PrePersist
|
||||
@PreUpdate
|
||||
void cleanTitle() {
|
||||
|
@ -72,6 +89,126 @@ public class FinalThesis extends DomainObject {
|
|||
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) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
|
@ -83,125 +220,23 @@ public class FinalThesis extends DomainObject {
|
|||
.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) {
|
||||
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() {
|
||||
Instant instant = document.getFileDescription().getDateCreated().toInstant();
|
||||
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;
|
||||
|
||||
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.system.DomainObject;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
@Entity
|
||||
@Table(name = "project_first_meeting")
|
||||
public final class ProjectFirstMeeting extends DomainObject {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@QueryInit("activityPlan.project")
|
||||
@OneToOne(optional = false, cascade = CascadeType.ALL)
|
||||
private Activity activity;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "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() {}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// getters and setters
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return activity.getDate();
|
||||
}
|
||||
|
||||
public String getRoom() {
|
||||
return room;
|
||||
}
|
||||
|
@ -40,10 +61,6 @@ public final class ProjectFirstMeeting extends DomainObject {
|
|||
this.room = room;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return activity.getDescription();
|
||||
}
|
||||
|
||||
Activity getActivity() {
|
||||
return activity;
|
||||
}
|
||||
|
@ -51,4 +68,15 @@ public final class ProjectFirstMeeting extends DomainObject {
|
|||
void setActivity(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;
|
||||
|
||||
import jakarta.persistence.Basic;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import se.su.dsv.scipro.file.FileReference;
|
||||
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
||||
|
@ -15,54 +16,51 @@ import jakarta.persistence.Lob;
|
|||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.Table;
|
||||
import java.util.*;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@Entity
|
||||
@Table(name = "forum_post")
|
||||
public class ForumPost extends LazyDeletableDomainObject {
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Lob
|
||||
@Basic
|
||||
@Column(name = "content", nullable = false)
|
||||
@Lob
|
||||
private String content;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of foreign keys in this table (forum_post) referencing other
|
||||
// tables.
|
||||
// ----------------------------------------------------------------------------------
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user", nullable = true)
|
||||
private User postedBy;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "thread", nullable = false)
|
||||
@JoinColumn(name = "thread_id", nullable = false)
|
||||
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)
|
||||
@JoinTable(name = "forum_post_file_description",
|
||||
joinColumns = {@JoinColumn(name = "forum_post_id")},
|
||||
@JoinTable(name = "forum_post_file_reference",
|
||||
joinColumns = {@JoinColumn(name = "forum_post_id", referencedColumnName = "id")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "file_reference_id")})
|
||||
private Set<FileReference> attachments = new HashSet<>();
|
||||
|
||||
public String getSubject() {
|
||||
return forumThread.getSubject();
|
||||
}
|
||||
|
||||
public Set<FileReference> getAttachments() {
|
||||
return attachments;
|
||||
}
|
||||
|
||||
public User getPostedBy() {
|
||||
return postedBy;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public ForumThread getForumThread() {
|
||||
return forumThread;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
|
@ -72,27 +70,41 @@ public class ForumPost extends LazyDeletableDomainObject {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public void setPostedBy(User postedBy) {
|
||||
this.postedBy = postedBy;
|
||||
public ForumThread getForumThread() {
|
||||
return forumThread;
|
||||
}
|
||||
|
||||
public void setForumThread(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) {
|
||||
this.attachments = attachments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ForumPost(id=" + this.getId() + ", content=" + this.getContent() + ", postedBy=" + this.getPostedBy() + ", forumThread=" + this.getForumThread() + ", attachments=" + this.getAttachments() + ")";
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -106,10 +118,6 @@ public class ForumPost extends LazyDeletableDomainObject {
|
|||
&& Objects.equals(this.getAttachments(), other.getAttachments());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof ForumPost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(
|
||||
|
@ -119,4 +127,22 @@ public class ForumPost extends LazyDeletableDomainObject {
|
|||
this.getForumThread(),
|
||||
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;
|
||||
|
||||
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 jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Entity
|
||||
@Table(name = "forum_post_read")
|
||||
@Table(name = "forum_post_read_state")
|
||||
public class ForumPostReadState implements Serializable {
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic and embedded JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@EmbeddedId
|
||||
private ForumPostReadStateId id;
|
||||
|
||||
|
@ -16,6 +23,9 @@ public class ForumPostReadState implements Serializable {
|
|||
@Column(name = "`read`", nullable = false)
|
||||
private boolean read = false;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------------------
|
||||
public ForumPostReadState() {
|
||||
}
|
||||
|
||||
|
@ -23,6 +33,9 @@ public class ForumPostReadState implements Serializable {
|
|||
id = new ForumPostReadStateId(user, post);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public ForumPostReadStateId getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -39,4 +52,3 @@ public class ForumPostReadState implements Serializable {
|
|||
this.read = read;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,11 +11,11 @@ import java.util.Objects;
|
|||
@Embeddable
|
||||
public class ForumPostReadStateId implements Serializable {
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user", nullable = false)
|
||||
@JoinColumn(name = "user_id", nullable = false)
|
||||
private User user;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "post", nullable = false)
|
||||
@JoinColumn(name = "forum_post_id", nullable = false)
|
||||
private ForumPost post;
|
||||
|
||||
public ForumPostReadStateId() {
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
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.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
@ -13,17 +25,88 @@ import java.util.Objects;
|
|||
@Inheritance(strategy = InheritanceType.JOINED)
|
||||
public class ForumThread extends LazyDeletableDomainObject {
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@OneToMany(mappedBy = "forumThread", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
private List<ForumPost> posts = new ArrayList<>();
|
||||
|
||||
@Basic
|
||||
@Column(name = "subject", nullable = false)
|
||||
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) {
|
||||
posts.add(post);
|
||||
}
|
||||
|
@ -32,15 +115,6 @@ public class ForumThread extends LazyDeletableDomainObject {
|
|||
return posts.size();
|
||||
}
|
||||
|
||||
@PostLoad
|
||||
void lazyDeletion() {
|
||||
posts.removeIf(LazyDeletableDomainObject::isDeleted);
|
||||
}
|
||||
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
public User getCreatedBy(){
|
||||
return getPosts().get(0).getPostedBy();
|
||||
}
|
||||
|
@ -53,48 +127,4 @@ public class ForumThread extends LazyDeletableDomainObject {
|
|||
}
|
||||
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;
|
||||
|
||||
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 jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "group_thread")
|
||||
@Table(name = "project_group_thread")
|
||||
public class GroupThread implements Serializable {
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of foreign keys in this table (project_group_thread) referencing other
|
||||
// tables.
|
||||
// ----------------------------------------------------------------------------------
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "group_id", nullable = false)
|
||||
@JoinColumn(name = "project_group_id", referencedColumnName = "id", nullable = false)
|
||||
private Group group;
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL, optional = false)
|
||||
@JoinColumn(name = "thread_id")
|
||||
@JoinColumn(name = "thread_id", referencedColumnName = "id")
|
||||
private ForumThread forumThread;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public Long getId() { return id; }
|
||||
|
||||
public Group getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public ForumThread getForumThread() {
|
||||
return forumThread;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Group getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public void setGroup(Group group) {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public ForumThread getForumThread() {
|
||||
return forumThread;
|
||||
}
|
||||
|
||||
public void setForumThread(ForumThread forumThread) {
|
||||
this.forumThread = forumThread;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -55,10 +76,6 @@ public class GroupThread implements Serializable {
|
|||
&& Objects.equals(this.getForumThread(), other.getForumThread());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof GroupThread;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.getId(), this.getGroup(), this.getForumThread());
|
||||
|
@ -66,6 +83,14 @@ public class GroupThread implements Serializable {
|
|||
|
||||
@Override
|
||||
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;
|
||||
|
||||
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 jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "project_thread")
|
||||
public class ProjectThread implements Serializable {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@OneToOne(optional = false)
|
||||
@JoinColumn(name = "thread_id")
|
||||
private ForumThread forumThread;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of foreign keys in this table (project_thread) referencing other
|
||||
// tables.
|
||||
// ----------------------------------------------------------------------------------
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "project_id")
|
||||
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||
private Project project;
|
||||
|
||||
@OneToOne(optional = false)
|
||||
@JoinColumn(name = "thread_id", referencedColumnName = "id")
|
||||
private ForumThread forumThread;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public ForumThread getForumThread() {
|
||||
return forumThread;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setForumThread(ForumThread forumThread) {
|
||||
this.forumThread = forumThread;
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public ForumThread getForumThread() {
|
||||
return forumThread;
|
||||
}
|
||||
|
||||
public void setForumThread(ForumThread forumThread) {
|
||||
this.forumThread = forumThread;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -56,10 +76,6 @@ public class ProjectThread implements Serializable {
|
|||
&& Objects.equals(this.getProject(), other.getProject());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof ProjectThread;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.getId(), this.getForumThread(), this.getProject());
|
||||
|
@ -67,6 +83,14 @@ public class ProjectThread implements Serializable {
|
|||
|
||||
@Override
|
||||
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;
|
||||
|
||||
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 jakarta.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "reviewer_thread")
|
||||
public class ReviewerThread {
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mapping
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@OneToOne(optional = false)
|
||||
@JoinColumn(name = "thread_id")
|
||||
private ForumThread forumThread;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of foreign keys in this table (mail_event) referencing other
|
||||
// tables.
|
||||
// ----------------------------------------------------------------------------------
|
||||
@OneToOne
|
||||
@JoinColumn(name = "project_id", unique = true)
|
||||
@JoinColumn(name = "project_id", referencedColumnName = "id", unique = true)
|
||||
private Project project;
|
||||
|
||||
@OneToOne(optional = false)
|
||||
@JoinColumn(name = "thread_id", referencedColumnName = "id")
|
||||
private ForumThread forumThread;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public ForumThread getForumThread() {
|
||||
return this.forumThread;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return this.project;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setForumThread(ForumThread forumThread) {
|
||||
this.forumThread = forumThread;
|
||||
public Project getProject() {
|
||||
return this.project;
|
||||
}
|
||||
|
||||
public void setProject(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
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -56,10 +75,6 @@ public class ReviewerThread {
|
|||
&& Objects.equals(this.getProject(), other.getProject());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof ReviewerThread;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.getId(), this.getForumThread(), this.getProject());
|
||||
|
@ -67,6 +82,14 @@ public class ReviewerThread {
|
|||
|
||||
@Override
|
||||
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;
|
||||
|
||||
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.notifications.dataobject.NotificationEvent;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "forum_notification")
|
||||
class ForumNotification {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Embedded JPA-mapping
|
||||
// ----------------------------------------------------------------------------------
|
||||
@EmbeddedId
|
||||
private Id id = new Id();
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of foreign keys in this table (forum_notification) referencing other
|
||||
// tables.
|
||||
// ----------------------------------------------------------------------------------
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "forum_post_id", referencedColumnName = "id")
|
||||
@MapsId("forumPostId")
|
||||
private ForumPost forumPost;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "notification_data_id")
|
||||
@MapsId("notificationEventId")
|
||||
private NotificationEvent notificationEvent;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------------------
|
||||
protected ForumNotification() { } // JPA
|
||||
|
||||
ForumNotification(final ForumPost forumPost, final NotificationEvent notificationEvent) {
|
||||
|
@ -28,6 +46,9 @@ class ForumNotification {
|
|||
this.notificationEvent = notificationEvent;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public ForumPost getForumPost() {
|
||||
return forumPost;
|
||||
}
|
||||
|
@ -36,6 +57,9 @@ class ForumNotification {
|
|||
return notificationEvent;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -47,10 +71,6 @@ class ForumNotification {
|
|||
&& Objects.equals(this.getNotificationEvent(), other.getNotificationEvent());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof ForumNotification;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.id, this.getForumPost(), this.getNotificationEvent());
|
||||
|
@ -58,9 +78,20 @@ class ForumNotification {
|
|||
|
||||
@Override
|
||||
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
|
||||
static class Id implements Serializable {
|
||||
private Long forumPostId;
|
||||
|
@ -103,7 +134,8 @@ class ForumNotification {
|
|||
|
||||
@Override
|
||||
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
|
||||
private Long id = null;
|
||||
|
||||
@Basic
|
||||
@Column(name = "daisy_profile_link_base_url")
|
||||
private String daisyProfileLinkBaseURL;
|
||||
|
||||
@Basic
|
||||
@Column(name = "daisy_select_research_area_url")
|
||||
private String daisySelectResearchAreaURL;
|
||||
|
||||
@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")
|
||||
private List<String> alarmMails = new ArrayList<>();
|
||||
|
||||
@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")
|
||||
private List<String> supervisorChangeMails = new ArrayList<>();
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "project_partner_days_to_live", nullable = true)
|
||||
private int projectPartnerDaysToLive;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "mail_notifications", nullable = false)
|
||||
private boolean mailNotifications = true;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "mail_from_name", nullable = false)
|
||||
private String mailFromName = "SciPro";
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "system_from_mail", nullable = false)
|
||||
private String systemFromMail = "noreply-scipro@dsv.su.se";
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "smtp_server", nullable = false)
|
||||
private String smtpServer = "localhost";
|
||||
|
||||
@Column(name = "peer_display_latest_reviews")
|
||||
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;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "public_reviews_activated", nullable = false)
|
||||
private boolean publicReviewsActivated = true;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "peer_download_enabled", nullable = false)
|
||||
private boolean peerDownloadEnabled = true;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "scipro_url", nullable = false)
|
||||
private String sciproURL = "http://localhost:8080/";
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "show_single_sign_on", nullable = false)
|
||||
private boolean showSingleSignOn = true;
|
||||
|
||||
@ElementCollection
|
||||
@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);
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "match_responsible_mail", nullable = true)
|
||||
private String matchResponsibleMail = "";
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "reviewer_support_mail", nullable = true)
|
||||
private String reviewerSupportMail;
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "thesis_support_mail", nullable = true)
|
||||
private String thesisSupportMail;
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "external_room_booking_url", nullable = true)
|
||||
private String externalRoomBookingURL;
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "external_getting_started_with_idea_url", nullable = true)
|
||||
private String externalGettingStartedWithIdeaURL;
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "external_grading_url", nullable = true)
|
||||
private String externalGradingURL;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "final_survey_available", nullable = false)
|
||||
private boolean finalSurveyAvailable = false;
|
||||
|
||||
@Basic
|
||||
@Column(name = "active_project_idea_support_mail")
|
||||
private String activeProjectIdeaSupportMail;
|
||||
|
||||
public GeneralSystemSettings() {
|
||||
|
|
|
@ -16,20 +16,31 @@ import java.time.Instant;
|
|||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "grading_history_approvals")
|
||||
@Table(name = "grading_history_approval")
|
||||
public class ApprovedEvent {
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "project_id")
|
||||
private Project project;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "`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() {
|
||||
return id;
|
||||
}
|
||||
|
@ -38,14 +49,6 @@ public class ApprovedEvent {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public Instant getWhen() {
|
||||
return when;
|
||||
}
|
||||
|
@ -54,6 +57,17 @@ public class ApprovedEvent {
|
|||
this.when = when;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
@ -70,10 +84,7 @@ public class ApprovedEvent {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApprovedEvent{" +
|
||||
"id=" + id +
|
||||
", project=" + project +
|
||||
", when=" + when +
|
||||
'}';
|
||||
return "ApprovedEvent{" + "id=" + id + ", project=" + project +
|
||||
", when=" + when + '}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,21 +12,20 @@ import java.util.Objects;
|
|||
@Entity
|
||||
@Table(name = "national_subject_category")
|
||||
public class NationalSubjectCategory {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = jakarta.persistence.GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private Long id;
|
||||
|
||||
@Basic
|
||||
@Column(name = "external_id")
|
||||
private Integer externalId;
|
||||
|
||||
@Basic
|
||||
@Column(name = "swedish_name")
|
||||
@Column(name = "name_sv")
|
||||
private String swedishName;
|
||||
|
||||
@Basic
|
||||
@Column(name = "english_name")
|
||||
@Column(name = "name_en")
|
||||
private String englishName;
|
||||
|
||||
@Basic
|
||||
|
@ -37,9 +36,19 @@ public class NationalSubjectCategory {
|
|||
@Column(name = "preselected")
|
||||
private boolean preselected;
|
||||
|
||||
@Basic
|
||||
@Column(name = "external_id")
|
||||
private Integer externalId;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Constructor
|
||||
// ----------------------------------------------------------------------------------
|
||||
public NationalSubjectCategory() {
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -48,14 +57,6 @@ public class NationalSubjectCategory {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getExternalId() {
|
||||
return externalId;
|
||||
}
|
||||
|
||||
public void setExternalId(Integer externalId) {
|
||||
this.externalId = externalId;
|
||||
}
|
||||
|
||||
public String getSwedishName() {
|
||||
return swedishName;
|
||||
}
|
||||
|
@ -88,6 +89,17 @@ public class NationalSubjectCategory {
|
|||
this.preselected = preselected;
|
||||
}
|
||||
|
||||
public Integer getExternalId() {
|
||||
return externalId;
|
||||
}
|
||||
|
||||
public void setExternalId(Integer externalId) {
|
||||
this.externalId = externalId;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
|
|
@ -17,34 +17,44 @@ import java.util.Objects;
|
|||
@Entity
|
||||
@Table(name = "publication_metadata")
|
||||
public class PublicationMetadata {
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@OneToOne(optional = false)
|
||||
private Project project;
|
||||
|
||||
@Basic
|
||||
@Column(name = "abstract_swedish")
|
||||
@Column(name = "abstract_sv")
|
||||
private String abstractSwedish;
|
||||
|
||||
@Basic
|
||||
@Column(name = "abstract_english")
|
||||
@Column(name = "abstract_en")
|
||||
private String abstractEnglish;
|
||||
|
||||
@Basic
|
||||
@Column(name = "keywords_swedish")
|
||||
@Column(name = "keywords_sv")
|
||||
private String keywordsSwedish;
|
||||
|
||||
@Basic
|
||||
@Column(name = "keywords_english")
|
||||
@Column(name = "keywords_en")
|
||||
private String keywordsEnglish;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of foreign keys in this table (publication_metadata) referencing
|
||||
// other tables.
|
||||
// ----------------------------------------------------------------------------------
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "national_subject_category_id")
|
||||
private NationalSubjectCategory nationalSubjectCategory;;
|
||||
|
||||
@OneToOne(optional = false)
|
||||
@JoinColumn(name = "project_id")
|
||||
private Project project;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -53,14 +63,6 @@ public class PublicationMetadata {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public String getAbstractSwedish() {
|
||||
return abstractSwedish;
|
||||
}
|
||||
|
@ -101,19 +103,17 @@ public class PublicationMetadata {
|
|||
this.nationalSubjectCategory = nationalSubjectCategory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PublicationMetadata{" +
|
||||
"id=" + id +
|
||||
", project=" + project +
|
||||
", abstractSwedish='" + abstractSwedish + '\'' +
|
||||
", abstractEnglish='" + abstractEnglish + '\'' +
|
||||
", keywordsSwedish='" + keywordsSwedish + '\'' +
|
||||
", keywordsEnglish='" + keywordsEnglish + '\'' +
|
||||
", nationalSubjectCategory=" + nationalSubjectCategory + '\'' +
|
||||
'}';
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return o instanceof PublicationMetadata that &&
|
||||
|
@ -124,4 +124,15 @@ public class PublicationMetadata {
|
|||
public int hashCode() {
|
||||
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;
|
||||
|
||||
@Entity
|
||||
@Table(name = "grading_history_rejections")
|
||||
@Table(name = "grading_history_rejection")
|
||||
public class RejectionEvent {
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "project_id")
|
||||
private Project project;
|
||||
@Basic
|
||||
@Column(name = "reason")
|
||||
private String reason;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "`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() {
|
||||
return id;
|
||||
}
|
||||
|
@ -42,22 +54,6 @@ public class RejectionEvent {
|
|||
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() {
|
||||
return reason;
|
||||
}
|
||||
|
@ -66,6 +62,25 @@ public class RejectionEvent {
|
|||
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
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
|
@ -18,27 +18,38 @@ import java.time.Instant;
|
|||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "grading_history_submissions")
|
||||
@Table(name = "grading_history_submission")
|
||||
public class SubmissionEvent {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "project_id")
|
||||
private Project project;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "author_id")
|
||||
private User author;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "`when`")
|
||||
private Instant when;
|
||||
|
||||
@Basic
|
||||
@Column(name = "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() {
|
||||
return id;
|
||||
}
|
||||
|
@ -47,22 +58,6 @@ public class SubmissionEvent {
|
|||
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() {
|
||||
return when;
|
||||
}
|
||||
|
@ -79,6 +74,25 @@ public class SubmissionEvent {
|
|||
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
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
@ -97,11 +111,8 @@ public class SubmissionEvent {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RejectionEvent{" +
|
||||
"id=" + id +
|
||||
", project=" + project +
|
||||
", author=" + author +
|
||||
", when=" + when +
|
||||
return "RejectionEvent{" + "id=" + id + ", project=" + project +
|
||||
", author=" + author + ", when=" + when +
|
||||
", corrections='" + corrections + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
|
|
@ -18,30 +18,124 @@ public class Group extends DomainObject {
|
|||
|
||||
public static final int STRING_MAX_LENGTH = 255;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(length = STRING_MAX_LENGTH)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "title", length = STRING_MAX_LENGTH)
|
||||
private String title;
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "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
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "user_id")
|
||||
@JoinColumn(name = "user_id", referencedColumnName = "id")
|
||||
private User user;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// @ManyToMany JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@ManyToMany
|
||||
@JoinTable(
|
||||
name = "project_group_project",
|
||||
joinColumns = @JoinColumn(name = "project_group_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "project_id"))
|
||||
@JoinTable(name = "project_group_project",
|
||||
joinColumns = @JoinColumn(name = "project_group_id", referencedColumnName = "id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "project_id", referencedColumnName = "id"))
|
||||
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) {
|
||||
for (Project project : projects) {
|
||||
|
@ -58,76 +152,4 @@ public class Group extends DomainObject {
|
|||
.filter(member -> member.getType() != Member.Type.REVIEWER)
|
||||
.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;
|
||||
|
||||
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.finalseminar.FinalSeminar;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "activity_final_seminar")
|
||||
class ActivityFinalSeminar {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// embedded JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@EmbeddedId
|
||||
@AttributeOverride(name = "activityId", column = @Column(name = "activity_id"))
|
||||
@AttributeOverride(name = "finalSeminarId", column = @Column(name = "final_seminar_id"))
|
||||
private Id id = new Id();
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of foreign keys in this table (activity_final_seminiar) referencing
|
||||
// other tables.
|
||||
// ----------------------------------------------------------------------------------
|
||||
@ManyToOne
|
||||
@MapsId("activityId")
|
||||
@JoinColumn(name = "activity_id")
|
||||
@JoinColumn(name = "activity_id", referencedColumnName = "id")
|
||||
private Activity activity;
|
||||
|
||||
@ManyToOne
|
||||
@MapsId("finalSeminarId")
|
||||
@JoinColumn(name = "final_seminar_id")
|
||||
@JoinColumn(name = "final_seminar_id", referencedColumnName = "id")
|
||||
private FinalSeminar finalSeminar;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// constructor
|
||||
// ----------------------------------------------------------------------------------
|
||||
protected ActivityFinalSeminar() {
|
||||
// JPA
|
||||
}
|
||||
|
@ -34,6 +53,9 @@ class ActivityFinalSeminar {
|
|||
this.finalSeminar = finalSeminar;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// getters
|
||||
// ----------------------------------------------------------------------------------
|
||||
public Id getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
@ -46,6 +68,9 @@ class ActivityFinalSeminar {
|
|||
return this.finalSeminar;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// other methods
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -57,10 +82,6 @@ class ActivityFinalSeminar {
|
|||
&& Objects.equals(this.getFinalSeminar(), other.getFinalSeminar());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof ActivityFinalSeminar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
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() + ")";
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof ActivityFinalSeminar;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// nested class
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Embeddable
|
||||
static class Id implements Serializable {
|
||||
private Long activityId;
|
||||
|
|
|
@ -1,27 +1,44 @@
|
|||
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.forum.dataobjects.ProjectThread;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "activity_thread")
|
||||
class ActivityThread {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// basic and embedded JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@EmbeddedId
|
||||
private Id id = new Id();
|
||||
|
||||
@ManyToOne
|
||||
@MapsId("threadId")
|
||||
@JoinColumn(name = "project_thread_id")
|
||||
private ProjectThread thread;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of foreign keys in this table (activity_thread) referencing other tables.
|
||||
// ----------------------------------------------------------------------------------
|
||||
@ManyToOne
|
||||
@MapsId("activityId")
|
||||
@JoinColumn(name = "activity_id", referencedColumnName = "id")
|
||||
private Activity activity;
|
||||
|
||||
@ManyToOne
|
||||
@MapsId("threadId")
|
||||
@JoinColumn(name = "project_thread_id", referencedColumnName = "id")
|
||||
private ProjectThread thread;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// constructor
|
||||
// ----------------------------------------------------------------------------------
|
||||
protected ActivityThread() {
|
||||
// JPA
|
||||
}
|
||||
|
@ -31,6 +48,9 @@ class ActivityThread {
|
|||
this.activity = activity;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// getters and setters
|
||||
// ----------------------------------------------------------------------------------
|
||||
public Id getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
@ -43,6 +63,9 @@ class ActivityThread {
|
|||
return this.activity;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// other methods
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -54,10 +77,6 @@ class ActivityThread {
|
|||
&& Objects.equals(this.getActivity(), other.getActivity());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof ActivityThread;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
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() + ")";
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof ActivityThread;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// nested class
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Embeddable
|
||||
static class Id implements Serializable {
|
||||
private Long threadId;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package se.su.dsv.scipro.mail;
|
||||
|
||||
import jakarta.persistence.CollectionTable;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import se.su.dsv.scipro.file.FileReference;
|
||||
import se.su.dsv.scipro.system.DomainObject;
|
||||
|
@ -19,61 +20,80 @@ import jakarta.persistence.Lob;
|
|||
import jakarta.persistence.ManyToMany;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import java.util.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@Entity
|
||||
@Table(name = "mail_event")
|
||||
@Cacheable(false)
|
||||
public class MailEvent extends DomainObject {
|
||||
public static final int STRING_MAX_LENGTH = 255;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
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)
|
||||
@Column(name = "subject", length = STRING_MAX_LENGTH)
|
||||
private String subject;
|
||||
|
||||
@Column(length = STRING_MAX_LENGTH)
|
||||
@Basic(optional = true)
|
||||
@Column(name = "from_name", length = STRING_MAX_LENGTH)
|
||||
private String fromName;
|
||||
|
||||
@Column(length = STRING_MAX_LENGTH)
|
||||
@Basic(optional = true)
|
||||
@Column(name = "from_email", length = STRING_MAX_LENGTH)
|
||||
private String fromEmail;
|
||||
|
||||
@Lob
|
||||
@Basic(optional = false)
|
||||
@Column(name = "message_body")
|
||||
@Lob
|
||||
private String messageBody;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "sent")
|
||||
private boolean sent = false;
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "message_id")
|
||||
private String messageID;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of foreign keys in this table (mail_event) referencing other
|
||||
// tables.
|
||||
// ----------------------------------------------------------------------------------
|
||||
@ManyToOne(optional = true)
|
||||
@JoinColumn(name = "attachment_reference_id")
|
||||
@JoinColumn(name = "attachment_file_reference_id", referencedColumnName = "id")
|
||||
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(
|
||||
final String subject,
|
||||
final String messageBody,
|
||||
final User recipient,
|
||||
final String fromName,
|
||||
public MailEvent(final String subject, final String messageBody, final User recipient, final String fromName,
|
||||
final String fromEmail) {
|
||||
this.subject = subject;
|
||||
this.messageBody = messageBody;
|
||||
|
@ -82,13 +102,8 @@ public class MailEvent extends DomainObject {
|
|||
this.fromEmail = fromEmail;
|
||||
}
|
||||
|
||||
public MailEvent(
|
||||
final String subject,
|
||||
final String messageBody,
|
||||
final Collection<User> recipients,
|
||||
final String fromName,
|
||||
final String fromEmail
|
||||
) {
|
||||
public MailEvent(final String subject, final String messageBody, final Collection<User> recipients,
|
||||
final String fromName, final String fromEmail) {
|
||||
this.subject = subject;
|
||||
this.messageBody = messageBody;
|
||||
this.recipients.addAll(recipients);
|
||||
|
@ -96,35 +111,124 @@ public class MailEvent extends DomainObject {
|
|||
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) {
|
||||
this.messageID = messageID;
|
||||
this.sent = true;
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Set<User> getRecipients() {
|
||||
return recipients;
|
||||
}
|
||||
|
||||
public void setMessageBody(String messageBody) {
|
||||
this.messageBody = messageBody;
|
||||
public String getSubject() {
|
||||
return this.subject;
|
||||
}
|
||||
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
public String getFromName() {
|
||||
return this.fromName;
|
||||
}
|
||||
|
||||
public void setFromName(String fromName) {
|
||||
this.fromName = fromName;
|
||||
}
|
||||
|
||||
public String getFromEmail() {
|
||||
return this.fromEmail;
|
||||
}
|
||||
|
||||
public void setFromEmail(String 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) {
|
||||
for (Recipient recipient : recipients) {
|
||||
recipient.accept(new RecipientVisitor<Boolean>() {
|
||||
|
@ -141,83 +245,8 @@ public class MailEvent extends DomainObject {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
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) {
|
||||
public void markSent(final String messageID) {
|
||||
this.messageID = messageID;
|
||||
}
|
||||
|
||||
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());
|
||||
this.sent = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,30 @@
|
|||
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.ProjectType;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
|
||||
@Entity
|
||||
@Cacheable(true)
|
||||
@Table(name="ApplicationPeriod")
|
||||
@Table(name="application_period")
|
||||
public class ApplicationPeriod extends DomainObject {
|
||||
|
||||
@Id
|
||||
|
@ -23,17 +36,16 @@ public class ApplicationPeriod extends DomainObject {
|
|||
|
||||
private String name;
|
||||
|
||||
@Basic
|
||||
@Column(name = "start_date")
|
||||
private LocalDate startDate = LocalDate.now();
|
||||
|
||||
@Basic
|
||||
@Column(name = "end_date")
|
||||
private LocalDate endDate = LocalDate.now();
|
||||
|
||||
@Basic
|
||||
@Column(name = "courseStartDate")
|
||||
@Column(name = "course_start_date")
|
||||
private LocalDateTime courseStartDateTime = LocalDate.now().atTime(8, 0);
|
||||
|
||||
@Basic
|
||||
@Column(name = "course_end_date")
|
||||
private LocalDate courseEndDate;
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "applicationPeriod", cascade=CascadeType.ALL, orphanRemoval=true)
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
package se.su.dsv.scipro.match;
|
||||
|
||||
import se.su.dsv.scipro.system.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
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
|
||||
@Table(name = "applicationperiodexemption")
|
||||
@Table(name = "application_period_exemption")
|
||||
public class ApplicationPeriodExemption implements Serializable {
|
||||
public enum Type {
|
||||
SUBMIT_STUDENT_IDEA(true),
|
||||
|
@ -39,16 +47,19 @@ public class ApplicationPeriodExemption implements Serializable {
|
|||
|
||||
@MapsId("applicationPeriodId")
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "applicationPeriodId")
|
||||
@JoinColumn(name = "application_period_id")
|
||||
private ApplicationPeriod applicationPeriod;
|
||||
|
||||
@Column(name = "end_date")
|
||||
private LocalDate endDate;
|
||||
|
||||
private String comment;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "granted_by_id")
|
||||
private User grantedBy;
|
||||
|
||||
@Column(name = "granted_on")
|
||||
private LocalDateTime grantedOn;
|
||||
|
||||
public ApplicationPeriodExemptionId getApplicationperiodexemptionId() {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
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.system.ProjectType;
|
||||
|
||||
|
@ -10,19 +12,23 @@ import jakarta.persistence.MapsId;
|
|||
import java.io.Serializable;
|
||||
|
||||
@Entity
|
||||
@Table(name = "application_period_project_type")
|
||||
public class ApplicationPeriodProjectType implements Serializable {
|
||||
@EmbeddedId
|
||||
private ApplicationPeriodProjectTypeId applicationPeriodProjectTypeId = new ApplicationPeriodProjectTypeId();
|
||||
|
||||
@MapsId("applicationPeriodId")
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "application_period_id")
|
||||
private ApplicationPeriod applicationPeriod;
|
||||
|
||||
@MapsId("projectTypeId")
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "project_type_id")
|
||||
private ProjectType projectType;
|
||||
|
||||
@ManyToOne(optional = true)
|
||||
@JoinColumn(name = "activity_plan_template_id")
|
||||
private ActivityPlanTemplate activityPlanTemplate;
|
||||
|
||||
protected ApplicationPeriodProjectType() {}
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
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.util.Date;
|
||||
import java.util.Objects;
|
||||
|
@ -9,72 +19,92 @@ import java.util.Objects;
|
|||
@Table(name = "idea_first_meeting")
|
||||
@Cacheable(true)
|
||||
public class FirstMeeting implements Serializable {
|
||||
public static final int LENGTH = 1024;
|
||||
private static final int LENGTH = 1024;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Basic(optional = false)
|
||||
private Date firstMeetingDate;
|
||||
|
||||
@Column(nullable = false, length = LENGTH)
|
||||
private String room;
|
||||
|
||||
@Column(nullable = true, length = LENGTH)
|
||||
@Basic
|
||||
@Column(name = "description", nullable = true, length = LENGTH)
|
||||
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)
|
||||
@JoinColumn(name = "idea_id", referencedColumnName = "id")
|
||||
private Idea idea;
|
||||
|
||||
public FirstMeeting() {
|
||||
|
||||
}
|
||||
// ----------------------------------------------------------------------------------
|
||||
// constructors
|
||||
// ----------------------------------------------------------------------------------
|
||||
public FirstMeeting() { }
|
||||
|
||||
public FirstMeeting(Date firstMeetingDate, Idea idea) {
|
||||
this.firstMeetingDate = firstMeetingDate;
|
||||
this.idea = idea;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// getters and setters
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
public Long getId() {
|
||||
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) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setFirstMeetingDate(Date firstMeetingDate) {
|
||||
this.firstMeetingDate = firstMeetingDate;
|
||||
}
|
||||
|
||||
public void setRoom(String room) {
|
||||
this.room = room;
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String 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) {
|
||||
this.idea = idea;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// other methods
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -94,11 +124,13 @@ public class FirstMeeting implements Serializable {
|
|||
|
||||
@Override
|
||||
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
|
||||
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;
|
||||
|
||||
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.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.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;
|
||||
|
||||
@Entity
|
||||
@Table(name = "idea")
|
||||
@Cacheable(true)
|
||||
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;
|
||||
public static final int TITLE_LENGTH = 1024;
|
||||
// ----------------------------------------------------------------------------------
|
||||
// basic and embedded JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
private ProjectType projectType;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Type type;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
private User creator;
|
||||
|
||||
@Basic
|
||||
@Column(nullable = true, length = DESCRIPTION_LENGTH)
|
||||
private String description;
|
||||
|
||||
@Basic
|
||||
@Column(nullable = true, length = PREREQUISITES_LENGTH)
|
||||
private String prerequisites;
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "idea", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@QueryInit({"user", "program"})
|
||||
private Set<IdeaParticipation> ideaParticipations = new HashSet<>();
|
||||
|
||||
@ManyToOne(optional = true)
|
||||
private ApplicationPeriod applicationPeriod;
|
||||
|
||||
@Basic
|
||||
@Column(nullable = false, length = TITLE_LENGTH)
|
||||
private String title;
|
||||
|
||||
@ManyToOne(optional = true)
|
||||
private ResearchArea researchArea;
|
||||
|
||||
@ElementCollection
|
||||
@CollectionTable(name = "idea_language")
|
||||
@Column(name = "language")
|
||||
@Basic
|
||||
@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
|
||||
@AttributeOverrides({
|
||||
@AttributeOverride(name = "practicalHow", column = @Column(insertable = false, updatable = false)),
|
||||
@AttributeOverride(name = "literature", column = @Column(insertable = false, updatable = false)),
|
||||
@AttributeOverride(name = "theoryHow", column = @Column(insertable = false, updatable = false)),
|
||||
@AttributeOverride(name = "why", column = @Column(insertable = false, updatable = false)),
|
||||
@AttributeOverride(name = "what", column = @Column(insertable = false, updatable = false))
|
||||
@AttributeOverride(name = "practicalHow", column = @Column(name = "practical_how", insertable = false, updatable = false)),
|
||||
@AttributeOverride(name = "theoryHow", column = @Column(name = "theory_how", insertable = false, updatable = false)),
|
||||
@AttributeOverride(name = "what", column = @Column(name = "what", insertable = false, updatable = false)),
|
||||
@AttributeOverride(name = "why", column = @Column(name = "why", insertable = false, updatable = false)),
|
||||
@AttributeOverride(name = "literature", column = @Column(name = "literature", insertable = false, updatable = false))
|
||||
})
|
||||
private Watson watson;
|
||||
|
||||
@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();
|
||||
|
||||
@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
|
||||
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||
private Project project;
|
||||
|
||||
@OneToOne(mappedBy = "idea", orphanRemoval = true, optional = true)
|
||||
private FirstMeeting firstMeeting;
|
||||
@ManyToOne(optional = false)
|
||||
@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)
|
||||
@OrderBy("dateCreated DESC")
|
||||
private List<Match> matchHistory = new ArrayList<>();
|
||||
|
||||
@OneToOne(optional = true, cascade = CascadeType.ALL)
|
||||
@QueryInit({"supervisor.user", "supervisor.unit"})
|
||||
private Match match;
|
||||
|
||||
@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;
|
||||
// from table "idea_first_meeting"
|
||||
@OneToOne(mappedBy = "idea", orphanRemoval = true, optional = true)
|
||||
private FirstMeeting firstMeeting;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// methods...
|
||||
// ----------------------------------------------------------------------------------
|
||||
public Idea copy(User supervisor) {
|
||||
Idea copy = new Idea();
|
||||
copy.projectType = this.projectType;
|
||||
|
@ -448,7 +535,9 @@ public class Idea extends DomainObject {
|
|||
public String toString() {
|
||||
return "Student idea";
|
||||
}
|
||||
}, SUPERVISOR {
|
||||
},
|
||||
|
||||
SUPERVISOR {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Supervisor idea";
|
||||
|
@ -463,18 +552,21 @@ public class Idea extends DomainObject {
|
|||
return "Unmatched";
|
||||
}
|
||||
},
|
||||
|
||||
MATCHED {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Matched, no project";
|
||||
}
|
||||
},
|
||||
|
||||
COMPLETED {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Matched, has project";
|
||||
}
|
||||
},
|
||||
|
||||
INACTIVE {
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
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 jakarta.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
|
@ -11,56 +21,69 @@ public class IdeaExport extends DomainObject {
|
|||
|
||||
public enum Result { FAIL, SUCCESS }
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// basic and embedded JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Result result;
|
||||
|
||||
@Basic
|
||||
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)
|
||||
@JoinColumn(name = "idea_id", referencedColumnName = "id")
|
||||
private Idea idea;
|
||||
|
||||
public boolean wasSuccessful() {
|
||||
return result == Result.SUCCESS;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// getters and setters
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
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) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setResult(Result result) {
|
||||
this.result = result;
|
||||
public String getReason() {
|
||||
return this.reason;
|
||||
}
|
||||
|
||||
public void setReason(String 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) {
|
||||
this.idea = idea;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// other methods
|
||||
// ----------------------------------------------------------------------------------
|
||||
public boolean wasSuccessful() {
|
||||
return result == Result.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
|
|
@ -1,83 +1,114 @@
|
|||
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.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "idea_student")
|
||||
@AssociationOverrides({
|
||||
@AssociationOverride(name = "idea",
|
||||
joinColumns = @JoinColumn(name = "idea_id")) })
|
||||
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) {
|
||||
this.user = student;
|
||||
this.idea = idea;
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne
|
||||
private User user;
|
||||
|
||||
@ManyToOne
|
||||
private Idea idea;
|
||||
|
||||
private Date dateCreated = new Date();
|
||||
|
||||
@ManyToOne(optional = true)
|
||||
private Program program;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// getters and setters
|
||||
// ----------------------------------------------------------------------------
|
||||
public Long getId() {
|
||||
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) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public void setIdea(Idea idea) {
|
||||
this.idea = idea;
|
||||
public Date getDateCreated() {
|
||||
return this.dateCreated;
|
||||
}
|
||||
|
||||
public void setDateCreated(Date 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) {
|
||||
this.program = program;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// methods
|
||||
// ----------------------------------------------------------------------------
|
||||
@Override
|
||||
public String toString() {
|
||||
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;
|
||||
|
||||
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.ResearchArea;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@Entity
|
||||
@Table(name = "keyword")
|
||||
@Cacheable(true)
|
||||
public class Keyword extends LazyDeletableDomainObject {
|
||||
|
||||
|
@ -20,7 +30,9 @@ public class Keyword extends LazyDeletableDomainObject {
|
|||
private String keyword;
|
||||
|
||||
@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<>();
|
||||
|
||||
public Keyword() {
|
||||
|
|
|
@ -1,56 +1,85 @@
|
|||
package se.su.dsv.scipro.match;
|
||||
|
||||
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.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Cacheable(true)
|
||||
@Table(name = "idea_match")
|
||||
@Cacheable(true)
|
||||
public class Match extends DomainObject {
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
private Idea idea;
|
||||
|
||||
@ManyToOne
|
||||
@QueryInit({"unit"})
|
||||
private User supervisor;
|
||||
|
||||
@Basic
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Idea.Status status;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of foreign keys in this table (idea_match) referencing other tables.
|
||||
// ----------------------------------------------------------------------------------
|
||||
@ManyToOne(optional = true)
|
||||
@JoinColumn(name = "changed_by_user_id", referencedColumnName = "id")
|
||||
private User changedBy;
|
||||
|
||||
public User getSupervisor() {
|
||||
return supervisor;
|
||||
}
|
||||
@ManyToOne(optional = false)
|
||||
@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
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public Idea getIdea() {
|
||||
return this.idea;
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Idea.Status getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public void setStatus(Idea.Status status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public User getChangedBy() {
|
||||
return this.changedBy;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
public void setChangedBy(User changedBy) {
|
||||
this.changedBy = changedBy;
|
||||
}
|
||||
|
||||
public Idea getIdea() {
|
||||
return this.idea;
|
||||
}
|
||||
|
||||
public void setIdea(Idea idea) {
|
||||
|
@ -61,14 +90,13 @@ public class Match extends DomainObject {
|
|||
this.supervisor = supervisor;
|
||||
}
|
||||
|
||||
public void setStatus(Idea.Status status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public void setChangedBy(User changedBy) {
|
||||
this.changedBy = changedBy;
|
||||
public User getSupervisor() {
|
||||
return supervisor;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// other methods
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -93,6 +121,7 @@ public class Match extends DomainObject {
|
|||
|
||||
@Override
|
||||
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;
|
||||
|
||||
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.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "preliminary_match")
|
||||
public class PreliminaryMatch extends DomainObject {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
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
|
||||
@JoinColumn(name = "idea_id", referencedColumnName = "id")
|
||||
private Idea idea;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "supervisor_user_id", referencedColumnName = "id")
|
||||
private User supervisor;
|
||||
|
||||
private String comment;
|
||||
|
||||
// JPA
|
||||
public PreliminaryMatch() {
|
||||
}
|
||||
// ----------------------------------------------------------------------------------
|
||||
// constructors
|
||||
// ----------------------------------------------------------------------------------
|
||||
public PreliminaryMatch() { }
|
||||
|
||||
public PreliminaryMatch(final Idea idea) {
|
||||
this.idea = idea;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// getters and setters
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
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) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setIdea(Idea idea) {
|
||||
this.idea = idea;
|
||||
}
|
||||
|
||||
public void setSupervisor(User supervisor) {
|
||||
this.supervisor = supervisor;
|
||||
public String getComment() {
|
||||
return this.comment;
|
||||
}
|
||||
|
||||
public void setComment(String 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
|
||||
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
|
||||
|
|
|
@ -20,12 +20,12 @@ public class Target implements Serializable {
|
|||
|
||||
@MapsId("applicationPeriodId")
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "applicationPeriodId")
|
||||
@JoinColumn(name = "application_period_id")
|
||||
private ApplicationPeriod applicationPeriod;
|
||||
|
||||
@MapsId("projectTypeId")
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "projectTypeId")
|
||||
@JoinColumn(name = "project_type_id")
|
||||
private ProjectType projectType;
|
||||
|
||||
private int target;
|
||||
|
|
|
@ -1,39 +1,54 @@
|
|||
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.project.Project;
|
||||
import se.su.dsv.scipro.system.DomainObject;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "milestone")
|
||||
public class Milestone extends DomainObject {
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
protected long id;
|
||||
|
||||
@ManyToOne
|
||||
private Project project;
|
||||
|
||||
@ManyToOne(optional = true)
|
||||
private User user;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
private MilestoneActivityTemplate activity;
|
||||
|
||||
@Basic
|
||||
@Column(name = "confirmed", nullable = false)
|
||||
private boolean confirmed = false;
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of foreign keys in this table (milestone) referencing other tables.
|
||||
// ----------------------------------------------------------------------------------
|
||||
@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() {
|
||||
|
||||
}
|
||||
|
@ -49,6 +64,15 @@ public class Milestone extends DomainObject {
|
|||
this.activity = activity;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -61,14 +85,6 @@ public class Milestone extends DomainObject {
|
|||
this.confirmed = confirmed;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public MilestoneActivityTemplate getActivity() {
|
||||
return activity;
|
||||
}
|
||||
|
@ -77,11 +93,22 @@ public class Milestone extends DomainObject {
|
|||
this.activity = activity;
|
||||
}
|
||||
|
||||
public List<Member> getMembers() {
|
||||
return Collections.singletonList(new Member(user, Member.Type.MILESTONE_INDIVIDUAL));
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
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;
|
||||
|
||||
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.LazyDeletableDomainObject;
|
||||
import se.su.dsv.scipro.system.ProjectType;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
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_TWO = "PEER_REVIEW_TWO";
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "title")
|
||||
private String title;
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "type")
|
||||
private Type type;
|
||||
|
||||
@Column(unique = true)
|
||||
@Basic
|
||||
@Column(name = "code", unique = true)
|
||||
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
|
||||
@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<>();
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "phase", nullable = false)
|
||||
private MilestonePhaseTemplate milestonePhaseTemplate;
|
||||
|
||||
@Column
|
||||
private int sortOrder;
|
||||
|
||||
@Column
|
||||
private boolean editableByStudents = false;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "activatedBy")
|
||||
private Event activatedBy;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------------------
|
||||
public MilestoneActivityTemplate() {
|
||||
}
|
||||
|
||||
|
@ -67,10 +104,9 @@ public class MilestoneActivityTemplate extends LazyDeletableDomainObject {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public void addProjectType(ProjectType projectType) {
|
||||
projectTypes.add(projectType);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
|
@ -80,79 +116,95 @@ public class MilestoneActivityTemplate extends LazyDeletableDomainObject {
|
|||
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) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public void setMilestonePhaseTemplate(MilestonePhaseTemplate milestonePhaseTemplate) {
|
||||
this.milestonePhaseTemplate = milestonePhaseTemplate;
|
||||
public int getSortOrder() {
|
||||
return this.sortOrder;
|
||||
}
|
||||
|
||||
public void setSortOrder(int sortOrder) {
|
||||
this.sortOrder = sortOrder;
|
||||
}
|
||||
|
||||
public boolean isEditableByStudents() {
|
||||
return this.editableByStudents;
|
||||
}
|
||||
|
||||
public void setEditableByStudents(boolean 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) {
|
||||
this.activatedBy = activatedBy;
|
||||
}
|
||||
|
||||
public Set<ProjectType> getProjectTypes() {
|
||||
return this.projectTypes;
|
||||
}
|
||||
|
||||
public void setProjectTypes(Set<ProjectType> 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
|
||||
public int compare(MilestoneActivityTemplate o1, MilestoneActivityTemplate o2) {
|
||||
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) {
|
||||
return sortOrderResult;
|
||||
|
@ -175,8 +227,4 @@ public class MilestoneActivityTemplate extends LazyDeletableDomainObject {
|
|||
return asString;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAutomatic() {
|
||||
return code != null || activatedBy != null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +1,41 @@
|
|||
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 jakarta.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "milestone_phase_template")
|
||||
public class MilestonePhaseTemplate extends LazyDeletableDomainObject {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
protected long id;
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "title")
|
||||
private String title;
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
|
||||
@Column(name = "sortOrder")
|
||||
@Basic
|
||||
@Column(name = "sort_order")
|
||||
private int sortOrder;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------------------
|
||||
public MilestonePhaseTemplate() {
|
||||
|
||||
}
|
||||
|
@ -41,37 +51,47 @@ public class MilestonePhaseTemplate extends LazyDeletableDomainObject {
|
|||
this.sortOrder = sortOrder;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public int getSortOrder() {
|
||||
return this.sortOrder;
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
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 int getSortOrder() {
|
||||
return this.sortOrder;
|
||||
}
|
||||
|
||||
public void setSortOrder(int sortOrder) {
|
||||
this.sortOrder = sortOrder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MilestonePhaseTemplate(id=" + this.getId() + ", title=" + this.getTitle() + ", description=" + this.getDescription() + ", sortOrder=" + this.getSortOrder() + ")";
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods
|
||||
// ----------------------------------------------------------------------------------
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof MilestonePhaseTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,12 +106,13 @@ public class MilestonePhaseTemplate extends LazyDeletableDomainObject {
|
|||
&& this.getSortOrder() == other.getSortOrder();
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof MilestonePhaseTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
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()
|
||||
.getProjectType()
|
||||
.getProjectTypeSettings()
|
||||
.getMinimumActiveParticipationsToBeGraded();
|
||||
.getMinActiveParticipationsToBeGraded();
|
||||
if (completedParticipations >= minimumActiveParticipationsToBeGraded) {
|
||||
activateIndividualMilestone(Set.of("ParticipationGradingEvent"), event.getProject(), event.getStudent());
|
||||
} else {
|
||||
|
|
|
@ -1,24 +1,29 @@
|
|||
package se.su.dsv.scipro.nonworkperiod;
|
||||
|
||||
import jakarta.persistence.GenerationType;
|
||||
import se.su.dsv.scipro.system.DomainObject;
|
||||
|
||||
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;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Cacheable(true)
|
||||
@Table(name = "non_work_day_period")
|
||||
public class NonWorkDayPeriod extends DomainObject {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "start_date")
|
||||
private LocalDate startDate;
|
||||
|
||||
@Column(name = "end_date")
|
||||
private LocalDate endDate;
|
||||
|
||||
private String comment;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package se.su.dsv.scipro.notifications.dataobject;
|
||||
|
||||
import jakarta.persistence.Basic;
|
||||
import jakarta.persistence.Column;
|
||||
import se.su.dsv.scipro.system.DomainObject;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
|
@ -13,6 +15,8 @@ public class CustomEvent extends NotificationEvent {
|
|||
IDEA_DELETED
|
||||
}
|
||||
|
||||
@Basic
|
||||
@Column(name = "event")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private CustomEvent.Event event;
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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.system.DomainObject;
|
||||
|
||||
|
@ -11,37 +14,40 @@ import jakarta.persistence.ManyToOne;
|
|||
@Entity
|
||||
public class GroupEvent extends NotificationEvent {
|
||||
|
||||
public void setEvent(Event event) {
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
public enum Event {
|
||||
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() {
|
||||
return group;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
private Group group;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Event event;
|
||||
|
||||
public GroupEvent() {
|
||||
super(Notification.Type.GROUP);
|
||||
}
|
||||
|
||||
public void setGroup(Group group) {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getEvent() {
|
||||
return event;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getEntityTitle() {
|
||||
return group.getTitle();
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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.system.DomainObject;
|
||||
|
||||
|
@ -11,18 +14,29 @@ import jakarta.persistence.ManyToOne;
|
|||
@Entity
|
||||
public class IdeaEvent extends NotificationEvent {
|
||||
|
||||
|
||||
public enum Event {
|
||||
STATUS_CHANGE, PARTNER_ACCEPT,
|
||||
ADDED_AS_PARTNER, FIRST_MEETING, REMOVED_AS_PARTNER, EXPORTED_FAIL
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
private Idea idea;
|
||||
|
||||
@Basic
|
||||
@Column(name = "event")
|
||||
@Enumerated(EnumType.STRING)
|
||||
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() {
|
||||
super(Notification.Type.IDEA);
|
||||
}
|
||||
|
@ -35,15 +49,6 @@ public class IdeaEvent extends NotificationEvent {
|
|||
this.idea = idea;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event getEvent() {
|
||||
return event;
|
||||
}
|
||||
|
||||
public void setEvent(Event event) {
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTitle() {
|
||||
return idea.getTitle();
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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.project.Project;
|
||||
import se.su.dsv.scipro.system.DomainObject;
|
||||
|
@ -17,24 +20,64 @@ public class MileStoneEvent extends NotificationEvent {
|
|||
MILESTONE_CONFIRMED, MILESTONE_REVOKED
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
private Milestone milestone;
|
||||
|
||||
@Basic
|
||||
@Column(name = "event")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Event event;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "milestone_id", referencedColumnName = "id")
|
||||
private Milestone milestone;
|
||||
|
||||
public MileStoneEvent() {
|
||||
super(Notification.Type.MILESTONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return milestone.getProject();
|
||||
public Enum getEvent() {
|
||||
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
|
||||
public Enum getEvent() {
|
||||
return event;
|
||||
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());
|
||||
}
|
||||
|
||||
@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
|
||||
|
@ -51,41 +94,4 @@ public class MileStoneEvent extends NotificationEvent {
|
|||
public DomainObject getEntity() {
|
||||
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;
|
||||
|
||||
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.system.DomainObject;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "notification")
|
||||
public class Notification extends DomainObject {
|
||||
|
||||
|
||||
public enum Type {
|
||||
PROJECT, IDEA, FINAL_SEMINAR, PEER, MILESTONE,
|
||||
GROUP, FORUM, CUSTOM
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Basic(optional = false)
|
||||
private boolean unread = true;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "mailed")
|
||||
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)
|
||||
@JoinColumn(name = "notificationData_id")
|
||||
@JoinColumn(name = "notification_data_id", referencedColumnName = "id")
|
||||
private NotificationEvent notificationEvent;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id", referencedColumnName = "id")
|
||||
private User user;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Constructor
|
||||
// ----------------------------------------------------------------------------------
|
||||
public Notification() {
|
||||
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
@ -45,6 +63,14 @@ public class Notification extends DomainObject {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public boolean isMailed() {
|
||||
return mailed;
|
||||
}
|
||||
|
||||
public void setMailed(boolean mailed) {
|
||||
this.mailed = mailed;
|
||||
}
|
||||
|
||||
public boolean isUnread() {
|
||||
return unread;
|
||||
}
|
||||
|
@ -69,14 +95,9 @@ public class Notification extends DomainObject {
|
|||
this.user = user;
|
||||
}
|
||||
|
||||
public boolean isMailed() {
|
||||
return mailed;
|
||||
}
|
||||
|
||||
public void setMailed(boolean mailed) {
|
||||
this.mailed = mailed;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Other methods
|
||||
// ----------------------------------------------------------------------------------
|
||||
public String getTitle() {
|
||||
return getNotificationEvent().getTitle();
|
||||
}
|
||||
|
@ -108,4 +129,12 @@ public class Notification extends DomainObject {
|
|||
public User 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;
|
||||
|
||||
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.system.DomainObject;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Collection;
|
||||
|
||||
@Entity
|
||||
@Table(name = "notification_data")
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
@Table(name = "NotificationData")
|
||||
@DiscriminatorColumn(name = "subclass")
|
||||
public abstract class NotificationEvent extends DomainObject {
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
protected long id;
|
||||
|
||||
@Basic
|
||||
@Column(name = "type")
|
||||
@Enumerated(EnumType.STRING)
|
||||
protected Notification.Type type;
|
||||
|
||||
@OneToMany(mappedBy = "notificationEvent", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Collection<Notification> notifications;
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "source")
|
||||
private String source;
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "additional_source")
|
||||
private String additionalSource;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of foreign keys in this table (notification_data) referencing other
|
||||
// tables.
|
||||
// ----------------------------------------------------------------------------------
|
||||
@ManyToOne(optional = true)
|
||||
@JoinColumn(name = "caused_by_user_id", referencedColumnName = "id")
|
||||
private User causedBy;
|
||||
|
||||
public abstract Enum getEvent();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of other tables referencing to this table "notification_data"
|
||||
// ----------------------------------------------------------------------------------
|
||||
@OneToMany(mappedBy = "notificationEvent", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Collection<Notification> notifications;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------------------
|
||||
protected NotificationEvent() {
|
||||
|
||||
}
|
||||
|
@ -58,6 +73,9 @@ public abstract class NotificationEvent extends DomainObject {
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
@ -75,14 +93,6 @@ public abstract class NotificationEvent extends DomainObject {
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
public Collection<Notification> getNotifications() {
|
||||
return notifications;
|
||||
}
|
||||
|
||||
public void setNotifications(Collection<Notification> notifications) {
|
||||
this.notifications = notifications;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
@ -91,8 +101,12 @@ public abstract class NotificationEvent extends DomainObject {
|
|||
this.source = source;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return hasEntity() ? getEntityTitle() : "[Deleted entity]";
|
||||
public String getAdditionalSource() {
|
||||
return additionalSource;
|
||||
}
|
||||
|
||||
public void setAdditionalSource(String additionalSource) {
|
||||
this.additionalSource = additionalSource;
|
||||
}
|
||||
|
||||
public User getCausedBy() {
|
||||
|
@ -103,6 +117,41 @@ public abstract class NotificationEvent extends DomainObject {
|
|||
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}.
|
||||
*
|
||||
|
@ -111,12 +160,4 @@ public abstract class NotificationEvent extends DomainObject {
|
|||
public Project getProject() {
|
||||
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;
|
||||
|
||||
import jakarta.persistence.Basic;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import se.su.dsv.scipro.peer.PeerReview;
|
||||
import se.su.dsv.scipro.project.Project;
|
||||
import se.su.dsv.scipro.system.DomainObject;
|
||||
|
@ -12,22 +15,31 @@ import jakarta.persistence.ManyToOne;
|
|||
@Entity
|
||||
public class PeerEvent extends NotificationEvent {
|
||||
|
||||
public enum Event { REVIEW_COMPLETED, REVIEW_COMMENT, REVIEW_ACCEPTED, REQUEST_DELETED,
|
||||
REQUEST_EXPIRED }
|
||||
|
||||
@ManyToOne
|
||||
private PeerReview review;
|
||||
public enum Event {
|
||||
REVIEW_COMPLETED, REVIEW_COMMENT, REVIEW_ACCEPTED, REQUEST_DELETED,
|
||||
REQUEST_EXPIRED
|
||||
}
|
||||
|
||||
@Basic
|
||||
@Column(name = "event")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Event event;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "peer_review_id", referencedColumnName = "id")
|
||||
private PeerReview review;
|
||||
|
||||
public PeerEvent() {
|
||||
super(Notification.Type.PEER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return review.getProject();
|
||||
public Event getEvent() {
|
||||
return event;
|
||||
}
|
||||
|
||||
public void setEvent(Event event) {
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
public PeerReview getReview() {
|
||||
|
@ -39,12 +51,8 @@ public class PeerEvent extends NotificationEvent {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Event getEvent() {
|
||||
return event;
|
||||
}
|
||||
|
||||
public void setEvent(Event event) {
|
||||
this.event = event;
|
||||
public Project getProject() {
|
||||
return review.getProject();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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.project.Project;
|
||||
import se.su.dsv.scipro.system.DomainObject;
|
||||
|
@ -12,10 +15,13 @@ import jakarta.persistence.ManyToOne;
|
|||
@Entity
|
||||
public class PeerRequestEvent extends NotificationEvent {
|
||||
|
||||
@Basic
|
||||
@Column(name = "event")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private PeerEvent.Event event;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "peer_request_id", referencedColumnName = "id")
|
||||
private PeerRequest request;
|
||||
|
||||
public PeerRequestEvent() {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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.system.DomainObject;
|
||||
|
||||
|
@ -19,29 +22,23 @@ public class ProjectEvent extends NotificationEvent {
|
|||
FINAL_SEMINAR_APPROVAL_APPROVED, FINAL_SEMINAR_APPROVAL_REJECTED, ROUGH_DRAFT_APPROVAL_REQUESTED,
|
||||
ROUGH_DRAFT_APPROVAL_APPROVED, ROUGH_DRAFT_APPROVAL_REJECTED, REVIEWER_GRADING_REPORT_SUBMITTED,
|
||||
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,
|
||||
PARTICIPATION_FAILED
|
||||
EXPORTED_SUCCESS, REVIEWER_GRADING_INITIAL_ASSESSMENT_DONE, FIRST_MEETING, OPPOSITION_FAILED,
|
||||
PARTICIPATION_APPROVED, COMPLETED, PARTICIPATION_FAILED
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
private Project project;
|
||||
|
||||
@Basic
|
||||
@Column(name = "event")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Event event;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||
private Project project;
|
||||
|
||||
public ProjectEvent() {
|
||||
super(Notification.Type.PROJECT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event getEvent() {
|
||||
return event;
|
||||
|
@ -51,6 +48,15 @@ public class ProjectEvent extends NotificationEvent {
|
|||
this.event = event;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTitle() {
|
||||
return project.getTitle();
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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.system.DomainObject;
|
||||
|
||||
|
@ -10,29 +13,24 @@ import jakarta.persistence.ManyToOne;
|
|||
|
||||
@Entity
|
||||
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 {
|
||||
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() {
|
||||
super(Notification.Type.FORUM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return this.project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event getEvent() {
|
||||
return event;
|
||||
|
@ -42,6 +40,15 @@ public class ProjectForumEvent extends NotificationEvent {
|
|||
this.event = event;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return this.project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getEntityTitle() {
|
||||
return project.getTitle();
|
||||
|
@ -56,5 +63,4 @@ public class ProjectForumEvent extends NotificationEvent {
|
|||
public DomainObject getEntity() {
|
||||
return project;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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.project.Project;
|
||||
import se.su.dsv.scipro.system.DomainObject;
|
||||
|
@ -12,27 +15,24 @@ import jakarta.persistence.ManyToOne;
|
|||
@Entity
|
||||
public class SeminarEvent extends NotificationEvent {
|
||||
|
||||
public enum Event { CREATED, ROOM_CHANGED, DATE_CHANGED, OPPOSITION_CHANGED, PARTICIPATION_CHANGED, THESIS_UPLOADED, THESIS_UPLOADED_OPPONENT,
|
||||
OPPOSITION_REPORT_UPLOADED, THESIS_DELETED, THESIS_UPLOAD_REMIND, CANCELLED}
|
||||
|
||||
@ManyToOne
|
||||
private FinalSeminar seminar;
|
||||
public enum Event { CREATED, ROOM_CHANGED, DATE_CHANGED, OPPOSITION_CHANGED,
|
||||
PARTICIPATION_CHANGED, THESIS_UPLOADED, THESIS_UPLOADED_OPPONENT,
|
||||
OPPOSITION_REPORT_UPLOADED, THESIS_DELETED, THESIS_UPLOAD_REMIND, CANCELLED
|
||||
}
|
||||
|
||||
@Basic
|
||||
@Column(name = "event")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Event event;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "final_seminar_id", referencedColumnName = "id")
|
||||
private FinalSeminar seminar;
|
||||
|
||||
public SeminarEvent() {
|
||||
super(Notification.Type.FINAL_SEMINAR);
|
||||
}
|
||||
|
||||
public FinalSeminar getSeminar() {
|
||||
return seminar;
|
||||
}
|
||||
|
||||
public void setSeminar(FinalSeminar seminar) {
|
||||
this.seminar = seminar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event getEvent() {
|
||||
return event;
|
||||
|
@ -42,6 +42,14 @@ public class SeminarEvent extends NotificationEvent {
|
|||
this.event = event;
|
||||
}
|
||||
|
||||
public FinalSeminar getSeminar() {
|
||||
return seminar;
|
||||
}
|
||||
|
||||
public void setSeminar(FinalSeminar seminar) {
|
||||
this.seminar = seminar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTitle() {
|
||||
return seminar.getProject().getTitle();
|
||||
|
|
|
@ -1,14 +1,21 @@
|
|||
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.system.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "notification_delivery_configuration",
|
||||
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 {
|
||||
|
||||
|
|
|
@ -1,80 +1,115 @@
|
|||
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.system.DomainObject;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name="answer")
|
||||
@Cacheable(true)
|
||||
public class Answer extends DomainObject {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(optional=false)
|
||||
private PeerReview peerReview;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "question")
|
||||
private String question;
|
||||
|
||||
@Lob
|
||||
@Basic(optional=true)
|
||||
private String motivation;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable=false)
|
||||
@Column(name = "answer", nullable=false)
|
||||
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(PeerReview peerReview, String question){
|
||||
this.peerReview = peerReview;
|
||||
this.question = question;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// getters and setters
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
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) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setPeerReview(PeerReview peerReview) {
|
||||
this.peerReview = peerReview;
|
||||
public String getQuestion() {
|
||||
return this.question;
|
||||
}
|
||||
|
||||
public void setQuestion(String question) {
|
||||
this.question = question;
|
||||
}
|
||||
|
||||
public void setMotivation(String motivation) {
|
||||
this.motivation = motivation;
|
||||
public ChecklistAnswerEnum getAnswer() {
|
||||
return this.answer;
|
||||
}
|
||||
|
||||
public void setAnswer(ChecklistAnswerEnum 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
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -84,10 +119,6 @@ public class Answer extends DomainObject {
|
|||
&& Objects.equals(this.getId(), other.getId());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof Answer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(this.getId());
|
||||
|
@ -95,6 +126,7 @@ public class Answer extends DomainObject {
|
|||
|
||||
@Override
|
||||
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;
|
||||
|
||||
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.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
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;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "creator_user_id", referencedColumnName = "id")
|
||||
private User creator;
|
||||
|
||||
@Basic
|
||||
@Column(name = "comment")
|
||||
@Lob
|
||||
private String comment;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "comment_thread_id", referencedColumnName = "id")
|
||||
private CommentThread commentThread;
|
||||
|
||||
protected Comment() {
|
||||
|
|
|
@ -8,7 +8,9 @@ import java.util.Set;
|
|||
import java.util.TreeSet;
|
||||
|
||||
@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)
|
||||
public class CommentThread extends DomainObject {
|
||||
|
||||
|
@ -16,11 +18,10 @@ public class CommentThread extends DomainObject {
|
|||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(length = 191)
|
||||
@Column(name = "commentable_key", length = 191, nullable = false)
|
||||
private String commentableKey;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "commentable_id", nullable = false)
|
||||
private Long commentableId;
|
||||
|
||||
@OneToMany(mappedBy = "commentThread", orphanRemoval = true, cascade = CascadeType.ALL, targetEntity = Comment.class)
|
||||
|
|
|
@ -1,7 +1,20 @@
|
|||
package se.su.dsv.scipro.peer;
|
||||
|
||||
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.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.data.dataobjects.Member;
|
||||
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.User;
|
||||
|
||||
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.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.Lob;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.Table;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "peer_request")
|
||||
@Cacheable(true)
|
||||
public class PeerRequest extends DomainObject {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Lob
|
||||
@Basic(optional = true)
|
||||
@Lob
|
||||
@Column(name = "comment")
|
||||
private String comment;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@QueryInit({"headSupervisor", "projectType"})
|
||||
private Project project;
|
||||
|
||||
@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)
|
||||
@Column(name = "status", nullable = false)
|
||||
private RequestStatus status = RequestStatus.WAITING;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
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")
|
||||
private List<PeerReview> peerReviews = new ArrayList<>(1);
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable = false)
|
||||
private RequestStatus status = RequestStatus.WAITING;
|
||||
// ----------------------------------------------------------------------------------
|
||||
// getters and setters
|
||||
// ----------------------------------------------------------------------------------
|
||||
@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() {
|
||||
List<Member> members = project.getMembers();
|
||||
|
||||
|
@ -80,77 +174,8 @@ public class PeerRequest extends DomainObject {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
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;
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof PeerRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -162,10 +187,6 @@ public class PeerRequest extends DomainObject {
|
|||
&& Objects.equals(this.getId(), other.getId());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof PeerRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(this.getId());
|
||||
|
@ -173,6 +194,9 @@ public class PeerRequest extends DomainObject {
|
|||
|
||||
@Override
|
||||
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;
|
||||
|
||||
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.data.dataobjects.Member;
|
||||
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.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -24,39 +41,138 @@ public class PeerReview extends DomainObject implements Commentable {
|
|||
IN_PROGRESS, COMPLETED, EXPIRED
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(optional=false)
|
||||
@QueryInit("*.*")
|
||||
private User reviewer;
|
||||
@Basic
|
||||
@Lob
|
||||
@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)
|
||||
@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"})
|
||||
private Project project;
|
||||
|
||||
@ManyToOne(optional=false)
|
||||
@QueryInit({"project.headSupervisor","requester.user", "language", "checklistTemplate"})
|
||||
private PeerRequest peerRequest;
|
||||
@JoinColumn(name = "reviewer_user_id", referencedColumnName = "id")
|
||||
@QueryInit("*.*")
|
||||
private User reviewer;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of other tables referencing to this table "peer_review"
|
||||
// ----------------------------------------------------------------------------------
|
||||
@OneToMany(mappedBy="peerReview", orphanRemoval=true, cascade=CascadeType.ALL)
|
||||
@OrderBy("id")
|
||||
private List<Answer> answers = new ArrayList<>();
|
||||
|
||||
@OneToOne(optional=true, orphanRemoval = true, cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "file_reference_id")
|
||||
private FileReference file;
|
||||
// ----------------------------------------------------------------------------------
|
||||
// getters and setters
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Lob
|
||||
private String comment;
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private ReviewStatus status = ReviewStatus.IN_PROGRESS;
|
||||
public String getComment() {
|
||||
return this.comment;
|
||||
}
|
||||
|
||||
@Basic(optional = false)
|
||||
private Date deadline;
|
||||
public void setComment(String comment) {
|
||||
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
|
||||
public final String getCommentKey() {
|
||||
return PeerReview.class.getCanonicalName();
|
||||
|
@ -73,10 +189,6 @@ public class PeerReview extends DomainObject implements Commentable {
|
|||
return new Date().after(getDeadline());
|
||||
}
|
||||
|
||||
public ReviewStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public boolean isExpired() {
|
||||
return status == ReviewStatus.EXPIRED;
|
||||
}
|
||||
|
@ -97,90 +209,12 @@ public class PeerReview extends DomainObject implements Commentable {
|
|||
setStatus(isLate() ? ReviewStatus.EXPIRED : ReviewStatus.COMPLETED);
|
||||
}
|
||||
|
||||
private static boolean isEmpty(String s) {
|
||||
return s == null || s.isBlank();
|
||||
}
|
||||
|
||||
public void expire() {
|
||||
status = ReviewStatus.EXPIRED;
|
||||
}
|
||||
|
||||
public void addAnswer(String question) {
|
||||
this.answers.add(new Answer(this, question));
|
||||
}
|
||||
|
||||
@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() + ")";
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof PeerReview;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -192,12 +226,23 @@ public class PeerReview extends DomainObject implements Commentable {
|
|||
&& Objects.equals(this.getId(), other.getId());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof PeerReview;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
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.OneToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import java.util.*;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "plagiarism_request")
|
||||
class PlagiarismRequest {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of foreign keys in this table (plagiarism_request) referencing other
|
||||
// tables.
|
||||
// ----------------------------------------------------------------------------------
|
||||
@OneToOne(optional = false)
|
||||
@JoinColumn(name = "document_reference_id")
|
||||
@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)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public FileReference getDocument() {
|
||||
return this.document;
|
||||
}
|
||||
|
||||
public User getReceiver() {
|
||||
return this.receiver;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public FileReference getDocument() {
|
||||
return this.document;
|
||||
}
|
||||
|
||||
public void setDocument(FileReference fileDescription) {
|
||||
this.document = fileDescription;
|
||||
}
|
||||
|
||||
public User getReceiver() {
|
||||
return this.receiver;
|
||||
}
|
||||
|
||||
public void setReceiver(User receiver) {
|
||||
this.receiver = receiver;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -62,10 +77,6 @@ class PlagiarismRequest {
|
|||
&& Objects.equals(this.getReceiver(), other.getReceiver());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof PlagiarismRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.getId(), this.getDocument(), this.getReceiver());
|
||||
|
@ -73,6 +84,14 @@ class PlagiarismRequest {
|
|||
|
||||
@Override
|
||||
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;
|
||||
|
||||
import jakarta.persistence.Basic;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
|
@ -15,12 +17,15 @@ public class UrkundSettings {
|
|||
private long id = ID;
|
||||
|
||||
@Basic
|
||||
@Column(name = "enabled")
|
||||
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
|
||||
@Column(name = "username")
|
||||
private String username;
|
||||
|
||||
@Basic
|
||||
@Column(name = "password")
|
||||
private String password;
|
||||
|
||||
public boolean isEnabled() {
|
||||
|
@ -70,6 +75,7 @@ public class UrkundSettings {
|
|||
|
||||
@Override
|
||||
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.Table;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "urkund_submission")
|
||||
public class UrkundSubmission extends DomainObject {
|
||||
|
||||
public enum State {
|
||||
SUBMISSION_FAILED, SUBMITTED, REJECTED, ACCEPTED, ANALYZED, ERROR;
|
||||
|
||||
public boolean isFinal() {
|
||||
return !(this == SUBMITTED || this == ACCEPTED);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne
|
||||
private User receiver;
|
||||
@Basic
|
||||
@Column(name = "submitted_date", nullable = false)
|
||||
private Instant submitted;
|
||||
|
||||
@Basic
|
||||
private String analysisAddress;
|
||||
|
||||
@Column(nullable = false)
|
||||
@Column(name = "state", nullable = false)
|
||||
@Enumerated(EnumType.STRING)
|
||||
private State state;
|
||||
|
||||
@Column(nullable = false)
|
||||
private Instant submitted;
|
||||
|
||||
@Column(nullable = false)
|
||||
@Basic
|
||||
@Column(name = "next_poll_date", nullable = false)
|
||||
private Instant nextPoll;
|
||||
|
||||
@Column(nullable = false)
|
||||
@Basic
|
||||
@Column(name = "polling_delay", nullable = false)
|
||||
@Enumerated(EnumType.STRING)
|
||||
private PollingDelay pollingDelay = PollingDelay.FIRST;
|
||||
|
||||
@OneToOne(optional = false)
|
||||
@JoinColumn(name = "document_reference_id")
|
||||
private FileReference document;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "message")
|
||||
private String message;
|
||||
|
||||
@Basic
|
||||
@Column(name = "report_url")
|
||||
private String reportUrl;
|
||||
|
||||
@Basic
|
||||
@Column(name = "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
|
||||
public Long getId() {
|
||||
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) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
void setReceiver(User receiver) {
|
||||
this.receiver = receiver;
|
||||
}
|
||||
|
||||
void setAnalysisAddress(String analysisAddress) {
|
||||
this.analysisAddress = analysisAddress;
|
||||
}
|
||||
|
||||
void setState(State state) {
|
||||
this.state = state;
|
||||
public Instant getSubmitted() {
|
||||
return this.submitted;
|
||||
}
|
||||
|
||||
void setSubmitted(Instant 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) {
|
||||
this.nextPoll = nextPoll;
|
||||
}
|
||||
|
||||
PollingDelay getPollingDelay() {
|
||||
return this.pollingDelay;
|
||||
}
|
||||
|
||||
void setPollingDelay(PollingDelay pollingDelay) {
|
||||
this.pollingDelay = pollingDelay;
|
||||
}
|
||||
|
||||
void setDocument(FileReference fileDescription) {
|
||||
this.document = fileDescription;
|
||||
public String getMessage() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getReportUrl() {
|
||||
return this.reportUrl;
|
||||
}
|
||||
|
||||
void setReportUrl(String reportUrl) {
|
||||
this.reportUrl = reportUrl;
|
||||
}
|
||||
|
||||
public Float getSignificance() {
|
||||
return this.significance;
|
||||
}
|
||||
|
||||
void setSignificance(Float 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
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -170,10 +190,6 @@ public class UrkundSubmission extends DomainObject {
|
|||
&& Objects.equals(this.getSignificance(), other.getSignificance());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof UrkundSubmission;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(
|
||||
|
@ -190,15 +206,31 @@ public class UrkundSubmission extends DomainObject {
|
|||
this.getSignificance());
|
||||
}
|
||||
|
||||
User getReceiver() {
|
||||
return this.receiver;
|
||||
@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() + ")";
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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 jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "project_user")
|
||||
public class Author {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Embedded JPA-mapping
|
||||
// ----------------------------------------------------------------------------------
|
||||
@EmbeddedId
|
||||
private AuthorPK authorPK;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "project_id", nullable = false)
|
||||
@MapsId("projectId")
|
||||
private Project project;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "user_id", nullable = false)
|
||||
@MapsId("userId")
|
||||
private User user;
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Basic(optional = true)
|
||||
@Column(name = "reflection")
|
||||
private String reflection;
|
||||
|
||||
/**
|
||||
* 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")
|
||||
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() {
|
||||
return project;
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "user_id", nullable = false)
|
||||
@MapsId("userId")
|
||||
private User user;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public String getReflection() {
|
||||
return reflection;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
public void setReflection(String reflection) {
|
||||
this.reflection = reflection;
|
||||
}
|
||||
|
||||
public boolean isSubscribedToFinalSeminarNotifications() {
|
||||
|
@ -55,14 +77,17 @@ public class Author {
|
|||
this.subscribedToFinalSeminarNotifications = subscribedToFinalSeminarNotifications;
|
||||
}
|
||||
|
||||
public String getReflection() {
|
||||
return reflection;
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setReflection(String reflection) {
|
||||
this.reflection = reflection;
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Nested class
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Embeddable
|
||||
public static class AuthorPK implements Serializable {
|
||||
private Long projectId;
|
||||
|
|
|
@ -1,13 +1,51 @@
|
|||
package se.su.dsv.scipro.project;
|
||||
|
||||
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.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.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;
|
||||
|
||||
@Entity
|
||||
|
@ -18,17 +56,30 @@ public class Project extends DomainObject {
|
|||
public static final String NO_CO_SUPERVISOR = "No co-supervisor";
|
||||
public static final int TITLE_MAX_LENGTH = 255;
|
||||
|
||||
public static ITitle builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(unique = true)
|
||||
private Integer identifier;
|
||||
|
||||
@Column(length = TITLE_MAX_LENGTH)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "title", length = TITLE_MAX_LENGTH)
|
||||
private String title;
|
||||
|
||||
@Basic
|
||||
@Column(name = "credits")
|
||||
private int credits;
|
||||
|
||||
@Basic
|
||||
@Column(name = "language")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Language language;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "start_date", nullable = false)
|
||||
private LocalDate startDate;
|
||||
|
@ -37,61 +88,91 @@ public class Project extends DomainObject {
|
|||
@Column(name = "expected_end_date")
|
||||
private LocalDate expectedEndDate;
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name = "project_user", inverseJoinColumns = @JoinColumn(name = "user_id"))
|
||||
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;
|
||||
|
||||
@Basic
|
||||
@Column(name = "project_status")
|
||||
@Enumerated(EnumType.STRING)
|
||||
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)
|
||||
private StateOfMind stateOfMind = StateOfMind.FINE;
|
||||
|
||||
@Basic(optional = true)
|
||||
private Date stateOfMindDate;
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "state_of_mind_reason")
|
||||
private String stateOfMindReason;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
private ProjectType projectType;
|
||||
|
||||
@Embedded
|
||||
@AttributeOverride(name = "name", column = @Column(name = "externalOrganization"))
|
||||
private ExternalOrganization externalOrganization;
|
||||
|
||||
@Column(name = "fs_rule_exmpt")
|
||||
private boolean finalSeminarRuleExempted = false;
|
||||
@Basic(optional = true)
|
||||
@Column(name = "state_of_mind_date")
|
||||
private Date stateOfMindDate;
|
||||
|
||||
@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)
|
||||
@JoinColumn(name = "research_area_id", referencedColumnName = "id")
|
||||
private ResearchArea researchArea;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Language language;
|
||||
@ManyToOne(optional = false)
|
||||
@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)
|
||||
@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")
|
||||
@SuppressWarnings("JpaDataSourceORMInspection") // false warning from IntelliJ for the @MapKeyJoinColumn
|
||||
@MapKeyJoinColumn(name = "user_id")
|
||||
private Map<User, String> userNotes = new HashMap<>();
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA Lifecycle Methods
|
||||
// ----------------------------------------------------------------------------------
|
||||
@PrePersist
|
||||
@PreUpdate
|
||||
void cleanTitle() {
|
||||
|
@ -101,12 +182,67 @@ public class Project extends DomainObject {
|
|||
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) {
|
||||
this.userNotes = userNotes;
|
||||
public void setId(Long id) {
|
||||
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() {
|
||||
|
@ -117,53 +253,20 @@ public class Project extends DomainObject {
|
|||
this.finalSeminarRuleExempted = finalSeminarRuleExempted;
|
||||
}
|
||||
|
||||
public User getHeadSupervisor() {
|
||||
return headSupervisor;
|
||||
public StateOfMind getStateOfMind() {
|
||||
return this.stateOfMind;
|
||||
}
|
||||
|
||||
public ProjectType getProjectType() {
|
||||
return projectType;
|
||||
public void setStateOfMind(StateOfMind stateOfMind) {
|
||||
this.stateOfMind = stateOfMind;
|
||||
}
|
||||
|
||||
public SortedSet<User> getCoSupervisors() {
|
||||
TreeSet<User> s = new TreeSet<>(new User.ByNameComparator());
|
||||
s.addAll(coSupervisors);
|
||||
return Collections.unmodifiableSortedSet(s);
|
||||
public String getStateOfMindReason() {
|
||||
return this.stateOfMindReason;
|
||||
}
|
||||
|
||||
public void setCoSupervisors(Collection<User> coSupervisors) {
|
||||
this.coSupervisors.clear();
|
||||
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 void setStateOfMindReason(String stateOfMindReason) {
|
||||
this.stateOfMindReason = stateOfMindReason;
|
||||
}
|
||||
|
||||
public Date getStateOfMindDate() {
|
||||
|
@ -176,8 +279,44 @@ public class Project extends DomainObject {
|
|||
: new Date(stateOfMindDate.getTime());
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return SciProUtilities.cleanString(title);
|
||||
public Integer getIdentifier() {
|
||||
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() {
|
||||
|
@ -191,10 +330,90 @@ public class Project extends DomainObject {
|
|||
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) {
|
||||
projectParticipants.add(s);
|
||||
}
|
||||
|
||||
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() {
|
||||
if (reviewers.isEmpty()) {
|
||||
|
@ -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() {
|
||||
List<Member> members = new ArrayList<>();
|
||||
|
||||
|
@ -240,23 +467,10 @@ public class Project extends DomainObject {
|
|||
return externalOrganization != null;
|
||||
}
|
||||
|
||||
public boolean isParticipant(User user) {
|
||||
for (User s : projectParticipants) {
|
||||
if (s.equals(user)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getSupervisorName() {
|
||||
return getHeadSupervisor().getFullName();
|
||||
}
|
||||
|
||||
public String getReviewerName() {
|
||||
return getReviewer() != null ? getReviewer().getFullName() : NO_REVIEWER;
|
||||
}
|
||||
|
||||
public DegreeType getProjectTypeDegreeType() {
|
||||
return getProjectType().getDegreeType();
|
||||
}
|
||||
|
@ -289,10 +503,6 @@ public class Project extends DomainObject {
|
|||
return getProjectType().hasModule(projectModule);
|
||||
}
|
||||
|
||||
public static ITitle builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public boolean isSupervisor(User user) {
|
||||
return headSupervisor != null && headSupervisor.equals(user);
|
||||
}
|
||||
|
@ -319,125 +529,9 @@ public class Project extends DomainObject {
|
|||
return Objects.requireNonNullElse(language, getProjectType().getDefaultLanguage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
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() + ")";
|
||||
}
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Nested classes and interfaces
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
private static class Builder implements ITitle, IProjectType, IStartDate, IBuild {
|
||||
private final Project instance = new Project();
|
||||
|
|
|
@ -1,15 +1,26 @@
|
|||
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.system.DomainObject;
|
||||
import se.su.dsv.scipro.system.ProjectType;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name="projectPartner")
|
||||
@Table(name="project_partner")
|
||||
@Cacheable(true)
|
||||
public class ProjectPartner extends DomainObject {
|
||||
@Id
|
||||
|
@ -20,17 +31,19 @@ public class ProjectPartner extends DomainObject {
|
|||
private User user;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "project_type_id")
|
||||
private ProjectType projectType;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "application_period_id")
|
||||
private ApplicationPeriod applicationPeriod;
|
||||
|
||||
@Lob
|
||||
@Basic(optional=false)
|
||||
@Column(name = "info_text", nullable=false)
|
||||
private String infotext;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(nullable = false, name = "active")
|
||||
@Column(name = "active", nullable = false)
|
||||
private boolean active = true;
|
||||
|
||||
public ProjectPartner(User user){
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package se.su.dsv.scipro.report;
|
||||
|
||||
import jakarta.persistence.GenerationType;
|
||||
import se.su.dsv.scipro.system.DomainObject;
|
||||
|
||||
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;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -15,19 +15,28 @@ import java.util.Objects;
|
|||
|
||||
@MappedSuperclass
|
||||
public abstract class AbstractCriterion extends DomainObject {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Basic
|
||||
@Column(name = "title_sv", nullable = false)
|
||||
private String title;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Basic
|
||||
@Column(name = "title_en", nullable = false)
|
||||
private String titleEn;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Basic
|
||||
@Column(name = "sort_order", nullable = false)
|
||||
private Integer sortOrder;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------------------
|
||||
protected AbstractCriterion() {
|
||||
}
|
||||
|
||||
|
@ -37,6 +46,9 @@ public abstract class AbstractCriterion extends DomainObject {
|
|||
this.sortOrder = sortOrder;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
|
@ -50,14 +62,13 @@ public abstract class AbstractCriterion extends DomainObject {
|
|||
return titleEn;
|
||||
}
|
||||
|
||||
public String getTitle(Language language) {
|
||||
return language == Language.ENGLISH ? getTitleEn() : getTitle();
|
||||
}
|
||||
|
||||
public Integer getSortOrder() {
|
||||
return this.sortOrder;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -71,10 +82,6 @@ public abstract class AbstractCriterion extends DomainObject {
|
|||
&& Objects.equals(this.getSortOrder(), other.getSortOrder());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof AbstractCriterion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
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() + ")";
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// 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 {
|
||||
@Override
|
||||
public int compare(AbstractCriterion o1, AbstractCriterion o2) {
|
||||
|
|
|
@ -8,7 +8,109 @@ import jakarta.persistence.MappedSuperclass;
|
|||
|
||||
@MappedSuperclass
|
||||
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 {
|
||||
/**
|
||||
* Criterion marked with this flag will add extra functionality related
|
||||
|
@ -25,91 +127,4 @@ public abstract class AbstractGradingCriterion extends AbstractCriterion {
|
|||
*/
|
||||
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;
|
||||
|
||||
import se.su.dsv.scipro.system.DomainObject;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import se.su.dsv.scipro.system.Language;
|
||||
|
||||
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
|
||||
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;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "point")
|
||||
private Integer point;
|
||||
|
||||
@Basic
|
||||
@Column(length = DESCRIPTION_LENGTH)
|
||||
@Column(name = "description_sv", length = DESCRIPTION_LENGTH)
|
||||
private String description;
|
||||
|
||||
@Basic
|
||||
@Column(length = DESCRIPTION_LENGTH)
|
||||
@Column(name = "description_en", length = DESCRIPTION_LENGTH)
|
||||
private String descriptionEn;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------------------
|
||||
public AbstractGradingCriterionPoint() {
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
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) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getPoint() {
|
||||
return this.point;
|
||||
}
|
||||
|
||||
public void setPoint(Integer point) {
|
||||
this.point = point;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescriptionEn() {
|
||||
return descriptionEn;
|
||||
}
|
||||
|
||||
public void setDescriptionEn(String descriptionEn) {
|
||||
this.descriptionEn = descriptionEn;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects and Comparable
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -78,10 +94,6 @@ public abstract class AbstractGradingCriterionPoint extends DomainObject impleme
|
|||
&& Objects.equals(this.getDescriptionEn(), other.getDescriptionEn());
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof AbstractGradingCriterionPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
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() {
|
||||
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.MappedSuperclass;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import java.util.*;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@MappedSuperclass
|
||||
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)
|
||||
@JoinColumn(name = "attachment_reference_id")
|
||||
@JoinColumn(name = "attachment_file_reference_id", referencedColumnName = "id")
|
||||
private FileReference attachment;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public FileReference getAttachment() {
|
||||
return this.attachment;
|
||||
}
|
||||
|
@ -24,6 +31,9 @@ public abstract class AttachmentReport extends Report {
|
|||
this.attachment = attachment;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -34,14 +44,16 @@ public abstract class AttachmentReport extends Report {
|
|||
&& Objects.equals(this.attachment, other.attachment);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof AttachmentReport;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
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;
|
||||
|
||||
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 java.util.Objects;
|
||||
|
@ -8,26 +13,34 @@ import java.util.Objects;
|
|||
@Entity
|
||||
@Table(name = "criterion")
|
||||
public class Criterion extends AbstractCriterion {
|
||||
|
||||
public static final int DESCRIPTION_LENGTH = 2000;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
private Report report;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Basic
|
||||
@Column
|
||||
private String feedback;
|
||||
|
||||
@Basic
|
||||
@Column(length = DESCRIPTION_LENGTH)
|
||||
@Column(name = "description_sv", length = DESCRIPTION_LENGTH)
|
||||
private String description;
|
||||
|
||||
@Basic
|
||||
@Column(length = DESCRIPTION_LENGTH)
|
||||
@Column(name = "description_en", length = DESCRIPTION_LENGTH)
|
||||
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) {
|
||||
|
@ -41,22 +54,9 @@ public class Criterion extends AbstractCriterion {
|
|||
this(report, gradingCriterionTemplate.getTitle(), gradingCriterionTemplate.getTitleEn(), gradingCriterionTemplate.getDescription(), gradingCriterionTemplate.getDescriptionEn(), gradingCriterionTemplate.getSortOrder());
|
||||
}
|
||||
|
||||
public void setFeedback(final String feedback) {
|
||||
this.feedback = feedback;
|
||||
}
|
||||
|
||||
public boolean isFilledOut() {
|
||||
return feedback != null && !feedback.isEmpty();
|
||||
}
|
||||
|
||||
public Report getReport() {
|
||||
return this.report;
|
||||
}
|
||||
|
||||
public String getFeedback() {
|
||||
return this.feedback;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
@ -65,10 +65,21 @@ public class Criterion extends AbstractCriterion {
|
|||
return this.descriptionEn;
|
||||
}
|
||||
|
||||
public String getDescription(Language language) {
|
||||
return language == Language.ENGLISH ? getDescriptionEn() : getDescription();
|
||||
public String getFeedback() {
|
||||
return this.feedback;
|
||||
}
|
||||
|
||||
public void setFeedback(final String feedback) {
|
||||
this.feedback = feedback;
|
||||
}
|
||||
|
||||
public Report getReport() {
|
||||
return this.report;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -82,11 +93,6 @@ public class Criterion extends AbstractCriterion {
|
|||
&& Objects.equals(this.getDescriptionEn(), other.getDescriptionEn());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof Criterion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.getReport(), this.getFeedback(), this.getDescription(), this.getDescriptionEn());
|
||||
|
@ -94,6 +100,24 @@ public class Criterion extends AbstractCriterion {
|
|||
|
||||
@Override
|
||||
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;
|
||||
|
||||
import jakarta.persistence.Basic;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
|
@ -8,18 +9,26 @@ import jakarta.persistence.Id;
|
|||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "grading_report_template_grade_limits")
|
||||
@Table(name = "grading_report_template_grade_limit")
|
||||
public class GradeLimit {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Basic
|
||||
@Column(name = "grade")
|
||||
private String grade;
|
||||
|
||||
@Basic
|
||||
@Column(name = "lower_limit")
|
||||
private int lowerLimit;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -1,30 +1,57 @@
|
|||
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.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@DiscriminatorColumn(name = "type")
|
||||
@Table(name = "grading_criterion")
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
@DiscriminatorColumn(name = "type")
|
||||
public abstract class GradingCriterion extends AbstractGradingCriterion {
|
||||
public static final int FEEDBACK_LENGTH = 2000;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
private GradingReport gradingReport;
|
||||
|
||||
@OneToMany(mappedBy = "gradingCriterion", orphanRemoval = true, cascade = CascadeType.PERSIST)
|
||||
private List<GradingCriterionPoint> gradingCriterionPoints = new ArrayList<>();
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Basic
|
||||
@Column(name = "points")
|
||||
private Integer points;
|
||||
|
||||
@Basic
|
||||
@Column(length = FEEDBACK_LENGTH)
|
||||
@Column(name = "feedback", length = FEEDBACK_LENGTH)
|
||||
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() {
|
||||
// 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() {
|
||||
return Objects.requireNonNullElse(getPoints(), 0) >= getPointsRequiredToPass();
|
||||
}
|
||||
|
@ -57,59 +149,4 @@ public abstract class GradingCriterion extends AbstractGradingCriterion {
|
|||
public int getMaxPoints() {
|
||||
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;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "GradingCriterionPoint")
|
||||
@Table(name = "grading_criterion_point")
|
||||
public class GradingCriterionPoint extends AbstractGradingCriterionPoint {
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of foreign keys in this table (grading_criterion_point) referencing other
|
||||
// tables.
|
||||
// ----------------------------------------------------------------------------------
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "grading_criterion_id", referencedColumnName = "id")
|
||||
private GradingCriterion gradingCriterion;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------------------
|
||||
public GradingCriterionPoint() {
|
||||
}
|
||||
|
||||
public GradingCriterionPoint(
|
||||
final Integer point,
|
||||
final String description,
|
||||
final String descriptionEn,
|
||||
final GradingCriterion gradingCriterion)
|
||||
{
|
||||
public GradingCriterionPoint(final Integer point, final String description,
|
||||
final String descriptionEn, final GradingCriterion gradingCriterion) {
|
||||
setPoint(point);
|
||||
setDescription(description);
|
||||
setDescriptionEn(descriptionEn);
|
||||
this.gradingCriterion = gradingCriterion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(AbstractGradingCriterionPoint abstractGradingCriterionPoint) {
|
||||
return this.getPoint().compareTo(abstractGradingCriterionPoint.getPoint());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public GradingCriterion getGradingCriterion() {
|
||||
return this.gradingCriterion;
|
||||
}
|
||||
|
@ -40,9 +42,12 @@ public class GradingCriterionPoint extends AbstractGradingCriterionPoint {
|
|||
this.gradingCriterion = gradingCriterion;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects and Comparable
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GradingCriterionPoint(gradingCriterion=" + this.getGradingCriterion() + ")";
|
||||
public int compareTo(AbstractGradingCriterionPoint abstractGradingCriterionPoint) {
|
||||
return this.getPoint().compareTo(abstractGradingCriterionPoint.getPoint());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,13 +60,22 @@ public class GradingCriterionPoint extends AbstractGradingCriterionPoint {
|
|||
&& 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
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof GradingCriterionPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(this.getGradingCriterion());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package se.su.dsv.scipro.report;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
|
@ -10,6 +12,7 @@ import java.util.Objects;
|
|||
public class GradingCriterionPointTemplate extends AbstractGradingCriterionPoint {
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "grading_criterion_template_id", nullable = false)
|
||||
private GradingCriterionTemplate gradingCriterionTemplate;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,18 +1,29 @@
|
|||
package se.su.dsv.scipro.report;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
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
|
||||
@DiscriminatorColumn(name = "type", length = GradingCriterionTemplate.LENGTH)
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
@Table(name = "grading_criterion_template")
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
@DiscriminatorColumn(name = "type", length = GradingCriterionTemplate.LENGTH)
|
||||
public abstract class GradingCriterionTemplate extends AbstractGradingCriterion {
|
||||
public static final int LENGTH = 64;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "grading_report_template_id")
|
||||
private GradingReportTemplate gradingReportTemplate;
|
||||
|
||||
@OneToMany(mappedBy = "gradingCriterionTemplate", orphanRemoval = true, cascade = CascadeType.ALL)
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
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.system.Language;
|
||||
import se.su.dsv.scipro.system.ProjectType;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -13,6 +21,7 @@ import java.util.List;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Entity
|
||||
@Table(name = "grading_report")
|
||||
public abstract class GradingReport extends Report {
|
||||
|
||||
public record Grade(String name) {
|
||||
|
@ -27,40 +36,51 @@ public abstract class GradingReport extends Report {
|
|||
|
||||
public enum State { INITIAL, REVIEWING, FINALIZED }
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Basic
|
||||
@Column(name = "state")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private State state = State.INITIAL;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
private Project project;
|
||||
|
||||
@OneToMany(mappedBy = "gradingReport", cascade = {CascadeType.ALL})
|
||||
private List<GradingCriterion> gradingCriteria = new ArrayList<>();
|
||||
|
||||
@Basic
|
||||
@Column(name = "date_submitted_to_examiner")
|
||||
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() {
|
||||
// JPA
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submit() {
|
||||
super.submit();
|
||||
setState(State.FINALIZED);
|
||||
setDateSubmittedToExaminer(Instant.now());
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
GradingReport(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(){
|
||||
|
@ -71,12 +91,8 @@ public abstract class GradingReport extends Report {
|
|||
this.dateSubmittedToExaminer = dateSubmittedToExaminer;
|
||||
}
|
||||
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(final State state) {
|
||||
this.state = state;
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public List<GradingCriterion> getGradingCriteria() {
|
||||
|
@ -84,6 +100,21 @@ public abstract class GradingReport extends Report {
|
|||
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() {
|
||||
return project.getTitle();
|
||||
}
|
||||
|
@ -112,7 +143,9 @@ public abstract class GradingReport extends Report {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GradingReport(state=" + this.getState() + ", project=" + this.getProject() + ")";
|
||||
public void submit() {
|
||||
super.submit();
|
||||
setState(State.FINALIZED);
|
||||
setDateSubmittedToExaminer(Instant.now());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,24 @@
|
|||
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.project.Project;
|
||||
import se.su.dsv.scipro.system.DomainObject;
|
||||
import se.su.dsv.scipro.system.ProjectType;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
@ -19,18 +30,16 @@ import java.util.Objects;
|
|||
@Table(name = "grading_report_template")
|
||||
public class GradingReportTemplate extends DomainObject {
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@OneToOne(optional = false)
|
||||
private ProjectType projectType;
|
||||
|
||||
@OneToMany(mappedBy = "gradingReportTemplate", cascade = {CascadeType.ALL}, orphanRemoval = true)
|
||||
private Collection<GradingCriterionTemplate> criteria = new HashSet<>();
|
||||
|
||||
@Temporal(TemporalType.DATE)
|
||||
@Basic
|
||||
@Column(name = "valid_from")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private LocalDate validFrom;
|
||||
|
||||
@Basic
|
||||
|
@ -41,10 +50,27 @@ public class GradingReportTemplate extends DomainObject {
|
|||
@Column(name = "failing_grade")
|
||||
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)
|
||||
@JoinColumn(name = "grading_report_template_id")
|
||||
@JoinColumn(name = "grading_report_template_id", referencedColumnName = "id")
|
||||
private Collection<GradeLimit> gradeLimits = new ArrayList<>();
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------------------
|
||||
protected GradingReportTemplate() {
|
||||
|
||||
}
|
||||
|
@ -57,43 +83,9 @@ public class GradingReportTemplate extends DomainObject {
|
|||
this.validFrom = validFrom;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public Collection<GradingCriterionTemplate> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
|
@ -107,14 +99,6 @@ public class GradingReportTemplate extends DomainObject {
|
|||
this.validFrom = validFrom;
|
||||
}
|
||||
|
||||
public ProjectType getProjectType() {
|
||||
return projectType;
|
||||
}
|
||||
|
||||
public void setProjectType(ProjectType projectType) {
|
||||
this.projectType = projectType;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
@ -131,6 +115,18 @@ public class GradingReportTemplate extends DomainObject {
|
|||
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() {
|
||||
return gradeLimits;
|
||||
}
|
||||
|
@ -139,6 +135,9 @@ public class GradingReportTemplate extends DomainObject {
|
|||
this.gradeLimits = gradeLimits;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Methods Common To All Objects
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) return true;
|
||||
|
@ -148,10 +147,6 @@ public class GradingReportTemplate extends DomainObject {
|
|||
&& Objects.equals(this.id, other.id);
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof GradingReportTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(this.id);
|
||||
|
@ -159,6 +154,56 @@ public class GradingReportTemplate extends DomainObject {
|
|||
|
||||
@Override
|
||||
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;
|
||||
|
||||
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.system.Language;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
|
@ -15,56 +22,57 @@ import java.util.stream.Collectors;
|
|||
@Table(name = "opposition_report")
|
||||
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)
|
||||
@JoinColumn(name = "final_seminar_opposition_id", referencedColumnName = "id")
|
||||
private FinalSeminarOpposition finalSeminarOpposition;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// JPA-mappings of other tables referencing to this table "opposition_report"
|
||||
// ----------------------------------------------------------------------------------
|
||||
@OneToMany(mappedBy = "report", cascade = {CascadeType.ALL})
|
||||
private List<Criterion> oppositionCriteria = new ArrayList<>();
|
||||
|
||||
@Basic
|
||||
@Column
|
||||
private String thesisSummary;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------------------
|
||||
protected OppositionReport() {
|
||||
|
||||
}
|
||||
|
||||
public OppositionReport(GradingReportTemplate gradingReportTemplate, FinalSeminarOpposition finalSeminarOpposition) {
|
||||
public OppositionReport(GradingReportTemplate gradingReportTemplate,
|
||||
FinalSeminarOpposition finalSeminarOpposition) {
|
||||
this.finalSeminarOpposition = finalSeminarOpposition;
|
||||
createCriteriaFromTemplate(gradingReportTemplate);
|
||||
}
|
||||
|
||||
private void createCriteriaFromTemplate(GradingReportTemplate gradingReportTemplate) {
|
||||
for (GradingCriterionTemplate template : gradingReportTemplate.getCriteria()) {
|
||||
if (template.isProjectCriterion()) {
|
||||
oppositionCriteria.add(new Criterion(this, template));
|
||||
}
|
||||
}
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public String getThesisSummary() {
|
||||
return this.thesisSummary;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
oppositionCriteria.sort(new AbstractCriterion.BySortOrderComparator());
|
||||
return Collections.unmodifiableList(oppositionCriteria);
|
||||
public void setThesisSummary(String thesisSummary) {
|
||||
this.thesisSummary = thesisSummary;
|
||||
}
|
||||
|
||||
@Override
|
||||
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();
|
||||
public FinalSeminarOpposition getFinalSeminarOpposition() {
|
||||
return this.finalSeminarOpposition;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Other Methods
|
||||
// ----------------------------------------------------------------------------------
|
||||
public User getUser() {
|
||||
return finalSeminarOpposition.getUser();
|
||||
}
|
||||
|
@ -110,15 +118,33 @@ public class OppositionReport extends AttachmentReport {
|
|||
return finalSeminarOpposition.getUser().getLastName();
|
||||
}
|
||||
|
||||
public FinalSeminarOpposition getFinalSeminarOpposition() {
|
||||
return this.finalSeminarOpposition;
|
||||
private void createCriteriaFromTemplate(GradingReportTemplate gradingReportTemplate) {
|
||||
for (GradingCriterionTemplate template : gradingReportTemplate.getCriteria()) {
|
||||
if (template.isProjectCriterion()) {
|
||||
oppositionCriteria.add(new Criterion(this, template));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getThesisSummary() {
|
||||
return this.thesisSummary;
|
||||
public List<Criterion> getCriteria() {
|
||||
oppositionCriteria.sort(new AbstractCriterion.BySortOrderComparator());
|
||||
return Collections.unmodifiableList(oppositionCriteria);
|
||||
}
|
||||
|
||||
public void setThesisSummary(String thesisSummary) {
|
||||
this.thesisSummary = thesisSummary;
|
||||
@Override
|
||||
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;
|
||||
|
||||
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 jakarta.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "report")
|
||||
@Inheritance(strategy = InheritanceType.JOINED)
|
||||
public abstract class Report extends DomainObject {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "submitted")
|
||||
private boolean submitted = false;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Override
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
|
@ -55,4 +43,37 @@ public abstract class Report extends DomainObject {
|
|||
public void setSubmitted(boolean 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;
|
||||
|
||||
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.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
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.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "supervisor_grading_report")
|
||||
public class SupervisorGradingReport extends GradingReport {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SupervisorGradingReport.class);
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
private User user;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Basic
|
||||
@Column(name = "rejection_comment")
|
||||
private String rejectionComment;
|
||||
|
@ -33,6 +31,17 @@ public class SupervisorGradingReport extends GradingReport {
|
|||
@Column(name = "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() {
|
||||
// JPA
|
||||
}
|
||||
|
@ -42,6 +51,40 @@ public class SupervisorGradingReport extends GradingReport {
|
|||
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() {
|
||||
List<GradingCriterion> result = new ArrayList<>();
|
||||
for (GradingCriterion criterion : getGradingCriteria()) {
|
||||
|
@ -82,34 +125,6 @@ public class SupervisorGradingReport extends GradingReport {
|
|||
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() {
|
||||
return getMotivation() != null && !getMotivation().isBlank();
|
||||
}
|
||||
|
|
|
@ -20,51 +20,73 @@ import se.su.dsv.scipro.system.User;
|
|||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
import java.util.Optional;
|
||||
|
||||
@Entity
|
||||
@Table(name = "Decision")
|
||||
@Table(name = "decision")
|
||||
public class Decision {
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Basic
|
||||
@Column(name = "status")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Status status = Status.UNDECIDED;
|
||||
|
||||
@OneToOne(optional = false)
|
||||
@JoinColumn(name = "thesis_reference_id")
|
||||
private FileReference thesis;
|
||||
|
||||
@Basic
|
||||
@Column(name = "reason")
|
||||
private String reason;
|
||||
|
||||
@Basic
|
||||
@Column(name = "comment")
|
||||
private String comment;
|
||||
|
||||
@OneToOne(optional = true)
|
||||
@JoinColumn(name = "attachment_reference_id")
|
||||
private FileReference attachment;
|
||||
|
||||
@Basic
|
||||
@Column(name = "requested_date")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date requested;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date deadline;
|
||||
|
||||
@Basic
|
||||
@Column(name = "decision_date")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date decisionDate;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
private ReviewerApproval reviewerApproval;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "assigned_reviewer_id")
|
||||
private User assignedReviewer;
|
||||
@Basic
|
||||
@Column(name = "deadline")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date deadline;
|
||||
|
||||
@Basic
|
||||
@Column(name = "assigned_reviewer_date")
|
||||
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
|
||||
|
||||
Decision(ReviewerApproval reviewerApproval, final FileReference thesis, final String comment, final Date deadline) {
|
||||
|
@ -79,6 +101,9 @@ public class Decision {
|
|||
this.comment = comment;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Properties (Getters and Setters)
|
||||
// ----------------------------------------------------------------------------------
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -87,14 +112,6 @@ public class Decision {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public FileReference getThesis() {
|
||||
return thesis;
|
||||
}
|
||||
|
||||
public ReviewerApproval getReviewerApproval() {
|
||||
return reviewerApproval;
|
||||
}
|
||||
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
@ -107,10 +124,6 @@ public class Decision {
|
|||
return comment;
|
||||
}
|
||||
|
||||
public Optional<FileReference> getAttachment() {
|
||||
return Optional.ofNullable(attachment);
|
||||
}
|
||||
|
||||
public Date getRequested() {
|
||||
return requested;
|
||||
}
|
||||
|
@ -127,14 +140,6 @@ public class Decision {
|
|||
this.deadline = deadline;
|
||||
}
|
||||
|
||||
public User getAssignedReviewer() {
|
||||
return assignedReviewer;
|
||||
}
|
||||
|
||||
public void setAssignedReviewer(User assignedReviewer) {
|
||||
this.assignedReviewer = assignedReviewer;
|
||||
}
|
||||
|
||||
public LocalDate getReviewerAssignedAt() {
|
||||
return reviewerAssignedAt;
|
||||
}
|
||||
|
@ -143,6 +148,29 @@ public class Decision {
|
|||
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) {
|
||||
decide(Status.APPROVED, reason, attachment);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package se.su.dsv.scipro.reviewing;
|
||||
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.Table;
|
||||
import se.su.dsv.scipro.file.FileReference;
|
||||
import se.su.dsv.scipro.project.Project;
|
||||
import se.su.dsv.scipro.system.DomainObject;
|
||||
|
@ -13,31 +15,61 @@ import jakarta.persistence.Id;
|
|||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.OneToOne;
|
||||
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
|
||||
@Table(name = "reviewer_approval")
|
||||
@DiscriminatorColumn(name = "type", length = 64)
|
||||
public abstract class ReviewerApproval extends DomainObject {
|
||||
@OneToOne(optional = false)
|
||||
protected Project project;
|
||||
|
||||
@OneToMany(mappedBy = "reviewerApproval", cascade = CascadeType.ALL)
|
||||
@OrderBy("requested desc")
|
||||
protected List<Decision> decisions = new LinkedList<>();
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Basic JPA-mappings
|
||||
// ----------------------------------------------------------------------------------
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
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;}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Other methods
|
||||
// ----------------------------------------------------------------------------------
|
||||
public abstract Step getStep();
|
||||
|
||||
public Decision getCurrentDecision() {
|
||||
return decisions.get(0);
|
||||
}
|
||||
|
||||
public FileReference getCurrentThesis() {
|
||||
return getCurrentDecision().getThesis();
|
||||
}
|
||||
|
||||
public Status getCurrentStatus() {
|
||||
return getCurrentDecision().getStatus();
|
||||
|
@ -63,10 +95,6 @@ public abstract class ReviewerApproval extends DomainObject {
|
|||
getCurrentDecision().reject(reason, attachment);
|
||||
}
|
||||
|
||||
public Decision getCurrentDecision() {
|
||||
return decisions.get(0);
|
||||
}
|
||||
|
||||
public void addNewThesis(final FileReference thesis, final String comment, final Date deadline) {
|
||||
if (getCurrentStatus() != Status.REJECTED) {
|
||||
throw new IllegalStateException();
|
||||
|
@ -86,17 +114,15 @@ public abstract class ReviewerApproval extends DomainObject {
|
|||
return getCurrentStatus() == Status.APPROVED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
public Date getCurrentDeadline() {
|
||||
return getCurrentDecision().getDeadline();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Nested types.
|
||||
// ----------------------------------------------------------------------------------
|
||||
public enum Step {
|
||||
ROUGH_DRAFT_APPROVAL,
|
||||
FINAL_SEMINAR_APPROVAL
|
||||
}
|
||||
|
||||
public Date getCurrentDeadline() {
|
||||
return getCurrentDecision().getDeadline();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,13 +13,13 @@ public class ReviewerDeadlineSettings extends DomainObject {
|
|||
@Id
|
||||
private Long id = null;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "rough_draft_approval", nullable = false)
|
||||
private int roughDraftApproval = 5;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "final_seminar_approval", nullable = false)
|
||||
private int finalSeminarApproval = 2;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "final_grading", nullable = false)
|
||||
private int finalGrading = 5;
|
||||
|
||||
public ReviewerDeadlineSettings() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package se.su.dsv.scipro.reviewing;
|
||||
|
||||
import jakarta.persistence.Basic;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
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.User;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
|
@ -20,22 +20,26 @@ public class ReviewerTarget extends DomainObject {
|
|||
@GeneratedValue(strategy = jakarta.persistence.GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "reviewer_id", nullable = false)
|
||||
private User reviewer;
|
||||
|
||||
@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`.
|
||||
@Column(name = "year", nullable = false)
|
||||
private int year;
|
||||
|
||||
@Basic
|
||||
@Column(name = "spring", nullable = false)
|
||||
private int spring;
|
||||
|
||||
@Basic
|
||||
@Column(name = "autumn", nullable = false)
|
||||
private int autumn;
|
||||
|
||||
@Basic
|
||||
@Column(name = "note")
|
||||
private String note;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "reviewer_user_id", referencedColumnName = "id", nullable = false)
|
||||
private User reviewer;
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
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.ProjectTeamMemberRoles;
|
||||
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.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "user_profile")
|
||||
public class UserProfile extends DomainObject {
|
||||
|
@ -24,40 +39,46 @@ public class UserProfile extends DomainObject {
|
|||
@OneToOne(optional = false)
|
||||
private User user;
|
||||
|
||||
@Basic(optional = true)
|
||||
private String skypeId;
|
||||
|
||||
@Basic(optional = true)
|
||||
private String phoneNumber;
|
||||
|
||||
@Basic(optional = true)
|
||||
@Column(name = "other_info", nullable = true)
|
||||
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;
|
||||
|
||||
@Column(name = "default_supervisor_filter", nullable = false)
|
||||
private boolean defaultSupervisorFilter = true;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "selected_role")
|
||||
private Roles selectedRole;
|
||||
|
||||
@ElementCollection
|
||||
@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);
|
||||
|
||||
@ElementCollection
|
||||
@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);
|
||||
|
||||
@Basic(optional = false)
|
||||
private boolean defaultSupervisorFilter = true;
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(
|
||||
name = "user_profile_ProjectType",
|
||||
joinColumns = {@JoinColumn(name = "user_profile_id")}
|
||||
@JoinTable(name = "user_profile_project_type",
|
||||
joinColumns = @JoinColumn(name = "user_profile_id", referencedColumnName = "id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "project_type_id", referencedColumnName = "id")
|
||||
)
|
||||
private Collection<ProjectType> defaultProjectTypeFilter = new ArrayList<>();
|
||||
|
||||
@Basic
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Roles selectedRole;
|
||||
|
||||
@Basic
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "supervisor_project_note_display")
|
||||
|
|
|
@ -1,11 +1,23 @@
|
|||
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.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "question")
|
||||
public class Question implements Serializable {
|
||||
public enum Type { TEXT, SINGLE_CHOICE, MULTIPLE_CHOICE, GROUP_HEADING }
|
||||
|
||||
|
@ -20,6 +32,9 @@ public class Question implements Serializable {
|
|||
private String text;
|
||||
|
||||
@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 Type type = Type.TEXT;
|
||||
|
|
|
@ -1,14 +1,23 @@
|
|||
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.system.User;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "survey")
|
||||
public class Survey implements Serializable {
|
||||
@Id
|
||||
@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.