From f0f51dbb349efb1cb00dccea4728ad43c233f1d2 Mon Sep 17 00:00:00 2001 From: Jon Van Oast Date: Thu, 22 Aug 2024 16:56:58 -0600 Subject: [PATCH] add individualNickName and individualFirstEncounterDate/individualLastEncounterDate --- src/main/java/org/ecocean/Encounter.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/org/ecocean/Encounter.java b/src/main/java/org/ecocean/Encounter.java index cf217d46de..cb8e7128b3 100644 --- a/src/main/java/org/ecocean/Encounter.java +++ b/src/main/java/org/ecocean/Encounter.java @@ -4434,11 +4434,19 @@ public void opensearchDocumentSerializer(JsonGenerator jgen) jgen.writeString(name); } jgen.writeEndArray(); + jgen.writeStringField("individualNickName", indiv.getNickName()); if (indiv.getTimeOfBirth() > 0) { String birthTime = Util.getISO8601Date(new DateTime( indiv.getTimeOfBirth()).toString()); jgen.writeStringField("individualTimeOfBirth", birthTime); } + Encounter[] encs = indiv.getDateSortedEncounters(true); + if ((encs != null) && (encs.length > 0)) { + String encDate = Util.getISO8601Date(encs[0].getDate()); + if (encDate != null) jgen.writeStringField("individualFirstEncounterDate", encDate); + encDate = Util.getISO8601Date(encs[encs.length - 1].getDate()); + if (encDate != null) jgen.writeStringField("individualLastEncounterDate", encDate); + } /* this currently is not needed as-is. we instead use just the social unit name as its own property (below)