From 44691a373200b0e265df5a24e159f5cdff89fb96 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 14 Jul 2017 10:56:20 +0500 Subject: Populate driverUniqueId in CopyAttributesHanler --- src/org/traccar/processing/CopyAttributesHandler.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/org/traccar/processing/CopyAttributesHandler.java') diff --git a/src/org/traccar/processing/CopyAttributesHandler.java b/src/org/traccar/processing/CopyAttributesHandler.java index 3a96ca98d..a9e761c3d 100644 --- a/src/org/traccar/processing/CopyAttributesHandler.java +++ b/src/org/traccar/processing/CopyAttributesHandler.java @@ -35,6 +35,7 @@ public class CopyAttributesHandler extends BaseDataHandler { position.getDeviceId(), "processing.copyAttributes", null, true); Position last = getLastPosition(position.getDeviceId()); if (attributesString != null && last != null) { + attributesString += Position.KEY_DRIVER_UNIQUE_ID + ","; for (String attribute : attributesString.split("[ ,]")) { if (last.getAttributes().containsKey(attribute) && !position.getAttributes().containsKey(attribute)) { position.getAttributes().put(attribute, last.getAttributes().get(attribute)); -- cgit v1.2.3 From b6ac9da5428f1177df360cdbfc58d219d3230a10 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 14 Jul 2017 12:28:44 +0500 Subject: Fix attributes copying --- src/org/traccar/processing/CopyAttributesHandler.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/org/traccar/processing/CopyAttributesHandler.java') diff --git a/src/org/traccar/processing/CopyAttributesHandler.java b/src/org/traccar/processing/CopyAttributesHandler.java index a9e761c3d..9fbcfa73f 100644 --- a/src/org/traccar/processing/CopyAttributesHandler.java +++ b/src/org/traccar/processing/CopyAttributesHandler.java @@ -32,10 +32,14 @@ public class CopyAttributesHandler extends BaseDataHandler { @Override protected Position handlePosition(Position position) { String attributesString = Context.getDeviceManager().lookupAttributeString( - position.getDeviceId(), "processing.copyAttributes", null, true); + position.getDeviceId(), "processing.copyAttributes", "", true); Position last = getLastPosition(position.getDeviceId()); - if (attributesString != null && last != null) { - attributesString += Position.KEY_DRIVER_UNIQUE_ID + ","; + if (attributesString.isEmpty()) { + attributesString = Position.KEY_DRIVER_UNIQUE_ID; + } else { + attributesString += "," + Position.KEY_DRIVER_UNIQUE_ID; + } + if (last != null) { for (String attribute : attributesString.split("[ ,]")) { if (last.getAttributes().containsKey(attribute) && !position.getAttributes().containsKey(attribute)) { position.getAttributes().put(attribute, last.getAttributes().get(attribute)); -- cgit v1.2.3