Skip to content

Commit

Permalink
Camtrap DP conformance; update java dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
swoellauer committed Oct 9, 2024
1 parent c5a7717 commit 26bdf2c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 23 deletions.
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ dependencies {
implementation group: 'org.tinylog', name: 'tinylog-impl', version: '2.7.0'
runtimeOnly group: 'org.tinylog', name: 'slf4j-tinylog', version: '2.7.0'

implementation group: 'org.eclipse.jetty', name: 'jetty-server', version: '11.0.22' // v12.x not compatible with Java 11
implementation group: 'org.eclipse.jetty', name: 'jetty-security', version: '11.0.22'
implementation group: 'org.eclipse.jetty.http2', name: 'http2-server', version: '11.0.22'
implementation group: 'org.eclipse.jetty', name: 'jetty-alpn-java-server', version: '11.0.22'
implementation group: 'org.eclipse.jetty', name: 'jetty-server', version: '11.0.24' // v12.x not compatible with Java 11
implementation group: 'org.eclipse.jetty', name: 'jetty-security', version: '11.0.24'
implementation group: 'org.eclipse.jetty.http2', name: 'http2-server', version: '11.0.24'
implementation group: 'org.eclipse.jetty', name: 'jetty-alpn-java-server', version: '11.0.24'

implementation group: 'org.json', name: 'json', version: '20240303'
implementation group: 'org.yaml', name: 'snakeyaml', version: '1.33' // TODO: check compatibility with newer version 2.x
implementation group: 'de.siegmar', name: 'fastcsv', version: '3.2.0'
implementation group: 'de.siegmar', name: 'fastcsv', version: '3.3.1'
implementation group: 'com.opencsv', name: 'opencsv', version: '5.9'
implementation group: 'ch.randelshofer', name: 'fastdoubleparser', version: '1.0.0'
implementation group: 'ch.randelshofer', name: 'fastdoubleparser', version: '1.0.1'

implementation group: 'com.github.wendykierp', name: 'JTransforms', version: '3.1'

Expand All @@ -82,7 +82,7 @@ dependencies {

implementation group: 'com.drewnoakes', name: 'metadata-extractor', version: '2.19.0'

implementation group: 'com.h2database', name: 'h2', version: '2.3.230' // old database v2.1.x files not compatible with v2.2.x
implementation group: 'com.h2database', name: 'h2', version: '2.3.232' // old database v2.1.x files not compatible with v2.2.x

implementation group: 'org.reflections', name: 'reflections', version: '0.10.2'

Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion src/photo/api/Photo2Handler.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import audio.Account;
import audio.Broker;
import audio.Sample2;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import photo.Photo2;
Expand Down
21 changes: 11 additions & 10 deletions src/photo/task/Task_photo_export_Camtrap_DP.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import util.yaml.YamlMap;

@Tag("photo")
@Description("Export photo meta data to CSV files in structure of Camtrap DP.")
@Description("Export photo metadata according to the Camtrap DP standard.")
@Role("admin")
public class Task_photo_export_Camtrap_DP extends Task {

Expand Down Expand Up @@ -88,8 +88,7 @@ public void run() {
}

HashSet<String> scientificNameSet = new HashSet<String>();
LocalDateTime[] deplMin = new LocalDateTime[] {MAX_DATE};
LocalDateTime[] deplMax = new LocalDateTime[] {MIN_DATE};
LocalDateTime[] deplRange = new LocalDateTime[] {MAX_DATE, MIN_DATE};
HashMap<String, LocalDateTime[]> rangeMap = new HashMap<String, LocalDateTime[]>();

try (
Expand Down Expand Up @@ -156,11 +155,11 @@ public void run() {
String favorite = ""; // optional
String mediaComments = ""; // optional

if(deplMin[0].isAfter(photo.date)) {
deplMin[0] = photo.date;
if(deplRange[0].isAfter(photo.date)) {
deplRange[0] = photo.date;
}
if(deplMax[0].isBefore(photo.date)) {
deplMax[0] = photo.date;
if(deplRange[1].isBefore(photo.date)) {
deplRange[1] = photo.date;
}

LocalDateTime[] range = rangeMap.get(photo.location);
Expand Down Expand Up @@ -431,12 +430,14 @@ public void run() {
json.key("profile");
json.value("https://raw.githubusercontent.com/tdwg/camtrap-dp/1.0.1/camtrap-dp-profile.json");
json.key("created");
json.value(LocalDateTime.now().toString());
json.value(localDateTimeToString(LocalDateTime.now()));
json.key("contributors");
json.array();
json.object();
json.key("title");
json.value("PhotoDB");
json.key("role");
json.value("publisher");
json.endObject();
json.endArray();
json.key("project");
Expand Down Expand Up @@ -469,9 +470,9 @@ public void run() {
json.key("temporal");
json.object();
json.key("start");
json.value(localDateTimeToString(deplMin[0]));
json.value(localDateTimeToString(deplRange[0]));
json.key("end");
json.value(localDateTimeToString(deplMax[0]));
json.value(localDateTimeToString(deplRange[1]));
json.endObject();
json.key("taxonomic");
json.array();
Expand Down
6 changes: 1 addition & 5 deletions src/util/yaml/YamlMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@
import java.util.function.IntConsumer;
import java.util.function.Supplier;


import org.tinylog.Logger;

import util.collections.ReadonlyList;

public class YamlMap {

public class YamlMap {

public static final YamlMap EMPTY_MAP = new YamlMap(new HashMap<>());

Expand Down

0 comments on commit 26bdf2c

Please sign in to comment.