working on time tracking implementation

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-08-26 15:33:31 +02:00
parent d0e3dc8b0c
commit 7a020048d8
6 changed files with 84 additions and 33 deletions

View File

@@ -3,19 +3,23 @@ package de.srsoftware.umbrella.core.model;
import static de.srsoftware.umbrella.core.Constants.*;
import static de.srsoftware.umbrella.core.Util.*;
import static java.time.ZoneOffset.UTC;
import de.srsoftware.tools.Mappable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
public class Time implements Mappable{
private final Collection<Long> taskIds;
private final LocalDateTime end, start;
private final long id, userId;
private LocalDateTime end;
private final LocalDateTime start;
private long id;
private final long userId;
private final String description, subject;
private final State state;
@@ -46,8 +50,9 @@ public class Time implements Mappable{
default -> throw new IllegalArgumentException();
};
}
}
}
public Time(long id, long userId, String subject, String description, LocalDateTime start, LocalDateTime end, State state, Collection<Long> taskIds){
this.id=id;
this.userId = userId;
@@ -58,6 +63,17 @@ public class Time implements Mappable{
this.state = state;
this.taskIds = taskIds;
}
public String description(){
return description;
}
public LocalDateTime end(){
return end;
}
public Long endSecond(){
return end == null ? null : end.toEpochSecond(UTC);
}
public long id(){
return id;
@@ -88,14 +104,31 @@ public class Time implements Mappable{
);
}
public void setId(long newValue) {
id = newValue;
}
public LocalDateTime start(){
return start;
}
public Long startSecond(){
return start == null ? null : start.toEpochSecond(UTC);
}
public State state(){
return state;
}
public Time stop(LocalDateTime now) {
end = now;
return this;
}
public String subject(){
return subject;
}
public Collection<Long> taskIds(){
return taskIds;
}
@@ -114,4 +147,8 @@ public class Time implements Mappable{
map.put(TASK_IDS,taskIds);
return map;
}
public long userId(){
return userId;
}
}