use of de.ii.ogcapi.foundation.domain.OgcApiQueryParameter in project ldproxy by interactive-instruments.
the class AbstractEndpointTileSingleCollection method computeDefinition.
protected ApiEndpointDefinition computeDefinition(OgcApiDataV2 apiData, String apiEntrypoint, int sortPriority, String basePath, String subSubPath, List<String> tags) {
ImmutableApiEndpointDefinition.Builder definitionBuilder = new ImmutableApiEndpointDefinition.Builder().apiEntrypoint(apiEntrypoint).sortPriority(sortPriority);
final String path = basePath + subSubPath;
final HttpMethods method = HttpMethods.GET;
final List<OgcApiPathParameter> pathParameters = getPathParameters(extensionRegistry, apiData, path);
final Optional<OgcApiPathParameter> optCollectionIdParam = pathParameters.stream().filter(param -> param.getName().equals("collectionId")).findAny();
if (optCollectionIdParam.isEmpty()) {
LOGGER.error("Path parameter 'collectionId' missing for resource at path '" + path + "'. The GET method will not be available.");
} else {
final OgcApiPathParameter collectionIdParam = optCollectionIdParam.get();
boolean explode = collectionIdParam.getExplodeInOpenApi(apiData);
final List<String> collectionIds = (explode) ? collectionIdParam.getValues(apiData) : ImmutableList.of("{collectionId}");
for (String collectionId : collectionIds) {
List<OgcApiQueryParameter> queryParameters = getQueryParameters(extensionRegistry, apiData, path, collectionId);
String operationSummary = "fetch a tile of the collection '" + collectionId + "'";
Optional<String> operationDescription = Optional.of("The tile in the requested tiling scheme ('{tileMatrixSetId}'), " + "on the requested zoom level ('{tileMatrix}'), with the requested grid coordinates ('{tileRow}', '{tileCol}') is returned. " + "The tile has a single layer with all selected features in the bounding box of the tile with the requested properties.");
String resourcePath = path.replace("{collectionId}", collectionId);
ImmutableOgcApiResourceData.Builder resourceBuilder = new ImmutableOgcApiResourceData.Builder().path(resourcePath).pathParameters(pathParameters);
ApiOperation operation = addOperation(apiData, HttpMethods.GET, queryParameters, collectionId, subSubPath, operationSummary, operationDescription, tags);
if (operation != null)
resourceBuilder.putOperations(method.name(), operation);
definitionBuilder.putResources(resourcePath, resourceBuilder.build());
}
}
return definitionBuilder.build();
}
use of de.ii.ogcapi.foundation.domain.OgcApiQueryParameter in project ldproxy by interactive-instruments.
the class AbstractEndpointTileSetMultiCollection method computeDefinition.
protected ApiEndpointDefinition computeDefinition(OgcApiDataV2 apiData, String apiEntrypoint, int sortPriority, String path, List<String> tags) {
ImmutableApiEndpointDefinition.Builder definitionBuilder = new ImmutableApiEndpointDefinition.Builder().apiEntrypoint(apiEntrypoint).sortPriority(sortPriority);
HttpMethods method = HttpMethods.GET;
List<OgcApiPathParameter> pathParameters = getPathParameters(extensionRegistry, apiData, path);
List<OgcApiQueryParameter> queryParameters = getQueryParameters(extensionRegistry, apiData, path);
String operationSummary = "retrieve information about a tile set";
Optional<String> operationDescription = Optional.of("This operation fetches information about a tile set.");
ImmutableOgcApiResourceAuxiliary.Builder resourceBuilderSet = new ImmutableOgcApiResourceAuxiliary.Builder().path(path).pathParameters(pathParameters);
ApiOperation operation = addOperation(apiData, queryParameters, path, operationSummary, operationDescription, tags);
if (operation != null)
resourceBuilderSet.putOperations(method.name(), operation);
definitionBuilder.putResources(path, resourceBuilderSet.build());
return definitionBuilder.build();
}
use of de.ii.ogcapi.foundation.domain.OgcApiQueryParameter in project ldproxy by interactive-instruments.
the class EndpointStylesCollection method computeDefinition.
protected ApiEndpointDefinition computeDefinition(OgcApiDataV2 apiData) {
ImmutableApiEndpointDefinition.Builder definitionBuilder = new ImmutableApiEndpointDefinition.Builder().apiEntrypoint("collections").sortPriority(ApiEndpointDefinition.SORT_PRIORITY_STYLES_COLLECTION);
final String subSubPath = "/styles";
final String path = "/collections/{collectionId}" + subSubPath;
final HttpMethods method = HttpMethods.GET;
final List<OgcApiPathParameter> pathParameters = getPathParameters(extensionRegistry, apiData, path);
final Optional<OgcApiPathParameter> optCollectionIdParam = pathParameters.stream().filter(param -> param.getName().equals("collectionId")).findAny();
if (!optCollectionIdParam.isPresent()) {
LOGGER.error("Path parameter 'collectionId' missing for resource at path '" + path + "'. The GET method will not be available.");
} else {
final OgcApiPathParameter collectionIdParam = optCollectionIdParam.get();
boolean explode = collectionIdParam.getExplodeInOpenApi(apiData);
final List<String> collectionIds = (explode) ? collectionIdParam.getValues(apiData) : ImmutableList.of("{collectionId}");
for (String collectionId : collectionIds) {
List<OgcApiQueryParameter> queryParameters = getQueryParameters(extensionRegistry, apiData, path, collectionId);
String operationSummary = "retrieve a list of the available styles for collection `" + collectionId + "`";
Optional<String> operationDescription = Optional.of("This operation fetches the set of styles available for this collection. " + "For each style the id, a title, links to the stylesheet of the style in each supported encoding, " + "and the link to the metadata is provided.");
String resourcePath = path.replace("{collectionId}", collectionId);
ImmutableOgcApiResourceSet.Builder resourceBuilder = new ImmutableOgcApiResourceSet.Builder().path(resourcePath).pathParameters(pathParameters).subResourceType("Style");
ApiOperation operation = addOperation(apiData, HttpMethods.GET, queryParameters, collectionId, subSubPath, operationSummary, operationDescription, TAGS);
if (operation != null)
resourceBuilder.putOperations(method.name(), operation);
definitionBuilder.putResources(resourcePath, resourceBuilder.build());
}
}
return definitionBuilder.build();
}
use of de.ii.ogcapi.foundation.domain.OgcApiQueryParameter in project ldproxy by interactive-instruments.
the class AbstractEndpointTileMultiCollection method computeDefinition.
protected ApiEndpointDefinition computeDefinition(OgcApiDataV2 apiData, String apiEntrypoint, int sortPriority, String path, List<String> tags) {
ImmutableApiEndpointDefinition.Builder definitionBuilder = new ImmutableApiEndpointDefinition.Builder().apiEntrypoint(apiEntrypoint).sortPriority(sortPriority);
final HttpMethods method = HttpMethods.GET;
final List<OgcApiPathParameter> pathParameters = getPathParameters(extensionRegistry, apiData, path);
final List<OgcApiQueryParameter> queryParameters = getQueryParameters(extensionRegistry, apiData, path);
String operationSummary = "fetch a tile with multiple layers, one per collection";
Optional<String> operationDescription = Optional.of("The tile in the requested tiling scheme ('{tileMatrixSetId}'), " + "on the requested zoom level ('{tileMatrix}'), with the requested grid coordinates ('{tileRow}', '{tileCol}') is returned. " + "The tile has one layer per collection with all selected features in the bounding box of the tile with the requested properties.");
ImmutableOgcApiResourceData.Builder resourceBuilder = new ImmutableOgcApiResourceData.Builder().path(path).pathParameters(pathParameters);
ApiOperation operation = addOperation(apiData, queryParameters, path, operationSummary, operationDescription, tags);
if (operation != null)
resourceBuilder.putOperations(method.name(), operation);
definitionBuilder.putResources(path, resourceBuilder.build());
return definitionBuilder.build();
}
use of de.ii.ogcapi.foundation.domain.OgcApiQueryParameter in project ldproxy by interactive-instruments.
the class AbstractEndpointTileSetSingleCollection method computeDefinition.
protected ApiEndpointDefinition computeDefinition(OgcApiDataV2 apiData, String apiEntrypoint, int sortPriority, String basePath, String subSubPath, List<String> tags) {
ImmutableApiEndpointDefinition.Builder definitionBuilder = new ImmutableApiEndpointDefinition.Builder().apiEntrypoint(apiEntrypoint).sortPriority(sortPriority);
final String path = basePath + subSubPath;
final HttpMethods method = HttpMethods.GET;
final List<OgcApiPathParameter> pathParameters = getPathParameters(extensionRegistry, apiData, path);
final Optional<OgcApiPathParameter> optCollectionIdParam = pathParameters.stream().filter(param -> param.getName().equals("collectionId")).findAny();
if (optCollectionIdParam.isEmpty()) {
LOGGER.error("Path parameter 'collectionId' missing for resource at path '" + path + "'. The GET method will not be available.");
} else {
final OgcApiPathParameter collectionIdParam = optCollectionIdParam.get();
boolean explode = collectionIdParam.getExplodeInOpenApi(apiData);
final List<String> collectionIds = (explode) ? collectionIdParam.getValues(apiData) : ImmutableList.of("{collectionId}");
for (String collectionId : collectionIds) {
List<OgcApiQueryParameter> queryParameters = getQueryParameters(extensionRegistry, apiData, path, collectionId);
String operationSummary = "retrieve information about a tile set";
Optional<String> operationDescription = Optional.of("This operation fetches information about a tile set.");
String resourcePath = path.replace("{collectionId}", collectionId);
ImmutableOgcApiResourceAuxiliary.Builder resourceBuilder = new ImmutableOgcApiResourceAuxiliary.Builder().path(resourcePath).pathParameters(pathParameters);
ApiOperation operation = addOperation(apiData, HttpMethods.GET, queryParameters, collectionId, subSubPath, operationSummary, operationDescription, tags);
if (operation != null)
resourceBuilder.putOperations(method.name(), operation);
definitionBuilder.putResources(resourcePath, resourceBuilder.build());
}
}
return definitionBuilder.build();
}
Aggregations