|
|
@@ -1000,4 +1000,27 @@ public class OpenAPIHandler {
|
|
|
)).encode())
|
|
|
.onFailure(th -> rc.fail(400, th)));
|
|
|
}
|
|
|
+
|
|
|
+ public void driverIdUnitIdActionIdGET(RoutingContext rc) {
|
|
|
+ String host = hostURLFull(rc.request());
|
|
|
+
|
|
|
+ int driverId = Integer.parseInt(rc.pathParam("driverId"));
|
|
|
+ int actionId = Integer.parseInt(rc.pathParam("actionId"));
|
|
|
+ long unitId = Integer.parseInt(rc.pathParam("unitId"));
|
|
|
+
|
|
|
+ List<String> paramNavigationLinks = rc.queryParam("navigationLinks");
|
|
|
+ boolean navigationLinks = paramNavigationLinks.isEmpty() ? DEFAULT_NAVIGATION_LINKS : parseBoolean(paramNavigationLinks.get(0));
|
|
|
+
|
|
|
+ repo.findActionByIdAndDriverIdAndUnitId(actionId, driverId, unitId)
|
|
|
+ .onSuccess(a -> rc.response().end((navigationLinks ? JsonObject.of(
|
|
|
+ "self@NavigationLink", String.format("%s/drivers/%d/units/%d/actions/%d", host, driverId, unitId, a.getId()),
|
|
|
+ "Driver@NavigationLink", String.format("%s/drivers/%d", host, driverId),
|
|
|
+ "DriverUnit@NavigationLink", String.format("%s/drivers/%d/units/%d", host, driverId, unitId),
|
|
|
+ "Events@NavigationLink", String.format("%s/drivers/%d/units/%d/actions/%d/events", host, driverId, unitId, a.getId())
|
|
|
+ ) : JsonObject.of()).mergeIn(JsonObject.of(
|
|
|
+ "id", a.getId(),
|
|
|
+ "name", a.getName()
|
|
|
+ )).encode())
|
|
|
+ .onFailure(th -> rc.fail(400, th)));
|
|
|
+ }
|
|
|
}
|