|
|
@@ -258,7 +258,7 @@ public class OpenAPIHandler {
|
|
|
"unitId", o.getUnitId(),
|
|
|
"timestamp", OffsetDateTime.ofInstant(o.getTimestamp().toInstant(), zone).format(ISO_OFFSET_DATE_TIME),
|
|
|
"speed", o.getSpeed(),
|
|
|
- "observations", o.getObservedValues()
|
|
|
+ "observedValues", o.getObservedValues()
|
|
|
)
|
|
|
)).collect(toList()))).encode()))
|
|
|
.onFailure(rc::fail);
|
|
|
@@ -379,7 +379,7 @@ public class OpenAPIHandler {
|
|
|
"unitId", o.getUnitId(),
|
|
|
"timestamp", OffsetDateTime.ofInstant(o.getTimestamp().toInstant(), zone).format(ISO_OFFSET_DATE_TIME),
|
|
|
"speed", o.getSpeed(),
|
|
|
- "observations", o.getObservedValues()
|
|
|
+ "observedValues", o.getObservedValues()
|
|
|
)
|
|
|
)).collect(toList()))).encode()))
|
|
|
.onFailure(rc::fail);
|
|
|
@@ -466,11 +466,10 @@ public class OpenAPIHandler {
|
|
|
),
|
|
|
"features", unitLocation.entrySet().stream().map(entry -> JsonObject.of(
|
|
|
"type", "Feature",
|
|
|
+ "properties", JsonObject.of(
|
|
|
+ "unitId", entry.getKey()),
|
|
|
"geometry", JsonObject.of(
|
|
|
"type", "MultiPoint",
|
|
|
- "properties", JsonObject.of(
|
|
|
- "unitId", entry.getKey()
|
|
|
- ),
|
|
|
"coordinates", new JsonArray(entry.getValue().stream().map(l -> JsonArray.of(
|
|
|
l.getLocation().getLongitude(),
|
|
|
l.getLocation().getLatitude(),
|
|
|
@@ -959,7 +958,7 @@ public class OpenAPIHandler {
|
|
|
"hasNext", paging.hasNext(),
|
|
|
"data", new JsonArray(
|
|
|
paging.data().stream().map(l -> JsonObject.of(
|
|
|
- "observed_value", l.getValue(),
|
|
|
+ "observedValue", l.getValue(),
|
|
|
"timestamp", OffsetDateTime.ofInstant(l.getTimestamp().toInstant(), zone).format(ISO_OFFSET_DATE_TIME),
|
|
|
"speed", l.getSpeed(),
|
|
|
"location", JsonObject.of(
|
|
|
@@ -991,7 +990,7 @@ public class OpenAPIHandler {
|
|
|
"unitId", unitId,
|
|
|
"timestamp", OffsetDateTime.ofInstant(o.getTimestamp().toInstant(), zone).format(ISO_OFFSET_DATE_TIME),
|
|
|
"speed", o.getSpeed(),
|
|
|
- "observations", JsonObject.of(
|
|
|
+ "observedValues", JsonObject.of(
|
|
|
String.valueOf(sensorId), o.getValue()
|
|
|
)
|
|
|
)
|
|
|
@@ -1387,7 +1386,7 @@ public class OpenAPIHandler {
|
|
|
"unitId", o.getUnitId(),
|
|
|
"timestamp", OffsetDateTime.ofInstant(o.getTimestamp().toInstant(), zone).format(ISO_OFFSET_DATE_TIME),
|
|
|
"speed", o.getSpeed(),
|
|
|
- "observations", o.getObservedValues()
|
|
|
+ "observedValues", o.getObservedValues()
|
|
|
)
|
|
|
)).collect(toList()))).encode()))
|
|
|
.onFailure(rc::fail);
|
|
|
@@ -1551,16 +1550,16 @@ public class OpenAPIHandler {
|
|
|
|
|
|
case GEOJSON -> Optional.of(rc.body().asJsonObject()).map(j -> j.getJsonArray("features"))
|
|
|
.map(jsonArray -> jsonArray.stream().filter(JsonObject.class::isInstance).map(JsonObject.class::cast)
|
|
|
- .map(f -> UnitTelemetry.of(
|
|
|
- f.getJsonObject("properties").getLong("unitId"),
|
|
|
- OffsetDateTime.parse(f.getJsonObject("properties").getString("timestamp")),
|
|
|
+ .map(feature -> UnitTelemetry.of(
|
|
|
+ feature.getJsonObject("properties").getLong("unitId"),
|
|
|
+ OffsetDateTime.parse(feature.getJsonObject("properties").getString("timestamp")),
|
|
|
Location.of(
|
|
|
- f.getJsonObject("geometry").getJsonArray("coordinates").getFloat(0),
|
|
|
- f.getJsonObject("geometry").getJsonArray("coordinates").getFloat(1),
|
|
|
- f.getJsonObject("geometry").getJsonArray("coordinates").getFloat(2)
|
|
|
+ feature.getJsonObject("geometry").getJsonArray("coordinates").getFloat(0),
|
|
|
+ feature.getJsonObject("geometry").getJsonArray("coordinates").getFloat(1),
|
|
|
+ feature.getJsonObject("geometry").getJsonArray("coordinates").getFloat(2)
|
|
|
),
|
|
|
- f.getJsonObject("properties").getInteger("speed"),
|
|
|
- f.getJsonObject("observations")
|
|
|
+ feature.getJsonObject("properties").getInteger("speed"),
|
|
|
+ feature.getJsonObject("observedValues")
|
|
|
)).sorted(comparing(UnitTelemetry::getTimestamp)).collect(toList()))
|
|
|
.ifPresent(orgTels -> repo.findCampaignById(campaignId)
|
|
|
.onSuccess(campaign -> fluentlyOf(telemetriesWithinCampaign(campaign, orgTels))
|