-
Notifications
You must be signed in to change notification settings - Fork 17
Add support for virtual location levels #1086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
adamkorynta
merged 27 commits into
USACE:develop
from
zack-rma:feature/virtual_loc_levels
Jun 12, 2025
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
c764bfd
Integration testing in progress
zack-rma b846e8d
Updated constituent handling, tests in progress
zack-rma b7f503e
Added delete method support
zack-rma 5086782
Deletion testing in progress
zack-rma 09fb5be
Deletion testing completed
zack-rma f9c4e69
Cleaned up testing, added creation helper functions
zack-rma 840bb31
Removed ratings cleanup
zack-rma 54ff757
Refactored LocationLevel, added child classes. Updated controller, DAO
zack-rma 912c138
Moved interpolate parameter, updated controller to handle LocationLev…
zack-rma 392e35c
Updated per feedback, added subclasses
zack-rma fe6211e
Updates from feedback. Fixed scoping and builders
zack-rma 6ef2488
Updates from feedback. Removed unnecessary query param, updated loggi…
zack-rma cc3e071
Formatting fixes
zack-rma 24c67cb
Minor unit test fixes
zack-rma 321df49
Updated naming, generic typing
zack-rma 3d211bd
Update query to handle paging. Catalog will not return virtual level …
zack-rma 76105c6
Paging test update
zack-rma fffb3d5
Improved paging test coverage
zack-rma 451c511
Updated virtual location level test data
zack-rma c0475c6
Merge remote-tracking branch 'refs/remotes/hec/develop' into feature/…
zack-rma 62659ab
Fix broken symbol reference
zack-rma 62e8d55
Fix broken latest rating test
zack-rma f70c4e0
Removed unnecessary casting method
zack-rma cdd814f
extracted common builder attributes
zack-rma 0b06084
Merge branch 'develop' into feature/virtual_loc_levels
zack-rma dc6363c
Cleaned up LocationLevel builder usage, added unit tests
zack-rma 5b0d47e
Fixed location level base class builder
zack-rma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
260 changes: 115 additions & 145 deletions
260
cwms-data-api/src/main/java/cwms/cda/api/LevelsController.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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
565 changes: 394 additions & 171 deletions
565
cwms-data-api/src/main/java/cwms/cda/data/dao/LocationLevelsDaoImpl.java
Large diffs are not rendered by default.
Oops, something went wrong.
589 changes: 0 additions & 589 deletions
589
cwms-data-api/src/main/java/cwms/cda/data/dto/LocationLevel.java
This file was deleted.
Oops, something went wrong.
119 changes: 119 additions & 0 deletions
119
cwms-data-api/src/main/java/cwms/cda/data/dto/locationlevel/ConstantLocationLevel.java
This file contains hidden or 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/* | ||
* | ||
* MIT License | ||
* | ||
* Copyright (c) 2025 Hydrologic Engineering Center | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
* DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package cwms.cda.data.dto.locationlevel; | ||
|
||
import java.time.ZonedDateTime; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonRootName; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; | ||
import cwms.cda.data.dto.CwmsDTOValidator; | ||
import cwms.cda.formatters.Formats; | ||
import cwms.cda.formatters.annotations.FormattableWith; | ||
import cwms.cda.formatters.json.JsonV1; | ||
import cwms.cda.formatters.json.JsonV2; | ||
import cwms.cda.formatters.xml.XMLv2; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
import hec.data.level.IParameterTypedValue; | ||
import hec.data.level.JDomLocationLevelImpl; | ||
import rma.util.RMAConst; | ||
|
||
@JsonRootName("ConstantLocationLevel") | ||
@JsonDeserialize(builder = ConstantLocationLevel.Builder.class) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy.class) | ||
@FormattableWith(contentType = Formats.JSONV2, formatter = JsonV2.class, aliases = {Formats.DEFAULT, Formats.JSON}) | ||
@FormattableWith(contentType = Formats.JSONV1, formatter = JsonV1.class) | ||
@FormattableWith(contentType = Formats.XMLV2, formatter = XMLv2.class, aliases = {Formats.XML}) | ||
public final class ConstantLocationLevel extends LocationLevel { | ||
@Schema(description = "Single value for this location level.") | ||
|
||
private final Double constantValue; | ||
|
||
private ConstantLocationLevel(ConstantLocationLevel.Builder builder) { | ||
super(builder); | ||
constantValue = builder.constantValue; | ||
} | ||
|
||
public Double getConstantValue() { | ||
return constantValue; | ||
} | ||
|
||
@JsonPOJOBuilder | ||
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy.class) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public static class Builder extends LocationLevel.Builder<ConstantLocationLevel.Builder> { | ||
private Double constantValue; | ||
|
||
@JsonCreator | ||
public Builder(@JsonProperty(value = "location-level-id", required = true) String name, | ||
@JsonProperty(value = "level-date", required = true) ZonedDateTime lvlDate) { | ||
super(name, lvlDate); | ||
} | ||
|
||
public Builder(ConstantLocationLevel copyFrom) { | ||
super(copyFrom); | ||
withConstantValue(copyFrom.getConstantValue()); | ||
} | ||
|
||
public Builder(JDomLocationLevelImpl copyFrom) { | ||
super(copyFrom); | ||
IParameterTypedValue constantLevel = copyFrom.getConstantLevel(); | ||
if (constantLevel != null) { | ||
withConstantValue(constantLevel.getSiParameterUnitsValue()); | ||
} | ||
} | ||
|
||
public ConstantLocationLevel.Builder withConstantValue(Double value) { | ||
if (value != null && RMAConst.isUndefinedValue(value)) { | ||
value = null; | ||
} | ||
this.constantValue = value; | ||
return this; | ||
} | ||
|
||
@Override | ||
public ConstantLocationLevel build() { | ||
return new ConstantLocationLevel(this); | ||
} | ||
} | ||
|
||
@Override | ||
protected void validateInternal(CwmsDTOValidator validator) { | ||
super.validateInternal(validator); | ||
validator.required(getOfficeId(), "office-id"); | ||
validator.required(getLocationLevelId(), "location-level-id"); | ||
validator.required(getConstantValue(), "constant-value"); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.