Skip to content

Commit

Permalink
Adjust created field of Tobira harvest response for events
Browse files Browse the repository at this point in the history
This changed in OC 16 with the Solr/Opensearch swap as far as I can see,
but it needs to be in a specific format in order to be harvested by
Tobira.

No version bump since this only restores old behaviour and is not a breaking
change.
  • Loading branch information
owi92 committed May 23, 2024
1 parent c668d14 commit 60ddcf7
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
Expand Down Expand Up @@ -155,7 +156,9 @@ class Item {
Jsons.p("title", title),
Jsons.p("partOf", event.getDublinCore().getFirst(DublinCore.PROPERTY_IS_PART_OF)),
Jsons.p("description", event.getDublinCore().getFirst(PROPERTY_DESCRIPTION)),
Jsons.p("created", event.getDublinCore().getFirst(DublinCore.PROPERTY_CREATED)),
Jsons.p("created", Date.from(
Instant.parse(event.getDublinCore().getFirst(DublinCore.PROPERTY_CREATED))
).getTime()),
Jsons.p("startTime", period.map(p -> p.getStart().getTime()).orElse(null)),
Jsons.p("endTime", period.map(p -> p.getEnd().getTime()).orElse(null)),
Jsons.p("creators", Jsons.arr(new ArrayList<>(creators))),
Expand Down

0 comments on commit 60ddcf7

Please sign in to comment.