|
|
@@ -538,6 +538,7 @@ public class OpenAPIHandler {
|
|
|
"Phenomenon@NavigationLink", String.format("%s/phenomenons/%d", host, s.getPhenomenon().getId())
|
|
|
) : JsonObject.of()).mergeIn(JsonObject.of(
|
|
|
"sensorId", s.getSensorId(),
|
|
|
+ "ioId", s.getIoID(),
|
|
|
"name", s.getName(),
|
|
|
"description", s.getDescription(),
|
|
|
"type", s.getType(),
|
|
|
@@ -696,4 +697,32 @@ public class OpenAPIHandler {
|
|
|
).encode()))
|
|
|
.onFailure(th -> rc.fail(400, th));
|
|
|
}
|
|
|
+
|
|
|
+ public void campaignIdUnitIdSensorIdGET(RoutingContext rc) {
|
|
|
+ String host = hostURLFull(rc.request());
|
|
|
+
|
|
|
+ long campaignId = Long.parseLong(rc.pathParam("campaignId"));
|
|
|
+ long unitId = Long.parseLong(rc.pathParam("unitId"));
|
|
|
+ long sensorId = Long.parseLong(rc.pathParam("sensorId"));
|
|
|
+
|
|
|
+ List<String> paramNavigationLinks = rc.queryParam("navigationLinks");
|
|
|
+ boolean navigationLinks = paramNavigationLinks.isEmpty() ? DEFAULT_NAVIGATION_LINKS : parseBoolean(paramNavigationLinks.get(0));
|
|
|
+
|
|
|
+ repo.findSensorByCampaignIdAndUnitId(campaignId, unitId, sensorId)
|
|
|
+ .onSuccess(s -> rc.response().end((navigationLinks ? JsonObject.of(
|
|
|
+ "self@NavigationLink", String.format("%s/campaigns/%d/units/%d/sensors/%d", host, campaignId, unitId, s.getSensorId()),
|
|
|
+ "Sensor@NavigationLink", String.format("%s/sensors/%d", host, s.getSensorId()),
|
|
|
+ "CampaignUnit@NavigationLink", String.format("%s/campaigns/%d/units/%d", host, campaignId, unitId),
|
|
|
+ "Phenomenon@NavigationLink", String.format("%s/phenomenons/%d", host, s.getPhenomenon().getId()),
|
|
|
+ "Observations@NavigationLink", String.format("%s/campaigns/%d/units/%d/sensors/%d/observations", host, campaignId, unitId, s.getSensorId())
|
|
|
+ ) : JsonObject.of()).mergeIn(JsonObject.of(
|
|
|
+ "sensorId", s.getSensorId(),
|
|
|
+ "ioId", s.getIoID(),
|
|
|
+ "name", s.getName(),
|
|
|
+ "description", s.getDescription(),
|
|
|
+ "type", s.getType(),
|
|
|
+ "phenomenon", s.getPhenomenon().getName()
|
|
|
+ )).encode())
|
|
|
+ .onFailure(th -> rc.fail(400, th)));
|
|
|
+ }
|
|
|
}
|