From 329f6aba325ce4c4eaa5737674cfdacc0d55f5bc Mon Sep 17 00:00:00 2001 From: Rosario Trischitta Date: Tue, 6 Oct 2020 14:42:44 +0200 Subject: [PATCH 01/10] adding @Getter & @Setter annotation --- pom.xml | 6 + .../executor/AggregateRequestExecutor.java | 6 +- .../executor/DataRequestExecutor.java | 6 +- .../executor/ElementsRequestExecutor.java | 25 ++- .../ohsomeapi/executor/ExecutionUtils.java | 10 +- .../ohsomeapi/executor/RequestParameters.java | 61 +----- .../ohsomeapi/executor/RequestResource.java | 11 +- .../executor/UsersRequestExecutor.java | 8 +- .../inputprocessing/FuzzyScoreObject.java | 10 +- .../inputprocessing/InputProcessor.java | 12 +- .../inputprocessing/ProcessingData.java | 181 ++---------------- .../dataaggregationresponse/Attribution.java | 10 +- .../DefaultAggregationResponse.java | 29 +-- .../dataaggregationresponse/Metadata.java | 18 +- .../RatioResponse.java | 26 +-- .../dataaggregationresponse/RatioResult.java | 18 +- .../elements/ElementsResult.java | 11 +- .../groupbyresponse/GroupByObject.java | 6 +- .../groupbyresponse/GroupByResponse.java | 35 +--- .../groupbyresponse/GroupByResult.java | 10 +- .../RatioGroupByBoundaryResponse.java | 35 +--- .../groupbyresponse/RatioGroupByResult.java | 12 +- .../users/UsersResult.java | 15 +- .../metadataresponse/ExtractRegion.java | 20 +- .../metadataresponse/MetadataResponse.java | 17 +- .../metadataresponse/TemporalExtent.java | 10 +- .../output/rawdataresponse/DataResponse.java | 25 +-- .../GroupByBoundaryGeoJsonGenerator.java | 4 +- 28 files changed, 125 insertions(+), 512 deletions(-) diff --git a/pom.xml b/pom.xml index 854bf3f1..46c9c1b9 100644 --- a/pom.xml +++ b/pom.xml @@ -164,6 +164,12 @@ HikariCP ${hikaricp.version} + + org.projectlombok + lombok + 1.18.12 + provided + diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java index f6a4d5bb..a9370306 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java @@ -136,7 +136,7 @@ public Response aggregate() throws Exception { * computeCountLengthPerimeterAreaGbB} */ public Response aggregateGroupByBoundary() throws Exception { - processingData.setIsGroupByBoundary(true); + processingData.setGroupByBoundary(true); RequestParameters requestParameters = processingData.getRequestParameters(); MapReducer mapRed = inputProcessor.processParameters(); InputProcessingUtils utils = inputProcessor.getUtils(); @@ -285,7 +285,7 @@ private ImmutablePair, List> createCsvResponseForElements List rows = new LinkedList<>(); for (int i = 0; i < resultSet.length; i++) { GroupByResult groupByResult = (GroupByResult) resultSet[i]; - Object groupByObject = groupByResult.getGroupByObject(); + Object groupByObject = groupByResult.getGroupByObjectValue(); if (groupByObject instanceof Object[]) { Object[] groupByObjectArr = (Object[]) groupByObject; columnNames.add(groupByObjectArr[0].toString() + "_" + groupByObjectArr[1].toString()); @@ -349,7 +349,7 @@ private ElementsResult[] fillElementsResult(SortedMap idx, idx -> (P) arrGeoms.get(idx))); MapAggregator, OSMEntitySnapshot> mapAgg = mapRed.aggregateByTimestamp().aggregateByGeometry(geoms); - if (processingData.containsSimpleFeatureTypes()) { + if (processingData.isContainingSimpleFeatureTypes()) { mapAgg = inputProcessor.filterOnSimpleFeatures(mapAgg); } Optional filter = processingData.getFilterExpression(); diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/DataRequestExecutor.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/DataRequestExecutor.java index 321e8df6..c6cdbe09 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/DataRequestExecutor.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/DataRequestExecutor.java @@ -67,9 +67,9 @@ public DataRequestExecutor(RequestResource requestResource, ElementsGeometry ele * streamElementsResponse} */ public void extract() throws Exception { - inputProcessor.getProcessingData().setIsFullHistory(true); + inputProcessor.getProcessingData().setFullHistory(true); InputProcessor snapshotInputProcessor = new InputProcessor(servletRequest, true, false); - snapshotInputProcessor.getProcessingData().setIsFullHistory(true); + snapshotInputProcessor.getProcessingData().setFullHistory(true); MapReducer mapRedSnapshot = null; MapReducer mapRedContribution = null; if (DbConnData.db instanceof OSHDBIgnite) { @@ -269,7 +269,7 @@ private boolean addEntityToOutput(ProcessingData processingData, InputProcessing final Set simpleFeatureTypes, final boolean requiresGeometryTypeCheck, FilterExpression filterExpression, Geometry currentGeom, OSMEntity currentEntity) { boolean addToOutput; - if (processingData.containsSimpleFeatureTypes()) { + if (processingData.isContainingSimpleFeatureTypes()) { addToOutput = utils.checkGeometryOnSimpleFeatures(currentGeom, simpleFeatureTypes); } else if (requiresGeometryTypeCheck) { addToOutput = filterExpression.applyOSMGeometry(currentEntity, currentGeom); diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ElementsRequestExecutor.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ElementsRequestExecutor.java index 668d285c..58ca89b6 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ElementsRequestExecutor.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ElementsRequestExecutor.java @@ -1,6 +1,7 @@ package org.heigit.ohsome.ohsomeapi.executor; import java.text.DecimalFormat; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -10,6 +11,7 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; import java.util.stream.Collectors; @@ -25,13 +27,16 @@ import org.heigit.bigspatialdata.oshdb.api.generic.function.SerializableFunction; import org.heigit.bigspatialdata.oshdb.api.mapreducer.MapAggregator; import org.heigit.bigspatialdata.oshdb.api.mapreducer.MapReducer; +import org.heigit.bigspatialdata.oshdb.api.object.OSMContribution; import org.heigit.bigspatialdata.oshdb.api.object.OSMEntitySnapshot; import org.heigit.bigspatialdata.oshdb.osm.OSMEntity; import org.heigit.bigspatialdata.oshdb.osm.OSMType; import org.heigit.bigspatialdata.oshdb.util.OSHDBTag; import org.heigit.bigspatialdata.oshdb.util.OSHDBTimestamp; +import org.heigit.bigspatialdata.oshdb.util.celliterator.ContributionType; import org.heigit.bigspatialdata.oshdb.util.geometry.Geo; import org.heigit.bigspatialdata.oshdb.util.tagtranslator.TagTranslator; +import org.heigit.bigspatialdata.oshdb.util.time.ISODateTimeParser; import org.heigit.bigspatialdata.oshdb.util.time.TimestampFormatter; import org.heigit.ohsome.filter.FilterExpression; import org.heigit.ohsome.filter.FilterParser; @@ -167,7 +172,7 @@ public static

Response aggregateGroupByBoundary final long startTime = System.currentTimeMillis(); MapReducer mapRed = null; InputProcessor inputProcessor = new InputProcessor(servletRequest, isSnapshot, isDensity); - inputProcessor.getProcessingData().setIsGroupByBoundary(true); + inputProcessor.getProcessingData().setGroupByBoundary(true); String[] groupByKey = inputProcessor.splitParamOnComma( inputProcessor.createEmptyArrayIfNull(servletRequest.getParameterValues("groupByKey"))); if (groupByKey.length != 1) { @@ -193,7 +198,7 @@ public static

Response aggregateGroupByBoundary Map geoms = IntStream.range(0, arrGeoms.size()).boxed() .collect(Collectors.toMap(idx -> idx, idx -> (P) arrGeoms.get(idx))); MapAggregator mapAgg = mapRed.aggregateByGeometry(geoms); - if (processingData.containsSimpleFeatureTypes()) { + if (processingData.isContainingSimpleFeatureTypes()) { mapAgg = inputProcessor.filterOnSimpleFeatures(mapAgg); } Optional filter = processingData.getFilterExpression(); @@ -516,7 +521,7 @@ public static Response aggregateBasicFiltersRatio(RequestResource requestResourc final boolean isSnapshot = true; final boolean isDensity = false; InputProcessor inputProcessor = new InputProcessor(servletRequest, isSnapshot, isDensity); - inputProcessor.getProcessingData().setIsRatio(true); + inputProcessor.getProcessingData().setRatio(true); final MapReducer intermediateMapRed = inputProcessor.processParameters(); ProcessingData processingData = inputProcessor.getProcessingData(); RequestParameters requestParameters = processingData.getRequestParameters(); @@ -666,7 +671,7 @@ public static Response aggregateRatio(RequestResource requestResource, final boolean isSnapshot = true; final boolean isDensity = false; InputProcessor inputProcessor = new InputProcessor(servletRequest, isSnapshot, isDensity); - inputProcessor.getProcessingData().setIsRatio(true); + inputProcessor.getProcessingData().setRatio(true); inputProcessor.processParameters(); ProcessingData processingData = inputProcessor.getProcessingData(); ExecutionUtils exeUtils = new ExecutionUtils(processingData); @@ -767,8 +772,8 @@ public static

Response aggregateBasicFiltersRat final boolean isSnapshot = true; final boolean isDensity = false; InputProcessor inputProcessor = new InputProcessor(servletRequest, isSnapshot, isDensity); - inputProcessor.getProcessingData().setIsGroupByBoundary(true); - inputProcessor.getProcessingData().setIsRatio(true); + inputProcessor.getProcessingData().setGroupByBoundary(true); + inputProcessor.getProcessingData().setRatio(true); final MapReducer intermediateMapRed = inputProcessor.processParameters(); ProcessingData processingData = inputProcessor.getProcessingData(); RequestParameters requestParameters = processingData.getRequestParameters(); @@ -965,8 +970,8 @@ public static

Response aggregateRatioGroupByBou final boolean isSnapshot = true; final boolean isDensity = false; InputProcessor inputProcessor = new InputProcessor(servletRequest, isSnapshot, isDensity); - inputProcessor.getProcessingData().setIsGroupByBoundary(true); - inputProcessor.getProcessingData().setIsRatio(true); + inputProcessor.getProcessingData().setGroupByBoundary(true); + inputProcessor.getProcessingData().setRatio(true); inputProcessor.processParameters(); ProcessingData processingData = inputProcessor.getProcessingData(); if (processingData.getBoundaryType() == BoundaryType.NOBOUNDARY) { @@ -991,8 +996,8 @@ public static

Response aggregateRatioGroupByBou InputProcessor inputProcessorCombined = new InputProcessor(servletRequest, isSnapshot, isDensity); inputProcessorCombined.setProcessingData(processingDataCombined); - inputProcessorCombined.getProcessingData().setIsRatio(true); - inputProcessorCombined.getProcessingData().setIsGroupByBoundary(true); + inputProcessorCombined.getProcessingData().setRatio(true); + inputProcessorCombined.getProcessingData().setGroupByBoundary(true); MapReducer mapRed = inputProcessorCombined.processParameters(); ArrayList arrGeoms = new ArrayList<>(processingData.getBoundaryList()); // intentionally as check for P on Polygonal is already performed diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java index 56950c69..fe8d0991 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java @@ -780,7 +780,7 @@ private ImmutablePair, List> createCsvResponseForElements List rows = new LinkedList<>(); for (int i = 0; i < resultSet.length; i++) { GroupByResult groupByResult = (GroupByResult) resultSet[i]; - Object groupByObject = groupByResult.getGroupByObject(); + Object groupByObject = groupByResult.getGroupByObjectValue(); if (groupByObject instanceof Object[]) { Object[] groupByObjectArr = (Object[]) groupByObject; columnNames.add(groupByObjectArr[0].toString() + "_" + groupByObjectArr[1].toString()); @@ -816,9 +816,9 @@ private ImmutablePair, List> createCsvResponseForElements List rows = new LinkedList<>(); for (int i = 0; i < resultSet.length; i++) { RatioGroupByResult ratioGroupByResult = (RatioGroupByResult) resultSet[i]; - columnNames.add(ratioGroupByResult.getGroupByObject() + "_value"); - columnNames.add(ratioGroupByResult.getGroupByObject() + "_value2"); - columnNames.add(ratioGroupByResult.getGroupByObject() + "_ratio"); + columnNames.add(ratioGroupByResult.getGroupByObjectValue() + "_value"); + columnNames.add(ratioGroupByResult.getGroupByObjectValue() + "_value2"); + columnNames.add(ratioGroupByResult.getGroupByObjectValue() + "_ratio"); for (int j = 0; j < ratioGroupByResult.getRatioResult().length; j++) { RatioResult ratioResult = ratioGroupByResult.getRatioResult()[j]; if (i == 0) { @@ -854,7 +854,7 @@ private ImmutablePair, List> createCsvResponseForUsersGro List rows = new LinkedList<>(); for (int i = 0; i < resultSet.length; i++) { GroupByResult groupByResult = (GroupByResult) resultSet[i]; - columnNames.add(groupByResult.getGroupByObject().toString()); + columnNames.add(groupByResult.getGroupByObjectValue().toString()); for (int j = 0; j < groupByResult.getResult().length; j++) { UsersResult usersResult = (UsersResult) groupByResult.getResult()[j]; if (i == 0) { diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestParameters.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestParameters.java index 74184046..241a23d8 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestParameters.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestParameters.java @@ -1,6 +1,11 @@ package org.heigit.ohsome.ohsomeapi.executor; +import lombok.Getter; +import lombok.Setter; + /** Holds those parameters, which are relevant for every request. */ +@Getter +@Setter public class RequestParameters { private String requestMethod; @@ -37,60 +42,4 @@ public RequestParameters(String requestMethod, boolean isSnapshot, boolean isDen this.timeout = timeout; this.filter = filter; } - - public String getRequestMethod() { - return requestMethod; - } - - public boolean isSnapshot() { - return isSnapshot; - } - - public boolean isDensity() { - return isDensity; - } - - public String getBboxes() { - return bboxes; - } - - public String getBcircles() { - return bcircles; - } - - public String getBpolys() { - return bpolys; - } - - public String[] getTypes() { - return types; - } - - public String[] getKeys() { - return keys; - } - - public String[] getValues() { - return values; - } - - public String[] getTime() { - return time; - } - - public String getFormat() { - return format; - } - - public String getShowMetadata() { - return showMetadata; - } - - public double getTimeout() { - return timeout; - } - - public String getFilter() { - return filter; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestResource.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestResource.java index 18df27b2..ef3f9a5c 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestResource.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestResource.java @@ -1,9 +1,12 @@ package org.heigit.ohsome.ohsomeapi.executor; +import lombok.Getter; + /** * Enumeration defining the request resource (LENGTH, PERIMETER, AREA, COUNT, GROUPBYTAG, * GROUPBYKEY, RATIO, DATAEXTRACTION, CONTRIBUTION). */ +@Getter public enum RequestResource { LENGTH("length", "meters"), PERIMETER("perimeter", "meters"), AREA("area", "square meters"), COUNT("count", "absolute values"), GROUPBYTAG("", ""), GROUPBYKEY("", @@ -19,12 +22,4 @@ public enum RequestResource { this.description = description; this.unit = unit; } - - public String getDescription() { - return description; - } - - public String getUnit() { - return unit; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/UsersRequestExecutor.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/UsersRequestExecutor.java index d43ff969..16b7710e 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/UsersRequestExecutor.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/UsersRequestExecutor.java @@ -302,7 +302,7 @@ public static

Response countGroupByBoundary( long startTime = System.currentTimeMillis(); MapReducer mapRed = null; InputProcessor inputProcessor = new InputProcessor(servletRequest, false, isDensity); - inputProcessor.getProcessingData().setIsGroupByBoundary(true); + inputProcessor.getProcessingData().setGroupByBoundary(true); mapRed = inputProcessor.processParameters(); ProcessingData processingData = inputProcessor.getProcessingData(); RequestParameters requestParameters = processingData.getRequestParameters(); @@ -312,7 +312,7 @@ public static

Response countGroupByBoundary( .collect(Collectors.toMap(idx -> idx, idx -> (P) arrGeoms.get(idx))); MapAggregator, OSMContribution> mapAgg = mapRed.aggregateByTimestamp().aggregateByGeometry(geoms); - if (processingData.containsSimpleFeatureTypes()) { + if (processingData.isContainingSimpleFeatureTypes()) { mapAgg = inputProcessor.filterOnSimpleFeatures(mapAgg); } Optional filter = processingData.getFilterExpression(); @@ -342,8 +342,8 @@ public static

Response countGroupByBoundary( } if ("geojson".equalsIgnoreCase(requestParameters.getFormat())) { return GroupByResponse.of(new Attribution(URL, TEXT), Application.API_VERSION, metadata, - "FeatureCollection", - GroupByBoundaryGeoJsonGenerator.createGeoJsonFeatures(resultSet, processingData.getGeoJsonGeoms())); + "FeatureCollection", GroupByBoundaryGeoJsonGenerator.createGeoJsonFeatures(resultSet, + processingData.getGeoJsonGeoms())); } else if ("csv".equalsIgnoreCase(requestParameters.getFormat())) { exeUtils.writeCsvResponse(resultSet, servletResponse, exeUtils.createCsvTopComments(URL, TEXT, Application.API_VERSION, metadata)); diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/FuzzyScoreObject.java b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/FuzzyScoreObject.java index e1f9b00a..04d58a8d 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/FuzzyScoreObject.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/FuzzyScoreObject.java @@ -2,8 +2,10 @@ import java.math.BigDecimal; import java.util.Comparator; +import lombok.Getter; /** Holds those variables which are relevant for the string similarity algorithm 'Fuzzy Score'. */ +@Getter public class FuzzyScoreObject { private final BigDecimal fuzzyScore; @@ -22,12 +24,4 @@ public FuzzyScoreObject(BigDecimal fuzzyScore, String possibleParameter) { */ static Comparator sortByScore = (o1, o2) -> o1.fuzzyScore.compareTo(o2.fuzzyScore); - - public BigDecimal getFuzzyScore() { - return fuzzyScore; - } - - public String getPossibleParameter() { - return possibleParameter; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/InputProcessor.java b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/InputProcessor.java index eedd000b..11c1f9bb 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/InputProcessor.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/InputProcessor.java @@ -246,7 +246,7 @@ public MapReducer processParameters(ComputeMode if (!processingData.isRatio()) { mapRed = mapRed.osmType((EnumSet) processingData.getOsmTypes()); } - if (processingData.containsSimpleFeatureTypes() + if (processingData.isContainingSimpleFeatureTypes() // skip in ratio or groupByBoundary requests -> needs to be done later in the processing && !processingData.isRatio() && !processingData.isGroupByBoundary() && !processingData.isFullHistory()) { @@ -269,7 +269,7 @@ public MapReducer processParameters(ComputeMode // skip in ratio or groupByBoundary requests -> needs to be done later in the processing && !processingData.isRatio() && !processingData.isGroupByBoundary() && !processingData.isFullHistory()) { - processingData.setContainsSimpleFeatureTypes(true); + processingData.setContainingSimpleFeatureTypes(true); mapRed = filterOnGeometryType(mapRed, filterExpr); } } @@ -347,7 +347,7 @@ public MapReducer defineTypes(String[] types, if (types.length == 0 || types.length == 1 && types[0].isEmpty()) { processingData.setOsmTypes(EnumSet.of(OSMType.NODE, OSMType.WAY, OSMType.RELATION)); } else { - if (!processingData.containsSimpleFeatureTypes()) { + if (!processingData.isContainingSimpleFeatureTypes()) { for (String type : types) { if ("node".equalsIgnoreCase(type)) { processingData.getOsmTypes().add(OSMType.NODE); @@ -712,15 +712,15 @@ private void checkTypes(String[] types) { } else if (types.length == 0 || types.length == 1 && types[0].isEmpty()) { // do nothing } else { - processingData.setContainsSimpleFeatureTypes(!"node".equalsIgnoreCase(types[0]) + processingData.setContainingSimpleFeatureTypes(!"node".equalsIgnoreCase(types[0]) && !"way".equalsIgnoreCase(types[0]) && !"relation".equalsIgnoreCase(types[0])); for (String type : types) { if (utils.isSimpleFeatureType(type)) { - if (!processingData.containsSimpleFeatureTypes()) { + if (!processingData.isContainingSimpleFeatureTypes()) { throw new BadRequestException(ExceptionMessages.TYPES_PARAM); } } else { - if (processingData.containsSimpleFeatureTypes()) { + if (processingData.isContainingSimpleFeatureTypes()) { throw new BadRequestException(ExceptionMessages.TYPES_PARAM); } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/ProcessingData.java b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/ProcessingData.java index c9f480dc..c080a421 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/ProcessingData.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/ProcessingData.java @@ -3,7 +3,6 @@ import java.util.EnumSet; import java.util.List; import java.util.Optional; -import java.util.Set; import org.geojson.GeoJsonObject; import org.heigit.bigspatialdata.oshdb.osm.OSMType; import org.heigit.ohsome.filter.BinaryOperator; @@ -11,12 +10,21 @@ import org.heigit.ohsome.filter.GeometryTypeFilter; import org.heigit.ohsome.ohsomeapi.executor.RequestParameters; import org.locationtech.jts.geom.Geometry; +import lombok.Getter; +import lombok.Setter; /** Holds the relevant objects for processing the request and creating the response. */ +@Getter +@Setter public class ProcessingData { - + @Getter + @Setter private static Geometry dataPolyGeom; + @Getter + @Setter private static double timeout; + @Getter + @Setter private static int numberOfDataExtractionThreads = 1; private RequestParameters requestParameters; private String requestUrl; @@ -29,8 +37,10 @@ public class ProcessingData { private Geometry requestGeom; private List boundaryList; private GeoJsonObject[] geoJsonGeoms; - private boolean containsSimpleFeatureTypes; + private boolean isContainingSimpleFeatureTypes; private EnumSet simpleFeatureTypes; + @Getter + @Setter private static int numberOfClusterNodes; private boolean isRatio; private boolean isGroupByBoundary; @@ -45,170 +55,7 @@ public ProcessingData(RequestParameters requestParameters, String requestUrl) { this.isFullHistory = false; } - public static Geometry getDataPolyGeom() { - return dataPolyGeom; - } - - public static void setDataPolyGeom(Geometry dataPolyGeom) { - ProcessingData.dataPolyGeom = dataPolyGeom; - } - - public static double getTimeout() { - return timeout; - } - - public static void setTimeout(double timeout) { - ProcessingData.timeout = timeout; - } - - public RequestParameters getRequestParameters() { - return requestParameters; - } - - public void setRequestParameters(RequestParameters requestParameters) { - this.requestParameters = requestParameters; - } - - public String getRequestUrl() { - return requestUrl; - } - - public void setRequestUrl(String requestUrl) { - this.requestUrl = requestUrl; - } - - public BoundaryType getBoundaryType() { - return boundaryType; - } - - public void setBoundaryType(BoundaryType boundaryType) { - this.boundaryType = boundaryType; - } - - public String[] getBoundaryValues() { - return boundaryValues; - } - - public void setBoundaryValues(String[] boundaryValues) { - this.boundaryValues = boundaryValues; - } - - public String getBoundaryValuesGeoJson() { - return boundaryValuesGeoJson; - } - - public void setBoundaryValuesGeoJson(String boundaryValuesGeoJson) { - this.boundaryValuesGeoJson = boundaryValuesGeoJson; - } - - public Set getOsmTypes() { - return osmTypes; - } - - public void setOsmTypes(Set osmTypes) { - this.osmTypes = (EnumSet) osmTypes; - } - - public String getFormat() { - return format; - } - - public void setFormat(String format) { - this.format = format; - } - - public Geometry getRequestGeom() { - return requestGeom; - } - - public void setRequestGeom(Geometry requestGeom) { - this.requestGeom = requestGeom; - } - - public List getBoundaryList() { - return boundaryList; - } - - public void setBoundaryList(List boundaryList) { - this.boundaryList = boundaryList; - } - - public GeoJsonObject[] getGeoJsonGeoms() { - return geoJsonGeoms; - } - - public void setGeoJsonGeoms(GeoJsonObject[] geoJsonGeoms) { - this.geoJsonGeoms = geoJsonGeoms; - } - - public boolean isShowMetadata() { - return showMetadata; - } - - public void setShowMetadata(boolean showMetadata) { - this.showMetadata = showMetadata; - } - - public boolean containsSimpleFeatureTypes() { - return containsSimpleFeatureTypes; - } - - public void setContainsSimpleFeatureTypes(boolean containsSimpleFeatureTypes) { - this.containsSimpleFeatureTypes = containsSimpleFeatureTypes; - } - - public Set getSimpleFeatureTypes() { - return simpleFeatureTypes; - } - - public void setSimpleFeatureTypes(Set simpleFeatureTypes) { - this.simpleFeatureTypes = (EnumSet) simpleFeatureTypes; - } - - public static int getNumberOfClusterNodes() { - return numberOfClusterNodes; - } - - public static void setNumberOfClusterNodes(int numberOfClusterNodes) { - ProcessingData.numberOfClusterNodes = numberOfClusterNodes; - } - - public static int getNumberOfDataExtractionThreads() { - return numberOfDataExtractionThreads; - } - - public static void setNumberOfDataExtractionThreads(int numberOfDataExtractionsThreads) { - numberOfDataExtractionThreads = numberOfDataExtractionsThreads; - } - - public boolean isRatio() { - return isRatio; - } - - public void setIsRatio(boolean isRatio) { - this.isRatio = isRatio; - } - - public boolean isGroupByBoundary() { - return isGroupByBoundary; - } - - public void setIsGroupByBoundary(boolean isGroupByBoundary) { - this.isGroupByBoundary = isGroupByBoundary; - } - - public boolean isFullHistory() { - return isFullHistory; - } - - public void setIsFullHistory(boolean isFullHistory) { - this.isFullHistory = isFullHistory; - } - - public void setFilterExpression(FilterExpression filterExpression) { - this.filterExpression = filterExpression; - } - + // Override @Getter of Lombok public Optional getFilterExpression() { return Optional.ofNullable(this.filterExpression); } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Attribution.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Attribution.java index 9cd818ee..ec1f5ff1 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Attribution.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Attribution.java @@ -1,11 +1,13 @@ package org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse; import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; /** * Represents the attribution information contained in every json response. It holds a link to the * copyright and license information and a short copyright text. */ +@Getter public class Attribution { @ApiModelProperty(notes = "URL to the copyright and license info", required = true) @@ -17,12 +19,4 @@ public Attribution(String url, String text) { this.url = url; this.text = text; } - - public String getUrl() { - return url; - } - - public String getText() { - return text; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java index c3fe5ba2..df962ec0 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java @@ -4,15 +4,16 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; import org.geojson.Feature; +import lombok.Getter; /** * Represents the outer JSON response object for the data aggregation requests that do not use the * /groupBy resource. It contains attribution info, the version of the api, optional - * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Metadata - * Metadata} and the + * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Metadata Metadata} and the * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.elements.ElementsResult * ElementsResult} objects. */ +@Getter @JsonInclude(Include.NON_NULL) public class DefaultAggregationResponse implements Response { @@ -61,28 +62,4 @@ public static DefaultAggregationResponse of(Attribution attribution, String apiV response.features = features; return response; } - - public Attribution getAttribution() { - return attribution; - } - - public String getApiVersion() { - return apiVersion; - } - - public Metadata getMetadata() { - return metadata; - } - - public String getType() { - return type; - } - - public Feature[] getFeatures() { - return features; - } - - public Result[] getResult() { - return result; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Metadata.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Metadata.java index 4d8d41de..46d097c5 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Metadata.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Metadata.java @@ -3,11 +3,13 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; /** - * Represents the metadata JSON object containing the execution time, a description of the - * result values, as well as the request URL. + * Represents the metadata JSON object containing the execution time, a description of the result + * values, as well as the request URL. */ +@Getter @JsonInclude(Include.NON_NULL) public class Metadata { @@ -24,16 +26,4 @@ public Metadata(Long executionTime, String description, String requestUrl) { this.description = description; this.requestUrl = requestUrl; } - - public Long getExecutionTime() { - return executionTime; - } - - public String getDescription() { - return description; - } - - public String getRequestUrl() { - return requestUrl; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResponse.java index 1c7ea288..13fbcd98 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResponse.java @@ -3,15 +3,17 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; /** * Represents the whole JSON response object for the data aggregation response using the /ratio * resource. It contains the license and copyright, optional - * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Metadata - * Metadata}, as well as the results section showing - * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.RatioResult - * RatioResult} objects. + * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Metadata Metadata}, as well as + * the results section showing + * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.RatioResult RatioResult} + * objects. */ +@Getter @JsonInclude(Include.NON_NULL) public class RatioResponse implements Response { @@ -31,20 +33,4 @@ public RatioResponse(Attribution attribution, String apiVersion, Metadata metada this.metadata = metadata; this.ratioResult = ratioResult; } - - public Attribution getAttribution() { - return attribution; - } - - public String getApiVersion() { - return apiVersion; - } - - public Metadata getMetadata() { - return metadata; - } - - public RatioResult[] getRatioResult() { - return ratioResult; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResult.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResult.java index 36da0b00..a2954b6e 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResult.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResult.java @@ -1,11 +1,13 @@ package org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse; import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; /** * Represents the result JSON object for the /ratio resource containing the timestamp together with * two values and their resulting ratio. */ +@Getter public class RatioResult implements Result { @ApiModelProperty(notes = "Timestamp in the format YYYY-MM-DDThh:mm:ssZ", required = true) @@ -24,20 +26,4 @@ public RatioResult(String timestamp, double value, double value2, double ratio) this.value2 = value2; this.ratio = ratio; } - - public String getTimestamp() { - return timestamp; - } - - public double getValue() { - return value; - } - - public double getValue2() { - return value2; - } - - public double getRatio() { - return ratio; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/elements/ElementsResult.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/elements/ElementsResult.java index ea82d08a..ce674756 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/elements/ElementsResult.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/elements/ElementsResult.java @@ -2,12 +2,14 @@ import io.swagger.annotations.ApiModelProperty; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Result; +import lombok.Getter; /** * Represents the result JSON object for most of the /elements resources containing the timestamp * together with the corresponding value. */ +@Getter public class ElementsResult implements Result { @ApiModelProperty(notes = "Timestamp in the format YYYY-MM-DDThh:mm:ssZ", required = true) @@ -19,13 +21,4 @@ public ElementsResult(String timestamp, double value) { this.timestamp = timestamp; this.value = value; } - - public String getTimestamp() { - return timestamp; - } - - @Override - public double getValue() { - return value; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java index 0169bd13..9e0ff382 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java @@ -1,6 +1,7 @@ package org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.groupbyresponse; import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; /** * Abstract class used by the groupByResult classes: @@ -11,6 +12,7 @@ * RatioGroupByResult} * */ +@Getter public abstract class GroupByObject { @ApiModelProperty(notes = "Object on which the results are grouped on", required = true) @@ -19,8 +21,4 @@ public abstract class GroupByObject { public GroupByObject(Object groupByObjectValue) { this.groupByObjectValue = groupByObjectValue; } - - public Object getGroupByObject() { - return groupByObjectValue; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java index 1b927c74..b628663e 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java @@ -7,18 +7,23 @@ import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Attribution; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Metadata; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Response; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; /** * Represents the whole JSON response object for the data aggregation response using the * count|length|area|perimeter/groupBy resource. It contains an optional - * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Metadata - * Metadata}, the requested + * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Metadata Metadata}, the + * requested * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.groupbyresponse.GroupByResult * GroupByResult} for a JSON response and an identifier of the object. If the output format is * GeoJSON, the response includes a {@link org.geojson.Feature Feature} array, which holds the * respective objects with their timestamp-value pairs. */ +@Getter +@NoArgsConstructor(access = AccessLevel.PRIVATE) @JsonInclude(Include.NON_NULL) public class GroupByResponse implements Response { @@ -36,8 +41,6 @@ public class GroupByResponse implements Response { + "with their timestamp-value pairs", required = true) private GroupByResult[] groupByResult; - private GroupByResponse() {} - public GroupByResponse(Attribution attribution, String apiVersion, Metadata metadata, GroupByResult[] groupByUserResult) { this.attribution = attribution; @@ -57,28 +60,4 @@ public static GroupByResponse of(Attribution attribution, String apiVersion, Met response.features = features; return response; } - - public Attribution getAttribution() { - return attribution; - } - - public String getApiVersion() { - return apiVersion; - } - - public Metadata getMetadata() { - return metadata; - } - - public String getType() { - return type; - } - - public Feature[] getFeatures() { - return features; - } - - public GroupByResult[] getGroupByResult() { - return groupByResult; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResult.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResult.java index 5b539004..4e2dbe3b 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResult.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResult.java @@ -2,12 +2,14 @@ import io.swagger.annotations.ApiModelProperty; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Result; +import lombok.Getter; /** * Represents the groupBy result JSON object containing the groupBy value and the respective - * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Result Result} - * objects. The GroupByResult is only used in responses for groupBy requests. + * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Result Result} objects. The + * GroupByResult is only used in responses for groupBy requests. */ +@Getter public class GroupByResult extends GroupByObject { @ApiModelProperty(notes = "Result array holding timestamp-value pairs", required = true) @@ -17,8 +19,4 @@ public GroupByResult(Object groupByName, Result[] result) { super(groupByName); this.result = result; } - - public Result[] getResult() { - return result; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java index f121f806..72161e90 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java @@ -7,18 +7,23 @@ import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Attribution; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Metadata; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Response; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; /** * Represents the whole JSON response object for the data aggregation response using the * /ratio/groupBy/boundary resource. It contains an optional - * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Metadata - * Metadata} object, the requested + * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Metadata Metadata} object, the + * requested * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.groupbyresponse.RatioGroupByResult * RatioGroupByResult} for a JSON response and an identifier of the object. If the output format is * GeoJSON, the response includes a {@link org.geojson.Feature Feature} array, which holds the * respective objects with their timestamp-value pairs. */ +@Getter +@NoArgsConstructor(access = AccessLevel.PRIVATE) @JsonInclude(Include.NON_NULL) public class RatioGroupByBoundaryResponse implements Response { @@ -36,8 +41,6 @@ public class RatioGroupByBoundaryResponse implements Response { + "with their timestamp-value-value2-ratio values", required = true) private RatioGroupByResult[] groupByBoundaryResult; - private RatioGroupByBoundaryResponse() {} - public RatioGroupByBoundaryResponse(Attribution attribution, String apiVersion, Metadata metadata, RatioGroupByResult[] groupByBoundaryResult) { this.attribution = attribution; @@ -57,28 +60,4 @@ public static RatioGroupByBoundaryResponse of(Attribution attribution, String ap response.features = features; return response; } - - public Attribution getAttribution() { - return attribution; - } - - public String getApiVersion() { - return apiVersion; - } - - public Metadata getMetadata() { - return metadata; - } - - public String getType() { - return type; - } - - public Feature[] getFeatures() { - return features; - } - - public RatioGroupByResult[] getGroupByBoundaryResult() { - return groupByBoundaryResult; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java index d02364b6..090075c3 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java @@ -2,14 +2,14 @@ import io.swagger.annotations.ApiModelProperty; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.RatioResult; - +import lombok.Getter; /** * Represents the ratio-groupBy result JSON object containing the groupBy value and the respective - * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.RatioResult - * RatioResult} objects. The RatioGroupByResult is only used in responses for /ratio/groupBy - * requests. + * {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.RatioResult RatioResult} + * objects. The RatioGroupByResult is only used in responses for /ratio/groupBy requests. */ +@Getter public class RatioGroupByResult extends GroupByObject { @ApiModelProperty(notes = "RatioResult array holding timestamp, whole and part values", @@ -20,8 +20,4 @@ public RatioGroupByResult(Object groupByObject, RatioResult[] ratioResult) { super(groupByObject); this.ratioResult = ratioResult; } - - public RatioResult[] getRatioResult() { - return ratioResult; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/users/UsersResult.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/users/UsersResult.java index 63b0e6d2..e7557344 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/users/UsersResult.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/users/UsersResult.java @@ -4,11 +4,13 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Result; +import lombok.Getter; /** * Represents the result JSON object for the /users resource containing the from timestamp together * with the corresponding value. */ +@Getter @JsonInclude(Include.NON_NULL) public class UsersResult implements Result { @@ -24,17 +26,4 @@ public UsersResult(String fromTimestamp, String toTimestamp, double value) { this.toTimestamp = toTimestamp; this.value = value; } - - public String getFromTimestamp() { - return fromTimestamp; - } - - public String getToTimestamp() { - return toTimestamp; - } - - @Override - public double getValue() { - return value; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/ExtractRegion.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/ExtractRegion.java index 691ad2ed..49ec3c8a 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/ExtractRegion.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/ExtractRegion.java @@ -2,12 +2,14 @@ import com.fasterxml.jackson.databind.JsonNode; import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; /** - * Represents the result JSON object containing the spatial extent as GeoJSON, the - * {@link org.heigit.ohsome.ohsomeapi.output.metadataresponse.TemporalExtent - * TemporalExtent} and the replication sequence number of the data-extract. + * Represents the result JSON object containing the spatial extent as GeoJSON, the + * {@link org.heigit.ohsome.ohsomeapi.output.metadataresponse.TemporalExtent TemporalExtent} and the + * replication sequence number of the data-extract. */ +@Getter public class ExtractRegion { @ApiModelProperty(notes = "Spatial extent of this extract-region", required = true, position = 1) @@ -23,16 +25,4 @@ public ExtractRegion(JsonNode spatialExtent, TemporalExtent temporalExtent, this.temporalExtent = temporalExtent; this.replicationSequenceNumber = replicationSequenceNumber; } - - public JsonNode getSpatialExtent() { - return spatialExtent; - } - - public TemporalExtent getTemporalExtent() { - return temporalExtent; - } - - public int getReplicationSequenceNumber() { - return replicationSequenceNumber; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/MetadataResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/MetadataResponse.java index a01b4ebf..262f2b68 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/MetadataResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/MetadataResponse.java @@ -4,13 +4,14 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Attribution; +import lombok.Getter; /** * Represents the JSON response object for the /metadata request. It contains information about the * attribution, the version of the API and the - * {@link org.heigit.ohsome.ohsomeapi.output.metadataresponse.ExtractRegion - * ExtractRegion}. + * {@link org.heigit.ohsome.ohsomeapi.output.metadataresponse.ExtractRegion ExtractRegion}. */ +@Getter @JsonInclude(Include.NON_NULL) public class MetadataResponse { @@ -28,16 +29,4 @@ public MetadataResponse(Attribution attribution, String apiVersion, ExtractRegio this.apiVersion = apiVersion; this.extractRegion = extractRegion; } - - public Attribution getAttribution() { - return attribution; - } - - public String getApiVersion() { - return apiVersion; - } - - public ExtractRegion getExtractRegion() { - return extractRegion; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/TemporalExtent.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/TemporalExtent.java index 64918c46..59c08df0 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/TemporalExtent.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/TemporalExtent.java @@ -1,11 +1,13 @@ package org.heigit.ohsome.ohsomeapi.output.metadataresponse; import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; /** * Represents the result JSON object containing the from- and toTimestamps of the respective * data-extract. */ +@Getter public class TemporalExtent { @ApiModelProperty(notes = "Timestamp in the format YYYY-MM-DDThh:mm:ssZ", required = true) @@ -17,12 +19,4 @@ public TemporalExtent(String fromTimestamp, String toTimestamp) { this.fromTimestamp = fromTimestamp; this.toTimestamp = toTimestamp; } - - public String getToTimestamp() { - return toTimestamp; - } - - public String getFromTimestamp() { - return fromTimestamp; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/rawdataresponse/DataResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/rawdataresponse/DataResponse.java index 92826a00..33dbbd00 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/rawdataresponse/DataResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/rawdataresponse/DataResponse.java @@ -8,11 +8,13 @@ import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Metadata; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Response; import org.wololo.geojson.Feature; +import lombok.Getter; /** * Represents the whole GeoJSON response object for the data-extraction endpoints. */ @JsonInclude(Include.NON_NULL) +@Getter public class DataResponse implements Response { @ApiModelProperty(notes = "License and copyright info", required = true) @@ -34,27 +36,4 @@ public DataResponse(Attribution attribution, String apiVersion, Metadata metadat this.type = type; this.features = features; } - - @Override - public Attribution getAttribution() { - return attribution; - } - - @Override - public String getApiVersion() { - return apiVersion; - } - - @Override - public Metadata getMetadata() { - return metadata; - } - - public String getType() { - return type; - } - - public List getFeatures() { - return features; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java b/src/main/java/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java index bead19d0..d49d8df0 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java @@ -93,7 +93,7 @@ private static Feature[] generateGroupByResultGeoJson(GroupByObject[] results, } feature.setProperty("value", res.getValue()); // needed for /groupBy/boundary/groupBy/tag - if (results[groupByResultCount].getGroupByObject() instanceof Object[]) { + if (results[groupByResultCount].getGroupByObjectValue() instanceof Object[]) { feature.setGeometry(geojsonGeoms[boundaryCount]); if ((i + 1) % nestedGroupByNextBoundaryInterval == 0) { boundaryCount++; @@ -132,7 +132,7 @@ private static Feature fillGeojsonFeature(GroupByObject[] results, int groupByRe /** Fills a GeoJSON Feature with the groupByBoundaryId and the geometry. */ private static Feature makeGeojsonFeature(GroupByObject[] results, int groupByResultCount, String id) { - Object groupByBoundaryId = results[groupByResultCount].getGroupByObject(); + Object groupByBoundaryId = results[groupByResultCount].getGroupByObjectValue(); Feature feature = new Feature(); if (groupByBoundaryId instanceof Object[]) { Object[] groupByBoundaryIdArr = (Object[]) groupByBoundaryId; From 59b42404d4a0b7ccfc79cc2a1e32069d05ef0b56 Mon Sep 17 00:00:00 2001 From: Rosario Trischitta Date: Tue, 6 Oct 2020 16:37:36 +0200 Subject: [PATCH 02/10] changing variable name --- .../ohsomeapi/executor/AggregateRequestExecutor.java | 2 +- .../ohsome/ohsomeapi/executor/ExecutionUtils.java | 10 +++++----- .../groupbyresponse/GroupByObject.java | 6 +++--- .../utils/GroupByBoundaryGeoJsonGenerator.java | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java index a9370306..2e587c70 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java @@ -285,7 +285,7 @@ private ImmutablePair, List> createCsvResponseForElements List rows = new LinkedList<>(); for (int i = 0; i < resultSet.length; i++) { GroupByResult groupByResult = (GroupByResult) resultSet[i]; - Object groupByObject = groupByResult.getGroupByObjectValue(); + Object groupByObject = groupByResult.getGroupByObject(); if (groupByObject instanceof Object[]) { Object[] groupByObjectArr = (Object[]) groupByObject; columnNames.add(groupByObjectArr[0].toString() + "_" + groupByObjectArr[1].toString()); diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java index fe8d0991..56950c69 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java @@ -780,7 +780,7 @@ private ImmutablePair, List> createCsvResponseForElements List rows = new LinkedList<>(); for (int i = 0; i < resultSet.length; i++) { GroupByResult groupByResult = (GroupByResult) resultSet[i]; - Object groupByObject = groupByResult.getGroupByObjectValue(); + Object groupByObject = groupByResult.getGroupByObject(); if (groupByObject instanceof Object[]) { Object[] groupByObjectArr = (Object[]) groupByObject; columnNames.add(groupByObjectArr[0].toString() + "_" + groupByObjectArr[1].toString()); @@ -816,9 +816,9 @@ private ImmutablePair, List> createCsvResponseForElements List rows = new LinkedList<>(); for (int i = 0; i < resultSet.length; i++) { RatioGroupByResult ratioGroupByResult = (RatioGroupByResult) resultSet[i]; - columnNames.add(ratioGroupByResult.getGroupByObjectValue() + "_value"); - columnNames.add(ratioGroupByResult.getGroupByObjectValue() + "_value2"); - columnNames.add(ratioGroupByResult.getGroupByObjectValue() + "_ratio"); + 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]; if (i == 0) { @@ -854,7 +854,7 @@ private ImmutablePair, List> createCsvResponseForUsersGro List rows = new LinkedList<>(); for (int i = 0; i < resultSet.length; i++) { GroupByResult groupByResult = (GroupByResult) resultSet[i]; - columnNames.add(groupByResult.getGroupByObjectValue().toString()); + columnNames.add(groupByResult.getGroupByObject().toString()); for (int j = 0; j < groupByResult.getResult().length; j++) { UsersResult usersResult = (UsersResult) groupByResult.getResult()[j]; if (i == 0) { diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java index 9e0ff382..75deeb23 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java @@ -16,9 +16,9 @@ public abstract class GroupByObject { @ApiModelProperty(notes = "Object on which the results are grouped on", required = true) - protected Object groupByObjectValue; + protected Object groupByObject; - public GroupByObject(Object groupByObjectValue) { - this.groupByObjectValue = groupByObjectValue; + public GroupByObject(Object groupByObject) { + this.groupByObject = groupByObject; } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java b/src/main/java/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java index d49d8df0..bead19d0 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java @@ -93,7 +93,7 @@ private static Feature[] generateGroupByResultGeoJson(GroupByObject[] results, } feature.setProperty("value", res.getValue()); // needed for /groupBy/boundary/groupBy/tag - if (results[groupByResultCount].getGroupByObjectValue() instanceof Object[]) { + if (results[groupByResultCount].getGroupByObject() instanceof Object[]) { feature.setGeometry(geojsonGeoms[boundaryCount]); if ((i + 1) % nestedGroupByNextBoundaryInterval == 0) { boundaryCount++; @@ -132,7 +132,7 @@ private static Feature fillGeojsonFeature(GroupByObject[] results, int groupByRe /** Fills a GeoJSON Feature with the groupByBoundaryId and the geometry. */ private static Feature makeGeojsonFeature(GroupByObject[] results, int groupByResultCount, String id) { - Object groupByBoundaryId = results[groupByResultCount].getGroupByObjectValue(); + Object groupByBoundaryId = results[groupByResultCount].getGroupByObject(); Feature feature = new Feature(); if (groupByBoundaryId instanceof Object[]) { Object[] groupByBoundaryIdArr = (Object[]) groupByBoundaryId; From 741d71c4739cf1269f570de6c481b14a933ec7df Mon Sep 17 00:00:00 2001 From: Rosario Trischitta Date: Wed, 7 Oct 2020 12:29:30 +0200 Subject: [PATCH 03/10] adding constructor annotations --- .../ohsomeapi/executor/ExecutionUtils.java | 8 +++---- .../ohsomeapi/executor/RequestExecutor.java | 13 +++++------ .../ohsomeapi/executor/RequestParameters.java | 22 ++----------------- .../ohsomeapi/executor/RequestResource.java | 7 +++--- .../inputprocessing/FuzzyScoreObject.java | 10 ++------- .../inputprocessing/GeometryBuilder.java | 8 +++---- .../inputprocessing/InputProcessor.java | 8 +++---- .../dataaggregationresponse/Attribution.java | 7 ++---- .../DefaultAggregationResponse.java | 4 ++-- .../dataaggregationresponse/Metadata.java | 8 ++----- .../RatioResponse.java | 10 ++------- .../dataaggregationresponse/RatioResult.java | 9 ++------ .../elements/ElementsResult.java | 7 ++---- .../groupbyresponse/GroupByObject.java | 6 ++--- .../groupbyresponse/GroupByResponse.java | 15 ++++++------- .../RatioGroupByBoundaryResponse.java | 15 ++++++------- .../users/UsersResult.java | 8 ++----- .../metadataresponse/ExtractRegion.java | 9 ++------ .../metadataresponse/MetadataResponse.java | 8 ++----- .../metadataresponse/TemporalExtent.java | 7 ++---- .../output/rawdataresponse/DataResponse.java | 11 ++-------- 21 files changed, 63 insertions(+), 137 deletions(-) diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java index 56950c69..b2793256 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java @@ -91,20 +91,20 @@ import org.wololo.geojson.Point; import org.wololo.geojson.Polygon; import org.wololo.jts2geojson.GeoJSONWriter; +import lombok.NonNull; +import lombok.RequiredArgsConstructor; /** Holds helper methods that are used by the executor classes. */ +@RequiredArgsConstructor public class ExecutionUtils { private AtomicReference isFirst; + @NonNull private final ProcessingData processingData; private final DecimalFormat ratioDf = defineDecimalFormat("#.######"); private static final Point emptyPoint = new Point(new double[0]); private static final LineString emptyLine = new LineString(new double[0][0]); private static final Polygon emptyPolygon = new Polygon(new double[0][0][0]); - public ExecutionUtils(ProcessingData processingData) { - this.processingData = processingData; - } - /** Applies a filter on the given MapReducer object using the given parameters. */ public MapReducer snapshotFilter(MapReducer mapRed, Set osmTypes1, Set osmTypes2, Set simpleFeatureTypes1, diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestExecutor.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestExecutor.java index 358a6103..e826df73 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestExecutor.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestExecutor.java @@ -5,19 +5,18 @@ import javax.servlet.http.HttpServletResponse; import org.heigit.ohsome.ohsomeapi.oshdb.ExtractMetadata; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Attribution; +import lombok.NonNull; +import lombok.RequiredArgsConstructor; +@RequiredArgsConstructor public abstract class RequestExecutor { - + protected static final String URL = ExtractMetadata.attributionUrl; protected static final String TEXT = ExtractMetadata.attributionShort; protected static final Attribution ATTRIBUTION = new Attribution(URL, TEXT); public static final DecimalFormat df = ExecutionUtils.defineDecimalFormat("#.##"); + @NonNull protected final HttpServletRequest servletRequest; + @NonNull protected final HttpServletResponse servletResponse; - - public RequestExecutor(HttpServletRequest servletRequest, HttpServletResponse servletResponse) { - this.servletRequest = servletRequest; - this.servletResponse = servletResponse; - } - } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestParameters.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestParameters.java index 241a23d8..985ac528 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestParameters.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestParameters.java @@ -1,11 +1,13 @@ package org.heigit.ohsome.ohsomeapi.executor; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; /** Holds those parameters, which are relevant for every request. */ @Getter @Setter +@AllArgsConstructor public class RequestParameters { private String requestMethod; @@ -22,24 +24,4 @@ public class RequestParameters { private String showMetadata; private double timeout; private String filter; - - public RequestParameters(String requestMethod, boolean isSnapshot, boolean isDensity, - String bboxes, String bcircles, String bpolys, String[] types, String[] keys, String[] values, - String[] time, String format, String showMetadata, double timeout, String filter) { - - this.requestMethod = requestMethod; - this.isDensity = isDensity; - this.isSnapshot = isSnapshot; - this.bboxes = bboxes; - this.bcircles = bcircles; - this.bpolys = bpolys; - this.types = types; - this.keys = keys; - this.values = values; - this.time = time; - this.format = format; - this.showMetadata = showMetadata; - this.timeout = timeout; - this.filter = filter; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestResource.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestResource.java index ef3f9a5c..36a805c9 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestResource.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestResource.java @@ -1,5 +1,7 @@ package org.heigit.ohsome.ohsomeapi.executor; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; import lombok.Getter; /** @@ -7,6 +9,7 @@ * GROUPBYKEY, RATIO, DATAEXTRACTION, CONTRIBUTION). */ @Getter +@AllArgsConstructor(access = AccessLevel.PACKAGE) public enum RequestResource { LENGTH("length", "meters"), PERIMETER("perimeter", "meters"), AREA("area", "square meters"), COUNT("count", "absolute values"), GROUPBYTAG("", ""), GROUPBYKEY("", @@ -18,8 +21,4 @@ public enum RequestResource { private final String description; private final String unit; - RequestResource(String description, String unit) { - this.description = description; - this.unit = unit; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/FuzzyScoreObject.java b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/FuzzyScoreObject.java index 04d58a8d..63c5872b 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/FuzzyScoreObject.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/FuzzyScoreObject.java @@ -2,23 +2,17 @@ import java.math.BigDecimal; import java.util.Comparator; +import lombok.AllArgsConstructor; import lombok.Getter; /** Holds those variables which are relevant for the string similarity algorithm 'Fuzzy Score'. */ @Getter +@AllArgsConstructor public class FuzzyScoreObject { private final BigDecimal fuzzyScore; private final String possibleParameter; - /** - * Creates an object with the relevant variables for the string similarity algorithm. - */ - public FuzzyScoreObject(BigDecimal fuzzyScore, String possibleParameter) { - this.fuzzyScore = fuzzyScore; - this.possibleParameter = possibleParameter; - } - /** * Sorts the request parameters by matching score. */ diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/GeometryBuilder.java b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/GeometryBuilder.java index 5b445a14..6688da13 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/GeometryBuilder.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/GeometryBuilder.java @@ -30,19 +30,19 @@ import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.TransformException; import org.wololo.jts2geojson.GeoJSONReader; +import lombok.NonNull; +import lombok.RequiredArgsConstructor; /** * Includes methods to create and manipulate geometries derived from the boundary input parameters. */ +@RequiredArgsConstructor public class GeometryBuilder { GeometryFactory gf; + @NonNull private final ProcessingData processingData; - public GeometryBuilder(ProcessingData processingData) { - this.processingData = processingData; - } - public GeometryBuilder() { this.processingData = null; } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/InputProcessor.java b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/InputProcessor.java index 11c1f9bb..94d20fc5 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/InputProcessor.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/InputProcessor.java @@ -51,6 +51,8 @@ import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.Polygonal; import org.wololo.jts2geojson.GeoJSONWriter; +import lombok.NonNull; +import lombok.RequiredArgsConstructor; /** * Holds general input processing and validation methods and validates specific parameters given by @@ -59,6 +61,7 @@ * inputProcessingUtils from {@link org.heigit.ohsome.ohsomeapi.inputprocessing.InputProcessingUtils * InputProcessingUtils}. Throws exceptions depending on their validity. */ +@RequiredArgsConstructor public class InputProcessor { /* @@ -67,6 +70,7 @@ public class InputProcessor { public static final int COMPUTE_MODE_THRESHOLD = 130; private GeometryBuilder geomBuilder; private InputProcessingUtils utils; + @NonNull private ProcessingData processingData; private boolean isSnapshot; private boolean isDensity; @@ -100,10 +104,6 @@ public InputProcessor(HttpServletRequest servletRequest, boolean isSnapshot, boo this.requestParameters = servletRequest.getParameterMap(); } - public InputProcessor(ProcessingData processingData) { - this.processingData = processingData; - } - /** * @throws Exception thrown by * {@link org.heigit.ohsome.ohsomeapi.inputprocessing.InputProcessor#processParameters(ComputeMode) diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Attribution.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Attribution.java index ec1f5ff1..91e2a49f 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Attribution.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Attribution.java @@ -1,6 +1,7 @@ package org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse; import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; import lombok.Getter; /** @@ -8,15 +9,11 @@ * copyright and license information and a short copyright text. */ @Getter +@AllArgsConstructor public class Attribution { @ApiModelProperty(notes = "URL to the copyright and license info", required = true) private String url; @ApiModelProperty(notes = "Copyright info about the used data", required = true) private String text; - - public Attribution(String url, String text) { - this.url = url; - this.text = text; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java index df962ec0..c791819e 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java @@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import org.geojson.Feature; import lombok.Getter; +import lombok.NoArgsConstructor; /** * Represents the outer JSON response object for the data aggregation requests that do not use the @@ -14,6 +15,7 @@ * ElementsResult} objects. */ @Getter +@NoArgsConstructor @JsonInclude(Include.NON_NULL) public class DefaultAggregationResponse implements Response { @@ -30,8 +32,6 @@ public class DefaultAggregationResponse implements Response { @ApiModelProperty(notes = "ElementsResult holding timestamp-value pairs", required = true) private Result[] result; - private DefaultAggregationResponse() {} - /** Static factory method returning the whole JSON response. */ public static DefaultAggregationResponse of(Attribution attribution, String apiVersion, Metadata metadata, Result[] result) { diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Metadata.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Metadata.java index 46d097c5..73063a29 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Metadata.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/Metadata.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; import lombok.Getter; /** @@ -10,6 +11,7 @@ * values, as well as the request URL. */ @Getter +@AllArgsConstructor @JsonInclude(Include.NON_NULL) public class Metadata { @@ -20,10 +22,4 @@ public class Metadata { @ApiModelProperty(notes = "Request URL to which this whole output JSON was generated", required = true) private String requestUrl; - - public Metadata(Long executionTime, String description, String requestUrl) { - this.executionTime = executionTime; - this.description = description; - this.requestUrl = requestUrl; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResponse.java index 13fbcd98..2d919ac3 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResponse.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; import lombok.Getter; /** @@ -14,6 +15,7 @@ * objects. */ @Getter +@AllArgsConstructor @JsonInclude(Include.NON_NULL) public class RatioResponse implements Response { @@ -25,12 +27,4 @@ public class RatioResponse implements Response { private Metadata metadata; @ApiModelProperty(notes = "ElementsResult for /ratio requests", required = true) private RatioResult[] ratioResult; - - public RatioResponse(Attribution attribution, String apiVersion, Metadata metadata, - RatioResult[] ratioResult) { - this.attribution = attribution; - this.apiVersion = apiVersion; - this.metadata = metadata; - this.ratioResult = ratioResult; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResult.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResult.java index a2954b6e..3882d9f8 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResult.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/RatioResult.java @@ -1,6 +1,7 @@ package org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse; import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; import lombok.Getter; /** @@ -8,6 +9,7 @@ * two values and their resulting ratio. */ @Getter +@AllArgsConstructor public class RatioResult implements Result { @ApiModelProperty(notes = "Timestamp in the format YYYY-MM-DDThh:mm:ssZ", required = true) @@ -19,11 +21,4 @@ public class RatioResult implements Result { private double value2; @ApiModelProperty(notes = "Ratio of value2/value", required = true) private double ratio; - - public RatioResult(String timestamp, double value, double value2, double ratio) { - this.timestamp = timestamp; - this.value = value; - this.value2 = value2; - this.ratio = ratio; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/elements/ElementsResult.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/elements/ElementsResult.java index ce674756..40cba911 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/elements/ElementsResult.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/elements/ElementsResult.java @@ -2,6 +2,7 @@ import io.swagger.annotations.ApiModelProperty; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Result; +import lombok.AllArgsConstructor; import lombok.Getter; @@ -10,15 +11,11 @@ * together with the corresponding value. */ @Getter +@AllArgsConstructor public class ElementsResult implements Result { @ApiModelProperty(notes = "Timestamp in the format YYYY-MM-DDThh:mm:ssZ", required = true) private String timestamp; @ApiModelProperty(notes = "Value corresponding to the filter parameters", required = true) private double value; - - public ElementsResult(String timestamp, double value) { - this.timestamp = timestamp; - this.value = value; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java index 75deeb23..3ad9fe22 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java @@ -1,6 +1,7 @@ package org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.groupbyresponse; import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; import lombok.Getter; /** @@ -13,12 +14,9 @@ * */ @Getter +@AllArgsConstructor public abstract class GroupByObject { @ApiModelProperty(notes = "Object on which the results are grouped on", required = true) protected Object groupByObject; - - public GroupByObject(Object groupByObject) { - this.groupByObject = groupByObject; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java index b628663e..56f130af 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java @@ -10,6 +10,8 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; +import lombok.NonNull; +import lombok.RequiredArgsConstructor; /** @@ -24,14 +26,18 @@ */ @Getter @NoArgsConstructor(access = AccessLevel.PRIVATE) +@RequiredArgsConstructor @JsonInclude(Include.NON_NULL) public class GroupByResponse implements Response { @ApiModelProperty(notes = "License and copyright info", required = true) + @NonNull private Attribution attribution; @ApiModelProperty(notes = "Version of this api", required = true) + @NonNull private String apiVersion; @ApiModelProperty(notes = "Metadata describing the output") + @NonNull private Metadata metadata; @ApiModelProperty(notes = "Type of the GeoJSON", required = true) private String type; @@ -39,16 +45,9 @@ public class GroupByResponse implements Response { private Feature[] features; @ApiModelProperty(notes = "GroupByResult array holding the respective objects " + "with their timestamp-value pairs", required = true) + @NonNull private GroupByResult[] groupByResult; - public GroupByResponse(Attribution attribution, String apiVersion, Metadata metadata, - GroupByResult[] groupByUserResult) { - this.attribution = attribution; - this.apiVersion = apiVersion; - this.metadata = metadata; - this.groupByResult = groupByUserResult; - } - /** Static factory method returning the whole GeoJSON response. */ public static GroupByResponse of(Attribution attribution, String apiVersion, Metadata metadata, String type, Feature[] features) { diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java index 72161e90..a8c42ad2 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java @@ -10,6 +10,8 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; +import lombok.NonNull; +import lombok.RequiredArgsConstructor; /** @@ -24,14 +26,18 @@ */ @Getter @NoArgsConstructor(access = AccessLevel.PRIVATE) +@RequiredArgsConstructor @JsonInclude(Include.NON_NULL) public class RatioGroupByBoundaryResponse implements Response { @ApiModelProperty(notes = "License and copyright info", required = true) + @NonNull private Attribution attribution; @ApiModelProperty(notes = "Version of this api", required = true) + @NonNull private String apiVersion; @ApiModelProperty(notes = "Metadata describing the output") + @NonNull private Metadata metadata; @ApiModelProperty(notes = "Type of the GeoJSON", required = true) private String type; @@ -39,16 +45,9 @@ 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) + @NonNull private RatioGroupByResult[] groupByBoundaryResult; - public RatioGroupByBoundaryResponse(Attribution attribution, String apiVersion, Metadata metadata, - RatioGroupByResult[] groupByBoundaryResult) { - this.attribution = attribution; - this.apiVersion = apiVersion; - this.metadata = metadata; - this.groupByBoundaryResult = groupByBoundaryResult; - } - /** Static factory method returning the whole GeoJSON response. */ public static RatioGroupByBoundaryResponse of(Attribution attribution, String apiVersion, Metadata metadata, String type, Feature[] features) { diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/users/UsersResult.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/users/UsersResult.java index e7557344..6d8c838d 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/users/UsersResult.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/users/UsersResult.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Result; +import lombok.AllArgsConstructor; import lombok.Getter; /** @@ -11,6 +12,7 @@ * with the corresponding value. */ @Getter +@AllArgsConstructor @JsonInclude(Include.NON_NULL) public class UsersResult implements Result { @@ -20,10 +22,4 @@ public class UsersResult implements Result { private String toTimestamp; @ApiModelProperty(notes = "Value corresponding to the filter parameters", required = true) private double value; - - public UsersResult(String fromTimestamp, String toTimestamp, double value) { - this.fromTimestamp = fromTimestamp; - this.toTimestamp = toTimestamp; - this.value = value; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/ExtractRegion.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/ExtractRegion.java index 49ec3c8a..9ec465ef 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/ExtractRegion.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/ExtractRegion.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.databind.JsonNode; import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; import lombok.Getter; /** @@ -10,6 +11,7 @@ * replication sequence number of the data-extract. */ @Getter +@AllArgsConstructor public class ExtractRegion { @ApiModelProperty(notes = "Spatial extent of this extract-region", required = true, position = 1) @@ -18,11 +20,4 @@ public class ExtractRegion { private TemporalExtent temporalExtent; @ApiModelProperty(notes = "Replication sequence number", position = 3) private int replicationSequenceNumber; - - public ExtractRegion(JsonNode spatialExtent, TemporalExtent temporalExtent, - int replicationSequenceNumber) { - this.spatialExtent = spatialExtent; - this.temporalExtent = temporalExtent; - this.replicationSequenceNumber = replicationSequenceNumber; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/MetadataResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/MetadataResponse.java index 262f2b68..3ee94d7f 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/MetadataResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/MetadataResponse.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Attribution; +import lombok.AllArgsConstructor; import lombok.Getter; /** @@ -12,6 +13,7 @@ * {@link org.heigit.ohsome.ohsomeapi.output.metadataresponse.ExtractRegion ExtractRegion}. */ @Getter +@AllArgsConstructor @JsonInclude(Include.NON_NULL) public class MetadataResponse { @@ -23,10 +25,4 @@ public class MetadataResponse { notes = "Extract region object holding the spatial|temporal extend + attribution", required = true) private ExtractRegion extractRegion; - - public MetadataResponse(Attribution attribution, String apiVersion, ExtractRegion extractRegion) { - this.attribution = attribution; - this.apiVersion = apiVersion; - this.extractRegion = extractRegion; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/TemporalExtent.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/TemporalExtent.java index 59c08df0..0915591b 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/TemporalExtent.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/TemporalExtent.java @@ -1,6 +1,7 @@ package org.heigit.ohsome.ohsomeapi.output.metadataresponse; import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; import lombok.Getter; /** @@ -8,15 +9,11 @@ * data-extract. */ @Getter +@AllArgsConstructor public class TemporalExtent { @ApiModelProperty(notes = "Timestamp in the format YYYY-MM-DDThh:mm:ssZ", required = true) private String fromTimestamp; @ApiModelProperty(notes = "Timestamp in the format YYYY-MM-DDThh:mm:ssZ", required = true) private String toTimestamp; - - public TemporalExtent(String fromTimestamp, String toTimestamp) { - this.fromTimestamp = fromTimestamp; - this.toTimestamp = toTimestamp; - } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/rawdataresponse/DataResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/rawdataresponse/DataResponse.java index 33dbbd00..a4223431 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/rawdataresponse/DataResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/rawdataresponse/DataResponse.java @@ -8,6 +8,7 @@ import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Metadata; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Response; import org.wololo.geojson.Feature; +import lombok.AllArgsConstructor; import lombok.Getter; /** @@ -15,6 +16,7 @@ */ @JsonInclude(Include.NON_NULL) @Getter +@AllArgsConstructor public class DataResponse implements Response { @ApiModelProperty(notes = "License and copyright info", required = true) @@ -27,13 +29,4 @@ public class DataResponse implements Response { private String type; @ApiModelProperty(notes = "List of GeoJSON features containing the OSM data") private List features; - - public DataResponse(Attribution attribution, String apiVersion, Metadata metadata, String type, - List features) { - this.attribution = attribution; - this.apiVersion = apiVersion; - this.metadata = metadata; - this.type = type; - this.features = features; - } } From c58d3aa6c2271d630e0e4ca415ab0e0461e48fcc Mon Sep 17 00:00:00 2001 From: Rosario Trischitta Date: Wed, 7 Oct 2020 15:26:54 +0200 Subject: [PATCH 04/10] deleting some @NonNull annotations --- .../ohsome/ohsomeapi/executor/ExecutionUtils.java | 2 -- .../ohsomeapi/executor/RequestExecutor.java | 3 --- .../inputprocessing/GeometryBuilder.java | 2 -- .../groupbyresponse/GroupByResponse.java | 15 ++++++++------- .../RatioGroupByBoundaryResponse.java | 15 ++++++++------- .../ohsomeapi/controller/GetControllerTest.java | 2 +- 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java index b2793256..fde51dbe 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java @@ -91,14 +91,12 @@ import org.wololo.geojson.Point; import org.wololo.geojson.Polygon; import org.wololo.jts2geojson.GeoJSONWriter; -import lombok.NonNull; import lombok.RequiredArgsConstructor; /** Holds helper methods that are used by the executor classes. */ @RequiredArgsConstructor public class ExecutionUtils { private AtomicReference isFirst; - @NonNull private final ProcessingData processingData; private final DecimalFormat ratioDf = defineDecimalFormat("#.######"); private static final Point emptyPoint = new Point(new double[0]); diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestExecutor.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestExecutor.java index e826df73..57d4728d 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestExecutor.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestExecutor.java @@ -5,7 +5,6 @@ import javax.servlet.http.HttpServletResponse; import org.heigit.ohsome.ohsomeapi.oshdb.ExtractMetadata; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Attribution; -import lombok.NonNull; import lombok.RequiredArgsConstructor; @RequiredArgsConstructor @@ -15,8 +14,6 @@ public abstract class RequestExecutor { protected static final String TEXT = ExtractMetadata.attributionShort; protected static final Attribution ATTRIBUTION = new Attribution(URL, TEXT); public static final DecimalFormat df = ExecutionUtils.defineDecimalFormat("#.##"); - @NonNull protected final HttpServletRequest servletRequest; - @NonNull protected final HttpServletResponse servletResponse; } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/GeometryBuilder.java b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/GeometryBuilder.java index 6688da13..cc8fc156 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/GeometryBuilder.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/GeometryBuilder.java @@ -30,7 +30,6 @@ import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.TransformException; import org.wololo.jts2geojson.GeoJSONReader; -import lombok.NonNull; import lombok.RequiredArgsConstructor; /** @@ -40,7 +39,6 @@ public class GeometryBuilder { GeometryFactory gf; - @NonNull private final ProcessingData processingData; public GeometryBuilder() { diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java index 56f130af..b628663e 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java @@ -10,8 +10,6 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; /** @@ -26,18 +24,14 @@ */ @Getter @NoArgsConstructor(access = AccessLevel.PRIVATE) -@RequiredArgsConstructor @JsonInclude(Include.NON_NULL) public class GroupByResponse implements Response { @ApiModelProperty(notes = "License and copyright info", required = true) - @NonNull private Attribution attribution; @ApiModelProperty(notes = "Version of this api", required = true) - @NonNull private String apiVersion; @ApiModelProperty(notes = "Metadata describing the output") - @NonNull private Metadata metadata; @ApiModelProperty(notes = "Type of the GeoJSON", required = true) private String type; @@ -45,9 +39,16 @@ public class GroupByResponse implements Response { private Feature[] features; @ApiModelProperty(notes = "GroupByResult array holding the respective objects " + "with their timestamp-value pairs", required = true) - @NonNull private GroupByResult[] groupByResult; + public GroupByResponse(Attribution attribution, String apiVersion, Metadata metadata, + GroupByResult[] groupByUserResult) { + this.attribution = attribution; + this.apiVersion = apiVersion; + this.metadata = metadata; + this.groupByResult = groupByUserResult; + } + /** Static factory method returning the whole GeoJSON response. */ public static GroupByResponse of(Attribution attribution, String apiVersion, Metadata metadata, String type, Feature[] features) { diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java index a8c42ad2..72161e90 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java @@ -10,8 +10,6 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; /** @@ -26,18 +24,14 @@ */ @Getter @NoArgsConstructor(access = AccessLevel.PRIVATE) -@RequiredArgsConstructor @JsonInclude(Include.NON_NULL) public class RatioGroupByBoundaryResponse implements Response { @ApiModelProperty(notes = "License and copyright info", required = true) - @NonNull private Attribution attribution; @ApiModelProperty(notes = "Version of this api", required = true) - @NonNull private String apiVersion; @ApiModelProperty(notes = "Metadata describing the output") - @NonNull private Metadata metadata; @ApiModelProperty(notes = "Type of the GeoJSON", required = true) private String type; @@ -45,9 +39,16 @@ 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) - @NonNull private RatioGroupByResult[] groupByBoundaryResult; + public RatioGroupByBoundaryResponse(Attribution attribution, String apiVersion, Metadata metadata, + RatioGroupByResult[] groupByBoundaryResult) { + this.attribution = attribution; + this.apiVersion = apiVersion; + this.metadata = metadata; + this.groupByBoundaryResult = groupByBoundaryResult; + } + /** Static factory method returning the whole GeoJSON response. */ public static RatioGroupByBoundaryResponse of(Attribution attribution, String apiVersion, Metadata metadata, String type, Feature[] features) { diff --git a/src/test/java/org/heigit/ohsome/ohsomeapi/controller/GetControllerTest.java b/src/test/java/org/heigit/ohsome/ohsomeapi/controller/GetControllerTest.java index 79cb7cd8..8238a3a4 100644 --- a/src/test/java/org/heigit/ohsome/ohsomeapi/controller/GetControllerTest.java +++ b/src/test/java/org/heigit/ohsome/ohsomeapi/controller/GetControllerTest.java @@ -991,7 +991,7 @@ public void areaRatioFilterTest() { assertEquals(0.060083, response.getBody().get("ratioResult").get(0).get("ratio").asDouble(), 1e-6); } - + @Test public void ratioGroupByBoundaryFilterTest() { TestRestTemplate restTemplate = new TestRestTemplate(); From 59a95bf8a249f24c16e271cb9984ea8bb42ce146 Mon Sep 17 00:00:00 2001 From: Rosario Trischitta Date: Mon, 12 Oct 2020 11:49:53 +0200 Subject: [PATCH 05/10] Requested changes making construct private deleting construct annotation --- .../ohsome/ohsomeapi/inputprocessing/InputProcessor.java | 8 ++++---- .../DefaultAggregationResponse.java | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/InputProcessor.java b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/InputProcessor.java index 94d20fc5..695a2175 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/InputProcessor.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/InputProcessor.java @@ -51,8 +51,6 @@ import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.Polygonal; import org.wololo.jts2geojson.GeoJSONWriter; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; /** * Holds general input processing and validation methods and validates specific parameters given by @@ -61,7 +59,6 @@ * inputProcessingUtils from {@link org.heigit.ohsome.ohsomeapi.inputprocessing.InputProcessingUtils * InputProcessingUtils}. Throws exceptions depending on their validity. */ -@RequiredArgsConstructor public class InputProcessor { /* @@ -70,7 +67,6 @@ public class InputProcessor { public static final int COMPUTE_MODE_THRESHOLD = 130; private GeometryBuilder geomBuilder; private InputProcessingUtils utils; - @NonNull private ProcessingData processingData; private boolean isSnapshot; private boolean isDensity; @@ -82,6 +78,10 @@ public class InputProcessor { private boolean includeOSMMetadata; private boolean clipGeometry = true; + public InputProcessor(ProcessingData processingData) { + this.processingData = processingData; + } + public InputProcessor(HttpServletRequest servletRequest, boolean isSnapshot, boolean isDensity) { if (DbConnData.db instanceof OSHDBIgnite) { checkClusterAvailability(); diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java index c791819e..77868547 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; import org.geojson.Feature; +import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; @@ -15,7 +16,7 @@ * ElementsResult} objects. */ @Getter -@NoArgsConstructor +@NoArgsConstructor(access = AccessLevel.PRIVATE) @JsonInclude(Include.NON_NULL) public class DefaultAggregationResponse implements Response { From 360508a6be35a4b0c2d6a9e731d911f1840d3d9e Mon Sep 17 00:00:00 2001 From: Rosario Trischitta Date: Tue, 13 Oct 2020 11:42:30 +0200 Subject: [PATCH 06/10] Changing variable name fitting methods fitting junit tests --- .../dataaggregation/AreaController.java | 16 ++- .../executor/AggregateRequestExecutor.java | 2 +- .../ohsomeapi/executor/ExecutionUtils.java | 10 +- .../groupbyresponse/GroupByObject.java | 2 +- .../groupbyresponse/RatioGroupByResult.java | 4 +- .../GroupByBoundaryGeoJsonGenerator.java | 4 +- .../controller/GetControllerTest.java | 134 +++++++++--------- .../controller/PostControllerTest.java | 113 +++++++-------- 8 files changed, 144 insertions(+), 141 deletions(-) diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/controller/dataaggregation/AreaController.java b/src/main/java/org/heigit/ohsome/ohsomeapi/controller/dataaggregation/AreaController.java index 15f1f81e..fe019ccf 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/controller/dataaggregation/AreaController.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/controller/dataaggregation/AreaController.java @@ -37,14 +37,15 @@ public class AreaController { * @param servletResponse HttpServletResponse of the outgoing response * @return {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Response Response} * @throws Exception thrown by - * {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregate() aggregate} + * {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregate() + * aggregate} */ @ApiOperation(value = "Area of OSM elements", nickname = "area", response = DefaultAggregationResponse.class) @RequestMapping(value = "", method = {RequestMethod.GET, RequestMethod.POST}, produces = {"application/json", "text/csv"}) - public Response area(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws Exception - { + public Response area(HttpServletRequest servletRequest, HttpServletResponse servletResponse) + throws Exception { AggregateRequestExecutor executor = new AggregateRequestExecutor(RequestResource.AREA, servletRequest, servletResponse, false); return executor.aggregate(); @@ -77,7 +78,8 @@ public Response areaGroupByType(HttpServletRequest servletRequest, * @param servletResponse HttpServletResponse of the outgoing response * @return {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Response Response} * @throws Exception thrown by - * {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregateGroupByBoundary() aggregateGroupByBoundary} + * {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregateGroupByBoundary() + * aggregateGroupByBoundary} */ @ApiOperation( value = "Area of OSM elements grouped by the boundary (bboxes, bcircles, or bpolys)", @@ -174,7 +176,8 @@ public Response areaGroupByTag(HttpServletRequest servletRequest, * @param servletResponse HttpServletResponse of the outgoing response * @return {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Response Response} * @throws Exception thrown by - * {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregate() aggregate} + * {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregate() + * aggregate} */ @ApiOperation( value = "Density of OSM elements (area of elements divided " @@ -217,7 +220,8 @@ public Response areaDensityGroupByType(HttpServletRequest servletRequest, * @param servletResponse HttpServletResponse of the outgoing response * @return {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Response Response} * @throws Exception thrown by - * {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregateGroupByBoundary() aggregateGroupByBoundary} + * {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregateGroupByBoundary() + * aggregateGroupByBoundary} */ @ApiOperation( value = "Density of OSM elements grouped by the boundary (bboxes, bcircles, or bpolys)", diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java index 2e587c70..ac217a56 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java @@ -285,7 +285,7 @@ private ImmutablePair, List> createCsvResponseForElements List rows = new LinkedList<>(); for (int i = 0; i < resultSet.length; i++) { GroupByResult groupByResult = (GroupByResult) resultSet[i]; - Object groupByObject = groupByResult.getGroupByObject(); + Object groupByObject = groupByResult.getGroupByObjectId(); if (groupByObject instanceof Object[]) { Object[] groupByObjectArr = (Object[]) groupByObject; columnNames.add(groupByObjectArr[0].toString() + "_" + groupByObjectArr[1].toString()); diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java index fde51dbe..a03e3a8e 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java @@ -778,7 +778,7 @@ private ImmutablePair, List> createCsvResponseForElements List rows = new LinkedList<>(); for (int i = 0; i < resultSet.length; i++) { GroupByResult groupByResult = (GroupByResult) resultSet[i]; - Object groupByObject = groupByResult.getGroupByObject(); + Object groupByObject = groupByResult.getGroupByObjectId(); if (groupByObject instanceof Object[]) { Object[] groupByObjectArr = (Object[]) groupByObject; columnNames.add(groupByObjectArr[0].toString() + "_" + groupByObjectArr[1].toString()); @@ -814,9 +814,9 @@ private ImmutablePair, List> createCsvResponseForElements List rows = new LinkedList<>(); for (int i = 0; i < resultSet.length; i++) { RatioGroupByResult ratioGroupByResult = (RatioGroupByResult) resultSet[i]; - columnNames.add(ratioGroupByResult.getGroupByObject() + "_value"); - columnNames.add(ratioGroupByResult.getGroupByObject() + "_value2"); - columnNames.add(ratioGroupByResult.getGroupByObject() + "_ratio"); + columnNames.add(ratioGroupByResult.getGroupByObjectId() + "_value"); + columnNames.add(ratioGroupByResult.getGroupByObjectId() + "_value2"); + columnNames.add(ratioGroupByResult.getGroupByObjectId() + "_ratio"); for (int j = 0; j < ratioGroupByResult.getRatioResult().length; j++) { RatioResult ratioResult = ratioGroupByResult.getRatioResult()[j]; if (i == 0) { @@ -852,7 +852,7 @@ private ImmutablePair, List> createCsvResponseForUsersGro List rows = new LinkedList<>(); for (int i = 0; i < resultSet.length; i++) { GroupByResult groupByResult = (GroupByResult) resultSet[i]; - columnNames.add(groupByResult.getGroupByObject().toString()); + columnNames.add(groupByResult.getGroupByObjectId().toString()); for (int j = 0; j < groupByResult.getResult().length; j++) { UsersResult usersResult = (UsersResult) groupByResult.getResult()[j]; if (i == 0) { diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java index 3ad9fe22..d99b20f3 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByObject.java @@ -18,5 +18,5 @@ public abstract class GroupByObject { @ApiModelProperty(notes = "Object on which the results are grouped on", required = true) - protected Object groupByObject; + protected Object groupByObjectId; } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java index 090075c3..5f368b58 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java @@ -16,8 +16,8 @@ public class RatioGroupByResult extends GroupByObject { required = true) private RatioResult[] ratioResult; - public RatioGroupByResult(Object groupByObject, RatioResult[] ratioResult) { - super(groupByObject); + public RatioGroupByResult(Object groupByObjectId, RatioResult[] ratioResult) { + super(groupByObjectId); this.ratioResult = ratioResult; } } diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java b/src/main/java/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java index bead19d0..6328ee48 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/utils/GroupByBoundaryGeoJsonGenerator.java @@ -93,7 +93,7 @@ private static Feature[] generateGroupByResultGeoJson(GroupByObject[] results, } feature.setProperty("value", res.getValue()); // needed for /groupBy/boundary/groupBy/tag - if (results[groupByResultCount].getGroupByObject() instanceof Object[]) { + if (results[groupByResultCount].getGroupByObjectId() instanceof Object[]) { feature.setGeometry(geojsonGeoms[boundaryCount]); if ((i + 1) % nestedGroupByNextBoundaryInterval == 0) { boundaryCount++; @@ -132,7 +132,7 @@ private static Feature fillGeojsonFeature(GroupByObject[] results, int groupByRe /** Fills a GeoJSON Feature with the groupByBoundaryId and the geometry. */ private static Feature makeGeojsonFeature(GroupByObject[] results, int groupByResultCount, String id) { - Object groupByBoundaryId = results[groupByResultCount].getGroupByObject(); + Object groupByBoundaryId = results[groupByResultCount].getGroupByObjectId(); Feature feature = new Feature(); if (groupByBoundaryId instanceof Object[]) { Object[] groupByBoundaryIdArr = (Object[]) groupByBoundaryId; diff --git a/src/test/java/org/heigit/ohsome/ohsomeapi/controller/GetControllerTest.java b/src/test/java/org/heigit/ohsome/ohsomeapi/controller/GetControllerTest.java index 8238a3a4..04f328c1 100644 --- a/src/test/java/org/heigit/ohsome/ohsomeapi/controller/GetControllerTest.java +++ b/src/test/java/org/heigit/ohsome/ohsomeapi/controller/GetControllerTest.java @@ -24,6 +24,7 @@ /** Test class for all of the controller classes sending GET requests. */ public class GetControllerTest { + private static final String GROUP_BY_OBJECT_ID = "groupByObjectId"; private static String port = TestProperties.PORT1; private String server = TestProperties.SERVER; @@ -147,7 +148,7 @@ public void getElementsCountGroupByBoundaryTest() { assertEquals(2, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("boundary1")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("boundary1")) .findFirst().get().get("result").get(0).get("value").asInt()); } @@ -158,13 +159,15 @@ public void getElementsCountGroupByBoundaryGroupByTagTest() { + "/elements/count/groupBy/boundary/groupBy/tag?bboxes=8.68086,49.39948,8.69401,49.40609&" + "types=way&time=2016-11-09&keys=building&groupByKey=building&groupByValues=yes", JsonNode.class); - assertEquals(43, StreamSupport - .stream(Spliterators.spliteratorUnknownSize( - response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter( - jsonNode -> "boundary1".equalsIgnoreCase(jsonNode.get("groupByObject").get(0).asText()) - && "remainder".equalsIgnoreCase(jsonNode.get("groupByObject").get(1).asText())) - .findFirst().get().get("result").get(0).get("value").asInt(), 0); + assertEquals(43, + StreamSupport + .stream(Spliterators.spliteratorUnknownSize( + response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) + .filter(jsonNode -> "boundary1" + .equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(0).asText()) + && "remainder".equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(1).asText())) + .findFirst().get().get("result").get(0).get("value").asInt(), + 0); } @Test @@ -178,7 +181,7 @@ public void getElementsCountGroupByTypeTest() { StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("way")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("way")) .findFirst().get().get("result").get(0).get("value").asInt()); } @@ -192,7 +195,8 @@ public void getElementsCountGroupByTagTest() { assertEquals(8, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("building=yes")) + .filter( + jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("building=yes")) .findFirst().get().get("result").get(0).get("value").asInt()); } @@ -204,12 +208,11 @@ public void getElementsCountGroupByKeyTest() { server + port + "/elements/count/groupBy/key?bboxes=8.67859,49.41189,8.67964,49.41263" + "&types=way&time=2012-01-01&groupByKeys=building&showMetadata=true", JsonNode.class); - assertEquals(7, - StreamSupport - .stream(Spliterators.spliteratorUnknownSize( - response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("building")) - .findFirst().get().get("result").get(0).get("value").asInt()); + assertEquals(7, StreamSupport + .stream(Spliterators.spliteratorUnknownSize( + response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("building")) + .findFirst().get().get("result").get(0).get("value").asInt()); } @Test @@ -236,7 +239,7 @@ public void getElementsCountRatioGroupByBoundaryTest() { Spliterators.spliteratorUnknownSize( response.getBody().get("groupByBoundaryResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("boundary1")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("boundary1")) .findFirst().get().get("ratioResult").get(0).get("ratio").asDouble(), 1e-6); } @@ -261,7 +264,7 @@ public void getElementsCountDensityGroupByBoundaryTest() { assertEquals(334.85, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("boundary2")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("boundary2")) .findFirst().get().get("result").get(0).get("value").asDouble(), 0); } @@ -275,7 +278,7 @@ public void getElementsCountDensityGroupByTypeTest() { StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("way")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("way")) .findFirst().get().get("result").get(0).get("value").asDouble(), 0); } @@ -289,7 +292,7 @@ public void getElementsCountDensityGroupByTagTest() { assertEquals(61.48, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("remainder")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("remainder")) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } @@ -303,8 +306,8 @@ public void getElementsCountDensityGroupByBoundaryGroupByTagTest() { assertEquals(2.83, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> "b2".equalsIgnoreCase(jsonNode.get("groupByObject").get(0).asText()) - && "building=church".equalsIgnoreCase(jsonNode.get("groupByObject").get(1).asText())) + .filter(jsonNode -> "b2".equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(0).asText()) + && "building=church".equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(1).asText())) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } @@ -333,7 +336,7 @@ public void getElementsLengthGroupByBoundaryTest() { assertEquals(25.5, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("boundary1")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("boundary1")) .findFirst().get().get("result").get(0).get("value").asDouble(), 0); } @@ -343,13 +346,16 @@ public void getElementsLengthGroupByBoundaryGroupByTagTest() { ResponseEntity response = restTemplate.getForEntity(server + port + "/elements/length/groupBy/boundary/groupBy/tag?bboxes=8.68086,49.39948,8.69401,49.40609" + "&types=way&time=2017-11-25&keys=highway&groupByKey=highway", JsonNode.class); - assertEquals(670.61, StreamSupport - .stream(Spliterators.spliteratorUnknownSize( - response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> "boundary1" - .equalsIgnoreCase(jsonNode.get("groupByObject").get(0).asText()) - && "highway=secondary".equalsIgnoreCase(jsonNode.get("groupByObject").get(1).asText())) - .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); + assertEquals(670.61, + StreamSupport + .stream(Spliterators.spliteratorUnknownSize( + response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) + .filter(jsonNode -> "boundary1" + .equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(0).asText()) + && "highway=secondary" + .equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(1).asText())) + .findFirst().get().get("result").get(0).get("value").asDouble(), + 1e-6); } @Test @@ -363,7 +369,7 @@ public void getElementsLengthGroupByTypeTest() { StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("way")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("way")) .findFirst().get().get("result").get(0).get("value").asDouble(), 0); } @@ -378,7 +384,7 @@ public void getElementsLengthGroupByKeyTest() { assertEquals(3132.95, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("remainder")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("remainder")) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } @@ -391,7 +397,8 @@ public void getElementsLengthGroupByTagTest() { assertEquals(372.78, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("highway=path")) + .filter( + jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("highway=path")) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } @@ -418,7 +425,7 @@ public void getElementsLengthRatioGroupByBoundaryTest() { Spliterators.spliteratorUnknownSize( response.getBody().get("groupByBoundaryResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("boundary1")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("boundary1")) .findFirst().get().get("ratioResult").get(0).get("ratio").asDouble(), 1e-6); } @@ -442,7 +449,7 @@ public void getElementsLengthDensityGroupByTypeTest() { StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("way")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("way")) .findFirst().get().get("result").get(0).get("value").asDouble(), 0); } @@ -456,7 +463,8 @@ public void getElementsLengthDensityGroupByTagTest() { assertEquals(20495.63, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("railway=tram")) + .filter( + jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("railway=tram")) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } @@ -471,7 +479,7 @@ public void getElementsLengthDensityGroupByBoundaryTest() { assertEquals(48739.54, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("boundary2")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("boundary2")) .findFirst().get().get("result").get(0).get("value").asDouble(), 0); } @@ -482,14 +490,12 @@ public void getElementsLengthDensityGroupByBoundaryGroupByTagTest() { + "/elements/length/density/groupBy/boundary/groupBy/tag?bboxes=b1:8.68086,49.39948,8.69401" + ",49.40609|b2:8.68081,49.39943,8.69408,49.40605&types=way&time=2017-10-08&keys=highway&" + "groupByKey=highway", JsonNode.class); - assertEquals(73.71, - StreamSupport - .stream(Spliterators.spliteratorUnknownSize( - response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> "b1".equalsIgnoreCase(jsonNode.get("groupByObject").get(0).asText()) - && "highway=steps".equalsIgnoreCase(jsonNode.get("groupByObject").get(1).asText())) - .findFirst().get().get("result").get(0).get("value").asDouble(), - 1e-6); + assertEquals(73.71, StreamSupport + .stream(Spliterators.spliteratorUnknownSize( + response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) + .filter(jsonNode -> "b1".equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(0).asText()) + && "highway=steps".equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(1).asText())) + .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } /* @@ -518,7 +524,7 @@ public void getUsersCountGroupByTypeTest() { StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("way")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("way")) .findFirst().get().get("result").get(0).get("value").asInt()); } @@ -529,12 +535,11 @@ public void getUsersCountGroupByKeyTest() { server + port + "/users/count/groupBy/key?bboxes=8.67,49.39941,8.69545,49.4096&types=way" + "&time=2014-01-01,2015-01-01&groupByKeys=building", JsonNode.class); - assertEquals(30, - StreamSupport - .stream(Spliterators.spliteratorUnknownSize( - response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("building")) - .findFirst().get().get("result").get(0).get("value").asInt()); + assertEquals(30, StreamSupport + .stream(Spliterators.spliteratorUnknownSize( + response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("building")) + .findFirst().get().get("result").get(0).get("value").asInt()); } @Test @@ -547,7 +552,8 @@ public void getUsersCountGroupByTagTest() { assertEquals(29, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("building=yes")) + .filter( + jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("building=yes")) .findFirst().get().get("result").get(0).get("value").asInt()); } @@ -567,13 +573,11 @@ public void getUsersCountDensityGroupByTypeTest() { ResponseEntity response = restTemplate.getForEntity(server + port + "/users/count/density/groupBy/type?bboxes=8.67,49.39941,8.69545,49.4096&types=way," + "relation&time=2014-01-01,2015-01-01&keys=building", JsonNode.class); - assertEquals(3.83, - StreamSupport - .stream(Spliterators.spliteratorUnknownSize( - response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("relation")) - .findFirst().get().get("result").get(0).get("value").asDouble(), - 1e-6); + assertEquals(3.83, StreamSupport + .stream(Spliterators.spliteratorUnknownSize( + response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("relation")) + .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } @Test @@ -585,7 +589,7 @@ public void getUsersCountDensityGroupByTagTest() { assertEquals(26.84, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("remainder")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("remainder")) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } @@ -600,13 +604,13 @@ public void getUsersCountGroupByBoundaryTest() { StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("a")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("a")) .findFirst().get().get("result").get(0).get("value").asInt()); assertEquals(30, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("b")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("b")) .findFirst().get().get("result").get(0).get("value").asInt()); } @@ -621,7 +625,7 @@ public void getUsersCountDensityGroupByBoundaryTest() { StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("b")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("b")) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } @@ -1005,7 +1009,7 @@ public void ratioGroupByBoundaryFilterTest() { Spliterators.spliteratorUnknownSize( response.getBody().get("groupByBoundaryResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("b2")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("b2")) .findFirst().get().get("ratioResult").get(0).get("ratio").asDouble(), 1e-6); } diff --git a/src/test/java/org/heigit/ohsome/ohsomeapi/controller/PostControllerTest.java b/src/test/java/org/heigit/ohsome/ohsomeapi/controller/PostControllerTest.java index b3ba7150..44a3521e 100644 --- a/src/test/java/org/heigit/ohsome/ohsomeapi/controller/PostControllerTest.java +++ b/src/test/java/org/heigit/ohsome/ohsomeapi/controller/PostControllerTest.java @@ -25,6 +25,7 @@ /** Test class for all of the controller classes sending POST requests. */ public class PostControllerTest { + private static final String GROUP_BY_OBJECT_ID = "groupByObjectId"; private static String port = TestProperties.PORT2; private String server = TestProperties.SERVER; @@ -299,7 +300,7 @@ public void elementsPerimeterGroupByBoundaryTest() { assertEquals(2476.29, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("Weststadt")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("Weststadt")) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } @@ -316,14 +317,16 @@ public void elementsPerimeterGroupByBoundaryGroupByTagTest() { map.add("groupByValues", "residential,garage"); ResponseEntity response = restTemplate.postForEntity( server + port + "/elements/perimeter/groupBy/boundary/groupBy/tag", map, JsonNode.class); - assertEquals(3051.72, StreamSupport - .stream(Spliterators.spliteratorUnknownSize( - response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter( - jsonNode -> "Weststadt".equalsIgnoreCase(jsonNode.get("groupByObject").get(0).asText()) + assertEquals(3051.72, + StreamSupport + .stream(Spliterators.spliteratorUnknownSize( + response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) + .filter(jsonNode -> "Weststadt" + .equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(0).asText()) && "building=residential" - .equalsIgnoreCase(jsonNode.get("groupByObject").get(1).asText())) - .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); + .equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(1).asText())) + .findFirst().get().get("result").get(0).get("value").asDouble(), + 1e-6); } @Test @@ -340,7 +343,7 @@ public void elementsPerimeterGroupByTypeTest() { StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("way")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("way")) .findFirst().get().get("result").get(0).get("value").asDouble(), 0); } @@ -355,13 +358,11 @@ public void elementsPerimeterGroupByKeyTest() { map.add("groupByKeys", "building,highway"); ResponseEntity response = restTemplate .postForEntity(server + port + "/elements/perimeter/groupBy/key", map, JsonNode.class); - assertEquals(65283.12, - StreamSupport - .stream(Spliterators.spliteratorUnknownSize( - response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("building")) - .findFirst().get().get("result").get(0).get("value").asDouble(), - 0); + assertEquals(65283.12, StreamSupport + .stream(Spliterators.spliteratorUnknownSize( + response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("building")) + .findFirst().get().get("result").get(0).get("value").asDouble(), 0); } @Test @@ -377,7 +378,7 @@ public void elementsPerimeterGroupByTagTest() { assertEquals(20513.5, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("remainder")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("remainder")) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } @@ -417,7 +418,7 @@ public void elementsPerimeterRatioGroupByBoundaryTest() { Spliterators.spliteratorUnknownSize( response.getBody().get("groupByBoundaryResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("Neuenheim")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("Neuenheim")) .findFirst().get().get("ratioResult").get(0).get("ratio").asDouble(), 1e-6); } @@ -445,13 +446,11 @@ public void elementsPerimeterDensityGroupByTypeTest() { map.add("keys", "building"); ResponseEntity response = restTemplate.postForEntity( server + port + "/elements/perimeter/density/groupBy/type", map, JsonNode.class); - assertEquals(990.97, - StreamSupport - .stream(Spliterators.spliteratorUnknownSize( - response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("relation")) - .findFirst().get().get("result").get(0).get("value").asDouble(), - 0); + assertEquals(990.97, StreamSupport + .stream(Spliterators.spliteratorUnknownSize( + response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("relation")) + .findFirst().get().get("result").get(0).get("value").asDouble(), 0); } @Test @@ -469,7 +468,7 @@ public void elementsPerimeterDensityGroupByTagTest() { assertEquals(5073.93, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("remainder")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("remainder")) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } @@ -488,7 +487,7 @@ public void elementsPerimeterDensityGroupByBoundaryTest() { assertEquals(455, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("Neuenheim")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("Neuenheim")) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } @@ -507,9 +506,9 @@ public void elementsPerimeterDensityGroupByBoundaryGroupByTagTest() { assertEquals(93.75, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter( - jsonNode -> "Weststadt".equalsIgnoreCase(jsonNode.get("groupByObject").get(0).asText()) - && "building=house".equalsIgnoreCase(jsonNode.get("groupByObject").get(1).asText())) + .filter(jsonNode -> "Weststadt" + .equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(0).asText()) + && "building=house".equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(1).asText())) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); assertEquals(10, response.getBody().get("groupByResult").size()); } @@ -565,7 +564,7 @@ public void elementsAreaGroupByBoundaryTest() { assertEquals(1861.71, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("Neuenheim")) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("Neuenheim")) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } @@ -584,8 +583,8 @@ public void elementsAreaGroupByBoundaryGroupByTagTest() { assertEquals(639.63, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> "b1".equalsIgnoreCase(jsonNode.get("groupByObject").get(0).asText()) - && "building=garage".equalsIgnoreCase(jsonNode.get("groupByObject").get(1).asText())) + .filter(jsonNode -> "b1".equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(0).asText()) + && "building=garage".equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(1).asText())) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); assertEquals(3, response.getBody().get("groupByResult").size()); } @@ -600,13 +599,11 @@ public void elementsAreaGroupByTypeTest() { map.add("keys", "building"); ResponseEntity response = restTemplate .postForEntity(server + port + "/elements/area/groupBy/type", map, JsonNode.class); - assertEquals(15969.39, - StreamSupport - .stream(Spliterators.spliteratorUnknownSize( - response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("relation")) - .findFirst().get().get("result").get(0).get("value").asDouble(), - 0); + assertEquals(15969.39, StreamSupport + .stream(Spliterators.spliteratorUnknownSize( + response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("relation")) + .findFirst().get().get("result").get(0).get("value").asDouble(), 0); } @Test @@ -619,13 +616,11 @@ public void elementsAreaGroupByKeyTest() { map.add("groupByKeys", "building"); ResponseEntity response = restTemplate .postForEntity(server + port + "/elements/area/groupBy/key", map, JsonNode.class); - assertEquals(263900.49, - StreamSupport - .stream(Spliterators.spliteratorUnknownSize( - response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("building")) - .findFirst().get().get("result").get(0).get("value").asDouble(), - 0); + assertEquals(263900.49, StreamSupport + .stream(Spliterators.spliteratorUnknownSize( + response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) + .filter(jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("building")) + .findFirst().get().get("result").get(0).get("value").asDouble(), 0); } @Test @@ -641,7 +636,8 @@ public void elementsAreaGroupByTagTest() { assertEquals(244076.11, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("building=yes")) + .filter( + jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("building=yes")) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } @@ -720,7 +716,8 @@ public void elementsAreaDensityGroupByTagTest() { assertEquals(404281.84, StreamSupport .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("building=yes")) + .filter( + jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("building=yes")) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } @@ -751,15 +748,13 @@ public void elementsAreaDensityGroupByBoundaryGroupByTagTest() { map.add("groupByValues", "residential,garage"); ResponseEntity response = restTemplate.postForEntity( server + port + "/elements/area/density/groupBy/boundary/groupBy/tag", map, JsonNode.class); - assertEquals(7568.03, - StreamSupport - .stream(Spliterators.spliteratorUnknownSize( - response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) - .filter(jsonNode -> "b1".equalsIgnoreCase(jsonNode.get("groupByObject").get(0).asText()) - && "building=residential" - .equalsIgnoreCase(jsonNode.get("groupByObject").get(1).asText())) - .findFirst().get().get("result").get(0).get("value").asDouble(), - 1e-6); + assertEquals(7568.03, StreamSupport + .stream(Spliterators.spliteratorUnknownSize( + response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) + .filter(jsonNode -> "b1".equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(0).asText()) + && "building=residential" + .equalsIgnoreCase(jsonNode.get(GROUP_BY_OBJECT_ID).get(1).asText())) + .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); assertEquals(3, response.getBody().get("groupByResult").size()); } @@ -810,7 +805,7 @@ public void elementsAreaGroupByTagSimpleFeaturePolygonTest() { .stream(Spliterators.spliteratorUnknownSize( response.getBody().get("groupByResult").iterator(), Spliterator.ORDERED), false) .filter( - jsonNode -> jsonNode.get("groupByObject").asText().equalsIgnoreCase("leisure=pitch")) + jsonNode -> jsonNode.get(GROUP_BY_OBJECT_ID).asText().equalsIgnoreCase("leisure=pitch")) .findFirst().get().get("result").get(0).get("value").asDouble(), 1e-6); } From 12ed66272680a9eb452b419290643f3fcf94050c Mon Sep 17 00:00:00 2001 From: Rosario Trischitta Date: Thu, 29 Oct 2020 10:50:47 +0100 Subject: [PATCH 07/10] Request changed not prioritizing domain package import formatting pom.xml --- pom.xml | 4 ++-- .../org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 46c9c1b9..3f00240f 100644 --- a/pom.xml +++ b/pom.xml @@ -164,10 +164,10 @@ HikariCP ${hikaricp.version} - + org.projectlombok lombok - 1.18.12 + 1.18.16 provided diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java index a03e3a8e..52a67508 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/ExecutionUtils.java @@ -34,6 +34,7 @@ import java.util.stream.Stream; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.geojson.GeoJsonObject; @@ -91,7 +92,6 @@ import org.wololo.geojson.Point; import org.wololo.geojson.Polygon; import org.wololo.jts2geojson.GeoJSONWriter; -import lombok.RequiredArgsConstructor; /** Holds helper methods that are used by the executor classes. */ @RequiredArgsConstructor From b101a3b8e7eb2c6fdd6155eaca656245b1bbc928 Mon Sep 17 00:00:00 2001 From: Fabian Kowatsch Date: Fri, 30 Oct 2020 14:45:14 +0100 Subject: [PATCH 08/10] fixing indentation to use 2 spaces instead of one tab --- pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 3f00240f..bb7e9c3b 100644 --- a/pom.xml +++ b/pom.xml @@ -165,11 +165,11 @@ ${hikaricp.version} - org.projectlombok - lombok - 1.18.16 - provided - + org.projectlombok + lombok + 1.18.16 + provided + From 13e0ba8ba70675e6932c0b8948f104171d8b9708 Mon Sep 17 00:00:00 2001 From: Fabian Kowatsch Date: Fri, 30 Oct 2020 15:39:47 +0100 Subject: [PATCH 09/10] fixing sorting of imports to be in alphabetical order --- .../heigit/ohsome/ohsomeapi/executor/RequestExecutor.java | 2 +- .../ohsome/ohsomeapi/inputprocessing/GeometryBuilder.java | 2 +- .../ohsome/ohsomeapi/inputprocessing/ProcessingData.java | 4 ++-- .../dataaggregationresponse/DefaultAggregationResponse.java | 2 +- .../dataaggregationresponse/elements/ElementsResult.java | 2 +- .../groupbyresponse/GroupByResponse.java | 6 +++--- .../groupbyresponse/GroupByResult.java | 2 +- .../groupbyresponse/RatioGroupByBoundaryResponse.java | 6 +++--- .../groupbyresponse/RatioGroupByResult.java | 2 +- .../output/dataaggregationresponse/users/UsersResult.java | 2 +- .../ohsomeapi/output/metadataresponse/MetadataResponse.java | 2 +- .../ohsomeapi/output/rawdataresponse/DataResponse.java | 4 ++-- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestExecutor.java b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestExecutor.java index 57d4728d..86aacc93 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestExecutor.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/executor/RequestExecutor.java @@ -3,9 +3,9 @@ import java.text.DecimalFormat; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; import org.heigit.ohsome.ohsomeapi.oshdb.ExtractMetadata; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Attribution; -import lombok.RequiredArgsConstructor; @RequiredArgsConstructor public abstract class RequestExecutor { diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/GeometryBuilder.java b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/GeometryBuilder.java index cc8fc156..b595a2a5 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/GeometryBuilder.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/GeometryBuilder.java @@ -10,6 +10,7 @@ import javax.json.JsonObject; import javax.json.JsonReader; import javax.json.JsonValue; +import lombok.RequiredArgsConstructor; import org.geojson.GeoJsonObject; import org.geotools.geometry.jts.JTS; import org.geotools.referencing.CRS; @@ -30,7 +31,6 @@ import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.TransformException; import org.wololo.jts2geojson.GeoJSONReader; -import lombok.RequiredArgsConstructor; /** * Includes methods to create and manipulate geometries derived from the boundary input parameters. diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/ProcessingData.java b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/ProcessingData.java index c080a421..a6cf33fb 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/ProcessingData.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/inputprocessing/ProcessingData.java @@ -3,6 +3,8 @@ import java.util.EnumSet; import java.util.List; import java.util.Optional; +import lombok.Getter; +import lombok.Setter; import org.geojson.GeoJsonObject; import org.heigit.bigspatialdata.oshdb.osm.OSMType; import org.heigit.ohsome.filter.BinaryOperator; @@ -10,8 +12,6 @@ import org.heigit.ohsome.filter.GeometryTypeFilter; import org.heigit.ohsome.ohsomeapi.executor.RequestParameters; import org.locationtech.jts.geom.Geometry; -import lombok.Getter; -import lombok.Setter; /** Holds the relevant objects for processing the request and creating the response. */ @Getter diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java index 77868547..a25d50a3 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/DefaultAggregationResponse.java @@ -3,10 +3,10 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; -import org.geojson.Feature; import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; +import org.geojson.Feature; /** * Represents the outer JSON response object for the data aggregation requests that do not use the diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/elements/ElementsResult.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/elements/ElementsResult.java index 40cba911..094606c2 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/elements/ElementsResult.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/elements/ElementsResult.java @@ -1,9 +1,9 @@ package org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.elements; import io.swagger.annotations.ApiModelProperty; -import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Result; import lombok.AllArgsConstructor; import lombok.Getter; +import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Result; /** diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java index b628663e..82d25d6f 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResponse.java @@ -3,13 +3,13 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; import org.geojson.Feature; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Attribution; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Metadata; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Response; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; /** diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResult.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResult.java index 4e2dbe3b..a6a7d809 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResult.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/GroupByResult.java @@ -1,8 +1,8 @@ package org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.groupbyresponse; import io.swagger.annotations.ApiModelProperty; -import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Result; import lombok.Getter; +import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Result; /** * Represents the groupBy result JSON object containing the groupBy value and the respective diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java index 72161e90..47ac2fd4 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByBoundaryResponse.java @@ -3,13 +3,13 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; import org.geojson.Feature; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Attribution; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Metadata; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Response; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; /** diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java index 5f368b58..26b5b4ac 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/groupbyresponse/RatioGroupByResult.java @@ -1,8 +1,8 @@ package org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.groupbyresponse; import io.swagger.annotations.ApiModelProperty; -import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.RatioResult; import lombok.Getter; +import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.RatioResult; /** * Represents the ratio-groupBy result JSON object containing the groupBy value and the respective diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/users/UsersResult.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/users/UsersResult.java index 6d8c838d..6dfb0926 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/users/UsersResult.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/dataaggregationresponse/users/UsersResult.java @@ -3,9 +3,9 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; -import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Result; import lombok.AllArgsConstructor; import lombok.Getter; +import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Result; /** * Represents the result JSON object for the /users resource containing the from timestamp together diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/MetadataResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/MetadataResponse.java index 3ee94d7f..97178b4c 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/MetadataResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/metadataresponse/MetadataResponse.java @@ -3,9 +3,9 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; -import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Attribution; import lombok.AllArgsConstructor; import lombok.Getter; +import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Attribution; /** * Represents the JSON response object for the /metadata request. It contains information about the diff --git a/src/main/java/org/heigit/ohsome/ohsomeapi/output/rawdataresponse/DataResponse.java b/src/main/java/org/heigit/ohsome/ohsomeapi/output/rawdataresponse/DataResponse.java index a4223431..0507ad7c 100644 --- a/src/main/java/org/heigit/ohsome/ohsomeapi/output/rawdataresponse/DataResponse.java +++ b/src/main/java/org/heigit/ohsome/ohsomeapi/output/rawdataresponse/DataResponse.java @@ -4,12 +4,12 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import io.swagger.annotations.ApiModelProperty; import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Attribution; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Metadata; import org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Response; import org.wololo.geojson.Feature; -import lombok.AllArgsConstructor; -import lombok.Getter; /** * Represents the whole GeoJSON response object for the data-extraction endpoints. From 47ecb469ee78f11614e6fd95bb859214b64ef779 Mon Sep 17 00:00:00 2001 From: Rosario Trischitta Date: Mon, 2 Nov 2020 12:04:40 +0100 Subject: [PATCH 10/10] add lombok in the prerequisite field --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index aaef5905..a984d168 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ These instructions will get you a copy of the project up and running on your loc * [Java 11](https://openjdk.java.net/projects/jdk/11/) or higher * [Apache Maven 3.5](https://maven.apache.org/download.cgi) or higher +* [Lombok 1.18.16](https://projectlombok.org/download) or higher. Please check the [requirements](https://projectlombok.org/setup/overview) for your IDE * data: [download](http://downloads.ohsome.org/) it directly, or work through a guide on [how to prepare a new OSHDB extract](https://github.com/GIScience/oshdb/blob/master/oshdb-tool/etl/README.md) ### Setting-up/Running