Skip to content
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

Minor updates #1

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
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
Empty file modified gradlew
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@
public class ArrayResult<T>
{
private List<T> data;

public ArrayResult(List<T> data) {
this.data = data;
}
}
14 changes: 14 additions & 0 deletions src/main/java/uk/ac/hutton/ics/brapi/resource/base/BaseResult.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package uk.ac.hutton.ics.brapi.resource.base;

import java.util.List;

import com.fasterxml.jackson.annotation.*;
import com.google.gson.annotations.SerializedName;
import lombok.*;
Expand All @@ -23,4 +25,16 @@ public BaseResult(T result, int currentPage, int pageSize, long totalCount)
this.result = result;
metadata.setPagination(new Pagination(pageSize, currentPage, totalCount, pageSize));
}

public BaseResult(T result, int currentPage, int pageSize, long totalCount, int totalPages)
{
this.result = result;
metadata.setPagination(new Pagination().setCurrentPage(currentPage).setPageSize(pageSize).setTotalCount(totalCount).setTotalPages(totalPages));
}

public BaseResult(T result, List<Status> status)
{
this.result = result;
metadata.setStatus(status);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.*;
import java.util.stream.Collectors;

import com.fasterxml.jackson.annotation.JsonValue;

public class BrapiCall
{
private List<String> contentTypes = new ArrayList<>();
Expand Down Expand Up @@ -118,6 +120,7 @@ public static ContentType getFromString(String type)
return null;
}

@JsonValue
public String getType()
{
return type;
Expand Down Expand Up @@ -147,6 +150,7 @@ public static DataType getFromString(String type)
return null;
}

@JsonValue
public String getType()
{
return type;
Expand Down Expand Up @@ -185,6 +189,7 @@ public static Version getFromString(String version)
return null;
}

@JsonValue
public String getNumber()
{
return number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import lombok.*;
import lombok.experimental.Accessors;

import java.sql.Timestamp;

@NoArgsConstructor
@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ public class Metadata
{
private List<DataFile> datafiles;
private Pagination pagination;
private List<Status> status;
private List<Status> status = List.of();
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
public class Pagination
{
private int pageSize;
private int page;
private int currentPage;
private long totalCount;
private int totalPages;

public Pagination(int pageSize, int page, long totalCount, int desiredPageSize)
{
this.pageSize = pageSize;
this.page = page;
this.currentPage = page;
this.totalCount = totalCount;
this.totalPages = (int) Math.ceil(totalCount / (float) desiredPageSize);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import lombok.*;
import lombok.experimental.Accessors;

import java.sql.Timestamp;
import java.util.List;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.experimental.Accessors;
import uk.ac.hutton.ics.brapi.resource.base.*;

import java.sql.Timestamp;
import java.util.List;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import uk.ac.hutton.ics.brapi.resource.phenotyping.observation.ObservationLevel;

import java.net.URI;
import java.sql.Timestamp;
import java.util.List;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import lombok.*;
import lombok.experimental.Accessors;
import uk.ac.hutton.ics.brapi.resource.base.Pagination;

@NoArgsConstructor
@AllArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package uk.ac.hutton.ics.brapi.resource.genotyping.call;

import com.google.gson.annotations.SerializedName;
import lombok.*;
import lombok.experimental.Accessors;
import uk.ac.hutton.ics.brapi.resource.base.BrapiObject;
import uk.ac.hutton.ics.brapi.resource.genotyping.variant.Genotype;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.experimental.Accessors;
import uk.ac.hutton.ics.brapi.resource.base.BrapiObject;

import java.sql.Timestamp;
import java.util.List;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import uk.ac.hutton.ics.brapi.resource.base.BrapiObject;

import java.net.URI;
import java.sql.Timestamp;

@NoArgsConstructor
@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import uk.ac.hutton.ics.brapi.resource.base.BrapiObject;
import uk.ac.hutton.ics.brapi.resource.germplasm.germplasm.MiniGermplasm;

import java.net.URI;
import java.util.List;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import uk.ac.hutton.ics.brapi.resource.base.Reference;
import uk.ac.hutton.ics.brapi.resource.germplasm.germplasm.MiniGermplasm;

import java.net.URI;
import java.util.List;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.experimental.Accessors;
import uk.ac.hutton.ics.brapi.resource.base.*;

import java.sql.Timestamp;
import java.util.List;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import lombok.*;
import lombok.experimental.Accessors;

import java.sql.Timestamp;
import java.util.List;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package uk.ac.hutton.ics.brapi.resource.genotyping.variant;

import com.google.gson.annotations.SerializedName;
import lombok.*;
import lombok.experimental.Accessors;
import uk.ac.hutton.ics.brapi.resource.base.*;

import java.sql.Timestamp;
import java.util.List;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.experimental.Accessors;
import uk.ac.hutton.ics.brapi.resource.base.*;

import java.sql.Timestamp;
import java.util.List;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

import java.util.List;

import com.fasterxml.jackson.annotation.JsonValue;

@NoArgsConstructor
@Getter
@Setter
@Accessors(chain = true)
public class Scale extends BrapiObject
{
private String dataType;
private DataType dataType;
private Integer decimalPlaces;
private List<Reference> externalReferences;
private OntologyReference ontologyReference;
Expand All @@ -21,4 +23,35 @@ public class Scale extends BrapiObject
private String scalePUI;
private String units;
private ValidValues validValues;

/**
* Scale data type
*/
public enum DataType {
/** Numerical scales express the trait with real numbers. The numerical scale defines the unit e.g. centimeter, ton per hectare, branches. */
NUMERICAL("Numerical"),
/** Ordinal scales are scales composed of ordered categories. */
ORDINAL("Ordinal"),
/** Categorical scale that can take one of a limited and fixed number of categories. There is no intrinsic ordering to the categories. */
NOMINAL("Nominal"),
/** A free text is used to express the trait. */
TEXT("Text"),
/** This scale class is exceptionally used to express complex traits. Code is a nominal scale that combines the expressions of the different traits composing the complex trait. For example a severity trait might be expressed by a 2 digit and 2 character code. The first 2 digits are the percentage of the plant covered by a fungus and the 2 characters refer to the delay in development, e.g. "75VD" means "75 %" of the plant is infected and the plant is very delayed. */
CODE("Code"),
/** The date class is for events expressed in a time format, See ISO 8601. */
DATE("Date"),
/** The Duration class is for time elapsed between two events expressed in a time format, e.g. days, hours, months. */
DURATION("Duration");

String value;

private DataType(String value) {
this.value = value;
}

@JsonValue
public String getValue() {
return value;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ public class ValidValues
private List<Category> categories;
private String maximumValue;
private String minimumValue;

/** @deprecated Deprecated in BrAPI 2.1 */
@Deprecated
private Integer min;
/** @deprecated Deprecated in BrAPI 2.1 */
@Deprecated
private Integer max;

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.experimental.Accessors;
import uk.ac.hutton.ics.brapi.resource.base.*;

import java.sql.Timestamp;
import java.util.*;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.experimental.Accessors;
import uk.ac.hutton.ics.brapi.resource.base.*;

import java.sql.Timestamp;
import java.util.List;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import uk.ac.hutton.ics.brapi.resource.core.location.GeometryPoint;

import java.net.URI;
import java.sql.Timestamp;
import java.util.List;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.experimental.Accessors;
import uk.ac.hutton.ics.brapi.resource.core.location.*;

import java.sql.Timestamp;
import java.util.List;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import lombok.*;
import lombok.experimental.Accessors;

import java.sql.Timestamp;
import java.util.List;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import uk.ac.hutton.ics.brapi.resource.germplasm.attribute.*;

import java.net.URI;
import java.sql.Timestamp;
import java.util.List;

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import jakarta.ws.rs.*;
import uk.ac.hutton.ics.brapi.resource.base.*;
import uk.ac.hutton.ics.brapi.resource.phenotyping.image.Image;
import uk.ac.hutton.ics.brapi.resource.phenotyping.ontology.Ontology;

import java.io.IOException;
Expand Down