-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MORE2-5 enable relative events on all places
- Loading branch information
Thomas Kurz
committed
Nov 17, 2023
1 parent
81d0963
commit 4fb2288
Showing
12 changed files
with
199 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/io/redlink/more/data/configuration/CachingConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.redlink.more.data.configuration; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.cache.CacheManager; | ||
import org.springframework.cache.annotation.CacheEvict; | ||
import org.springframework.cache.annotation.EnableCaching; | ||
import org.springframework.cache.concurrent.ConcurrentMapCacheManager; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.scheduling.annotation.EnableScheduling; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
|
||
@Configuration | ||
@EnableCaching | ||
@EnableScheduling | ||
public class CachingConfiguration { | ||
|
||
public static final String OBSERVATION_ENDINGS = "observationEndings"; | ||
private static final Logger LOGGER = LoggerFactory.getLogger(CachingConfiguration.class); | ||
@Bean | ||
public CacheManager cacheManager() { | ||
return new ConcurrentMapCacheManager(OBSERVATION_ENDINGS); | ||
} | ||
|
||
@CacheEvict(allEntries = true, value = {OBSERVATION_ENDINGS}) | ||
@Scheduled(fixedDelay = 60 * 60 * 1000 , initialDelay = 5000) | ||
public void reportCacheEvict() { | ||
LOGGER.info("Flush Cache"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
src/main/java/io/redlink/more/data/model/SimpleParticipant.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
package io.redlink.more.data.model; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.Instant; | ||
|
||
public record SimpleParticipant( | ||
int id, | ||
String alias, | ||
LocalDateTime start | ||
Instant start, | ||
Instant end | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/io/redlink/more/data/model/scheduler/Interval.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.redlink.more.data.model.scheduler; | ||
|
||
import java.time.Instant; | ||
|
||
public class Interval { | ||
private Instant start; | ||
private Instant end; | ||
|
||
public Interval(Instant start, Instant end) { | ||
this.start = start; | ||
this.end = end; | ||
} | ||
|
||
public static Interval from(Event event) { | ||
return new Interval(event.getDateStart(), event.getDateEnd()); | ||
} | ||
|
||
public Instant getStart() { | ||
return start; | ||
} | ||
|
||
public Instant getEnd() { | ||
return end; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Dear @tkurz, @ja-fra
I think this condition does not satisfy the true requirement for saving bulk data endpoint.
because when the "timestamp" >= "participant.starton" data-points do not save!
I think the opposite of this condition should be fulfilled...