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,10 +30,13 @@ import java.util.Objects;
@Table(name = "activity") @Table(name = "activity")
@Cacheable(true) @Cacheable(true)
public class Activity extends LazyDeletableDomainObject { public class Activity extends LazyDeletableDomainObject {
// ----------------------------------------------------------------------------------
// basic JPA-mappings public static IActivityPlan builder(){
// ---------------------------------------------------------------------------------- return new Builder();
@Id }
//<editor-fold desc="Basic JPA-mappings">
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id; private Long id;
@ -56,10 +59,9 @@ public class Activity extends LazyDeletableDomainObject {
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
@Column(name = "action") @Column(name = "action")
private Action action = Action.NONE; private Action action = Action.NONE;
//</editor-fold>
// ---------------------------------------------------------------------------------- //<editor-fold desc="JPA-mappings of foreign keys in this table (activity) referencing other tables.">
// JPA-mappings of foreign keys in this table (activity) referencing other tables.
// ----------------------------------------------------------------------------------
@ManyToOne(optional = false) @ManyToOne(optional = false)
@JoinColumn(name = "activity_plan_id", referencedColumnName = "id") @JoinColumn(name = "activity_plan_id", referencedColumnName = "id")
@QueryInit("project") @QueryInit("project")
@ -70,20 +72,18 @@ public class Activity extends LazyDeletableDomainObject {
private Checklist checklist; private Checklist checklist;
@OneToOne(optional = true, cascade = CascadeType.ALL) @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; private FileReference fileUpload;
//</editor-fold>
// ---------------------------------------------------------------------------------- //<editor-fold desc="Constructor">
// constructor
// ----------------------------------------------------------------------------------
public Activity() { public Activity() {
this.title = ""; this.title = "";
this.description = ""; this.description = "";
} }
//</editor-fold>
// ---------------------------------------------------------------------------------- //<editor-fold desc="Properties (Getters and Setters)">
// getters and setters
// ----------------------------------------------------------------------------------
@Override @Override
public Long getId() { public Long getId() {
return this.id; return this.id;
@ -156,10 +156,9 @@ public class Activity extends LazyDeletableDomainObject {
public void setFileUpload(FileReference fileUpload) { public void setFileUpload(FileReference fileUpload) {
this.fileUpload = fileUpload; this.fileUpload = fileUpload;
} }
//</editor-fold>
// ---------------------------------------------------------------------------------- //<editor-fold desc="Methods Common To All Objects">
// other methods
// ----------------------------------------------------------------------------------
@Override @Override
public boolean equals(final Object o) { public boolean equals(final Object o) {
if (o == this) return true; if (o == this) return true;
@ -178,21 +177,15 @@ public class Activity extends LazyDeletableDomainObject {
public String toString(){ public String toString(){
return "Event: "+ getTitle()+"@"+getDate(); return "Event: "+ getTitle()+"@"+getDate();
} }
//</editor-fold>
//<editor-fold desc="Other methods">
protected boolean canEqual(final Object other) { protected boolean canEqual(final Object other) {
return other instanceof Activity; return other instanceof Activity;
} }
//</editor-fold>
// ---------------------------------------------------------------------------------- //<editor-fold desc="Nested types">
// static methods
// ----------------------------------------------------------------------------------
public static IActivityPlan builder(){
return new Builder();
}
// ----------------------------------------------------------------------------------
// nested classes
// ----------------------------------------------------------------------------------
public static class ByDateComparator implements Comparator<Activity>, Serializable { public static class ByDateComparator implements Comparator<Activity>, Serializable {
@Override @Override
public int compare(Activity o1, Activity o2) { public int compare(Activity o1, Activity o2) {
@ -269,4 +262,5 @@ public class Activity extends LazyDeletableDomainObject {
IBuild editable(boolean editable); IBuild editable(boolean editable);
Activity build(); Activity build();
} }
//</editor-fold>
} }

View File

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