From 158c6603d8ba678eb7b6955c24652f49aa01ff72 Mon Sep 17 00:00:00 2001 From: Rosario Trischitta Date: Tue, 9 Feb 2021 16:42:54 +0100 Subject: [PATCH] style: change objects names in responses --- .../heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java | 5 ++--- .../output/dataaggregationresponse/RatioResponse.java | 2 +- .../groupbyresponse/RatioGroupByBoundaryResponse.java | 6 +++--- .../groupbyresponse/RatioGroupByResult.java | 6 +++--- .../ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java | 4 ++-- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/main/lombok/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java b/src/main/lombok/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java index f98d4d99..539d8a01 100644 --- a/src/main/lombok/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java +++ b/src/main/lombok/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java @@ -61,7 +61,6 @@ import org.heigit.bigspatialdata.oshdb.util.tagtranslator.OSMTag; import org.heigit.bigspatialdata.oshdb.util.tagtranslator.TagTranslator; import org.heigit.bigspatialdata.oshdb.util.time.TimestampFormatter; -import org.heigit.ohsome.filter.FilterExpression; import org.heigit.ohsome.ohsomeapi.Application; import org.heigit.ohsome.ohsomeapi.controller.rawdata.ElementsGeometry; import org.heigit.ohsome.ohsomeapi.exception.DatabaseAccessException; @@ -792,8 +791,8 @@ private ImmutablePair, List> createCsvResponseForElements columnNames.add(ratioGroupByResult.getGroupByObject() + "_value"); columnNames.add(ratioGroupByResult.getGroupByObject() + "_value2"); columnNames.add(ratioGroupByResult.getGroupByObject() + "_ratio"); - for (int j = 0; j < ratioGroupByResult.getRatioResult().length; j++) { - RatioResult ratioResult = ratioGroupByResult.getRatioResult()[j]; + for (int j = 0; j < ratioGroupByResult.getResult().length; j++) { + RatioResult ratioResult = ratioGroupByResult.getResult()[j]; if (i == 0) { String[] row = new String[resultSet.length * 3 + 1]; row[0] = ratioResult.getTimestamp(); diff --git a/src/main/lombok/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResponse.java b/src/main/lombok/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResponse.java index 2d919ac3..352f5f1d 100644 --- a/src/main/lombok/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResponse.java +++ b/src/main/lombok/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResponse.java @@ -26,5 +26,5 @@ public class RatioResponse implements Response { @ApiModelProperty(notes = "Metadata describing the output") private Metadata metadata; @ApiModelProperty(notes = "ElementsResult for /ratio requests", required = true) - private RatioResult[] ratioResult; + private RatioResult[] result; } diff --git a/src/main/lombok/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java b/src/main/lombok/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java index 47ac2fd4..2fa17d55 100644 --- a/src/main/lombok/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java +++ b/src/main/lombok/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java @@ -39,14 +39,14 @@ public class RatioGroupByBoundaryResponse implements Response { private Feature[] features; @ApiModelProperty(notes = "RatioGroupByResult array holding the respective objects " + "with their timestamp-value-value2-ratio values", required = true) - private RatioGroupByResult[] groupByBoundaryResult; + private RatioGroupByResult[] groupByResult; public RatioGroupByBoundaryResponse(Attribution attribution, String apiVersion, Metadata metadata, - RatioGroupByResult[] groupByBoundaryResult) { + RatioGroupByResult[] groupByResult) { this.attribution = attribution; this.apiVersion = apiVersion; this.metadata = metadata; - this.groupByBoundaryResult = groupByBoundaryResult; + this.groupByResult = groupByResult; } /** Static factory method returning the whole GeoJSON response. */ diff --git a/src/main/lombok/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java b/src/main/lombok/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java index 6c437fcd..192ed16d 100644 --- a/src/main/lombok/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java +++ b/src/main/lombok/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java @@ -14,10 +14,10 @@ public class RatioGroupByResult extends GroupByObject { @ApiModelProperty(notes = "RatioResult array holding timestamp, whole and part values", required = true) - private RatioResult[] ratioResult; + private RatioResult[] result; - public RatioGroupByResult(Object groupByObject, RatioResult[] ratioResult) { + public RatioGroupByResult(Object groupByObject, RatioResult[] result) { super(groupByObject); - this.ratioResult = ratioResult; + this.result = result; } } diff --git a/src/main/lombok/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java b/src/main/lombok/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java index bead19d0..d83cb93d 100644 --- a/src/main/lombok/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java +++ b/src/main/lombok/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java @@ -38,11 +38,11 @@ private static Feature[] generateRatioGroupByResultGeoJson(GroupByObject[] resul int tstampCount) { Feature[] features; RatioGroupByResult[] groupByResults = (RatioGroupByResult[]) results; - int resultLength = groupByResults[0].getRatioResult().length; + int resultLength = groupByResults[0].getResult().length; int featuresLength = groupByResultsLength * resultLength; features = new Feature[featuresLength]; for (int i = 0; i < featuresLength; i++) { - RatioResult result = groupByResults[groupByResultCount].getRatioResult()[tstampCount]; + RatioResult result = groupByResults[groupByResultCount].getResult()[tstampCount]; String tstamp = result.getTimestamp(); Feature feature = fillGeojsonFeature(results, groupByResultCount, tstamp); feature.setProperty("value", result.getValue());