Skip to content
Merged
Show file tree
Hide file tree
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 May 6, 2025
fab5f05
Resolve compilation issues after migration
jloux-brapi May 21, 2025
7aa2e93
Add endpoints, create first base entity repository
jloux-brapi May 27, 2025
0c6878a
Refactor Repo configuration and structure to allow for two base repos
jloux-brapi May 27, 2025
6822f8b
Merge bi fork dynamic observation levels into prod server
jloux-brapi May 29, 2025
47f5521
Fix bug in PUT method, correct server info for obslvlnames
jloux-brapi Jul 2, 2025
0ce831e
Add unique index for level_name, program_id
jloux-brapi Jul 11, 2025
c12dc37
Ensure batch optimizations for obs and obs units is intact
jloux-brapi Jul 21, 2025
1fdd5eb
Merge branch 'obs-opts' into dynamic-obs-levels
jloux-brapi Jul 22, 2025
5399628
Make old /observationlevels endpoint usable
jloux-brapi Aug 6, 2025
35e5675
Merge branch 'brapi-server-v2' into dynamic-obs-levels
jloux-brapi Aug 7, 2025
6afd444
Optimize /observationlevels GET endpoint for use with dynamic obs lvls
jloux-brapi Aug 8, 2025
8b7414c
Fix issues with study posts including obs lvls, fix ou search
jloux-brapi Aug 12, 2025
6011699
Improve var usage, add comments
jloux-brapi Aug 12, 2025
a08dc2a
Support for removing level_name_new and utilizing new column ref
jloux-brapi Aug 13, 2025
f032294
[BI-2219] Obfuscate unused new level name fields
jloux-brapi Jan 27, 2026
fde4e15
Return 409 with offending duplicate message
jloux-brapi Jan 29, 2026
d76fc89
Update migration file to add partial index for global level names
jloux-brapi Jan 29, 2026
47ab537
Add page and pageCount to get method. POST returns empty metadata
jloux-brapi Feb 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions src/main/java/io/swagger/api/pheno/ObservationLevelNamesApi.java
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;
}

11 changes: 11 additions & 0 deletions src/main/java/io/swagger/model/core/StudyNewRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public class StudyNewRequest extends BrAPIDataModel{
@JsonProperty("trialDbId")
private String trialDbId = null;

@JsonProperty("programDbId")
private String programDbId = null;

@JsonProperty("trialName")
private String trialName = null;

Expand Down Expand Up @@ -463,6 +466,14 @@ public void setTrialDbId(String trialDbId) {
this.trialDbId = trialDbId;
}

public String getProgramDbId() {
return programDbId;
}

public void setProgramDbId(String programDbId) {
this.programDbId = programDbId;
}

public StudyNewRequest trialName(String trialName) {
this.trialName = trialName;
return this;
Expand Down
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;
}
}
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 ");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,7 @@ public enum ObservationTableHeaderRowEnum {
GERMPLASMNAME("germplasmName"),
POSITIONCOORDINATEX("positionCoordinateX"),
POSITIONCOORDINATEY("positionCoordinateY"),
YEAR("year"),
FIELD("field"),
PLOT("plot"),
SUB_PLOT("sub-plot"),
PLANT("plant"),
POT("pot"),
BLOCK("block"),
ENTRY("entry"),
REP("rep");
YEAR("year");
private String value;

ObservationTableHeaderRowEnum(String value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,42 @@

import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

public class ObservationUnitHierarchyLevel {

@JsonProperty("levelNameDbId")
private String levelNameDbId = null;

@JsonProperty("levelName")
private ObservationUnitHierarchyLevelEnum levelName = null;
private String levelName = null;

@JsonProperty("levelOrder")
private Integer levelOrder = null;

public ObservationUnitHierarchyLevel levelName(ObservationUnitHierarchyLevelEnum levelName) {
this.levelName = levelName;
return this;
@JsonProperty("programDbId")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String programDbId = null;

// NOTE: This property is NOT used for lookups, only responses.
@JsonProperty("programName")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String programName = null;

public String getLevelNameDbId() {
return levelNameDbId;
}

public void setLevelNameDbId(String value) {
this.levelNameDbId = value;
}

public ObservationUnitHierarchyLevelEnum getLevelName() {
public String getLevelName() {
return levelName;
}

public void setLevelName(ObservationUnitHierarchyLevelEnum levelName) {
public void setLevelName(String levelName) {
this.levelName = levelName;
}

Expand All @@ -38,6 +54,22 @@ public void setLevelOrder(Integer levelOrder) {
this.levelOrder = levelOrder;
}

public String getProgramDbId() {
return programDbId;
}

public void setProgramDbId(String value) {
this.programDbId = value;
}

public String getProgramName() {
return programName;
}

public void setProgramName(String value) {
this.programName = value;
}

@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
Expand All @@ -47,13 +79,12 @@ public boolean equals(java.lang.Object o) {
return false;
}
ObservationUnitHierarchyLevel observationUnitHierarchyLevel = (ObservationUnitHierarchyLevel) o;
return Objects.equals(this.levelName, observationUnitHierarchyLevel.levelName)
&& Objects.equals(this.levelOrder, observationUnitHierarchyLevel.levelOrder);
return Objects.equals(this.levelNameDbId, observationUnitHierarchyLevel.levelNameDbId);
}

@Override
public int hashCode() {
return Objects.hash(levelName, levelOrder);
return Objects.hash(levelNameDbId);
}

@Override
Expand All @@ -63,7 +94,9 @@ public String toString() {

sb.append(" levelName: ").append(toIndentedString(levelName)).append("\n");
sb.append(" levelOrder: ").append(toIndentedString(levelOrder)).append("\n");
sb.append("}");
sb.append(" levelNameDbId: ").append(toIndentedString(levelNameDbId)).append("\n");
sb.append(" programDbId: ").append(toIndentedString(programDbId)).append("\n");
sb.append(" programName: ").append(toIndentedString(programName)).append("\n");
return sb.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass())
return false;
ObservationUnitLevel other = (ObservationUnitLevel) obj;
return Objects.equals(levelCode, other.levelCode);
return Objects.equals(getLevelNameDbId(), other.getLevelNameDbId());
}

@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + Objects.hash(levelCode);
result = prime * result + Objects.hash(getLevelNameDbId());
return result;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.brapi.test.BrAPITestServer.auth;
package org.brapi.test.BrAPITestServer.config;

import org.brapi.test.BrAPITestServer.auth.BrapiTestServerJWTAuthFilter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down
Loading