Merge pull request 'issue-113: Fix all Delete Operations' (#114) from issue-113 into master
Reviewed-on: #114
This commit is contained in:
commit
0d3ba5d7d7
@ -34,7 +34,7 @@ public class Task {
|
|||||||
@OneToOne(mappedBy = "task", cascade = CascadeType.ALL, orphanRemoval = true)
|
@OneToOne(mappedBy = "task", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||||
private TaskSerieItem taskSerieItem;
|
private TaskSerieItem taskSerieItem;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
@OneToMany(mappedBy = "parent", cascade = CascadeType.REMOVE, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||||
private Set<Task> subtasks;
|
private Set<Task> subtasks;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@ -15,9 +15,6 @@ public class TaskSerie {
|
|||||||
@OneToMany(fetch = FetchType.EAGER, mappedBy = "taskSerie", orphanRemoval = true)
|
@OneToMany(fetch = FetchType.EAGER, mappedBy = "taskSerie", orphanRemoval = true)
|
||||||
List<TaskSerieItem> tasks = new ArrayList<>();
|
List<TaskSerieItem> tasks = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public long getTaskSerieID() {
|
public long getTaskSerieID() {
|
||||||
return taskSerieID;
|
return taskSerieID;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public class Taskgroup {
|
|||||||
@JoinColumn(name = "taskgroupuser", nullable = false)
|
@JoinColumn(name = "taskgroupuser", nullable = false)
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
|
@OneToMany(mappedBy = "parent", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, orphanRemoval = true)
|
||||||
private Set<Taskgroup> children;
|
private Set<Taskgroup> children;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@ -33,7 +33,7 @@ public class Taskgroup {
|
|||||||
private Taskgroup parent;
|
private Taskgroup parent;
|
||||||
|
|
||||||
|
|
||||||
@OneToMany(mappedBy = "taskgroup", cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
|
@OneToMany(mappedBy = "taskgroup", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, orphanRemoval = true)
|
||||||
private Set<Task> tasks;
|
private Set<Task> tasks;
|
||||||
|
|
||||||
public Taskgroup(String taskgroupName, User user) {
|
public Taskgroup(String taskgroupName, User user) {
|
||||||
|
@ -135,11 +135,7 @@ public class TaskSeriesService {
|
|||||||
task.setTaskSerieItem(null);
|
task.setTaskSerieItem(null);
|
||||||
taskSerieItemRepository.delete(item);
|
taskSerieItemRepository.delete(item);
|
||||||
if(taskSerie.getTasks().isEmpty()) {
|
if(taskSerie.getTasks().isEmpty()) {
|
||||||
for(TaskSerieItem taskSerieItem : taskSerie.getTasks()) {
|
taskSeriesRepository.deleteUnreferenced();
|
||||||
taskSerieItem.setTaskSerie(null);
|
|
||||||
}
|
|
||||||
taskSerie.getTasks().clear();
|
|
||||||
taskSeriesRepository.delete(taskSerie);
|
|
||||||
} else if(task.getParent() == null){
|
} else if(task.getParent() == null){
|
||||||
repearIndexing(taskSerie, item.getSeriesIndex());
|
repearIndexing(taskSerie, item.getSeriesIndex());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user