diff options
author | Renaud Allard <renaud@allard.it> | 2016-12-21 00:31:44 +0100 |
---|---|---|
committer | Renaud Allard <renaud@allard.it> | 2016-12-21 00:31:44 +0100 |
commit | 444d74eac0f05756de4367b783b57a60b6ba39b6 (patch) | |
tree | b39e27c101e7f9c2bbcf10b171504e06458f8378 /src/org/traccar | |
parent | 22fdf5388719120b84ce981807d17d68e87a0c07 (diff) | |
download | traccar-server-444d74eac0f05756de4367b783b57a60b6ba39b6.tar.gz traccar-server-444d74eac0f05756de4367b783b57a60b6ba39b6.tar.bz2 traccar-server-444d74eac0f05756de4367b783b57a60b6ba39b6.zip |
Allow setting the interval in Future filter
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/FilterHandler.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/org/traccar/FilterHandler.java b/src/org/traccar/FilterHandler.java index 898651837..0a54cfeca 100644 --- a/src/org/traccar/FilterHandler.java +++ b/src/org/traccar/FilterHandler.java @@ -21,16 +21,14 @@ import org.traccar.model.Position; public class FilterHandler extends BaseDataHandler { - private static final long FILTER_FUTURE_LIMIT = 5 * 60 * 1000; - private boolean filterInvalid; private boolean filterZero; private boolean filterDuplicate; - private boolean filterFuture; private boolean filterApproximate; private boolean filterStatic; private int filterDistance; private long filterLimit; + private long filterFuture; public void setFilterInvalid(boolean filterInvalid) { this.filterInvalid = filterInvalid; @@ -44,10 +42,6 @@ public class FilterHandler extends BaseDataHandler { this.filterDuplicate = filterDuplicate; } - public void setFilterFuture(boolean filterFuture) { - this.filterFuture = filterFuture; - } - public void setFilterApproximate(boolean filterApproximate) { this.filterApproximate = filterApproximate; } @@ -64,17 +58,21 @@ public class FilterHandler extends BaseDataHandler { this.filterLimit = filterLimit; } + public void setFilterFuture(long filterFuture) { + this.filterFuture = filterFuture; + } + public FilterHandler() { Config config = Context.getConfig(); if (config != null) { filterInvalid = config.getBoolean("filter.invalid"); filterZero = config.getBoolean("filter.zero"); filterDuplicate = config.getBoolean("filter.duplicate"); - filterFuture = config.getBoolean("filter.future"); filterApproximate = config.getBoolean("filter.approximate"); filterStatic = config.getBoolean("filter.static"); filterDistance = config.getInteger("filter.distance"); filterLimit = config.getLong("filter.limit") * 1000; + filterFuture = config.getLong("filter.future") * 1000; } } @@ -107,7 +105,7 @@ public class FilterHandler extends BaseDataHandler { } private boolean filterFuture(Position position) { - return filterFuture && position.getFixTime().getTime() > System.currentTimeMillis() + FILTER_FUTURE_LIMIT; + return filterFuture != 0 && position.getFixTime().getTime() > System.currentTimeMillis() + filterFuture; } private boolean filterApproximate(Position position) { |