forked from plantbreeding/brapi-Java-TestServer
-
Notifications
You must be signed in to change notification settings - Fork 1
Implement Dynamic Observation Levels #17
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
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
0f0dce1
Add migration scripts
jloux-brapi fab5f05
Resolve compilation issues after migration
jloux-brapi 7aa2e93
Add endpoints, create first base entity repository
jloux-brapi 0c6878a
Refactor Repo configuration and structure to allow for two base repos
jloux-brapi 6822f8b
Merge bi fork dynamic observation levels into prod server
jloux-brapi 47f5521
Fix bug in PUT method, correct server info for obslvlnames
jloux-brapi 0ce831e
Add unique index for level_name, program_id
jloux-brapi c12dc37
Ensure batch optimizations for obs and obs units is intact
jloux-brapi 1fdd5eb
Merge branch 'obs-opts' into dynamic-obs-levels
jloux-brapi 5399628
Make old /observationlevels endpoint usable
jloux-brapi 35e5675
Merge branch 'brapi-server-v2' into dynamic-obs-levels
jloux-brapi 6afd444
Optimize /observationlevels GET endpoint for use with dynamic obs lvls
jloux-brapi 8b7414c
Fix issues with study posts including obs lvls, fix ou search
jloux-brapi 6011699
Improve var usage, add comments
jloux-brapi a08dc2a
Support for removing level_name_new and utilizing new column ref
jloux-brapi f032294
[BI-2219] Obfuscate unused new level name fields
jloux-brapi fde4e15
Return 409 with offending duplicate message
jloux-brapi d76fc89
Update migration file to add partial index for global level names
jloux-brapi 47ab537
Add page and pageCount to get method. POST returns empty metadata
jloux-brapi 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
68 changes: 68 additions & 0 deletions
68
src/main/java/io/swagger/api/pheno/ObservationLevelNamesApi.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,68 @@ | ||
| package io.swagger.api.pheno; | ||
|
|
||
| import io.swagger.annotations.*; | ||
| import io.swagger.model.pheno.*; | ||
| import jakarta.validation.Valid; | ||
| import org.brapi.test.BrAPITestServer.exceptions.BrAPIServerException; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.*; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @javax.annotation.processing.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-05-21T16:32:22.556Z[GMT]") | ||
| @Api(value = "observationlevelnames", description = "the observationlevelnames API") | ||
| public interface ObservationLevelNamesApi { | ||
| @ApiOperation(value = "Get the Observation Level Names", nickname = "observationlevelnamesGet", notes = "Call to retrieve the list of supported observation level names", response = ObservationLevelListResponse.class, authorizations = { | ||
| @Authorization(value = "AuthorizationToken") }, tags = { "Observation level names", }) | ||
| @ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = ObservationLevelListResponse.class), | ||
| @ApiResponse(code = 400, message = "Bad Request", response = String.class), | ||
| @ApiResponse(code = 401, message = "Unauthorized", response = String.class), | ||
| @ApiResponse(code = 403, message = "Forbidden", response = String.class) }) | ||
| @RequestMapping(value = "/observationlevelnames", produces = { "application/json" }, method = RequestMethod.GET) | ||
| ResponseEntity<ObservationLevelListResponse> observationlevelnamesGet( | ||
| @ApiParam(value = "programDbId") @Valid @RequestParam(value = "programDbId", required = false) String programDbId, | ||
| @ApiParam(value = "all") @Valid @RequestParam(value = "all", required = false) Boolean all, | ||
| @ApiParam(value = "page") @Valid @RequestParam(value = "page", required = false) Integer page, | ||
| @ApiParam(value = "pageSize") @Valid @RequestParam(value = "pageSize", required = false) Integer pageSize, | ||
| @ApiParam(value = "HTTP HEADER - Token used for Authorization <strong> Bearer {token_string} </strong>") @RequestHeader(value = "Authorization", required = false) String authorization) | ||
| throws BrAPIServerException; | ||
|
|
||
| @ApiOperation(value = "Create Observation Level Names", nickname = "observationlevelnamesPost", notes = "Call to save a list of observation level names", response = ObservationLevelListResponse.class, authorizations = { | ||
| @Authorization(value = "AuthorizationToken") }, tags = { "Observation level names", }) | ||
| @ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = ObservationLevelListResponse.class), | ||
| @ApiResponse(code = 400, message = "Bad Request", response = String.class), | ||
| @ApiResponse(code = 401, message = "Unauthorized", response = String.class), | ||
| @ApiResponse(code = 403, message = "Forbidden", response = String.class) }) | ||
| @RequestMapping(value = "/observationlevelnames", produces = { "application/json" }, method = RequestMethod.POST) | ||
| ResponseEntity<ObservationLevelListResponse> observationlevelnamesPost( | ||
| @ApiParam(value = "") @Valid @RequestBody List<ObservationLevelNewRequest> body, | ||
| @ApiParam(value = "HTTP HEADER - Token used for Authorization <strong> Bearer {token_string} </strong>") @RequestHeader(value = "Authorization", required = false) String authorization) | ||
| throws BrAPIServerException; | ||
|
|
||
| @ApiOperation(value = "Delete Observation Level Names", nickname = "observationlevelnamesGet", notes = "Call to delete a list of observation level names", response = ObservationLevelListResponse.class, authorizations = { | ||
| @Authorization(value = "AuthorizationToken") }, tags = { "Observation level names", }) | ||
| @ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = ObservationLevelListResponse.class), | ||
| @ApiResponse(code = 400, message = "Bad Request", response = String.class), | ||
| @ApiResponse(code = 401, message = "Unauthorized", response = String.class), | ||
| @ApiResponse(code = 403, message = "Forbidden", response = String.class) }) | ||
| @RequestMapping(value = "/observationlevelnames/{observationlevelnameDbId}", produces = { "application/json" }, method = RequestMethod.DELETE) | ||
| ResponseEntity<ObservationLevelListResponse> observationlevelnamesDelete( | ||
| @ApiParam(value = "The unique ID of this generic list", required = true) @PathVariable("observationlevelnameDbId") String observationLevelNameDbId, | ||
| @ApiParam(value = "HTTP HEADER - Token used for Authorization <strong> Bearer {token_string} </strong>") @RequestHeader(value = "Authorization", required = false) String authorization) | ||
| throws BrAPIServerException; | ||
|
|
||
| @ApiOperation(value = "Update an existing Observation Level Name", nickname = "observationlevelnamesDbIdPut", notes = "Update an existing Observation Level Name", response = ObservationLevelListResponse.class, authorizations = { | ||
| @Authorization(value = "AuthorizationToken") }, tags = { "Observation Units", }) | ||
| @ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = ObservationUnitHierarchyLevel.class), | ||
| @ApiResponse(code = 400, message = "Bad Request", response = String.class), | ||
| @ApiResponse(code = 401, message = "Unauthorized", response = String.class), | ||
| @ApiResponse(code = 403, message = "Forbidden", response = String.class) }) | ||
| @RequestMapping(value = "/observationlevelnames/{observationlevelnameDbId}", produces = { "application/json" }, consumes = { | ||
| "application/json" }, method = RequestMethod.PUT) | ||
| ResponseEntity<ObservationLevelSingleResponse> observationlevelnamesDbIdPut( | ||
| @ApiParam(value = "The unique ID of the specific Observation Level Name", required = true) @PathVariable("observationlevelnameDbId") String observationlevelnameDbId, | ||
| @ApiParam(value = "") @Valid @RequestBody ObservationLevelNewRequest body, | ||
| @ApiParam(value = "HTTP HEADER - Token used for Authorization <strong> Bearer {token_string} </strong>") @RequestHeader(value = "Authorization", required = false) String authorization) | ||
| throws BrAPIServerException; | ||
| } | ||
|
|
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
13 changes: 13 additions & 0 deletions
13
src/main/java/io/swagger/model/pheno/ObservationLevelNewRequest.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,13 @@ | ||
| package io.swagger.model.pheno; | ||
|
|
||
| public class ObservationLevelNewRequest extends ObservationUnitHierarchyLevel { | ||
| private Boolean global = null; | ||
|
|
||
| public Boolean getGlobal() { | ||
| return global; | ||
| } | ||
|
|
||
| public void setGlobal(Boolean value) { | ||
| this.global = value; | ||
| } | ||
| } |
127 changes: 127 additions & 0 deletions
127
src/main/java/io/swagger/model/pheno/ObservationLevelSingleResponse.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,127 @@ | ||
| package io.swagger.model.pheno; | ||
|
|
||
| import java.util.Objects; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
|
|
||
| import io.swagger.annotations.ApiModelProperty; | ||
| import io.swagger.model.BrAPIResponse; | ||
| import io.swagger.model.Context; | ||
| import io.swagger.model.Metadata; | ||
|
|
||
| import io.swagger.model.pheno.ObservationLevelListResponseResult; | ||
| import org.springframework.validation.annotation.Validated; | ||
| import jakarta.validation.Valid; | ||
|
|
||
|
|
||
| /** | ||
| * ObservationLevelListResponse | ||
| */ | ||
| @Validated | ||
| @javax.annotation.processing.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-03-20T16:32:22.556Z[GMT]") | ||
| public class ObservationLevelSingleResponse implements BrAPIResponse<ObservationUnitHierarchyLevel> { | ||
| @JsonProperty("@context") | ||
| private Context _atContext = null; | ||
|
|
||
| @JsonProperty("metadata") | ||
| private Metadata metadata = null; | ||
|
|
||
| @JsonProperty("result") | ||
| private ObservationUnitHierarchyLevel result = null; | ||
|
|
||
| public ObservationLevelSingleResponse _atContext(Context _atContext) { | ||
| this._atContext = _atContext; | ||
| return this; | ||
| } | ||
|
|
||
|
|
||
|
|
||
| public void set_atContext(Context _atContext) { | ||
| this._atContext = _atContext; | ||
| } | ||
|
|
||
| public ObservationLevelSingleResponse metadata(Metadata metadata) { | ||
| this.metadata = metadata; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Get metadata | ||
| * @return metadata | ||
| **/ | ||
| @ApiModelProperty(required = true, value = "") | ||
|
|
||
|
|
||
| @Valid | ||
| public Metadata getMetadata() { | ||
| return metadata; | ||
| } | ||
|
|
||
| public void setMetadata(Metadata metadata) { | ||
| this.metadata = metadata; | ||
| } | ||
|
|
||
| public ObservationLevelSingleResponse result(ObservationUnitHierarchyLevel result) { | ||
| this.result = result; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Get result | ||
| * @return result | ||
| **/ | ||
| @ApiModelProperty(required = true, value = "") | ||
|
|
||
|
|
||
| @Valid | ||
| public ObservationUnitHierarchyLevel getResult() { | ||
| return result; | ||
| } | ||
|
|
||
| public void setResult(ObservationUnitHierarchyLevel result) { | ||
| this.result = result; | ||
| } | ||
|
|
||
|
|
||
| @Override | ||
| public boolean equals(java.lang.Object o) { | ||
| if (this == o) { | ||
| return true; | ||
| } | ||
| if (o == null || getClass() != o.getClass()) { | ||
| return false; | ||
| } | ||
| ObservationLevelSingleResponse observationLevelSingleResponse = (ObservationLevelSingleResponse) o; | ||
| return Objects.equals(this._atContext, observationLevelSingleResponse._atContext) && | ||
| Objects.equals(this.metadata, observationLevelSingleResponse.metadata) && | ||
| Objects.equals(this.result, observationLevelSingleResponse.result); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(_atContext, metadata, result); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| StringBuilder sb = new StringBuilder(); | ||
| sb.append("class ObservationLevelListResponse {\n"); | ||
|
|
||
| sb.append(" _atContext: ").append(toIndentedString(_atContext)).append("\n"); | ||
| sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); | ||
| sb.append(" result: ").append(toIndentedString(result)).append("\n"); | ||
| sb.append("}"); | ||
| return sb.toString(); | ||
| } | ||
|
|
||
| /** | ||
| * Convert the given object to string with each line indented by 4 spaces | ||
| * (except the first line). | ||
| */ | ||
| private String toIndentedString(java.lang.Object o) { | ||
| if (o == null) { | ||
| return "null"; | ||
| } | ||
| return o.toString().replace("\n", "\n "); | ||
| } | ||
| } |
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
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
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
3 changes: 2 additions & 1 deletion
3
...erver/auth/BrapiTestServerAuthConfig.java → ...ver/config/BrapiTestServerAuthConfig.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
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.