task/3382: Harmonisera tabellnamn #6
@ -6,6 +6,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
import jakarta.persistence.Cacheable;
|
import jakarta.persistence.Cacheable;
|
||||||
import jakarta.persistence.CascadeType;
|
import jakarta.persistence.CascadeType;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
@ -28,28 +29,38 @@ import se.su.dsv.scipro.system.User;
|
|||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
public class ActivityPlanTemplate extends DomainObject {
|
public class ActivityPlanTemplate extends DomainObject {
|
||||||
|
|
||||||
|
//<editor-fold desc="Basic JPA-mappings">
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Basic
|
||||||
@Column(name = "is_sys_admin_template", nullable=false)
|
@Column(name = "is_sys_admin_template", nullable=false)
|
||||||
private boolean isSysAdminTemplate = false;
|
private boolean isSysAdminTemplate = false;
|
||||||
|
|
||||||
|
@Basic
|
||||||
@Column(nullable=false)
|
@Column(nullable=false)
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "description")
|
||||||
@Lob
|
@Lob
|
||||||
private String description;
|
private String description;
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
@OrderColumn(name = "number_in_order")
|
//<editor-fold desc="JPA-mappings of foreign keys in this table (activity_plan_template) referencing other tables.">
|
||||||
@OneToMany(mappedBy="activityPlanTemplate", orphanRemoval=true, cascade=CascadeType.ALL)
|
@ManyToOne(optional=false)
|
||||||
private List<ActivityTemplate> activityTemplates = new ArrayList<>();
|
|
||||||
|
|
||||||
@ManyToOne(optional=false)
|
|
||||||
@JoinColumn(name = "user_id")
|
@JoinColumn(name = "user_id")
|
||||||
private User creator;
|
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
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
@ -83,28 +94,6 @@ public class ActivityPlanTemplate extends DomainObject {
|
|||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ActivityTemplate> getActivityTemplates(){
|
|
||||||
return Collections.unmodifiableList(activityTemplates);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setActivityTemplates(List<ActivityTemplate> activityTemplates){
|
|
||||||
this.activityTemplates = new ArrayList<>(activityTemplates);
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getCreator() {
|
public User getCreator() {
|
||||||
return this.creator;
|
return this.creator;
|
||||||
}
|
}
|
||||||
@ -113,6 +102,16 @@ public class ActivityPlanTemplate extends DomainObject {
|
|||||||
this.creator = creator;
|
this.creator = creator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ActivityTemplate> getActivityTemplates(){
|
||||||
|
return Collections.unmodifiableList(activityTemplates);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivityTemplates(List<ActivityTemplate> activityTemplates){
|
||||||
|
this.activityTemplates = new ArrayList<>(activityTemplates);
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="Methods Common To All Objects">
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
@ -139,6 +138,25 @@ public class ActivityPlanTemplate extends DomainObject {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ActivityPlanTemplate(id=" + this.getId() + ", creator=" + this.getCreator() + ", title=" + this.getTitle() + ", description=" + this.getDescription() + ", isSysAdminTemplate=" + this.isSysAdminTemplate() + ")";
|
return "ActivityPlanTemplate(id=" + this.getId() + ", creator=" + this.getCreator() +
|
||||||
|
", title=" + this.getTitle() + ", description=" + this.getDescription() +
|
||||||
|
", isSysAdminTemplate=" + this.isSysAdminTemplate() + ")";
|
||||||
}
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="Other methods">
|
||||||
|
public void addActivity(ActivityTemplate activity){
|
||||||
|
activity.setActivityPlanTemplate(this);
|
||||||
|
activity.setNumberInOrder(activityTemplates.size());
|
||||||
|
activityTemplates.add(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearActivities(){
|
||||||
|
activityTemplates.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addActivities(final Collection<ActivityTemplate> activities){
|
||||||
|
activityTemplates.addAll(activities);
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package se.su.dsv.scipro.activityplan;
|
|||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Basic;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.EnumType;
|
import jakarta.persistence.EnumType;
|
||||||
@ -21,110 +22,121 @@ import se.su.dsv.scipro.system.DomainObject;
|
|||||||
@Table(name = "activity_template")
|
@Table(name = "activity_template")
|
||||||
public class ActivityTemplate extends DomainObject {
|
public class ActivityTemplate extends DomainObject {
|
||||||
|
|
||||||
|
//<editor-fold desc="Basic JPA-mappings">
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Basic
|
||||||
|
@Column(name = "title", nullable = false)
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "description")
|
||||||
@Lob
|
@Lob
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@ManyToOne
|
@Basic
|
||||||
@JoinColumn(name = "activity_plan_template_id")
|
|
||||||
private ActivityPlanTemplate activityPlanTemplate;
|
|
||||||
|
|
||||||
@Column(name = "days_offset", nullable = false)
|
@Column(name = "days_offset", nullable = false)
|
||||||
private int daysOffset;
|
private int daysOffset;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "action")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private Action action = Action.NONE;
|
private Action action = Action.NONE;
|
||||||
|
|
||||||
@Column(name =" number_in_order", nullable = false)
|
@Basic
|
||||||
|
@Column(name = "number_in_order", nullable = false)
|
||||||
private int numberInOrder = Integer.MAX_VALUE;
|
private int numberInOrder = Integer.MAX_VALUE;
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="JPA-mappings of foreign keys in this table (activity_template) referencing other tables.">
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "activity_plan_template_id", referencedColumnName = "id")
|
||||||
|
private ActivityPlanTemplate activityPlanTemplate;
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
@ManyToOne(optional = true)
|
||||||
@JoinColumn(name = "checklist_template_id")
|
@JoinColumn(name = "checklist_template_id", referencedColumnName = "id")
|
||||||
private ChecklistTemplate checklistTemplate;
|
private ChecklistTemplate checklistTemplate;
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="Constructors">
|
||||||
public ActivityTemplate() {
|
public ActivityTemplate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActivityTemplate(int daysOffset) {
|
public ActivityTemplate(int daysOffset) {
|
||||||
this.daysOffset = daysOffset;
|
this.daysOffset = daysOffset;
|
||||||
}
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
public int getDaysOffset() {
|
//<editor-fold desc="Properties (Getters and Setters">
|
||||||
return daysOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getNumberInOrder() {
|
|
||||||
return numberInOrder;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return this.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return this.description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActivityPlanTemplate getActivityPlanTemplate() {
|
|
||||||
return this.activityPlanTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action getAction() {
|
|
||||||
return this.action;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChecklistTemplate getChecklistTemplate() {
|
|
||||||
return this.checklistTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return this.title;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActivityPlanTemplate(ActivityPlanTemplate activityPlanTemplate) {
|
public int getDaysOffset() {
|
||||||
this.activityPlanTemplate = activityPlanTemplate;
|
return daysOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDaysOffset(int daysOffset) {
|
public void setDaysOffset(int daysOffset) {
|
||||||
this.daysOffset = daysOffset;
|
this.daysOffset = daysOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action getAction() {
|
||||||
|
return this.action;
|
||||||
|
}
|
||||||
|
|
||||||
public void setAction(Action action) {
|
public void setAction(Action action) {
|
||||||
this.action = action;
|
this.action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getNumberInOrder() {
|
||||||
|
return numberInOrder;
|
||||||
|
}
|
||||||
|
|
||||||
public void setNumberInOrder(int numberInOrder) {
|
public void setNumberInOrder(int numberInOrder) {
|
||||||
this.numberInOrder = numberInOrder;
|
this.numberInOrder = numberInOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActivityPlanTemplate getActivityPlanTemplate() {
|
||||||
|
return this.activityPlanTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivityPlanTemplate(ActivityPlanTemplate activityPlanTemplate) {
|
||||||
|
this.activityPlanTemplate = activityPlanTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChecklistTemplate getChecklistTemplate() {
|
||||||
|
return this.checklistTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
public void setChecklistTemplate(ChecklistTemplate checklistTemplate) {
|
public void setChecklistTemplate(ChecklistTemplate checklistTemplate) {
|
||||||
this.checklistTemplate = checklistTemplate;
|
this.checklistTemplate = checklistTemplate;
|
||||||
}
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
@Override
|
//<editor-fold desc="Methods Common To All Objects">
|
||||||
public String toString() {
|
|
||||||
return "ActivityTemplate(id=" + this.getId() + ", title=" + this.getTitle() + ", description=" + this.getDescription() + ", activityPlanTemplate=" + this.getActivityPlanTemplate() + ", daysOffset=" + this.getDaysOffset() + ", action=" + this.getAction() + ", numberInOrder=" + this.getNumberInOrder() + ", checklistTemplate=" + this.getChecklistTemplate() + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
@ -134,12 +146,24 @@ public class ActivityTemplate extends DomainObject {
|
|||||||
&& Objects.equals(this.getId(), other.getId());
|
&& Objects.equals(this.getId(), other.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof ActivityTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(this.getId());
|
return Objects.hashCode(this.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ActivityTemplate(id=" + this.getId() + ", title=" + this.getTitle() +
|
||||||
|
", description=" + this.getDescription() + ", activityPlanTemplate=" +
|
||||||
|
this.getActivityPlanTemplate() + ", daysOffset=" + this.getDaysOffset() + ", action=" +
|
||||||
|
this.getAction() + ", numberInOrder=" + this.getNumberInOrder() + ", checklistTemplate=" +
|
||||||
|
this.getChecklistTemplate() + ")";
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold desc="Other methods">
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof ActivityTemplate;
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user