|
|
|
|
@ -20,7 +20,7 @@ public class Task implements Mappable {
@@ -20,7 +20,7 @@ public class Task implements Mappable {
|
|
|
|
|
private final long id, projectId; |
|
|
|
|
private Long parentTaskId; |
|
|
|
|
private String description, name; |
|
|
|
|
private Status status; |
|
|
|
|
private int status; |
|
|
|
|
private Double estimatedTime; |
|
|
|
|
private LocalDate dueDate, start; |
|
|
|
|
private boolean noIndex, showClosed; |
|
|
|
|
@ -28,7 +28,7 @@ public class Task implements Mappable {
@@ -28,7 +28,7 @@ public class Task implements Mappable {
|
|
|
|
|
private final Set<String> dirtyFields = new HashSet<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Task (long id, long projectId, Long parentTaskId, String name, String description, Status status, Double estimatedTime, LocalDate start, LocalDate dueDate, boolean showClosed, boolean noIndex, Map<Long,Member> members){ |
|
|
|
|
public Task (long id, long projectId, Long parentTaskId, String name, String description, int status, Double estimatedTime, LocalDate start, LocalDate dueDate, boolean showClosed, boolean noIndex, Map<Long,Member> members){ |
|
|
|
|
this.id = id; |
|
|
|
|
this.projectId = projectId; |
|
|
|
|
this.parentTaskId = parentTaskId; |
|
|
|
|
@ -109,7 +109,7 @@ public class Task implements Mappable {
@@ -109,7 +109,7 @@ public class Task implements Mappable {
|
|
|
|
|
parentTaskId == 0d ? null : parentTaskId, |
|
|
|
|
rs.getString(NAME), |
|
|
|
|
rs.getString(DESCRIPTION), |
|
|
|
|
Status.of(rs.getInt(STATUS)), |
|
|
|
|
rs.getInt(STATUS), |
|
|
|
|
estTime == 0d ? null : estTime, |
|
|
|
|
startDate != null ? LocalDate.parse(startDate) : null, |
|
|
|
|
dueDate != null ? LocalDate.parse(dueDate) : null, |
|
|
|
|
@ -131,10 +131,11 @@ public class Task implements Mappable {
@@ -131,10 +131,11 @@ public class Task implements Mappable {
|
|
|
|
|
default -> throw invalidFieldException(json.get(DESCRIPTION).getClass().getSimpleName(),"String or JSON"); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
var status = Status.OPEN; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var status = Status.OPEN.code(); |
|
|
|
|
if (json.has(STATUS) && json.get(STATUS) instanceof JSONObject state){ |
|
|
|
|
if (state.get(CODE) instanceof Number code) status = Status.of(code.intValue()); |
|
|
|
|
if (state.get(CODE) instanceof String code) status = Status.valueOf(code); |
|
|
|
|
if (state.get(CODE) instanceof Number code) status = code.intValue(); |
|
|
|
|
} |
|
|
|
|
Double estimatedTime = null; |
|
|
|
|
if (json.has(ESTIMATED_TIME)) { |
|
|
|
|
@ -165,7 +166,7 @@ public class Task implements Mappable {
@@ -165,7 +166,7 @@ public class Task implements Mappable {
|
|
|
|
|
case PARENT_TASK_ID: parentTaskId = json.getLong(PARENT_TASK_ID); break; |
|
|
|
|
case SHOW_CLOSED: showClosed = json.getBoolean(SHOW_CLOSED); break; |
|
|
|
|
case START_DATE: start = json.isNull(START_DATE) || json.getString(START_DATE).isBlank() ? null : LocalDate.parse(json.getString(START_DATE)); break; |
|
|
|
|
case STATUS: status = json.get(key) instanceof Number number ? Status.of(number.intValue()) : Status.valueOf(json.getString(key)); break; |
|
|
|
|
case STATUS: status = json.getInt(key); break; |
|
|
|
|
default: { |
|
|
|
|
LOG.log(WARNING,"Tried to patch field ''{0}'' of task, which is not implemented!",key); |
|
|
|
|
key = null; |
|
|
|
|
@ -192,7 +193,7 @@ public class Task implements Mappable {
@@ -192,7 +193,7 @@ public class Task implements Mappable {
|
|
|
|
|
return start; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Status status(){ |
|
|
|
|
public int status(){ |
|
|
|
|
return status; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -208,7 +209,7 @@ public class Task implements Mappable {
@@ -208,7 +209,7 @@ public class Task implements Mappable {
|
|
|
|
|
map.put(PARENT_TASK_ID, parentTaskId); |
|
|
|
|
map.put(NAME, name); |
|
|
|
|
map.put(DESCRIPTION, mapMarkdown(description)); |
|
|
|
|
map.put(STATUS, Map.of(NAME,status.name(),STATUS_CODE,status.code())); |
|
|
|
|
map.put(STATUS, status); |
|
|
|
|
map.put(ESTIMATED_TIME, estimatedTime); |
|
|
|
|
map.put(START_DATE,start); |
|
|
|
|
map.put(DUE_DATE,dueDate); |
|
|
|
|
|