Skip to content

Commit

Permalink
adding new parameter ‘format’
Browse files Browse the repository at this point in the history
can accept json (default) and geojson
will be used in /count/groupBy/boundary
  • Loading branch information
kowatsch committed Jun 22, 2018
1 parent b5d1704 commit 1aaba30
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,8 @@ public GroupByResponse postAreaGroupByUser(String bboxes, String bcircles, Strin
produces = "application/json", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public GroupByResponse postAreaGroupByBoundary(String bboxes, String bcircles, String bpolys,
String[] types, String[] keys, String[] values, String[] userids, String[] time,
String showMetadata) throws UnsupportedOperationException, Exception, BadRequestException {
String format, String showMetadata)
throws UnsupportedOperationException, Exception, BadRequestException {

return ElementsRequestExecutor.executeCountLengthPerimeterAreaGroupByBoundary(
RequestResource.AREA, new RequestParameters(true, true, false, bboxes, bcircles, bpolys,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,15 @@ public GroupByResponse getCountGroupByBoundary(
required = false) String[] userids,
@ApiParam(hidden = true) @RequestParam(value = "time", defaultValue = "",
required = false) String[] time,
@ApiParam(hidden = true) @RequestParam(value = "format", defaultValue = "",
required = false) String format,
@ApiParam(hidden = true) @RequestParam(value = "showMetadata",
defaultValue = "false") String showMetadata)
throws UnsupportedOperationException, Exception {

return ElementsRequestExecutor.executeCountLengthPerimeterAreaGroupByBoundary(
RequestResource.COUNT, new RequestParameters(false, true, false, bboxes, bcircles, bpolys,
types, keys, values, userids, time, showMetadata));
RequestResource.COUNT, RequestParameters.of(false, true, false, bboxes, bcircles, bpolys,
types, keys, values, userids, time, format, showMetadata));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,8 @@ RequestResource.LENGTH, new RequestParameters(true, true, false, bboxes, bcircle
produces = "application/json", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public GroupByResponse postLengthGroupByBoundary(String bboxes, String bcircles, String bpolys,
String[] types, String[] keys, String[] values, String[] userids, String[] time,
String showMetadata) throws UnsupportedOperationException, Exception, BadRequestException {
String format, String showMetadata)
throws UnsupportedOperationException, Exception, BadRequestException {

return ElementsRequestExecutor.executeCountLengthPerimeterAreaGroupByBoundary(
RequestResource.LENGTH, new RequestParameters(true, true, false, bboxes, bcircles, bpolys,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,8 @@ RequestResource.PERIMETER, new RequestParameters(true, true, false, bboxes, bcir
produces = "application/json", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public GroupByResponse postPerimeterGroupByBoundary(String bboxes, String bcircles, String bpolys,
String[] types, String[] keys, String[] values, String[] userids, String[] time,
String showMetadata) throws UnsupportedOperationException, Exception, BadRequestException {
String format, String showMetadata)
throws UnsupportedOperationException, Exception, BadRequestException {

return ElementsRequestExecutor.executeCountLengthPerimeterAreaGroupByBoundary(
RequestResource.PERIMETER, new RequestParameters(true, true, false, bboxes, bcircles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public class UsersController {
* {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.controller.dataAggregation.CountController#getCount(String, String, String, String[], String[], String[], String[], String[], String)
* getCount} method.
*
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.groupByResponse.GroupByResponse
* GroupByTypeResponseContent}
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.DefaultAggregationResponse
* DefaultAggregationResponse}
*/
@ApiOperation(value = "Count of OSM users")
@RequestMapping(value = "/count", method = RequestMethod.GET, produces = "application/json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ public class RequestParameters {
private String[] values;
private String[] userids;
private String[] time;
private String format;
private String showMetadata;

private RequestParameters() {

}

public RequestParameters(boolean isPost, boolean isSnapshot, boolean isDensity, String bboxes, String bcircles,
String bpolys, String[] types, String[] keys, String[] values, String[] userids,
String[] time, String showMetadata) {
Expand All @@ -33,6 +38,28 @@ public RequestParameters(boolean isPost, boolean isSnapshot, boolean isDensity,
this.time = time;
this.showMetadata = showMetadata;
}

public static RequestParameters of(boolean isPost, boolean isSnapshot, boolean isDensity, String bboxes, String bcircles,
String bpolys, String[] types, String[] keys, String[] values, String[] userids,
String[] time, String format, String showMetadata) {

RequestParameters rPs = new RequestParameters();
rPs.isPost = isPost;
rPs.isSnapshot = isSnapshot;
rPs.isDensity = isDensity;
rPs.bboxes = bboxes;
rPs.bcircles = bcircles;
rPs.bpolys = bpolys;
rPs.types = types;
rPs.keys = keys;
rPs.values = values;
rPs.userids = userids;
rPs.time = time;
rPs.format = format;
rPs.showMetadata = showMetadata;

return rPs;
}

public boolean isPost() {
return isPost;
Expand Down Expand Up @@ -77,6 +104,10 @@ public String[] getUserids() {
public String[] getTime() {
return time;
}

public String getFormat() {
return format;
}

public String getShowMetadata() {
return showMetadata;
Expand Down

0 comments on commit 1aaba30

Please sign in to comment.