Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
66 changes: 66 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,66 @@
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. Observation levels indicate the granularity level at which the measurements are taken. `levelName` defines the level, `levelOrder` defines where that level exists in the hierarchy of levels. `levelOrder`s lower numbers are at the top of the hierarchy (ie field > 0) and higher numbers are at the bottom of the hierarchy (ie plant > 6). The values are used to supply the `observationLevel` parameter in the observation unit details call.", 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 = "HTTP HEADER - Token used for Authorization <strong> Bearer {token_string} </strong>") @RequestHeader(value = "Authorization", required = false) String authorization)
throws BrAPIServerException;

@ApiOperation(value = "Get the Observation Level Names", nickname = "observationlevelnamesGet", notes = "Call to save a list of observation level names", response = ObservationLevelListResponse.class, authorizations = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a missed copy/paste, should have value, nickname, and notes updated for POST instead of GET

@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 = "Get the Observation Level Names", nickname = "observationlevelnamesGet", notes = "Call to save a list of observation level names", response = ObservationLevelListResponse.class, authorizations = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a missed copy/paste, should have value, nickname, and notes updated for DELETE instead of GET

@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,40 @@

import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonIgnore;
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")
private String programDbId = null;

// NOTE: This property is NOT used for lookups, only responses.
@JsonProperty("programName")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GET /observationlevels now has additional programDbId and programName properties in the response objects (always null). That's a change from the spec. I guess in this case it's just an addition so assuming the client ignores new properties it should be backwards compatible. Thinking mostly for Field Book which uses the BrAPI java client. We do have some integration tests in the BrAPI java client repo. I'll add a card to create a github action so we can run the tests in there against brapi server PRs.

Also it would be nice to keep the BrAPI java client in sync with brapi server changes. We may have to have a version that is ahead of the brapi spec to support some of the stuff that's been added to the brapi server.

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 +52,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 +77,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 +92,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