Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nshmp-ws-static
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ghsc
National Seismic Hazard Model Project
nshmp-ws-static
Merge requests
!136
Production Release | nshmp-ws-static
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Production Release | nshmp-ws-static
main
into
production
Overview
0
Commits
9
Pipelines
1
Changes
4
Merged
Clayton, Brandon Scott
requested to merge
main
into
production
2 years ago
Overview
0
Commits
9
Pipelines
1
Changes
4
Expand
0
0
Merge request reports
Compare
production
production (base)
and
latest version
latest version
691e8b50
9 commits,
2 years ago
4 files
+
238
−
6
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
src/hazard/src/main/java/gov/usgs/earthquake/nshmp/netcdf/www/FeatureCollectionService.java
0 → 100644
+
50
−
0
Options
package
gov.usgs.earthquake.nshmp.netcdf.www
;
import
com.google.gson.JsonElement
;
import
gov.usgs.earthquake.nshmp.geo.json.FeatureCollection
;
import
gov.usgs.earthquake.nshmp.netcdf.NetcdfVersion
;
import
gov.usgs.earthquake.nshmp.www.ResponseBody
;
import
gov.usgs.earthquake.nshmp.www.ResponseMetadata
;
import
io.micronaut.http.HttpRequest
;
import
jakarta.inject.Singleton
;
/**
* Handle feature collection services.
*
* @author U.S. Geological Survey
*/
@Singleton
public
class
FeatureCollectionService
{
static
String
handleFeatureCollection
(
HttpRequest
<?>
http
,
String
name
,
FeatureCollection
fc
,
Boolean
raw
)
{
RequestData
requestData
=
new
RequestData
(
raw
);
if
(
requestData
.
raw
)
{
return
fc
.
toJson
();
}
else
{
var
response
=
ResponseBody
.<
RequestData
,
JsonElement
>
success
()
.
name
(
name
)
.
url
(
http
.
getUri
().
toString
())
.
metadata
(
new
ResponseMetadata
(
NetcdfVersion
.
appVersions
()))
.
request
(
requestData
)
.
response
(
fc
.
toJsonTree
())
.
build
();
return
NetcdfWsUtils
.
GSON
.
toJson
(
response
);
}
}
static
class
RequestData
{
public
boolean
raw
;
RequestData
(
Boolean
raw
)
{
this
.
raw
=
raw
==
null
?
false
:
raw
;
}
}
}
Loading