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
Commits
b90c59d9
Commit
b90c59d9
authored
2 years ago
by
Clayton, Brandon Scott
Browse files
Options
Downloads
Patches
Plain Diff
Move request to own class
parent
fee2f13f
No related branches found
No related tags found
2 merge requests
!124
Production Release | nshmp-ws-static
,
!123
Resolves - Remove GITLAB_TOKEN Requirement and AASHTO-2023 web service -- add CSV response
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib/src/main/java/gov/usgs/earthquake/nshmp/netcdf/www/Request.java
+85
-0
85 additions, 0 deletions
...in/java/gov/usgs/earthquake/nshmp/netcdf/www/Request.java
with
85 additions
and
0 deletions
src/lib/src/main/java/gov/usgs/earthquake/nshmp/netcdf/www/Request.java
0 → 100644
+
85
−
0
View file @
b90c59d9
package
gov.usgs.earthquake.nshmp.netcdf.www
;
import
java.util.List
;
import
gov.usgs.earthquake.nshmp.Text
;
import
gov.usgs.earthquake.nshmp.Text.Delimiter
;
import
gov.usgs.earthquake.nshmp.geo.Location
;
import
gov.usgs.earthquake.nshmp.gmm.Imt
;
import
gov.usgs.earthquake.nshmp.gmm.NehrpSiteClass
;
import
gov.usgs.earthquake.nshmp.netcdf.www.NetcdfWsUtils.Key
;
/**
* Web service request data.
*
* @author U.S. Geological Survey
*/
public
class
Request
{
interface
RequestDataToCsv
{
/**
* Convert the request data into a CSV line.
*/
String
toCsv
();
}
/**
* Basic request data with latitude, longitude, and format.
*/
static
class
RequestData
implements
RequestDataToCsv
{
public
Double
latitude
;
public
Double
longitude
;
public
ResponseFormat
format
;
public
transient
Location
site
;
RequestData
(
Location
site
,
ResponseFormat
format
)
{
latitude
=
site
.
latitude
;
longitude
=
site
.
longitude
;
this
.
format
=
format
;
this
.
site
=
site
;
}
public
String
toCsv
()
{
return
Text
.
join
(
List
.
of
(
Key
.
LONGITUDE
.
toString
(),
longitude
,
Key
.
LATITUDE
.
toString
(),
latitude
),
Delimiter
.
COMMA
);
}
}
/**
* Request data with site class and imt
*/
static
class
RequestDataImt
extends
RequestDataSiteClass
{
public
Imt
imt
;
RequestDataImt
(
Location
site
,
NehrpSiteClass
siteClass
,
Imt
imt
,
ResponseFormat
format
)
{
super
(
site
,
siteClass
,
format
);
this
.
imt
=
imt
;
}
@Override
public
String
toCsv
()
{
return
String
.
format
(
"%s,%s"
,
super
.
toCsv
(),
Text
.
join
(
List
.
of
(
Key
.
IMT
.
toString
(),
imt
.
name
()),
Delimiter
.
COMMA
));
}
}
/**
* Request data with site class
*/
static
class
RequestDataSiteClass
extends
RequestData
{
public
NehrpSiteClass
siteClass
;
RequestDataSiteClass
(
Location
site
,
NehrpSiteClass
siteClass
,
ResponseFormat
format
)
{
super
(
site
,
format
);
this
.
siteClass
=
siteClass
;
}
@Override
public
String
toCsv
()
{
return
String
.
format
(
"%s,%s"
,
super
.
toCsv
(),
Text
.
join
(
List
.
of
(
Key
.
SITE_CLASS
.
toString
(),
siteClass
),
Delimiter
.
COMMA
));
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment