|
@@ -31,7 +31,7 @@ public class OGCSensorThingsGateway extends AbstractGateway {
|
|
|
|
|
|
|
|
router().get(create("Things(:id)")).handler(ctx -> {
|
|
router().get(create("Things(:id)")).handler(ctx -> {
|
|
|
RequestUriComponent uriComponent = parseUriToComponents(ctx.request());
|
|
RequestUriComponent uriComponent = parseUriToComponents(ctx.request());
|
|
|
- int id = Integer.parseInt(ctx.pathParam("id"));
|
|
|
|
|
|
|
+ String id = ctx.pathParam("id");
|
|
|
|
|
|
|
|
Think think = new Think();
|
|
Think think = new Think();
|
|
|
think.setId(id);
|
|
think.setId(id);
|
|
@@ -56,7 +56,7 @@ public class OGCSensorThingsGateway extends AbstractGateway {
|
|
|
Unit afcUnit = client.getSensor(id);
|
|
Unit afcUnit = client.getSensor(id);
|
|
|
|
|
|
|
|
Location ogcLocation = new Location();
|
|
Location ogcLocation = new Location();
|
|
|
- ogcLocation.setId(Integer.parseInt(id));
|
|
|
|
|
|
|
+ ogcLocation.setId(id);
|
|
|
ogcLocation.setSelfLink(format("%s/Locations(%s)", uriComponent.getGatewayUri(), id));
|
|
ogcLocation.setSelfLink(format("%s/Locations(%s)", uriComponent.getGatewayUri(), id));
|
|
|
ogcLocation.setHistoricalLocationsNavigationLink("unknown");
|
|
ogcLocation.setHistoricalLocationsNavigationLink("unknown");
|
|
|
ogcLocation.setName(afcUnit.getResourceType());
|
|
ogcLocation.setName(afcUnit.getResourceType());
|
|
@@ -97,7 +97,7 @@ public class OGCSensorThingsGateway extends AbstractGateway {
|
|
|
|
|
|
|
|
router().get(create("Datastreams(:id)")).handler(ctx -> {
|
|
router().get(create("Datastreams(:id)")).handler(ctx -> {
|
|
|
RequestUriComponent uriComponent = parseUriToComponents(ctx.request());
|
|
RequestUriComponent uriComponent = parseUriToComponents(ctx.request());
|
|
|
- int id = Integer.parseInt(ctx.pathParam("id"));
|
|
|
|
|
|
|
+ String id = ctx.pathParam("id");
|
|
|
|
|
|
|
|
Datastream datastream = new Datastream();
|
|
Datastream datastream = new Datastream();
|
|
|
datastream.setId(id);
|
|
datastream.setId(id);
|
|
@@ -143,7 +143,7 @@ public class OGCSensorThingsGateway extends AbstractGateway {
|
|
|
List<HistoricalLocation.Value> valueList = new ArrayList<>();
|
|
List<HistoricalLocation.Value> valueList = new ArrayList<>();
|
|
|
for (int valueId = id; valueId < id + 2; valueId++) {
|
|
for (int valueId = id; valueId < id + 2; valueId++) {
|
|
|
HistoricalLocation.Value value = new HistoricalLocation.Value();
|
|
HistoricalLocation.Value value = new HistoricalLocation.Value();
|
|
|
- value.setId(valueId);
|
|
|
|
|
|
|
+ value.setId(String.valueOf(valueId));
|
|
|
value.setSelfLink(format("%s/HistoricalLocations(%s)", uriComponent.getGatewayUri(), valueId));
|
|
value.setSelfLink(format("%s/HistoricalLocations(%s)", uriComponent.getGatewayUri(), valueId));
|
|
|
value.setLocationsNavigationLink(format("HistoricalLocations(%s)/Locations", valueId));
|
|
value.setLocationsNavigationLink(format("HistoricalLocations(%s)/Locations", valueId));
|
|
|
value.setThingNavigationLink(format("HistoricalLocations(%s)/Thing", valueId));
|
|
value.setThingNavigationLink(format("HistoricalLocations(%s)/Thing", valueId));
|
|
@@ -185,7 +185,7 @@ public class OGCSensorThingsGateway extends AbstractGateway {
|
|
|
|
|
|
|
|
router().get(create("ObservedProperties(:id)")).handler(ctx -> {
|
|
router().get(create("ObservedProperties(:id)")).handler(ctx -> {
|
|
|
RequestUriComponent uriComponent = parseUriToComponents(ctx.request());
|
|
RequestUriComponent uriComponent = parseUriToComponents(ctx.request());
|
|
|
- int id = Integer.parseInt(ctx.pathParam("id"));
|
|
|
|
|
|
|
+ String id = ctx.pathParam("id");
|
|
|
|
|
|
|
|
ObservedProperty observedProperty = new ObservedProperty();
|
|
ObservedProperty observedProperty = new ObservedProperty();
|
|
|
observedProperty.setId(id);
|
|
observedProperty.setId(id);
|
|
@@ -200,7 +200,7 @@ public class OGCSensorThingsGateway extends AbstractGateway {
|
|
|
|
|
|
|
|
router().get(create("Observations(:id)")).handler(ctx -> {
|
|
router().get(create("Observations(:id)")).handler(ctx -> {
|
|
|
RequestUriComponent uriComponent = parseUriToComponents(ctx.request());
|
|
RequestUriComponent uriComponent = parseUriToComponents(ctx.request());
|
|
|
- int id = Integer.parseInt(ctx.pathParam("id"));
|
|
|
|
|
|
|
+ String id = ctx.pathParam("id");
|
|
|
|
|
|
|
|
Observation observation = new Observation();
|
|
Observation observation = new Observation();
|
|
|
observation.setId(id);
|
|
observation.setId(id);
|
|
@@ -216,7 +216,7 @@ public class OGCSensorThingsGateway extends AbstractGateway {
|
|
|
|
|
|
|
|
router().get(create("FeaturesOfInterest(:id)")).handler(ctx -> {
|
|
router().get(create("FeaturesOfInterest(:id)")).handler(ctx -> {
|
|
|
RequestUriComponent uriComponent = parseUriToComponents(ctx.request());
|
|
RequestUriComponent uriComponent = parseUriToComponents(ctx.request());
|
|
|
- int id = Integer.parseInt(ctx.pathParam("id"));
|
|
|
|
|
|
|
+ String id = ctx.pathParam("id");
|
|
|
|
|
|
|
|
FeatureOfInterest featureOfInterest = new FeatureOfInterest();
|
|
FeatureOfInterest featureOfInterest = new FeatureOfInterest();
|
|
|
featureOfInterest.setId(id);
|
|
featureOfInterest.setId(id);
|
|
@@ -243,15 +243,7 @@ public class OGCSensorThingsGateway extends AbstractGateway {
|
|
|
|
|
|
|
|
static Sensor convertSensor(Unit afcUnit, RequestUriComponent uriComponent) {
|
|
static Sensor convertSensor(Unit afcUnit, RequestUriComponent uriComponent) {
|
|
|
Sensor ogcSensor = new Sensor();
|
|
Sensor ogcSensor = new Sensor();
|
|
|
-
|
|
|
|
|
- int ogcId;
|
|
|
|
|
- try {
|
|
|
|
|
- ogcId = Integer.parseInt(afcUnit.getResourceId());
|
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
|
- throw new NumberFormatException(format("Number %s can not be converted as integer.", afcUnit.getResourceId()));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- ogcSensor.setId(ogcId);
|
|
|
|
|
|
|
+ ogcSensor.setId(afcUnit.getResourceId());
|
|
|
ogcSensor.setSelfLink(format("%s/Sensors(%s)", uriComponent.getGatewayUri(), afcUnit.getResourceId()));
|
|
ogcSensor.setSelfLink(format("%s/Sensors(%s)", uriComponent.getGatewayUri(), afcUnit.getResourceId()));
|
|
|
ogcSensor.setDataStreamNavigationLink("unknown"); // TODO add Datastream navigation link
|
|
ogcSensor.setDataStreamNavigationLink("unknown"); // TODO add Datastream navigation link
|
|
|
ogcSensor.setName(afcUnit.getResourceType());
|
|
ogcSensor.setName(afcUnit.getResourceType());
|