task/3382: Harmonisera tabellnamn #6

Merged
ansv7779 merged 104 commits from task/3382 into develop 2024-11-12 13:33:44 +01:00
2 changed files with 41 additions and 53 deletions
Showing only changes of commit f507fcf0ec - Show all commits

View File

@ -30,9 +30,12 @@ import java.util.Objects;
@Table(name = "activity")
@Cacheable(true)
public class Activity extends LazyDeletableDomainObject {
// ----------------------------------------------------------------------------------
// basic JPA-mappings
// ----------------------------------------------------------------------------------
public static IActivityPlan builder(){
return new Builder();
}
//<editor-fold desc="Basic JPA-mappings">
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ -56,10 +59,9 @@ public class Activity extends LazyDeletableDomainObject {
@Enumerated(EnumType.STRING)
@Column(name = "action")
private Action action = Action.NONE;
//</editor-fold>
// ----------------------------------------------------------------------------------
// JPA-mappings of foreign keys in this table (activity) referencing other tables.
// ----------------------------------------------------------------------------------
//<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")
@ -70,20 +72,18 @@ public class Activity extends LazyDeletableDomainObject {
private Checklist checklist;
@OneToOne(optional = true, cascade = CascadeType.ALL)
@JoinColumn(name = "file_upload_reference_id", referencedColumnName = "id")
@JoinColumn(name = "file_reference_id", referencedColumnName = "id")
tozh4728 marked this conversation as resolved Outdated

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 while file_reference_id conveys no such information.

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 while `file_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.

It's renamed to 'upload_file_reference_id', following the same scheme <context>_user_id. "file_reference" is the table name.
private FileReference fileUpload;
//</editor-fold>
// ----------------------------------------------------------------------------------
// constructor
// ----------------------------------------------------------------------------------
//<editor-fold desc="Constructor">
public Activity() {
this.title = "";
this.description = "";
}
//</editor-fold>
// ----------------------------------------------------------------------------------
// getters and setters
// ----------------------------------------------------------------------------------
//<editor-fold desc="Properties (Getters and Setters)">
@Override
public Long getId() {
return this.id;
@ -156,10 +156,9 @@ public class Activity extends LazyDeletableDomainObject {
public void setFileUpload(FileReference fileUpload) {
this.fileUpload = fileUpload;
}
//</editor-fold>
// ----------------------------------------------------------------------------------
// other methods
// ----------------------------------------------------------------------------------
//<editor-fold desc="Methods Common To All Objects">
@Override
public boolean equals(final Object o) {
if (o == this) return true;
@ -178,21 +177,15 @@ public class Activity extends LazyDeletableDomainObject {
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>
// ----------------------------------------------------------------------------------
// static methods
// ----------------------------------------------------------------------------------
public static IActivityPlan builder(){
return new Builder();
}
// ----------------------------------------------------------------------------------
// nested classes
// ----------------------------------------------------------------------------------
//<editor-fold desc="Nested types">
public static class ByDateComparator implements Comparator<Activity>, Serializable {
@Override
public int compare(Activity o1, Activity o2) {
@ -269,4 +262,5 @@ public class Activity extends LazyDeletableDomainObject {
IBuild editable(boolean editable);
Activity build();
}
//</editor-fold>
}

View File

@ -22,12 +22,15 @@ import java.util.Set;
import java.util.TreeSet;
@Entity
@Table(name =" activity_plan")
@Table(name ="activity_plan")
@Cacheable(true)
public class ActivityPlan extends DomainObject {
// ----------------------------------------------------------------------------------
// basic JPA-mappings
// ----------------------------------------------------------------------------------
public static IProject builder() {
return new Builder();
}
//<editor-fold desc="Basic JPA-mappings">
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ -35,23 +38,20 @@ public class ActivityPlan extends DomainObject {
@Basic
@Column(name = "start_date")
private Date startDate;
//</editor-fold>
// ----------------------------------------------------------------------------------
// JPA-mappings of foreign keys in this table (activity_plan) referencing other tables.
// ----------------------------------------------------------------------------------
//<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>
// ----------------------------------------------------------------------------------
// JPA-mappings of other tables referencing to this table "activity_plan"
// ----------------------------------------------------------------------------------
//<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>
// ----------------------------------------------------------------------------------
// getters and setters
// ----------------------------------------------------------------------------------
//<editor-fold desc="Properties (Getters and Setters)">
@Override
public Long getId() {
return this.id;
@ -84,10 +84,9 @@ public class ActivityPlan extends DomainObject {
public void setActivities(Set<Activity> activities) {
this.activities = activities;
}
//</editor-fold>
// ----------------------------------------------------------------------------------
// other methods
// ----------------------------------------------------------------------------------
//<editor-fold desc="Methods Common To All Objects">
@Override
public boolean equals(final Object o) {
if (o == this) return true;
@ -110,21 +109,15 @@ public class ActivityPlan extends DomainObject {
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>
// ----------------------------------------------------------------------------------
// static methods
// ----------------------------------------------------------------------------------
public static IProject builder() {
return new Builder();
}
// ----------------------------------------------------------------------------------
// nested classes
// ----------------------------------------------------------------------------------
//<editor-fold desc="Nested types"
private static class Builder implements IProject, IBuild {
private Project project;
@ -149,4 +142,5 @@ public class ActivityPlan extends DomainObject {
public interface IBuild {
ActivityPlan build();
}
//</editor-fold>
}