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
2 changes: 1 addition & 1 deletion brapi-java-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.brapi</groupId>
<artifactId>brapi</artifactId>
<version>2.2-SNAPSHOT</version>
<version>2.2.1-SNAPSHOT</version>
</parent>

<name>${project.artifactId}</name>
Expand Down
2 changes: 1 addition & 1 deletion brapi-java-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>org.brapi</groupId>
<artifactId>brapi</artifactId>
<version>2.2-SNAPSHOT</version>
<version>2.2.1-SNAPSHOT</version>
</parent>

<name>${project.artifactId}</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.brapi.v2.model;

public class BrAPIFilterBy {
private String filterOn;
private String value;

public String getFilterOn() {
return filterOn;
}

public void setFilterOn(String filterOn) {
this.filterOn = filterOn;
}

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
package org.brapi.v2.model;

import java.util.List;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;





/**
* SearchRequestParametersPaging
*/


public class BrAPISearchRequestParametersPaging {
@JsonProperty("page")
private Integer page = null;

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

@JsonProperty("sortBy")
protected List<BrAPISortBy> sortBy = null;

@JsonProperty("filterBy")
protected List<BrAPIFilterBy> filterBy = null;

public BrAPISearchRequestParametersPaging page(Integer page) {
this.page = page;
return this;
Expand Down Expand Up @@ -57,6 +58,21 @@ public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}

public List<BrAPISortBy> getSortBy() {
return sortBy;
}

public void setSortBy(List<BrAPISortBy> sortBy) {
this.sortBy = sortBy;
}

public List<BrAPIFilterBy> getFilterBy() {
return filterBy;
}

public void setFilterBy(List<BrAPIFilterBy> filterBy) {
this.filterBy = filterBy;
}

@Override
public boolean equals(java.lang.Object o) {
Expand Down
70 changes: 19 additions & 51 deletions brapi-java-model/src/main/java/org/brapi/v2/model/BrAPISortBy.java
Original file line number Diff line number Diff line change
@@ -1,62 +1,30 @@
package org.brapi.v2.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public enum BrAPISortBy implements BrAPIEnum {

STUDYDBID("studyDbId"),

STARTDATE("startDate"),

ENDDATE("endDate"),

TRIALDBID("trialDbId"),

TRIALNAME("trialName"),

PROGRAMDBID("programDbId"),

LOCATIONDBID("locationDbId"),

SEASONDBID("seasonDbId"),

STUDYTYPE("studyType"),

STUDYNAME("studyName"),

STUDYLOCATION("studyLocation"),

PROGRAMNAME("programName"),

GERMPLASMDBID("germplasmDbId"),

OBSERVATIONVARIABLEDBID("observationVariableDbId");
public class BrAPISortBy {
private String sortedOn;
private BrAPISortOrder sortOrder = BrAPISortOrder.ASC;

public BrAPISortBy(String sortedOn,
BrAPISortOrder sortOrder) {
this.sortedOn = sortedOn;
this.sortOrder = sortOrder;
}

private String value;
public BrAPISortBy() {}

BrAPISortBy(String value) {
this.value = value;
public String getSortedOn() {
return sortedOn;
}

@Override
@JsonValue
public String toString() {
return String.valueOf(value);
public void setSortedOn(String sortedOn) {
this.sortedOn = sortedOn;
}

@JsonCreator
public static BrAPISortBy fromValue(String text) {
for (BrAPISortBy b : BrAPISortBy.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
public BrAPISortOrder getSortOrder() {
return sortOrder;
}

@Override
public String getBrapiValue() {
return value;
}
public void setSortOrder(BrAPISortOrder sortOrder) {
this.sortOrder = sortOrder;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ public class BrAPIStudySearchRequest extends BrAPISearchRequestParametersPaging
@JsonProperty("seasonDbIds")
private List<String> seasonDbIds = null;

@JsonProperty("sortBy")
private BrAPISortBy sortBy = null;

@JsonProperty("sortOrder")
private BrAPISortOrder sortOrder = null;

@JsonProperty("studyCodes")
private List<String> studyCodes = null;

Expand Down Expand Up @@ -598,45 +592,6 @@ public void setSeasonDbIds(List<String> seasonDbIds) {
this.seasonDbIds = seasonDbIds;
}

public BrAPIStudySearchRequest sortBy(BrAPISortBy sortBy) {
this.sortBy = sortBy;
return this;
}

/**
* Name of one of the fields within the study object on which results can be
* sorted
*
* @return sortBy
**/

public BrAPISortBy getSortBy() {
return sortBy;
}

public void setSortBy(BrAPISortBy sortBy) {
this.sortBy = sortBy;
}

public BrAPIStudySearchRequest sortOrder(BrAPISortOrder sortOrder) {
this.sortOrder = sortOrder;
return this;
}

/**
* Order results should be sorted. ex. \"ASC\" or \"DESC\"
*
* @return sortOrder
**/

public BrAPISortOrder getSortOrder() {
return sortOrder;
}

public void setSortOrder(BrAPISortOrder sortOrder) {
this.sortOrder = sortOrder;
}

public BrAPIStudySearchRequest studyCodes(List<String> studyCodes) {
this.studyCodes = studyCodes;
return this;
Expand Down Expand Up @@ -748,7 +703,6 @@ public boolean equals(java.lang.Object o) {
&& Objects.equals(this.active, studySearchRequest.active)
&& Objects.equals(this.seasonDbIds, studySearchRequest.seasonDbIds)
&& Objects.equals(this.sortBy, studySearchRequest.sortBy)
&& Objects.equals(this.sortOrder, studySearchRequest.sortOrder)
&& Objects.equals(this.studyCodes, studySearchRequest.studyCodes)
&& Objects.equals(this.studyPUIs, studySearchRequest.studyPUIs)
&& Objects.equals(this.studyTypes, studySearchRequest.studyTypes) && super.equals(o);
Expand All @@ -759,7 +713,7 @@ public int hashCode() {
return Objects.hash(commonCropNames, programDbIds, programNames, trialDbIds, trialNames, studyDbIds, studyNames,
locationDbIds, locationNames, germplasmDbIds, germplasmNames, observationVariableDbIds,
observationVariableNames, observationVariablePUIs, externalReferenceIds, externalReferenceIDs,
externalReferenceSources, active, seasonDbIds, sortBy, sortOrder, studyCodes, studyPUIs, studyTypes,
externalReferenceSources, active, seasonDbIds, sortBy, studyCodes, studyPUIs, studyTypes,
super.hashCode());
}

Expand Down Expand Up @@ -788,7 +742,6 @@ public String toString() {
sb.append(" active: ").append(toIndentedString(active)).append("\n");
sb.append(" seasonDbIds: ").append(toIndentedString(seasonDbIds)).append("\n");
sb.append(" sortBy: ").append(toIndentedString(sortBy)).append("\n");
sb.append(" sortOrder: ").append(toIndentedString(sortOrder)).append("\n");
sb.append(" studyCodes: ").append(toIndentedString(studyCodes)).append("\n");
sb.append(" studyPUIs: ").append(toIndentedString(studyPUIs)).append("\n");
sb.append(" studyTypes: ").append(toIndentedString(studyTypes)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import java.time.LocalDate;

import org.brapi.v2.model.BrAPISearchRequestParametersPaging;
import org.brapi.v2.model.BrAPISortBy;
import org.brapi.v2.model.BrAPISortOrder;

/**
* TrialSearchRequest
Expand Down Expand Up @@ -68,28 +66,6 @@ public class BrAPITrialSearchRequest extends BrAPISearchRequestParametersPaging
@JsonProperty("trialPUIs")
private List<String> trialPUIs = null;

@JsonProperty("sortBy")
private BrAPISortBy sortBy = null;

@JsonProperty("sortOrder")
private BrAPISortOrder sortOrder = null;

public BrAPISortBy getSortBy() {
return sortBy;
}

public void setSortBy(BrAPISortBy sortBy) {
this.sortBy = sortBy;
}

public BrAPISortOrder getSortOrder() {
return sortOrder;
}

public void setSortOrder(BrAPISortOrder sortOrder) {
this.sortOrder = sortOrder;
}

public BrAPITrialSearchRequest commonCropNames(List<String> commonCropNames) {
this.commonCropNames = commonCropNames;
return this;
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<groupId>org.brapi</groupId>
<artifactId>brapi</artifactId>
<version>2.2-SNAPSHOT</version>
<version>2.2.1-SNAPSHOT</version>

<name>${project.artifactId}</name>
<url>https://github.com/Breeding-Insight/brapi</url>
Expand Down
Loading