From 73ddaf6275fd844f4cb02a3b5b44acee75917d1c Mon Sep 17 00:00:00 2001 From: Peter Selby Date: Mon, 21 Aug 2023 13:12:57 -0400 Subject: [PATCH] fixes issues #167, #168, #169, #170, #171, #172, #173. Dependent on #199 --- .../germplasm/SeedLotQueryParams.java | 30 +- .../SeedLotTransactionQueryParams.java | 32 +- .../v2/modules/germplasm/SeedLotsApiTest.java | 295 +++--- .../org/brapi/v2/model/germ/BrAPISeedLot.java | 887 ++++++++++-------- .../germ/BrAPISeedLotContentMixture.java | 176 ++++ 5 files changed, 857 insertions(+), 563 deletions(-) create mode 100644 brapi-java-model/src/main/java/org/brapi/v2/model/germ/BrAPISeedLotContentMixture.java diff --git a/brapi-java-client/src/main/java/org/brapi/client/v2/model/queryParams/germplasm/SeedLotQueryParams.java b/brapi-java-client/src/main/java/org/brapi/client/v2/model/queryParams/germplasm/SeedLotQueryParams.java index 4a238613..05e16a19 100644 --- a/brapi-java-client/src/main/java/org/brapi/client/v2/model/queryParams/germplasm/SeedLotQueryParams.java +++ b/brapi-java-client/src/main/java/org/brapi/client/v2/model/queryParams/germplasm/SeedLotQueryParams.java @@ -26,28 +26,34 @@ import org.brapi.client.v2.model.queryParams.core.BrAPIQueryParams; - @Getter @Setter @SuperBuilder @NoArgsConstructor @AllArgsConstructor -@Accessors(fluent=true) +@Accessors(fluent = true) public class SeedLotQueryParams extends BrAPIQueryParams { - private String seedLotDbId; - private String germplasmDbId; - private String externalReferenceSource; - private String externalReferenceId; - @Deprecated - private String externalReferenceID; - - public String getExternalReferenceId() { + private String seedLotDbId; + private String germplasmDbId; + private String externalReferenceSource; + private String externalReferenceId; + @Deprecated + private String externalReferenceID; + private String germplasmName; + private String crossDbId; + private String commonCropName; + private String crossName; + private String programDbId; + + public String getExternalReferenceId() { return externalReferenceId; } - public String externalReferenceId() { + + public String externalReferenceId() { return externalReferenceId; } + public void setExternalReferenceId(String externalReferenceId) { this.externalReferenceId = externalReferenceId; } @@ -56,10 +62,12 @@ public void setExternalReferenceId(String externalReferenceId) { public String getExternalReferenceID() { return externalReferenceID; } + @Deprecated public String externalReferenceID() { return externalReferenceID; } + @Deprecated public void setExternalReferenceID(String externalReferenceID) { this.externalReferenceID = externalReferenceID; diff --git a/brapi-java-client/src/main/java/org/brapi/client/v2/model/queryParams/germplasm/SeedLotTransactionQueryParams.java b/brapi-java-client/src/main/java/org/brapi/client/v2/model/queryParams/germplasm/SeedLotTransactionQueryParams.java index 5f95e830..4dd4647e 100644 --- a/brapi-java-client/src/main/java/org/brapi/client/v2/model/queryParams/germplasm/SeedLotTransactionQueryParams.java +++ b/brapi-java-client/src/main/java/org/brapi/client/v2/model/queryParams/germplasm/SeedLotTransactionQueryParams.java @@ -26,29 +26,35 @@ import org.brapi.client.v2.model.queryParams.core.BrAPIQueryParams; - @Getter @Setter @SuperBuilder @NoArgsConstructor @AllArgsConstructor -@Accessors(fluent=true) +@Accessors(fluent = true) public class SeedLotTransactionQueryParams extends BrAPIQueryParams { - private String transactionDbId; - private String seedLotDbId; - private String germplasmDbId; - private String externalReferenceSource; - private String externalReferenceId; - @Deprecated - private String externalReferenceID; - - public String getExternalReferenceId() { + private String transactionDbId; + private String seedLotDbId; + private String germplasmDbId; + private String externalReferenceSource; + private String externalReferenceId; + @Deprecated + private String externalReferenceID; + private String germplasmName; + private String crossDbId; + private String commonCropName; + private String crossName; + private String programDbId; + + public String getExternalReferenceId() { return externalReferenceId; } - public String externalReferenceId() { + + public String externalReferenceId() { return externalReferenceId; } + public void setExternalReferenceId(String externalReferenceId) { this.externalReferenceId = externalReferenceId; } @@ -57,10 +63,12 @@ public void setExternalReferenceId(String externalReferenceId) { public String getExternalReferenceID() { return externalReferenceID; } + @Deprecated public String externalReferenceID() { return externalReferenceID; } + @Deprecated public void setExternalReferenceID(String externalReferenceID) { this.externalReferenceID = externalReferenceID; diff --git a/brapi-java-client/src/test/java/org/brapi/client/v2/modules/germplasm/SeedLotsApiTest.java b/brapi-java-client/src/test/java/org/brapi/client/v2/modules/germplasm/SeedLotsApiTest.java index 766bd843..a5c63587 100644 --- a/brapi-java-client/src/test/java/org/brapi/client/v2/modules/germplasm/SeedLotsApiTest.java +++ b/brapi-java-client/src/test/java/org/brapi/client/v2/modules/germplasm/SeedLotsApiTest.java @@ -13,6 +13,7 @@ package org.brapi.client.v2.modules.germplasm; import org.brapi.client.v2.ApiResponse; +import org.brapi.client.v2.BrAPIClientTest; import org.brapi.client.v2.model.exceptions.ApiException; import org.brapi.client.v2.model.queryParams.germplasm.SeedLotQueryParams; import org.brapi.client.v2.model.queryParams.germplasm.SeedLotTransactionQueryParams; @@ -22,156 +23,160 @@ import org.brapi.v2.model.germ.response.BrAPISeedLotSingleResponse; import org.brapi.v2.model.germ.response.BrAPISeedLotTransactionListResponse; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; -import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import java.math.BigDecimal; +import java.util.Arrays; import java.util.List; /** * API tests for SeedLotsApi */ -public class SeedLotsApiTest { - - private final SeedLotsApi api = new SeedLotsApi(); - - /** - * Get a filtered list of Seed Lot descriptions - * - * Get a filtered list of Seed Lot descriptions available in a system. - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void seedlotsGetTest() throws ApiException { - String seedLotDbId = null; - String germplasmDbId = null; - String externalReferenceID = null; - String externalReferenceSource = null; - Integer page = null; - Integer pageSize = null; - - SeedLotQueryParams queryParams = new SeedLotQueryParams(); - ApiResponse response = api.seedlotsGet(queryParams); - - // TODO: test validations - } - /** - * Add new Seed Lot descriptions to a server - * - * Add new Seed Lot descriptions to a server - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void seedlotsPostTest() throws ApiException { - List body = null; - - IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> { - ApiResponse response = api.seedlotsPost(body); - }); - - // TODO: test validations - } - /** - * Get a specific Seed Lot - * - * Get a specific Seed Lot by seedLotDbId - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void seedlotsSeedLotDbIdGetTest() throws ApiException { - String seedLotDbId = null; - - IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> { - ApiResponse response = api.seedlotsSeedLotDbIdGet(seedLotDbId); - }); - - // TODO: test validations - } - /** - * Update an existing Seed Lot - * - * Update an existing Seed Lot - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void seedlotsSeedLotDbIdPutTest() throws ApiException { - String seedLotDbId = null; - BrAPISeedLot body = null; - - IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> { - ApiResponse response = api.seedlotsSeedLotDbIdPut(seedLotDbId, body); - }); - - // TODO: test validations - } - /** - * Get all Transactions related to a specific Seed Lot - * - * Get all Transactions related to a specific Seed Lot - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void seedlotsSeedLotDbIdTransactionsGetTest() throws ApiException { - String seedLotDbId = null; - String transactionDbId = null; - String transactionDirection = null; - Integer page = null; - Integer pageSize = null; - - IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> { - ApiResponse response = api.seedlotsSeedLotDbIdTransactionsGet(seedLotDbId, transactionDbId, transactionDirection, page, pageSize); - }); - - // TODO: test validations - } - /** - * Get a filtered list of Seed Lot Transactions - * - * Get a filtered list of Seed Lot Transactions - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void seedlotsTransactionsGetTest() throws ApiException { - String transactionDbId = null; - String seedLotDbId = null; - String germplasmDbId = null; - String externalReferenceID = null; - String externalReferenceSource = null; - Integer page = null; - Integer pageSize = null; - - SeedLotTransactionQueryParams queryParams = new SeedLotTransactionQueryParams(); - ApiResponse response = api.seedlotsTransactionsGet(queryParams); - - // TODO: test validations - } - /** - * Add new Seed Lot Transaction to be recorded - * - * Add new Seed Lot Transaction to be recorded - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void seedlotsTransactionsPostTest() throws ApiException { - List body = null; - - IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> { - ApiResponse response = api.seedlotsTransactionsPost(body); - }); - - // TODO: test validations - } +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +public class SeedLotsApiTest extends BrAPIClientTest { + + private final SeedLotsApi api = new SeedLotsApi(this.apiClient); + + /** + * Get a filtered list of Seed Lot descriptions + * + * Get a filtered list of Seed Lot descriptions available in a system. + * + * @throws ApiException if the Api call fails + */ + @Test + public void seedlotsGetTest() throws ApiException { + String seedLotDbId = "seed_lot1"; + + SeedLotQueryParams queryParams = new SeedLotQueryParams().seedLotDbId(seedLotDbId); + ApiResponse response = api.seedlotsGet(queryParams); + + assertEquals(1, response.getBody().getResult().getData().size()); + assertEquals(seedLotDbId, response.getBody().getResult().getData().get(0).getSeedLotDbId()); + } + + /** + * Add new Seed Lot descriptions to a server + * + * Add new Seed Lot descriptions to a server + * + * @throws ApiException if the Api call fails + */ + @Test + public void seedlotsPostTest() throws ApiException { + BrAPISeedLot seedLot = new BrAPISeedLot().seedLotName("New Name"); + List body = Arrays.asList(seedLot); + + ApiResponse response = api.seedlotsPost(body); + + assertEquals(1, response.getBody().getResult().getData().size()); + assertEquals(seedLot.getSeedLotName(), response.getBody().getResult().getData().get(0).getSeedLotName()); + assertNotNull(response.getBody().getResult().getData().get(0).getSeedLotDbId()); + + } + + /** + * Get a specific Seed Lot + * + * Get a specific Seed Lot by seedLotDbId + * + * @throws ApiException if the Api call fails + */ + @Test + public void seedlotsSeedLotDbIdGetTest() throws ApiException { + String seedLotDbId = "seed_lot1"; + + ApiResponse response = api.seedlotsSeedLotDbIdGet(seedLotDbId); + + assertEquals(seedLotDbId, response.getBody().getResult().getSeedLotDbId()); + } + + /** + * Update an existing Seed Lot + * + * Update an existing Seed Lot + * + * @throws ApiException if the Api call fails + */ + @Test + public void seedlotsSeedLotDbIdPutTest() throws ApiException { + String seedLotDbId = "seed_lot1"; + BrAPISeedLot seedLot = new BrAPISeedLot().seedLotName("New Name").seedLotDbId(seedLotDbId); + + ApiResponse response = api.seedlotsSeedLotDbIdPut(seedLotDbId, seedLot); + + assertEquals(seedLot.getSeedLotDbId(), response.getBody().getResult().getSeedLotDbId()); + assertEquals(seedLot.getSeedLotName(), response.getBody().getResult().getSeedLotName()); + } + + /** + * Get all Transactions related to a specific Seed Lot + * + * Get all Transactions related to a specific Seed Lot + * + * @throws ApiException if the Api call fails + */ + @Test + public void seedlotsSeedLotDbIdTransactionsGetTest() throws ApiException { + String seedLotDbId = "seed_lot1"; + String transactionDbId = "seed_lot_transaction2"; + String transactionDirection = null; + Integer page = null; + Integer pageSize = null; + + ApiResponse response = api.seedlotsSeedLotDbIdTransactionsGet(seedLotDbId, + transactionDbId, transactionDirection, page, pageSize); + + assertEquals(1, response.getBody().getResult().getData().size()); + } + + /** + * Get a filtered list of Seed Lot Transactions + * + * Get a filtered list of Seed Lot Transactions + * + * @throws ApiException if the Api call fails + */ + @Test + public void seedlotsTransactionsGetTest() throws ApiException { + String transactionDbId = "seed_lot_transaction1"; + + SeedLotTransactionQueryParams queryParams = new SeedLotTransactionQueryParams() + .transactionDbId(transactionDbId); + ApiResponse response = api.seedlotsTransactionsGet(queryParams); + + assertEquals(1, response.getBody().getResult().getData().size()); + assertEquals(transactionDbId, response.getBody().getResult().getData().get(0).getTransactionDbId()); + } + + /** + * Add new Seed Lot Transaction to be recorded + * + * Add new Seed Lot Transaction to be recorded + * + * @throws ApiException if the Api call fails + */ + @Test + public void seedlotsTransactionsPostTest() throws ApiException { + BrAPISeedLotTransaction transaction = new BrAPISeedLotTransaction().fromSeedLotDbId("seed_lot1") + .toSeedLotDbId("seed_lot2").amount(new BigDecimal(20)).transactionDescription("test").units("seeds"); + List body = Arrays.asList(transaction); + + ApiResponse response = api.seedlotsTransactionsPost(body); + + assertEquals(1, response.getBody().getResult().getData().size()); + assertNotNull(response.getBody().getResult().getData().get(0).getTransactionDbId()); + assertEquals(transaction.getFromSeedLotDbId(), + response.getBody().getResult().getData().get(0).getFromSeedLotDbId()); + assertEquals(transaction.getToSeedLotDbId(), + response.getBody().getResult().getData().get(0).getToSeedLotDbId()); + assertEquals(transaction.getAmount(), response.getBody().getResult().getData().get(0).getAmount()); + assertEquals(transaction.getTransactionDescription(), + response.getBody().getResult().getData().get(0).getTransactionDescription()); + assertEquals(transaction.getUnits(), response.getBody().getResult().getData().get(0).getUnits()); + + } } diff --git a/brapi-java-model/src/main/java/org/brapi/v2/model/germ/BrAPISeedLot.java b/brapi-java-model/src/main/java/org/brapi/v2/model/germ/BrAPISeedLot.java index d8916b19..eb7e8a09 100644 --- a/brapi-java-model/src/main/java/org/brapi/v2/model/germ/BrAPISeedLot.java +++ b/brapi-java-model/src/main/java/org/brapi/v2/model/germ/BrAPISeedLot.java @@ -2,416 +2,513 @@ import java.math.BigDecimal; import java.time.OffsetDateTime; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.Objects; +import org.brapi.v2.model.BrAPIExternalReference; +import org.brapi.v2.model.NullableJsonElementTypeAdapterFactory; + +import com.fasterxml.jackson.annotation.JsonProperty; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.annotations.JsonAdapter; -import org.brapi.v2.model.BrAPIExternalReference; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.brapi.v2.model.NullableJsonElementTypeAdapterFactory; - -import javax.validation.Valid; - /** - * SeedLot + * BrAPISeedLot */ - public class BrAPISeedLot { - @JsonProperty("seedLotDbId") - private String seedLotDbId = null; - - @JsonProperty("additionalInfo") - @Valid - @JsonAdapter(NullableJsonElementTypeAdapterFactory.class) - private JsonObject additionalInfo = null; - - @JsonProperty("amount") - private BigDecimal amount = null; - - @JsonProperty("createdDate") - private OffsetDateTime createdDate = null; - - @JsonProperty("externalReferences") - private List externalReferences = null; - - @JsonProperty("germplasmDbId") - private String germplasmDbId = null; - - @JsonProperty("lastUpdated") - private OffsetDateTime lastUpdated = null; - - @JsonProperty("locationDbId") - private String locationDbId = null; - - @JsonProperty("programDbId") - private String programDbId = null; - - @JsonProperty("seedLotDescription") - private String seedLotDescription = null; - - @JsonProperty("seedLotName") - private String seedLotName = null; - - @JsonProperty("sourceCollection") - private String sourceCollection = null; - - @JsonProperty("storageLocation") - private String storageLocation = null; - - @JsonProperty("units") - private String units = null; - - private final transient Gson gson = new Gson(); - - public BrAPISeedLot seedLotDbId(String seedLotDbId) { - this.seedLotDbId = seedLotDbId; - return this; - } - - /** - * Unique DbId for the Seed Lot - * @return seedLotDbId - **/ - - - - public String getSeedLotDbId() { - return seedLotDbId; - } - - public void setSeedLotDbId(String seedLotDbId) { - this.seedLotDbId = seedLotDbId; - } - - public BrAPISeedLot additionalInfo(JsonObject additionalInfo) { - this.additionalInfo = additionalInfo; - return this; - } - - public BrAPISeedLot putAdditionalInfoItem(String key, Object additionalInfoItem) { - if (this.additionalInfo == null) { - this.additionalInfo = new JsonObject(); - } - JsonElement newElement = gson.toJsonTree(additionalInfoItem); - this.additionalInfo.add(key, newElement); - return this; - } - - /** - * Additional arbitrary info - * @return additionalInfo - **/ - - - public JsonObject getAdditionalInfo() { - return additionalInfo; - } - - public void setAdditionalInfo(JsonObject additionalInfo) { - this.additionalInfo = additionalInfo; - } - - public BrAPISeedLot amount(BigDecimal amount) { - this.amount = amount; - return this; - } - - /** - * Current balance of seeds in this lot. Could be a count (seeds, bulbs, etc) or a weight (kg of seed). - * @return amount - **/ - - - @Valid - public BigDecimal getAmount() { - return amount; - } - - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - - public BrAPISeedLot createdDate(OffsetDateTime createdDate) { - this.createdDate = createdDate; - return this; - } - - /** - * The time stamp for when this seed lot was created - * @return createdDate - **/ - - - @Valid - public OffsetDateTime getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(OffsetDateTime createdDate) { - this.createdDate = createdDate; - } - - public BrAPISeedLot externalReferences(List externalReferences) { - this.externalReferences = externalReferences; - return this; - } - - /** - * Get externalReferences - * @return externalReferences - **/ - - - @Valid - public List getExternalReferences() { - return externalReferences; - } - - public void setExternalReferences(List externalReferences) { - this.externalReferences = externalReferences; - } - - public BrAPISeedLot germplasmDbId(String germplasmDbId) { - this.germplasmDbId = germplasmDbId; - return this; - } - - /** - * Unique DbId of the Germplasm held in this Seed Lot - * @return germplasmDbId - **/ - - - public String getGermplasmDbId() { - return germplasmDbId; - } - - public void setGermplasmDbId(String germplasmDbId) { - this.germplasmDbId = germplasmDbId; - } - - public BrAPISeedLot lastUpdated(OffsetDateTime lastUpdated) { - this.lastUpdated = lastUpdated; - return this; - } - - /** - * The timestamp for the last update to this Seed Lot (including transactions) - * @return lastUpdated - **/ - - - @Valid - public OffsetDateTime getLastUpdated() { - return lastUpdated; - } - - public void setLastUpdated(OffsetDateTime lastUpdated) { - this.lastUpdated = lastUpdated; - } - - public BrAPISeedLot locationDbId(String locationDbId) { - this.locationDbId = locationDbId; - return this; - } - - /** - * DbId of the storage location - * @return locationDbId - **/ - - - public String getLocationDbId() { - return locationDbId; - } - - public void setLocationDbId(String locationDbId) { - this.locationDbId = locationDbId; - } - - public BrAPISeedLot programDbId(String programDbId) { - this.programDbId = programDbId; - return this; - } - - /** - * Unique DbId of the breeding Program this Seed Lot belongs to - * @return programDbId - **/ - - - public String getProgramDbId() { - return programDbId; - } + @JsonProperty("additionalInfo") + @JsonAdapter(NullableJsonElementTypeAdapterFactory.class) + private JsonObject additionalInfo = null; - public void setProgramDbId(String programDbId) { - this.programDbId = programDbId; - } + @JsonProperty("amount") + private BigDecimal amount = null; - public BrAPISeedLot seedLotDescription(String seedLotDescription) { - this.seedLotDescription = seedLotDescription; - return this; - } + @JsonProperty("contentMixture") + private List contentMixture = null; - /** - * A general description of this Seed Lot - * @return seedLotDescription - **/ + @JsonProperty("createdDate") + private OffsetDateTime createdDate = null; + @JsonProperty("externalReferences") + private List externalReferences = null; + + @Deprecated + @JsonProperty("germplasmDbId") + private String germplasmDbId = null; + + @JsonProperty("lastUpdated") + private OffsetDateTime lastUpdated = null; + + @JsonProperty("locationDbId") + private String locationDbId = null; + + @JsonProperty("locationName") + private String locationName = null; + + @JsonProperty("programDbId") + private String programDbId = null; + + @JsonProperty("programName") + private String programName = null; + + @JsonProperty("seedLotDbId") + private String seedLotDbId = null; + + @JsonProperty("seedLotDescription") + private String seedLotDescription = null; + + @JsonProperty("seedLotName") + private String seedLotName = null; + + @JsonProperty("sourceCollection") + private String sourceCollection = null; + + @JsonProperty("storageLocation") + private String storageLocation = null; + + @JsonProperty("units") + private String units = null; + + private final transient Gson gson = new Gson(); + + public BrAPISeedLot additionalInfo(JsonObject additionalInfo) { + this.additionalInfo = additionalInfo; + return this; + } + + public BrAPISeedLot putAdditionalInfoItem(String key, Object additionalInfoItem) { + if (this.additionalInfo == null) { + this.additionalInfo = new JsonObject(); + } + JsonElement newElement = gson.toJsonTree(additionalInfoItem); + this.additionalInfo.add(key, newElement); + return this; + } + + /** + * A free space containing any additional information related to a particular + * object. A data source may provide any JSON object, unrestriced by the BrAPI + * specification. + * + * @return additionalInfo + **/ + + public JsonObject getAdditionalInfo() { + return additionalInfo; + } + + public void setAdditionalInfo(JsonObject additionalInfo) { + this.additionalInfo = additionalInfo; + } + + public BrAPISeedLot amount(BigDecimal amount) { + this.amount = amount; + return this; + } + + /** + * The current balance of the amount of material in a BrAPISeedLot. Could be a + * count (seeds, bulbs, etc) or a weight (kg of seed). + * + * @return amount + **/ + + public BigDecimal getAmount() { + return amount; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + public BrAPISeedLot contentMixture(List contentMixture) { + this.contentMixture = contentMixture; + return this; + } + + public BrAPISeedLot addContentMixtureItem(BrAPISeedLotContentMixture contentMixtureItem) { + if (this.contentMixture == null) { + this.contentMixture = new ArrayList(); + } + this.contentMixture.add(contentMixtureItem); + return this; + } + + /** + * The mixture of germplasm present in the seed lot. <br/> If this seed + * lot only contains a single germplasm, the response should contain the name + * and DbId of that germplasm with a mixturePercentage value of 100 <br/> + * If the seed lot contains a mixture of different germplasm, the response + * should contain the name and DbId every germplasm present. The + * mixturePercentage field should contain the ratio of each germplasm in the + * total mixture. All of the mixturePercentage values in this array should sum + * to equal 100. + * + * @return contentMixture + **/ + + public List getContentMixture() { + return contentMixture; + } + + public void setContentMixture(List contentMixture) { + this.contentMixture = contentMixture; + } + + public BrAPISeedLot createdDate(OffsetDateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * The time stamp for when this seed lot was created + * + * @return createdDate + **/ + + public OffsetDateTime getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(OffsetDateTime createdDate) { + this.createdDate = createdDate; + } + + public BrAPISeedLot externalReferences(List externalReferences) { + this.externalReferences = externalReferences; + return this; + } + + public BrAPISeedLot addExternalReferencesItem(BrAPIExternalReference externalReferencesItem) { + if (this.externalReferences == null) { + this.externalReferences = new ArrayList(); + } + this.externalReferences.add(externalReferencesItem); + return this; + } + + /** + * An array of external reference ids. These are references to this piece of + * data in an external system. Could be a simple string or a URI. + * + * @return externalReferences + **/ + + public List getExternalReferences() { + return externalReferences; + } + + public void setExternalReferences(List externalReferences) { + this.externalReferences = externalReferences; + } + + @Deprecated + public BrAPISeedLot germplasmDbId(String germplasmDbId) { + this.germplasmDbId = germplasmDbId; + return this; + } + + /** + * The unique identifier for a Location + * + * @return locationDbId + **/ + + @Deprecated + public String getGermplasmDbId() { + return germplasmDbId; + } + + @Deprecated + public void setGermplasmDbId(String germplasmDbId) { + this.germplasmDbId = germplasmDbId; + } + + public BrAPISeedLot lastUpdated(OffsetDateTime lastUpdated) { + this.lastUpdated = lastUpdated; + return this; + } + + /** + * The timestamp for the last update to this Seed Lot (including transactions) + * + * @return lastUpdated + **/ + + public OffsetDateTime getLastUpdated() { + return lastUpdated; + } + + public void setLastUpdated(OffsetDateTime lastUpdated) { + this.lastUpdated = lastUpdated; + } + + public BrAPISeedLot locationDbId(String locationDbId) { + this.locationDbId = locationDbId; + return this; + } + + /** + * The unique identifier for a Location + * + * @return locationDbId + **/ + + public String getLocationDbId() { + return locationDbId; + } + + public void setLocationDbId(String locationDbId) { + this.locationDbId = locationDbId; + } + + public BrAPISeedLot locationName(String locationName) { + this.locationName = locationName; + return this; + } + + /** + * A human readable name for a location + * + * @return locationName + **/ + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public BrAPISeedLot programDbId(String programDbId) { + this.programDbId = programDbId; + return this; + } + + /** + * The unique DbId of the breeding program this Seed Lot belongs to + * + * @return programDbId + **/ + + public String getProgramDbId() { + return programDbId; + } + + public void setProgramDbId(String programDbId) { + this.programDbId = programDbId; + } + + public BrAPISeedLot programName(String programName) { + this.programName = programName; + return this; + } + + /** + * The human readable name of the breeding program this Seed Lot belongs to + * + * @return programName + **/ + + public String getProgramName() { + return programName; + } + + public void setProgramName(String programName) { + this.programName = programName; + } + + public BrAPISeedLot seedLotDbId(String seedLotDbId) { + this.seedLotDbId = seedLotDbId; + return this; + } + + /** + * Unique DbId for the Seed Lot + * + * @return seedLotDbId + **/ + + public String getSeedLotDbId() { + return seedLotDbId; + } + + public void setSeedLotDbId(String seedLotDbId) { + this.seedLotDbId = seedLotDbId; + } + + public BrAPISeedLot seedLotDescription(String seedLotDescription) { + this.seedLotDescription = seedLotDescription; + return this; + } + + /** + * A general description of this Seed Lot + * + * @return seedLotDescription + **/ + + public String getSeedLotDescription() { + return seedLotDescription; + } + + public void setSeedLotDescription(String seedLotDescription) { + this.seedLotDescription = seedLotDescription; + } + + public BrAPISeedLot seedLotName(String seedLotName) { + this.seedLotName = seedLotName; + return this; + } + + /** + * A human readable name for this Seed Lot + * + * @return seedLotName + **/ + + public String getSeedLotName() { + return seedLotName; + } + + public void setSeedLotName(String seedLotName) { + this.seedLotName = seedLotName; + } + + public BrAPISeedLot sourceCollection(String sourceCollection) { + this.sourceCollection = sourceCollection; + return this; + } + + /** + * The description of the source where this material was originally collected + * (wild, nursery, etc) + * + * @return sourceCollection + **/ + + public String getSourceCollection() { + return sourceCollection; + } + + public void setSourceCollection(String sourceCollection) { + this.sourceCollection = sourceCollection; + } + + public BrAPISeedLot storageLocation(String storageLocation) { + this.storageLocation = storageLocation; + return this; + } + + /** + * Description the storage location + * + * @return storageLocation + **/ + + public String getStorageLocation() { + return storageLocation; + } + + public void setStorageLocation(String storageLocation) { + this.storageLocation = storageLocation; + } + + public BrAPISeedLot units(String units) { + this.units = units; + return this; + } + + /** + * A description of the things being counted in a BrAPISeedLot (seeds, bulbs, + * kg, tree, etc) + * + * @return units + **/ + + public String getUnits() { + return units; + } + + public void setUnits(String units) { + this.units = units; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrAPISeedLot seedLot = (BrAPISeedLot) o; + return Objects.equals(this.additionalInfo, seedLot.additionalInfo) + && Objects.equals(this.amount, seedLot.amount) + && Objects.equals(this.contentMixture, seedLot.contentMixture) + && Objects.equals(this.createdDate, seedLot.createdDate) + && Objects.equals(this.externalReferences, seedLot.externalReferences) + && Objects.equals(this.germplasmDbId, seedLot.germplasmDbId) + && Objects.equals(this.lastUpdated, seedLot.lastUpdated) + && Objects.equals(this.locationDbId, seedLot.locationDbId) + && Objects.equals(this.locationName, seedLot.locationName) + && Objects.equals(this.programDbId, seedLot.programDbId) + && Objects.equals(this.programName, seedLot.programName) + && Objects.equals(this.seedLotDbId, seedLot.seedLotDbId) + && Objects.equals(this.seedLotDescription, seedLot.seedLotDescription) + && Objects.equals(this.seedLotName, seedLot.seedLotName) + && Objects.equals(this.sourceCollection, seedLot.sourceCollection) + && Objects.equals(this.storageLocation, seedLot.storageLocation) + && Objects.equals(this.units, seedLot.units); + } + + @Override + public int hashCode() { + return Objects.hash(additionalInfo, amount, contentMixture, createdDate, externalReferences, germplasmDbId, + lastUpdated, locationDbId, locationName, programDbId, programName, seedLotDbId, seedLotDescription, + seedLotName, sourceCollection, storageLocation, units); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BrAPISeedLot {\n"); + + sb.append(" additionalInfo: ").append(toIndentedString(additionalInfo)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" contentMixture: ").append(toIndentedString(contentMixture)).append("\n"); + sb.append(" createdDate: ").append(toIndentedString(createdDate)).append("\n"); + sb.append(" externalReferences: ").append(toIndentedString(externalReferences)).append("\n"); + sb.append(" germplasmDbId: ").append(toIndentedString(germplasmDbId)).append("\n"); + sb.append(" lastUpdated: ").append(toIndentedString(lastUpdated)).append("\n"); + sb.append(" locationDbId: ").append(toIndentedString(locationDbId)).append("\n"); + sb.append(" locationName: ").append(toIndentedString(locationName)).append("\n"); + sb.append(" programDbId: ").append(toIndentedString(programDbId)).append("\n"); + sb.append(" programName: ").append(toIndentedString(programName)).append("\n"); + sb.append(" seedLotDbId: ").append(toIndentedString(seedLotDbId)).append("\n"); + sb.append(" seedLotDescription: ").append(toIndentedString(seedLotDescription)).append("\n"); + sb.append(" seedLotName: ").append(toIndentedString(seedLotName)).append("\n"); + sb.append(" sourceCollection: ").append(toIndentedString(sourceCollection)).append("\n"); + sb.append(" storageLocation: ").append(toIndentedString(storageLocation)).append("\n"); + sb.append(" units: ").append(toIndentedString(units)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } - public String getSeedLotDescription() { - return seedLotDescription; - } - - public void setSeedLotDescription(String seedLotDescription) { - this.seedLotDescription = seedLotDescription; - } - - public BrAPISeedLot seedLotName(String seedLotName) { - this.seedLotName = seedLotName; - return this; - } - - /** - * A human readable name for this Seed Lot - * @return seedLotName - **/ - - - public String getSeedLotName() { - return seedLotName; - } - - public void setSeedLotName(String seedLotName) { - this.seedLotName = seedLotName; - } - - public BrAPISeedLot sourceCollection(String sourceCollection) { - this.sourceCollection = sourceCollection; - return this; - } - - /** - * The description of the source where this material was originally collected (wild, nursery, etc) - * @return sourceCollection - **/ - - - public String getSourceCollection() { - return sourceCollection; - } - - public void setSourceCollection(String sourceCollection) { - this.sourceCollection = sourceCollection; - } - - public BrAPISeedLot storageLocation(String storageLocation) { - this.storageLocation = storageLocation; - return this; - } - - /** - * Description the storage location - * @return storageLocation - **/ - - - public String getStorageLocation() { - return storageLocation; - } - - public void setStorageLocation(String storageLocation) { - this.storageLocation = storageLocation; - } - - public BrAPISeedLot units(String units) { - this.units = units; - return this; - } - - /** - * Description of the things being counted in this Seed Lot (seeds, bulbs, kg, tree, etc) - * @return units - **/ - - - public String getUnits() { - return units; - } - - public void setUnits(String units) { - this.units = units; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BrAPISeedLot seedLot = (BrAPISeedLot) o; - return Objects.equals(this.seedLotDbId, seedLot.seedLotDbId) && - Objects.equals(this.additionalInfo, seedLot.additionalInfo) && - Objects.equals(this.amount, seedLot.amount) && - Objects.equals(this.createdDate, seedLot.createdDate) && - Objects.equals(this.externalReferences, seedLot.externalReferences) && - Objects.equals(this.germplasmDbId, seedLot.germplasmDbId) && - Objects.equals(this.lastUpdated, seedLot.lastUpdated) && - Objects.equals(this.locationDbId, seedLot.locationDbId) && - Objects.equals(this.programDbId, seedLot.programDbId) && - Objects.equals(this.seedLotDescription, seedLot.seedLotDescription) && - Objects.equals(this.seedLotName, seedLot.seedLotName) && - Objects.equals(this.sourceCollection, seedLot.sourceCollection) && - Objects.equals(this.storageLocation, seedLot.storageLocation) && - Objects.equals(this.units, seedLot.units); - } - - @Override - public int hashCode() { - return Objects.hash(seedLotDbId, additionalInfo, amount, createdDate, externalReferences, germplasmDbId, lastUpdated, locationDbId, programDbId, seedLotDescription, seedLotName, sourceCollection, storageLocation, units); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SeedLot {\n"); - sb.append(" seedLotDbId: ").append(toIndentedString(seedLotDbId)).append("\n"); - sb.append(" additionalInfo: ").append(toIndentedString(additionalInfo)).append("\n"); - sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); - sb.append(" createdDate: ").append(toIndentedString(createdDate)).append("\n"); - sb.append(" externalReferences: ").append(toIndentedString(externalReferences)).append("\n"); - sb.append(" germplasmDbId: ").append(toIndentedString(germplasmDbId)).append("\n"); - sb.append(" lastUpdated: ").append(toIndentedString(lastUpdated)).append("\n"); - sb.append(" locationDbId: ").append(toIndentedString(locationDbId)).append("\n"); - sb.append(" programDbId: ").append(toIndentedString(programDbId)).append("\n"); - sb.append(" seedLotDescription: ").append(toIndentedString(seedLotDescription)).append("\n"); - sb.append(" seedLotName: ").append(toIndentedString(seedLotName)).append("\n"); - sb.append(" sourceCollection: ").append(toIndentedString(sourceCollection)).append("\n"); - sb.append(" storageLocation: ").append(toIndentedString(storageLocation)).append("\n"); - sb.append(" units: ").append(toIndentedString(units)).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 "); - } } diff --git a/brapi-java-model/src/main/java/org/brapi/v2/model/germ/BrAPISeedLotContentMixture.java b/brapi-java-model/src/main/java/org/brapi/v2/model/germ/BrAPISeedLotContentMixture.java new file mode 100644 index 00000000..2530758d --- /dev/null +++ b/brapi-java-model/src/main/java/org/brapi/v2/model/germ/BrAPISeedLotContentMixture.java @@ -0,0 +1,176 @@ +/* + * BrAPI-Germplasm + * The Breeding API (BrAPI) is a Standardized REST ful Web Service API Specification for communicating Plant Breeding Data. BrAPI allows for easy data sharing between databases and tools involved in plant breeding.

BrAPI Core

The BrAPI Core module contains high level entities used for organization and management. This includes Programs, Trials, Studies, Locations, People, and Lists
V2.1

BrAPI Phenotyping

The BrAPI Phenotyping module contains entities related to phenotypic observations. This includes Observation Units, Observations, Observation Variables, Traits, Scales, Methods, and Images
V2.1

BrAPI Genotyping

The BrAPI Genotyping module contains entities related to genotyping analysis. This includes Samples, Markers, Variant Sets, Variants, Call Sets, Calls, References, Reads, and Vendor Orders
V2.1

BrAPI Germplasm

The BrAPI Germplasm module contains entities related to germplasm management. This includes Germplasm, Germplasm Attributes, Seed Lots, Crosses, Pedigree, and Progeny
V2.1
+ * + * OpenAPI spec version: 2.1 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package org.brapi.v2.model.germ; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SeedLotContentMixture + */ + +public class BrAPISeedLotContentMixture { + @JsonProperty("crossDbId") + private String crossDbId = null; + + @JsonProperty("crossName") + private String crossName = null; + + @JsonProperty("germplasmDbId") + private String germplasmDbId = null; + + @JsonProperty("germplasmName") + private String germplasmName = null; + + @JsonProperty("mixturePercentage") + private Integer mixturePercentage = null; + + public BrAPISeedLotContentMixture crossDbId(String crossDbId) { + this.crossDbId = crossDbId; + return this; + } + + /** + * The unique DbId for a cross contained in this seed lot + * + * @return crossDbId + **/ + public String getCrossDbId() { + return crossDbId; + } + + public void setCrossDbId(String crossDbId) { + this.crossDbId = crossDbId; + } + + public BrAPISeedLotContentMixture crossName(String crossName) { + this.crossName = crossName; + return this; + } + + /** + * The human readable name for a cross contained in this seed lot + * + * @return crossName + **/ + public String getCrossName() { + return crossName; + } + + public void setCrossName(String crossName) { + this.crossName = crossName; + } + + public BrAPISeedLotContentMixture germplasmDbId(String germplasmDbId) { + this.germplasmDbId = germplasmDbId; + return this; + } + + /** + * The unique DbId of the Germplasm contained in this Seed Lot + * + * @return germplasmDbId + **/ + public String getGermplasmDbId() { + return germplasmDbId; + } + + public void setGermplasmDbId(String germplasmDbId) { + this.germplasmDbId = germplasmDbId; + } + + public BrAPISeedLotContentMixture germplasmName(String germplasmName) { + this.germplasmName = germplasmName; + return this; + } + + /** + * The human readable name of the Germplasm contained in this Seed Lot + * + * @return germplasmName + **/ + public String getGermplasmName() { + return germplasmName; + } + + public void setGermplasmName(String germplasmName) { + this.germplasmName = germplasmName; + } + + public BrAPISeedLotContentMixture mixturePercentage(Integer mixturePercentage) { + this.mixturePercentage = mixturePercentage; + return this; + } + + /** + * The percentage of the given germplasm in the seed lot mixture. + * + * @return mixturePercentage + **/ + + public Integer getMixturePercentage() { + return mixturePercentage; + } + + public void setMixturePercentage(Integer mixturePercentage) { + this.mixturePercentage = mixturePercentage; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrAPISeedLotContentMixture seedLotContentMixture = (BrAPISeedLotContentMixture) o; + return Objects.equals(this.crossDbId, seedLotContentMixture.crossDbId) + && Objects.equals(this.crossName, seedLotContentMixture.crossName) + && Objects.equals(this.germplasmDbId, seedLotContentMixture.germplasmDbId) + && Objects.equals(this.germplasmName, seedLotContentMixture.germplasmName) + && Objects.equals(this.mixturePercentage, seedLotContentMixture.mixturePercentage); + } + + @Override + public int hashCode() { + return Objects.hash(crossDbId, crossName, germplasmDbId, germplasmName, mixturePercentage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BrAPISeedLotContentMixture {\n"); + + sb.append(" crossDbId: ").append(toIndentedString(crossDbId)).append("\n"); + sb.append(" crossName: ").append(toIndentedString(crossName)).append("\n"); + sb.append(" germplasmDbId: ").append(toIndentedString(germplasmDbId)).append("\n"); + sb.append(" germplasmName: ").append(toIndentedString(germplasmName)).append("\n"); + sb.append(" mixturePercentage: ").append(toIndentedString(mixturePercentage)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +}