-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GetStyle/PutStyle extension for WFS3, dataset level resources
- Loading branch information
Showing
40 changed files
with
1,648 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/community/wfs3/src/main/java/org/geoserver/wfs3/AbstractWFS3Extension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,38 @@ | |||
/* (c) 2019 Open Source Geospatial Foundation - all rights reserved | |||
* This code is licensed under the GPL 2.0 license, available at the root | |||
* application directory. | |||
*/ | |||
package org.geoserver.wfs3; | |||
|
|||
import io.swagger.v3.core.util.Yaml; | |||
import io.swagger.v3.oas.models.Components; | |||
import io.swagger.v3.oas.models.OpenAPI; | |||
import io.swagger.v3.oas.models.media.Schema; | |||
import io.swagger.v3.oas.models.parameters.Parameter; | |||
import java.util.Map; | |||
import org.geoserver.platform.ServiceException; | |||
|
|||
public abstract class AbstractWFS3Extension implements WFS3Extension { | |||
|
|||
protected void addSchemasAndParameters(OpenAPI api, OpenAPI template) { | |||
// and add all schemas and parameters | |||
Components apiComponents = api.getComponents(); | |||
Components tileComponents = template.getComponents(); | |||
Map<String, Schema> tileSchemas = tileComponents.getSchemas(); | |||
apiComponents.getSchemas().putAll(tileSchemas); | |||
Map<String, Parameter> tileParameters = tileComponents.getParameters(); | |||
apiComponents.getParameters().putAll(tileParameters); | |||
} | |||
|
|||
/** | |||
* Reads the template to customize (each time, as the object tree is not thread safe nor | |||
* cloneable not serializable) | |||
*/ | |||
protected OpenAPI readTemplate(String source) { | |||
try { | |||
return Yaml.mapper().readValue(source, OpenAPI.class); | |||
} catch (Exception e) { | |||
throw new ServiceException(e); | |||
} | |||
} | |||
} |
Oops, something went wrong.