task/3382: Harmonisera tabellnamn #6
@ -33,7 +33,11 @@ import jakarta.persistence.Table;
|
|||||||
|
|
||||||
import se.su.dsv.scipro.data.dataobjects.Member;
|
import se.su.dsv.scipro.data.dataobjects.Member;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.*;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
|
import se.su.dsv.scipro.system.Language;
|
||||||
|
import se.su.dsv.scipro.system.ProjectType;
|
||||||
|
import se.su.dsv.scipro.system.ResearchArea;
|
||||||
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -1,39 +1,54 @@
|
|||||||
package se.su.dsv.scipro.milestones.dataobjects;
|
package se.su.dsv.scipro.milestones.dataobjects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Member;
|
import se.su.dsv.scipro.data.dataobjects.Member;
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
import se.su.dsv.scipro.system.DomainObject;
|
import se.su.dsv.scipro.system.DomainObject;
|
||||||
import se.su.dsv.scipro.system.User;
|
import se.su.dsv.scipro.system.User;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "milestone")
|
@Table(name = "milestone")
|
||||||
public class Milestone extends DomainObject {
|
public class Milestone extends DomainObject {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
protected long id;
|
protected long id;
|
||||||
|
|
||||||
@ManyToOne
|
@Basic
|
||||||
private Project project;
|
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
|
||||||
private User user;
|
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
|
||||||
private MilestoneActivityTemplate activity;
|
|
||||||
|
|
||||||
@Column(name = "confirmed", nullable = false)
|
@Column(name = "confirmed", nullable = false)
|
||||||
private boolean confirmed = false;
|
private boolean confirmed = false;
|
||||||
|
|
||||||
@Override
|
// ----------------------------------------------------------------------------------
|
||||||
public Long getId() {
|
// JPA-mappings of foreign keys in this table (milestone) referencing other tables.
|
||||||
return id;
|
// ----------------------------------------------------------------------------------
|
||||||
}
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "milestone_activity_template_id", referencedColumnName = "id")
|
||||||
|
private MilestoneActivityTemplate activity;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "project_id", referencedColumnName = "id")
|
||||||
|
private Project project;
|
||||||
|
|
||||||
|
@ManyToOne(optional = true)
|
||||||
|
@JoinColumn(name = "user_id", referencedColumnName = "id")
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
protected Milestone() {
|
protected Milestone() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -49,6 +64,15 @@ public class Milestone extends DomainObject {
|
|||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters and Setters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@ -61,14 +85,6 @@ public class Milestone extends DomainObject {
|
|||||||
this.confirmed = confirmed;
|
this.confirmed = confirmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Project getProject() {
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProject(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MilestoneActivityTemplate getActivity() {
|
public MilestoneActivityTemplate getActivity() {
|
||||||
return activity;
|
return activity;
|
||||||
}
|
}
|
||||||
@ -77,11 +93,22 @@ public class Milestone extends DomainObject {
|
|||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Member> getMembers() {
|
public Project getProject() {
|
||||||
return Collections.singletonList(new Member(user, Member.Type.MILESTONE_INDIVIDUAL));
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProject(Project project) {
|
||||||
|
this.project = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getUser() {
|
public User getUser() {
|
||||||
return this.user;
|
return this.user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public List<Member> getMembers() {
|
||||||
|
return Collections.singletonList(new Member(user, Member.Type.MILESTONE_INDIVIDUAL));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,23 @@
|
|||||||
package se.su.dsv.scipro.milestones.dataobjects;
|
package se.su.dsv.scipro.milestones.dataobjects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.JoinTable;
|
||||||
|
import jakarta.persistence.ManyToMany;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.system.Event;
|
import se.su.dsv.scipro.system.Event;
|
||||||
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
||||||
import se.su.dsv.scipro.system.ProjectType;
|
import se.su.dsv.scipro.system.ProjectType;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -18,22 +31,55 @@ public class MilestoneActivityTemplate extends LazyDeletableDomainObject {
|
|||||||
public static final String PEER_REVIEW_ONE = "PEER_REVIEW_ONE";
|
public static final String PEER_REVIEW_ONE = "PEER_REVIEW_ONE";
|
||||||
public static final String PEER_REVIEW_TWO = "PEER_REVIEW_TWO";
|
public static final String PEER_REVIEW_TWO = "PEER_REVIEW_TWO";
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "title")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Basic(optional = true)
|
||||||
|
@Column(name = "description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(name = "type")
|
||||||
private Type type;
|
private Type type;
|
||||||
|
|
||||||
@Column(unique = true)
|
@Basic
|
||||||
|
@Column(name = "code", unique = true)
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "sort_order")
|
||||||
|
private int sortOrder;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "editable_by_students")
|
||||||
|
private boolean editableByStudents = false;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// JPA-mappings of foreign keys in this table (milestone_activity_template)
|
||||||
|
// referencing other tables.
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "milestone_phase_template_id", referencedColumnName = "id", nullable = false)
|
||||||
|
private MilestonePhaseTemplate milestonePhaseTemplate;
|
||||||
|
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "activated_by_event_name", referencedColumnName = "name")
|
||||||
|
private Event activatedBy;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// @ManyToMany JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Many-to-Many between table milestone_activity_template and project_type through
|
||||||
|
// table "milestone_activity_template_project_type".
|
||||||
@ManyToMany
|
@ManyToMany
|
||||||
@JoinTable(
|
@JoinTable(
|
||||||
name = "milestone_activity_template_project_type",
|
name = "milestone_activity_template_project_type",
|
||||||
@ -42,20 +88,9 @@ public class MilestoneActivityTemplate extends LazyDeletableDomainObject {
|
|||||||
)
|
)
|
||||||
private Set<ProjectType> projectTypes = new HashSet<>();
|
private Set<ProjectType> projectTypes = new HashSet<>();
|
||||||
|
|
||||||
@ManyToOne
|
// ----------------------------------------------------------------------------------
|
||||||
@JoinColumn(name = "phase", nullable = false)
|
// Constructors
|
||||||
private MilestonePhaseTemplate milestonePhaseTemplate;
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
@Column
|
|
||||||
private int sortOrder;
|
|
||||||
|
|
||||||
@Column
|
|
||||||
private boolean editableByStudents = false;
|
|
||||||
|
|
||||||
@OneToOne
|
|
||||||
@JoinColumn(name = "activatedBy")
|
|
||||||
private Event activatedBy;
|
|
||||||
|
|
||||||
public MilestoneActivityTemplate() {
|
public MilestoneActivityTemplate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,10 +104,9 @@ public class MilestoneActivityTemplate extends LazyDeletableDomainObject {
|
|||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addProjectType(ProjectType projectType) {
|
// ----------------------------------------------------------------------------------
|
||||||
projectTypes.add(projectType);
|
// Properties (Getters and Setters)
|
||||||
}
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
@ -82,79 +116,95 @@ public class MilestoneActivityTemplate extends LazyDeletableDomainObject {
|
|||||||
return this.title;
|
return this.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return this.description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Type getType() {
|
|
||||||
return this.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode() {
|
|
||||||
return this.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<ProjectType> getProjectTypes() {
|
|
||||||
return this.projectTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MilestonePhaseTemplate getMilestonePhaseTemplate() {
|
|
||||||
return this.milestonePhaseTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSortOrder() {
|
|
||||||
return this.sortOrder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEditableByStudents() {
|
|
||||||
return this.editableByStudents;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Event getActivatedBy() {
|
|
||||||
return this.activatedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Type getType() {
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
|
||||||
public void setType(Type type) {
|
public void setType(Type type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
|
||||||
public void setCode(String code) {
|
public void setCode(String code) {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMilestonePhaseTemplate(MilestonePhaseTemplate milestonePhaseTemplate) {
|
public int getSortOrder() {
|
||||||
this.milestonePhaseTemplate = milestonePhaseTemplate;
|
return this.sortOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSortOrder(int sortOrder) {
|
public void setSortOrder(int sortOrder) {
|
||||||
this.sortOrder = sortOrder;
|
this.sortOrder = sortOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEditableByStudents() {
|
||||||
|
return this.editableByStudents;
|
||||||
|
}
|
||||||
|
|
||||||
public void setEditableByStudents(boolean editableByStudents) {
|
public void setEditableByStudents(boolean editableByStudents) {
|
||||||
this.editableByStudents = editableByStudents;
|
this.editableByStudents = editableByStudents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MilestonePhaseTemplate getMilestonePhaseTemplate() {
|
||||||
|
return this.milestonePhaseTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMilestonePhaseTemplate(MilestonePhaseTemplate milestonePhaseTemplate) {
|
||||||
|
this.milestonePhaseTemplate = milestonePhaseTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Event getActivatedBy() {
|
||||||
|
return this.activatedBy;
|
||||||
|
}
|
||||||
|
|
||||||
public void setActivatedBy(Event activatedBy) {
|
public void setActivatedBy(Event activatedBy) {
|
||||||
this.activatedBy = activatedBy;
|
this.activatedBy = activatedBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<ProjectType> getProjectTypes() {
|
||||||
|
return this.projectTypes;
|
||||||
|
}
|
||||||
|
|
||||||
public void setProjectTypes(Set<ProjectType> projectTypes) {
|
public void setProjectTypes(Set<ProjectType> projectTypes) {
|
||||||
this.projectTypes = projectTypes;
|
this.projectTypes = projectTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BySortOrderComparator implements Comparator<MilestoneActivityTemplate>, Serializable {
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public void addProjectType(ProjectType projectType) {
|
||||||
|
projectTypes.add(projectType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAutomatic() {
|
||||||
|
return code != null || activatedBy != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Nested classes and types
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
public static class BySortOrderComparator implements Comparator<MilestoneActivityTemplate>,
|
||||||
|
Serializable {
|
||||||
@Override
|
@Override
|
||||||
public int compare(MilestoneActivityTemplate o1, MilestoneActivityTemplate o2) {
|
public int compare(MilestoneActivityTemplate o1, MilestoneActivityTemplate o2) {
|
||||||
int sortOrderResult = o1.sortOrder - o2.sortOrder;
|
int sortOrderResult = o1.sortOrder - o2.sortOrder;
|
||||||
int phaseSortOrderResult = o1.milestonePhaseTemplate.getSortOrder() - o2.getMilestonePhaseTemplate().getSortOrder();
|
int phaseSortOrderResult = o1.milestonePhaseTemplate.getSortOrder() -
|
||||||
|
o2.getMilestonePhaseTemplate().getSortOrder();
|
||||||
|
|
||||||
if (phaseSortOrderResult == 0) {
|
if (phaseSortOrderResult == 0) {
|
||||||
return sortOrderResult;
|
return sortOrderResult;
|
||||||
@ -177,8 +227,4 @@ public class MilestoneActivityTemplate extends LazyDeletableDomainObject {
|
|||||||
return asString;
|
return asString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAutomatic() {
|
|
||||||
return code != null || activatedBy != null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,31 +1,41 @@
|
|||||||
package se.su.dsv.scipro.milestones.dataobjects;
|
package se.su.dsv.scipro.milestones.dataobjects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "milestone_phase_template")
|
@Table(name = "milestone_phase_template")
|
||||||
public class MilestonePhaseTemplate extends LazyDeletableDomainObject {
|
public class MilestonePhaseTemplate extends LazyDeletableDomainObject {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
protected long id;
|
protected long id;
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@Column(name = "title")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@Basic(optional = true)
|
@Basic(optional = true)
|
||||||
|
@Column(name = "description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Column(name = "sortOrder")
|
@Basic
|
||||||
|
@Column(name = "sort_order")
|
||||||
private int sortOrder;
|
private int sortOrder;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructors
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public MilestonePhaseTemplate() {
|
public MilestonePhaseTemplate() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -41,37 +51,47 @@ public class MilestonePhaseTemplate extends LazyDeletableDomainObject {
|
|||||||
this.sortOrder = sortOrder;
|
this.sortOrder = sortOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
// ----------------------------------------------------------------------------------
|
||||||
return this.title;
|
// Properties (Getters and Setters)
|
||||||
}
|
// ----------------------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
public String getDescription() {
|
public Long getId() {
|
||||||
return this.description;
|
return id;
|
||||||
}
|
|
||||||
|
|
||||||
public int getSortOrder() {
|
|
||||||
return this.sortOrder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(long id) {
|
public void setId(long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return this.title;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSortOrder() {
|
||||||
|
return this.sortOrder;
|
||||||
|
}
|
||||||
|
|
||||||
public void setSortOrder(int sortOrder) {
|
public void setSortOrder(int sortOrder) {
|
||||||
this.sortOrder = sortOrder;
|
this.sortOrder = sortOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// ----------------------------------------------------------------------------------
|
||||||
public String toString() {
|
// Methods
|
||||||
return "MilestonePhaseTemplate(id=" + this.getId() + ", title=" + this.getTitle() + ", description=" + this.getDescription() + ", sortOrder=" + this.getSortOrder() + ")";
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof MilestonePhaseTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -86,12 +106,13 @@ public class MilestonePhaseTemplate extends LazyDeletableDomainObject {
|
|||||||
&& this.getSortOrder() == other.getSortOrder();
|
&& this.getSortOrder() == other.getSortOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof MilestonePhaseTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.getId(), this.getTitle(), this.getDescription(), this.getSortOrder());
|
return Objects.hash(this.getId(), this.getTitle(), this.getDescription(), this.getSortOrder());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "MilestonePhaseTemplate(id=" + this.getId() + ", title=" + this.getTitle() + ", description=" + this.getDescription() + ", sortOrder=" + this.getSortOrder() + ")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,36 @@
|
|||||||
package se.su.dsv.scipro.system;
|
package se.su.dsv.scipro.system;
|
||||||
|
|
||||||
import jakarta.persistence.Basic;
|
import jakarta.persistence.Basic;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name = "event")
|
||||||
public class Event implements Serializable {
|
public class Event implements Serializable {
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Basic JPA-mappings
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
@Id
|
@Id
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
@Column(name = "description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Constructor
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
protected Event() {
|
protected Event() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Properties (Getters)
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
@ -25,6 +39,13 @@ public class Event implements Serializable {
|
|||||||
return this.description;
|
return this.description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
// Other Methods
|
||||||
|
// ----------------------------------------------------------------------------------
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof Event;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
@ -34,10 +55,6 @@ public class Event implements Serializable {
|
|||||||
&& Objects.equals(this.getName(), other.getName());
|
&& Objects.equals(this.getName(), other.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof Event;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(this.getName());
|
return Objects.hashCode(this.getName());
|
||||||
@ -45,6 +62,7 @@ public class Event implements Serializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Event(name=" + this.getName() + ", description=" + this.getDescription() + ")";
|
return "Event(name=" + this.getName() + ", description=" +
|
||||||
|
this.getDescription() + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1990,10 +1990,98 @@ alter table `answer`
|
|||||||
foreign key (peer_review_id) references peer_review (id)
|
foreign key (peer_review_id) references peer_review (id)
|
||||||
on delete cascade on update cascade;
|
on delete cascade on update cascade;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Step 13: Milestone related tables
|
||||||
|
*/
|
||||||
|
|
||||||
|
-- table: milestone
|
||||||
|
|
||||||
|
alter table `milestone` drop foreign key `FKC0841970667E5A5E`;
|
||||||
|
alter table `milestone` drop foreign key `FKC0841970C1813915`;
|
||||||
|
alter table `milestone` drop foreign key `milestone_user_id`;
|
||||||
|
|
||||||
|
alter table `milestone` drop key `FKC0841970667E5A5E`;
|
||||||
|
alter table `milestone` drop key `FKC0841970C1813915`;
|
||||||
|
alter table `milestone` drop key `milestone_user_id`;
|
||||||
|
|
||||||
|
alter table `milestone` rename column `activity_id` to `milestone_activity_template_id`;
|
||||||
|
|
||||||
|
alter table `milestone`
|
||||||
|
add constraint fk_milestone_milestone_activity_template_id
|
||||||
|
foreign key (milestone_activity_template_id) references milestone_activity_template (id)
|
||||||
|
on delete cascade on update cascade;
|
||||||
|
|
||||||
|
alter table `milestone`
|
||||||
|
add constraint fk_milestone_project_id
|
||||||
|
foreign key (project_id) references project (id)
|
||||||
|
on delete cascade on update cascade;
|
||||||
|
|
||||||
|
alter table `milestone`
|
||||||
|
add constraint fk_milestone_user_id
|
||||||
|
foreign key (user_id) references user (id)
|
||||||
|
on delete cascade on update cascade;
|
||||||
|
|
||||||
|
-- table: milestone_activity_template, except foreign key to becoming table event
|
||||||
|
|
||||||
|
alter table `milestone_activity_template` drop foreign key `milestone_activity_template_ibfk_1`;
|
||||||
|
alter table `milestone_activity_template` drop foreign key `FK42DAA8FE233E1A72`;
|
||||||
|
|
||||||
|
alter table `milestone_activity_template` drop key `milestone_activity_template_ibfk_1`;
|
||||||
|
alter table `milestone_activity_template` drop key `FK42DAA8FE233E1A72`;
|
||||||
|
alter table `milestone_activity_template` drop key `deleted_index`;
|
||||||
|
alter table `milestone_activity_template` drop key `code`;
|
||||||
|
|
||||||
|
alter table `milestone_activity_template` change `description` `description` varchar(255) default null after `title`;
|
||||||
|
alter table `milestone_activity_template` change `sortOrder` `sort_order` int(11) default null;
|
||||||
|
alter table `milestone_activity_template` change `editableByStudents` `editable_by_students` bit(1) not null default b'0' after `sort_order`;
|
||||||
|
|
||||||
|
alter table `milestone_activity_template` change `phase` `milestone_phase_template_id` bigint(20) not null;
|
||||||
|
alter table `milestone_activity_template` change `activatedBy` `activated_by_event_name` varchar(191) default null;
|
||||||
|
|
||||||
|
alter table `milestone_activity_template` add constraint uk_milestone_activity_template_code unique(code);
|
||||||
|
|
||||||
|
create index idx_milestone_activity_template_deleted on milestone_activity_template (deleted);
|
||||||
|
|
||||||
|
alter table `milestone_activity_template`
|
||||||
|
add constraint fk_mat_milestone_phase_template_id
|
||||||
|
foreign key (milestone_phase_template_id) references milestone_phase_template (id)
|
||||||
|
on delete cascade on update cascade;
|
||||||
|
|
||||||
|
-- table: event
|
||||||
|
|
||||||
|
rename table `Event` to `event`;
|
||||||
|
|
||||||
|
-- add foreign key reference from milestone_activity_template to event
|
||||||
|
alter table `milestone_activity_template`
|
||||||
|
add constraint fk_mat_activated_by_event_name
|
||||||
|
foreign key (activated_by_event_name) references event (name)
|
||||||
|
on delete cascade on update cascade;
|
||||||
|
|
||||||
|
-- table: milestone_phase_template
|
||||||
|
|
||||||
|
alter table `milestone_phase_template` drop key `deleted_index`;
|
||||||
|
|
||||||
|
alter table `milestone_phase_template` change `description` `description` varchar(255) default null after `title`;
|
||||||
|
|
||||||
|
alter table `milestone_phase_template` rename column `sortOrder` to `sort_order`;
|
||||||
|
|
||||||
|
create index idx_milestone_phase_template_deleted on milestone_phase_template (deleted);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Step 14: Final Seminar related tables
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Step X: Many-to-Many tables between project and user.
|
* Step XX: Many-to-Many tables between project and user.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
-- table: project_user_note (new changes from develop branch)
|
-- table: project_user_note (new changes from develop branch)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user