use of de.ii.ogcapi.foundation.domain.ExtensionRegistry 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.ExtensionRegistry 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.ExtensionRegistry 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();
}
use of de.ii.ogcapi.foundation.domain.ExtensionRegistry in project ldproxy by interactive-instruments.
the class AbstractEndpointTileSetsSingleCollection 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 a list of the available tile sets";
Optional<String> operationDescription = Optional.of("This operation fetches the list of tile sets available for this collection.");
String resourcePath = path.replace("{collectionId}", collectionId);
ImmutableOgcApiResourceSet.Builder resourceBuilder = new ImmutableOgcApiResourceSet.Builder().path(resourcePath).pathParameters(pathParameters).subResourceType("Tile Set");
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.ExtensionRegistry in project ldproxy by interactive-instruments.
the class EndpointStyle method computeDefinition.
@Override
protected ApiEndpointDefinition computeDefinition(OgcApiDataV2 apiData) {
ImmutableApiEndpointDefinition.Builder definitionBuilder = new ImmutableApiEndpointDefinition.Builder().apiEntrypoint("styles").sortPriority(ApiEndpointDefinition.SORT_PRIORITY_STYLESHEET);
String path = "/styles/{styleId}";
List<OgcApiQueryParameter> queryParameters = getQueryParameters(extensionRegistry, apiData, path);
List<OgcApiPathParameter> pathParameters = getPathParameters(extensionRegistry, apiData, path);
if (!pathParameters.stream().filter(param -> param.getName().equals("styleId")).findAny().isPresent()) {
LOGGER.error("Path parameter 'styleId' missing for resource at path '" + path + "'. The GET method will not be available.");
} else {
String operationSummary = "fetch a style";
Optional<String> operationDescription = Optional.of("Fetches the style with identifier `styleId`. " + "The set of available styles can be retrieved at `/styles`. Not all styles are available in " + "all style encodings.");
ImmutableOgcApiResourceAuxiliary.Builder resourceBuilder = new ImmutableOgcApiResourceAuxiliary.Builder().path(path).pathParameters(pathParameters);
ApiOperation operation = addOperation(apiData, queryParameters, path, operationSummary, operationDescription, TAGS);
if (operation != null)
resourceBuilder.putOperations("GET", operation);
definitionBuilder.putResources(path, resourceBuilder.build());
}
return definitionBuilder.build();
}
Aggregations