Skip to content

Commit b40584f

Browse files
Merge pull request #9 from plantbreeding/brapi-server-v2
Merge upstream changes for dynamic observation levels
2 parents 44d1472 + c7661d4 commit b40584f

File tree

115 files changed

+2164
-523
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+2164
-523
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package io.swagger.api.pheno;
2+
3+
import io.swagger.annotations.*;
4+
import io.swagger.model.pheno.*;
5+
import jakarta.validation.Valid;
6+
import org.brapi.test.BrAPITestServer.exceptions.BrAPIServerException;
7+
import org.springframework.http.ResponseEntity;
8+
import org.springframework.web.bind.annotation.*;
9+
10+
import java.util.List;
11+
12+
@javax.annotation.processing.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-05-21T16:32:22.556Z[GMT]")
13+
@Api(value = "observationlevelnames", description = "the observationlevelnames API")
14+
public interface ObservationLevelNamesApi {
15+
@ApiOperation(value = "Get the Observation Level Names", nickname = "observationlevelnamesGet", notes = "Call to retrieve the list of supported observation level names", response = ObservationLevelListResponse.class, authorizations = {
16+
@Authorization(value = "AuthorizationToken") }, tags = { "Observation level names", })
17+
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = ObservationLevelListResponse.class),
18+
@ApiResponse(code = 400, message = "Bad Request", response = String.class),
19+
@ApiResponse(code = 401, message = "Unauthorized", response = String.class),
20+
@ApiResponse(code = 403, message = "Forbidden", response = String.class) })
21+
@RequestMapping(value = "/observationlevelnames", produces = { "application/json" }, method = RequestMethod.GET)
22+
ResponseEntity<ObservationLevelListResponse> observationlevelnamesGet(
23+
@ApiParam(value = "programDbId") @Valid @RequestParam(value = "programDbId", required = false) String programDbId,
24+
@ApiParam(value = "all") @Valid @RequestParam(value = "all", required = false) Boolean all,
25+
@ApiParam(value = "page") @Valid @RequestParam(value = "page", required = false) Integer page,
26+
@ApiParam(value = "pageSize") @Valid @RequestParam(value = "pageSize", required = false) Integer pageSize,
27+
@ApiParam(value = "HTTP HEADER - Token used for Authorization <strong> Bearer {token_string} </strong>") @RequestHeader(value = "Authorization", required = false) String authorization)
28+
throws BrAPIServerException;
29+
30+
@ApiOperation(value = "Create Observation Level Names", nickname = "observationlevelnamesPost", notes = "Call to save a list of observation level names", response = ObservationLevelListResponse.class, authorizations = {
31+
@Authorization(value = "AuthorizationToken") }, tags = { "Observation level names", })
32+
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = ObservationLevelListResponse.class),
33+
@ApiResponse(code = 400, message = "Bad Request", response = String.class),
34+
@ApiResponse(code = 401, message = "Unauthorized", response = String.class),
35+
@ApiResponse(code = 403, message = "Forbidden", response = String.class) })
36+
@RequestMapping(value = "/observationlevelnames", produces = { "application/json" }, method = RequestMethod.POST)
37+
ResponseEntity<ObservationLevelListResponse> observationlevelnamesPost(
38+
@ApiParam(value = "") @Valid @RequestBody List<ObservationLevelNewRequest> body,
39+
@ApiParam(value = "HTTP HEADER - Token used for Authorization <strong> Bearer {token_string} </strong>") @RequestHeader(value = "Authorization", required = false) String authorization)
40+
throws BrAPIServerException;
41+
42+
@ApiOperation(value = "Delete Observation Level Names", nickname = "observationlevelnamesGet", notes = "Call to delete a list of observation level names", response = ObservationLevelListResponse.class, authorizations = {
43+
@Authorization(value = "AuthorizationToken") }, tags = { "Observation level names", })
44+
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = ObservationLevelListResponse.class),
45+
@ApiResponse(code = 400, message = "Bad Request", response = String.class),
46+
@ApiResponse(code = 401, message = "Unauthorized", response = String.class),
47+
@ApiResponse(code = 403, message = "Forbidden", response = String.class) })
48+
@RequestMapping(value = "/observationlevelnames/{observationlevelnameDbId}", produces = { "application/json" }, method = RequestMethod.DELETE)
49+
ResponseEntity<ObservationLevelListResponse> observationlevelnamesDelete(
50+
@ApiParam(value = "The unique ID of this generic list", required = true) @PathVariable("observationlevelnameDbId") String observationLevelNameDbId,
51+
@ApiParam(value = "HTTP HEADER - Token used for Authorization <strong> Bearer {token_string} </strong>") @RequestHeader(value = "Authorization", required = false) String authorization)
52+
throws BrAPIServerException;
53+
54+
@ApiOperation(value = "Update an existing Observation Level Name", nickname = "observationlevelnamesDbIdPut", notes = "Update an existing Observation Level Name", response = ObservationLevelListResponse.class, authorizations = {
55+
@Authorization(value = "AuthorizationToken") }, tags = { "Observation Units", })
56+
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = ObservationUnitHierarchyLevel.class),
57+
@ApiResponse(code = 400, message = "Bad Request", response = String.class),
58+
@ApiResponse(code = 401, message = "Unauthorized", response = String.class),
59+
@ApiResponse(code = 403, message = "Forbidden", response = String.class) })
60+
@RequestMapping(value = "/observationlevelnames/{observationlevelnameDbId}", produces = { "application/json" }, consumes = {
61+
"application/json" }, method = RequestMethod.PUT)
62+
ResponseEntity<ObservationLevelSingleResponse> observationlevelnamesDbIdPut(
63+
@ApiParam(value = "The unique ID of the specific Observation Level Name", required = true) @PathVariable("observationlevelnameDbId") String observationlevelnameDbId,
64+
@ApiParam(value = "") @Valid @RequestBody ObservationLevelNewRequest body,
65+
@ApiParam(value = "HTTP HEADER - Token used for Authorization <strong> Bearer {token_string} </strong>") @RequestHeader(value = "Authorization", required = false) String authorization)
66+
throws BrAPIServerException;
67+
}
68+

src/main/java/io/swagger/model/core/StudyNewRequest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public class StudyNewRequest extends BrAPIDataModel{
8484
@JsonProperty("trialDbId")
8585
private String trialDbId = null;
8686

87+
@JsonProperty("programDbId")
88+
private String programDbId = null;
89+
8790
@JsonProperty("trialName")
8891
private String trialName = null;
8992

@@ -463,6 +466,14 @@ public void setTrialDbId(String trialDbId) {
463466
this.trialDbId = trialDbId;
464467
}
465468

469+
public String getProgramDbId() {
470+
return programDbId;
471+
}
472+
473+
public void setProgramDbId(String programDbId) {
474+
this.programDbId = programDbId;
475+
}
476+
466477
public StudyNewRequest trialName(String trialName) {
467478
this.trialName = trialName;
468479
return this;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package io.swagger.model.pheno;
2+
3+
public class ObservationLevelNewRequest extends ObservationUnitHierarchyLevel {
4+
private Boolean global = null;
5+
6+
public Boolean getGlobal() {
7+
return global;
8+
}
9+
10+
public void setGlobal(Boolean value) {
11+
this.global = value;
12+
}
13+
}
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
package io.swagger.model.pheno;
2+
3+
import java.util.Objects;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
6+
7+
import io.swagger.annotations.ApiModelProperty;
8+
import io.swagger.model.BrAPIResponse;
9+
import io.swagger.model.Context;
10+
import io.swagger.model.Metadata;
11+
12+
import io.swagger.model.pheno.ObservationLevelListResponseResult;
13+
import org.springframework.validation.annotation.Validated;
14+
import jakarta.validation.Valid;
15+
16+
17+
/**
18+
* ObservationLevelListResponse
19+
*/
20+
@Validated
21+
@javax.annotation.processing.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-03-20T16:32:22.556Z[GMT]")
22+
public class ObservationLevelSingleResponse implements BrAPIResponse<ObservationUnitHierarchyLevel> {
23+
@JsonProperty("@context")
24+
private Context _atContext = null;
25+
26+
@JsonProperty("metadata")
27+
private Metadata metadata = null;
28+
29+
@JsonProperty("result")
30+
private ObservationUnitHierarchyLevel result = null;
31+
32+
public ObservationLevelSingleResponse _atContext(Context _atContext) {
33+
this._atContext = _atContext;
34+
return this;
35+
}
36+
37+
38+
39+
public void set_atContext(Context _atContext) {
40+
this._atContext = _atContext;
41+
}
42+
43+
public ObservationLevelSingleResponse metadata(Metadata metadata) {
44+
this.metadata = metadata;
45+
return this;
46+
}
47+
48+
/**
49+
* Get metadata
50+
* @return metadata
51+
**/
52+
@ApiModelProperty(required = true, value = "")
53+
54+
55+
@Valid
56+
public Metadata getMetadata() {
57+
return metadata;
58+
}
59+
60+
public void setMetadata(Metadata metadata) {
61+
this.metadata = metadata;
62+
}
63+
64+
public ObservationLevelSingleResponse result(ObservationUnitHierarchyLevel result) {
65+
this.result = result;
66+
return this;
67+
}
68+
69+
/**
70+
* Get result
71+
* @return result
72+
**/
73+
@ApiModelProperty(required = true, value = "")
74+
75+
76+
@Valid
77+
public ObservationUnitHierarchyLevel getResult() {
78+
return result;
79+
}
80+
81+
public void setResult(ObservationUnitHierarchyLevel result) {
82+
this.result = result;
83+
}
84+
85+
86+
@Override
87+
public boolean equals(java.lang.Object o) {
88+
if (this == o) {
89+
return true;
90+
}
91+
if (o == null || getClass() != o.getClass()) {
92+
return false;
93+
}
94+
ObservationLevelSingleResponse observationLevelSingleResponse = (ObservationLevelSingleResponse) o;
95+
return Objects.equals(this._atContext, observationLevelSingleResponse._atContext) &&
96+
Objects.equals(this.metadata, observationLevelSingleResponse.metadata) &&
97+
Objects.equals(this.result, observationLevelSingleResponse.result);
98+
}
99+
100+
@Override
101+
public int hashCode() {
102+
return Objects.hash(_atContext, metadata, result);
103+
}
104+
105+
@Override
106+
public String toString() {
107+
StringBuilder sb = new StringBuilder();
108+
sb.append("class ObservationLevelListResponse {\n");
109+
110+
sb.append(" _atContext: ").append(toIndentedString(_atContext)).append("\n");
111+
sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n");
112+
sb.append(" result: ").append(toIndentedString(result)).append("\n");
113+
sb.append("}");
114+
return sb.toString();
115+
}
116+
117+
/**
118+
* Convert the given object to string with each line indented by 4 spaces
119+
* (except the first line).
120+
*/
121+
private String toIndentedString(java.lang.Object o) {
122+
if (o == null) {
123+
return "null";
124+
}
125+
return o.toString().replace("\n", "\n ");
126+
}
127+
}

src/main/java/io/swagger/model/pheno/ObservationTableHeaderRowEnum.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,7 @@ public enum ObservationTableHeaderRowEnum {
1515
GERMPLASMNAME("germplasmName"),
1616
POSITIONCOORDINATEX("positionCoordinateX"),
1717
POSITIONCOORDINATEY("positionCoordinateY"),
18-
YEAR("year"),
19-
FIELD("field"),
20-
PLOT("plot"),
21-
SUB_PLOT("sub-plot"),
22-
PLANT("plant"),
23-
POT("pot"),
24-
BLOCK("block"),
25-
ENTRY("entry"),
26-
REP("rep");
18+
YEAR("year");
2719
private String value;
2820

2921
ObservationTableHeaderRowEnum(String value) {

src/main/java/io/swagger/model/pheno/ObservationUnitHierarchyLevel.java

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,42 @@
22

33
import java.util.Objects;
44

5+
import com.fasterxml.jackson.annotation.JsonInclude;
56
import com.fasterxml.jackson.annotation.JsonProperty;
67

78
public class ObservationUnitHierarchyLevel {
89

10+
@JsonProperty("levelNameDbId")
11+
private String levelNameDbId = null;
12+
913
@JsonProperty("levelName")
10-
private ObservationUnitHierarchyLevelEnum levelName = null;
14+
private String levelName = null;
1115

1216
@JsonProperty("levelOrder")
1317
private Integer levelOrder = null;
1418

15-
public ObservationUnitHierarchyLevel levelName(ObservationUnitHierarchyLevelEnum levelName) {
16-
this.levelName = levelName;
17-
return this;
19+
@JsonProperty("programDbId")
20+
@JsonInclude(JsonInclude.Include.NON_NULL)
21+
private String programDbId = null;
22+
23+
// NOTE: This property is NOT used for lookups, only responses.
24+
@JsonProperty("programName")
25+
@JsonInclude(JsonInclude.Include.NON_NULL)
26+
private String programName = null;
27+
28+
public String getLevelNameDbId() {
29+
return levelNameDbId;
30+
}
31+
32+
public void setLevelNameDbId(String value) {
33+
this.levelNameDbId = value;
1834
}
1935

20-
public ObservationUnitHierarchyLevelEnum getLevelName() {
36+
public String getLevelName() {
2137
return levelName;
2238
}
2339

24-
public void setLevelName(ObservationUnitHierarchyLevelEnum levelName) {
40+
public void setLevelName(String levelName) {
2541
this.levelName = levelName;
2642
}
2743

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

57+
public String getProgramDbId() {
58+
return programDbId;
59+
}
60+
61+
public void setProgramDbId(String value) {
62+
this.programDbId = value;
63+
}
64+
65+
public String getProgramName() {
66+
return programName;
67+
}
68+
69+
public void setProgramName(String value) {
70+
this.programName = value;
71+
}
72+
4173
@Override
4274
public boolean equals(java.lang.Object o) {
4375
if (this == o) {
@@ -47,13 +79,12 @@ public boolean equals(java.lang.Object o) {
4779
return false;
4880
}
4981
ObservationUnitHierarchyLevel observationUnitHierarchyLevel = (ObservationUnitHierarchyLevel) o;
50-
return Objects.equals(this.levelName, observationUnitHierarchyLevel.levelName)
51-
&& Objects.equals(this.levelOrder, observationUnitHierarchyLevel.levelOrder);
82+
return Objects.equals(this.levelNameDbId, observationUnitHierarchyLevel.levelNameDbId);
5283
}
5384

5485
@Override
5586
public int hashCode() {
56-
return Objects.hash(levelName, levelOrder);
87+
return Objects.hash(levelNameDbId);
5788
}
5889

5990
@Override
@@ -63,7 +94,9 @@ public String toString() {
6394

6495
sb.append(" levelName: ").append(toIndentedString(levelName)).append("\n");
6596
sb.append(" levelOrder: ").append(toIndentedString(levelOrder)).append("\n");
66-
sb.append("}");
97+
sb.append(" levelNameDbId: ").append(toIndentedString(levelNameDbId)).append("\n");
98+
sb.append(" programDbId: ").append(toIndentedString(programDbId)).append("\n");
99+
sb.append(" programName: ").append(toIndentedString(programName)).append("\n");
67100
return sb.toString();
68101
}
69102

src/main/java/io/swagger/model/pheno/ObservationUnitLevel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ public boolean equals(Object obj) {
2424
if (getClass() != obj.getClass())
2525
return false;
2626
ObservationUnitLevel other = (ObservationUnitLevel) obj;
27-
return Objects.equals(levelCode, other.levelCode);
27+
return Objects.equals(getLevelNameDbId(), other.getLevelNameDbId());
2828
}
2929

3030
@Override
3131
public int hashCode() {
3232
final int prime = 31;
3333
int result = super.hashCode();
34-
result = prime * result + Objects.hash(levelCode);
34+
result = prime * result + Objects.hash(getLevelNameDbId());
3535
return result;
3636
}
3737

src/main/java/org/brapi/test/BrAPITestServer/auth/BrapiTestServerAuthConfig.java renamed to src/main/java/org/brapi/test/BrAPITestServer/config/BrapiTestServerAuthConfig.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
package org.brapi.test.BrAPITestServer.auth;
1+
package org.brapi.test.BrAPITestServer.config;
22

3+
import org.brapi.test.BrAPITestServer.auth.BrapiTestServerJWTAuthFilter;
34
import org.springframework.beans.factory.annotation.Value;
45
import org.springframework.context.annotation.Bean;
56
import org.springframework.context.annotation.Configuration;

0 commit comments

Comments
 (0)