diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-10-18 20:23:12 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-18 20:23:12 +1300 |
commit | 42515694997bbcaf9abd85ece7586f84ff3065e7 (patch) | |
tree | 15d878ecf94868732d29515461ff4a8ad98ad1fa /src/org | |
parent | 7e2698ea6d1933030cd7e7a2fb33e3c984166f78 (diff) | |
parent | c0acd034c1103cf5d38e94bd42ec183147678135 (diff) | |
download | trackermap-server-42515694997bbcaf9abd85ece7586f84ff3065e7.tar.gz trackermap-server-42515694997bbcaf9abd85ece7586f84ff3065e7.tar.bz2 trackermap-server-42515694997bbcaf9abd85ece7586f84ff3065e7.zip |
Merge pull request #2450 from renaudallard/master
Log which filters have been used
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/FilterHandler.java | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/src/org/traccar/FilterHandler.java b/src/org/traccar/FilterHandler.java index 1ce9e2460..e9e3245a6 100644 --- a/src/org/traccar/FilterHandler.java +++ b/src/org/traccar/FilterHandler.java @@ -148,18 +148,43 @@ public class FilterHandler extends BaseDataHandler { } } - private boolean filter(Position p) { + private boolean filter(Position position) { - boolean result = filterInvalid(p) || filterZero(p) || filterDuplicate(p) - || filterFuture(p) || filterApproximate(p) || filterStatic(p) - || filterDistance(p); + boolean result = false; + StringBuilder filterType = new StringBuilder(8 + 5 + 10 + 7 + 12 + 7 + 9); - if (filterLimit(p)) { - result = false; + if (filterInvalid(position)) { + filterType.append("Invalid "); + } + if (filterZero(position)) { + filterType.append("Zero "); + } + if (filterDuplicate(position)) { + filterType.append("Duplicate "); + } + if (filterFuture(position)) { + filterType.append("Future "); + } + if (filterApproximate(position)) { + filterType.append("Approximate "); + } + if (filterStatic(position)) { + filterType.append("Static "); } + if (filterDistance(position)) { + filterType.append("Distance "); + } + + if (filterType.length() > 0) { + result = true; + } + + if (filterLimit(position)) { + result = false; + } if (result) { - Log.info("Position filtered from " + p.getDeviceId()); + Log.info("Position filtered by " + filterType.toString() + "filters from " + position.getDeviceId()); } return result; |