From 2f4da7ec1ac67481fc3121a10e219003adb63b10 Mon Sep 17 00:00:00 2001 From: Landon Reed Date: Thu, 8 Feb 2018 15:21:28 -0500 Subject: [PATCH] add serialization fixes --- .../conveyal/gtfs/loader/FeedLoadResult.java | 28 +++++++++++++++++++ .../gtfs/validator/ValidationResult.java | 6 ++++ 2 files changed, 34 insertions(+) diff --git a/src/main/java/com/conveyal/gtfs/loader/FeedLoadResult.java b/src/main/java/com/conveyal/gtfs/loader/FeedLoadResult.java index a2b801f93..77116da76 100644 --- a/src/main/java/com/conveyal/gtfs/loader/FeedLoadResult.java +++ b/src/main/java/com/conveyal/gtfs/loader/FeedLoadResult.java @@ -1,5 +1,7 @@ package com.conveyal.gtfs.loader; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + import java.io.Serializable; /** @@ -7,7 +9,10 @@ * It provides a summary of what happened during the loading process. * It also provides the unique name that was assigned to this feed by the loader. * That unique name is the name of a database schema including all the tables loaded from this feed. + * + * Ignore unknown properties on deserialization to avoid conflicts with past versions. FIXME */ +@JsonIgnoreProperties(ignoreUnknown = true) public class FeedLoadResult implements Serializable { private static final long serialVersionUID = 1L; @@ -31,4 +36,27 @@ public class FeedLoadResult implements Serializable { public long loadTimeMillis; public long completionTime; + + public FeedLoadResult () { + this(false); + } + + /** + * Optional constructor to generate blank table load results on instantiation. + */ + public FeedLoadResult (boolean constructTableResults) { + agency = new TableLoadResult(); + calendar = new TableLoadResult(); + calendarDates = new TableLoadResult(); + fareAttributes = new TableLoadResult(); + fareRules = new TableLoadResult(); + feedInfo = new TableLoadResult(); + frequencies = new TableLoadResult(); + routes = new TableLoadResult(); + shapes = new TableLoadResult(); + stops = new TableLoadResult(); + stopTimes = new TableLoadResult(); + transfers = new TableLoadResult(); + trips = new TableLoadResult(); + } } diff --git a/src/main/java/com/conveyal/gtfs/validator/ValidationResult.java b/src/main/java/com/conveyal/gtfs/validator/ValidationResult.java index 957b52a46..51bc514b1 100644 --- a/src/main/java/com/conveyal/gtfs/validator/ValidationResult.java +++ b/src/main/java/com/conveyal/gtfs/validator/ValidationResult.java @@ -3,6 +3,9 @@ import java.awt.geom.Rectangle2D; import java.io.Serializable; import com.conveyal.gtfs.model.Pattern; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + import java.time.LocalDate; import java.util.List; @@ -11,7 +14,10 @@ * It groups together several kinds of information about what happened during the validation process. * Detailed lists of errors can be found in database tables created by the validator, but this class provides * immediate summary information. + * + * Ignore unknown properties on deserialization to avoid conflicts with past versions. FIXME */ +@JsonIgnoreProperties(ignoreUnknown = true) public class ValidationResult implements Serializable { private static final long serialVersionUID = 1L;