preparing for task dependency implementation

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-09-05 08:49:25 +02:00
parent dd1ba104e3
commit 91f536a658
4 changed files with 29 additions and 6 deletions

View File

@@ -6,7 +6,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
public class Constants {
private Constants(){}
public static final String ADDRESS = "address";
@@ -140,6 +139,7 @@ public class Constants {
public static final String RECEIVERS = "receivers";
public static final String REDIRECT = "redirect";
public static final String RENDERED = "rendered";
public static final String REQUIRED_TASKS_IDS = "required_tasks_ids";
public static final String SENDER = "sender";
public static final String SETTINGS = "settings";

View File

@@ -20,6 +20,7 @@ public class Task implements Mappable {
private final long id, projectId;
private Long parentTaskId;
private String description, name;
private Set<Long> requiredTasksIds;
private int status;
private Double estimatedTime;
private LocalDate dueDate, start;
@@ -41,6 +42,7 @@ public class Task implements Mappable {
this.showClosed = showClosed;
this.noIndex = noIndex;
this.members = members;
this.requiredTasksIds = new HashSet<>();
}
public Task clean() {
@@ -131,8 +133,6 @@ public class Task implements Mappable {
default -> throw invalidFieldException(json.get(DESCRIPTION).getClass().getSimpleName(),"String or JSON");
};
var status = Status.OPEN.code();
if (json.has(STATUS) && json.get(STATUS) instanceof JSONObject state){
if (state.get(CODE) instanceof Number code) status = code.intValue();
@@ -185,6 +185,10 @@ public class Task implements Mappable {
return projectId;
}
public Set<Long> requiredTasksIds(){
return requiredTasksIds;
}
public boolean showClosed(){
return showClosed;
}
@@ -216,6 +220,7 @@ public class Task implements Mappable {
map.put(SHOW_CLOSED,showClosed);
map.put(NO_INDEX,noIndex);
map.put(MEMBERS,memberMap);
map.put(REQUIRED_TASKS_IDS,requiredTasksIds);
return map;
}