19 package org.turro.elephant.entities.db;
21 import java.io.Serializable;
22 import java.time.Instant;
23 import java.time.LocalDateTime;
24 import java.time.ZoneId;
25 import java.time.ZonedDateTime;
26 import java.time.temporal.ChronoUnit;
27 import java.util.Date;
28 import javax.persistence.Entity;
29 import javax.persistence.Id;
30 import javax.persistence.IdClass;
31 import javax.persistence.Temporal;
32 import org.turro.string.Strings;
33 import org.turro.entities.Entities;
34 import org.turro.entities.IElephantEntity;
35 import org.turro.util.CompareUtil;
42 @IdClass(TimeTrackerPK.class)
45 @Id
private String entityPath;
46 @Id
private String trackedPath;
48 @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
49 @Id
private Date timeTrack;
55 private boolean validated;
62 this.entityPath = entityPath;
70 this.trackedPath = trackedPath;
78 this.timeTrack = timeTrack;
86 this.trackType = trackType;
102 this.validated = validated;
108 return LocalDateTime.from(timeTrack.toInstant().atZone(ZoneId.systemDefault()));
112 return Strings.isBlank(entityPath) || timeTrack ==
null || trackType ==
null;
120 return timeTrack.toInstant().truncatedTo(ChronoUnit.DAYS)
121 .equals(Instant.now().truncatedTo(ChronoUnit.DAYS));
138 int result = CompareUtil.compare(entityPath, o.entityPath);
140 result = CompareUtil.compare(trackedPath, o.trackedPath);
143 result = CompareUtil.compare(timeTrack, o.timeTrack);
void setEntityPath(String entityPath)
void setTrackType(TimeTrackerType trackType)
IElephantEntity getEntity()
void setHours(double hours)
void setTimeTrack(Date timeTrack)
LocalDateTime getLocalDateTime()
boolean isPreviousValid(TimeTracker previous)
void setValidated(boolean validated)
void setTrackedPath(String trackedPath)
IElephantEntity getTracked()
int compareTo(TimeTracker o)
TimeTrackerType getTrackType()
static IElephantEntity getController(String path)
boolean isPreviousValid(TimeTrackerType previousType)