From 2c6725c024e83ee8a034bcf2c3d28378e0fd4850 Mon Sep 17 00:00:00 2001 From: Dhirendra Singh Date: Thu, 20 May 2021 07:24:42 +1000 Subject: [PATCH] Updated to allow evac zone ID header column to be configurable --- .../io/github/agentsoz/ees/MessagingModel.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ees/src/main/java/io/github/agentsoz/ees/MessagingModel.java b/ees/src/main/java/io/github/agentsoz/ees/MessagingModel.java index 42b7fc09..89fc8f9b 100644 --- a/ees/src/main/java/io/github/agentsoz/ees/MessagingModel.java +++ b/ees/src/main/java/io/github/agentsoz/ees/MessagingModel.java @@ -46,9 +46,11 @@ public class MessagingModel implements DataSource opts) { optJsonFile = opts.get(opt); break; case eZonesFile: - optGeoJsonZonesFile = opts.get(opt); + optZonesFile = opts.get(opt); + break; + case eZonesFileIdColumnName: + optZonesFileIdColumnName = opts.get(opt); break; case Config.eGlobalStartHhMm: String[] tokens = opts.get(opt).split(":"); @@ -163,6 +168,9 @@ private void loadGeoJsonZones(String file) throws IOException, ParseException, j String zoneId = (properties.get("SA1_MAIN11") != null) ? (String) properties.get("SA1_MAIN11") : (String) properties.get("SA1_MAIN16"); + if (optZonesFileIdColumnName != null) { + zoneId = (String) properties.get(optZonesFileIdColumnName); + } if (zoneId == null) { logger.warn("Feature has no property named SA1_MAIN11 or SA1_MAIN16; discarding"); continue; @@ -215,9 +223,9 @@ public void start(int[] hhmm) { } public void start() { - if (optGeoJsonZonesFile !=null && !optGeoJsonZonesFile.isEmpty() && optJsonFile != null && !optJsonFile.isEmpty()) { + if (optZonesFile !=null && !optZonesFile.isEmpty() && optJsonFile != null && !optJsonFile.isEmpty()) { try { - loadJsonMessagesForZones(optJsonFile, optGeoJsonZonesFile); + loadJsonMessagesForZones(optJsonFile, optZonesFile); dataServer.registerTimedUpdate(Constants.EMERGENCY_MESSAGE, this, Time.convertTime(startTimeInSeconds, Time.TimestepUnit.SECONDS, timestepUnit)); } catch (Exception e) { throw new RuntimeException("Could not load json from [" + optJsonFile + "]", e);