Skip to content

Commit

Permalink
Merge pull request #664 from rma-rripken/bugfix/650-location-level-un…
Browse files Browse the repository at this point in the history
…itsystem

Removed use of JDomLocationLevelImpl because it was converting values…
  • Loading branch information
rma-rripken authored Jun 3, 2024
2 parents afaa7bc + 66d3b70 commit 618da9d
Show file tree
Hide file tree
Showing 4 changed files with 374 additions and 213 deletions.
13 changes: 2 additions & 11 deletions cwms-data-api/src/main/java/cwms/cda/api/LevelsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ public void delete(@NotNull Context ctx, @NotNull String levelId) {
+ "the default SI units for their parameters."
+ "\n* `Other` "
+ "Any unit returned in the response to the units URI request that is "
+ "appropriate for the requested parameters. The " + Formats.JSONV2
+ " format currently only supports SI."),
+ "appropriate for the requested parameters. "),
@OpenApiParam(name = DATUM, description = "Specifies the elevation datum of"
+ " the response. This field affects only elevation location levels. "
+ "Valid values for this field are:"
Expand Down Expand Up @@ -284,7 +283,7 @@ public void getAll(@NotNull Context ctx) {
name(LevelsController.class.getName(), GET_ALL));

String office = ctx.queryParam(OFFICE);
String unit = ctx.queryParam(UNIT);
String unit = ctx.queryParamAsClass(UNIT, String.class).getOrDefault(UnitSystem.SI.getValue());
String datum = ctx.queryParam(DATUM);
String begin = ctx.queryParam(BEGIN);
String end = ctx.queryParam(END);
Expand All @@ -294,14 +293,6 @@ public void getAll(@NotNull Context ctx) {

if ("2".equals(version)) {

if (unit == null) {
// The dao currently only supports SI.
unit = UnitSystem.SI.getValue();
}
if (!UnitSystem.SI.getValue().equals(unit)) {
throw new IllegalArgumentException("Levels Version 2 currently only supports SI");
}

String cursor = ctx.queryParamAsClass(PAGE, String.class)
.getOrDefault("");
int pageSize = ctx.queryParamAsClass(PAGE_SIZE, Integer.class)
Expand Down
Loading

0 comments on commit 618da9d

Please sign in to comment.