diff --git a/brapi-java-client/src/main/java/org/brapi/client/v2/modules/core/BatchDeletesApi.java b/brapi-java-client/src/main/java/org/brapi/client/v2/modules/core/BatchDeletesApi.java new file mode 100644 index 00000000..cd65c0ff --- /dev/null +++ b/brapi-java-client/src/main/java/org/brapi/client/v2/modules/core/BatchDeletesApi.java @@ -0,0 +1,310 @@ +package org.brapi.client.v2.modules.core; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.apache.commons.lang3.tuple.Pair; +import org.brapi.client.v2.ApiCallback; +import org.brapi.client.v2.BrAPIClient; +import org.brapi.client.v2.ApiResponse; +import org.brapi.client.v2.Configuration; +import org.brapi.client.v2.model.exceptions.ApiException; +import org.brapi.v2.model.core.BrAPIBatchDelete; +import org.brapi.v2.model.core.response.BrAPIBatchDeleteSingleResponse; +import org.brapi.v2.model.core.response.BrAPIBatchDeleteListResponse; + +import com.google.gson.reflect.TypeToken; + +import okhttp3.Call; + +public class BatchDeletesApi { + private BrAPIClient apiClient; + + public BatchDeletesApi() { + this(Configuration.getDefaultApiClient()); + } + + public BatchDeletesApi(BrAPIClient apiClient) { + this.apiClient = apiClient; + } + + public BrAPIClient getApiClient() { + return apiClient; + } + + public void setApiClient(BrAPIClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Build call for batchDeleteBatchDeleteDbIdGet + * @param batchDeleteDbId The internal id of the batchDelete (required) + + + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + private Call batchDeleteBatchDeleteDbIdGetCall(String batchDeleteDbId) throws ApiException { + if(batchDeleteDbId == null) { + throw new IllegalArgumentException("batchDeleteDbId cannot be null"); + } + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/batchDeletes/{batchDeleteDbId}" + .replaceAll("\\{" + "batchDeleteDbId" + "\\}", apiClient.escapeString(batchDeleteDbId)); + + Map localVarQueryParams = new HashMap<>(); + Map localVarCollectionQueryParams = new HashMap<>(); + + Map localVarHeaderParams = new HashMap(); + + + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "AuthorizationToken" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames); + } + + /** + * Get the details of a specific batchDelete + * @param batchDeleteDbId The internal id of the batch delete (required) + + * @return ApiResponse<BatchDeleteSingleResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse batchDeleteBatchDeleteDbIdGet(String batchDeleteDbId) throws ApiException { + Call call = batchDeleteBatchDeleteDbIdGetCall(batchDeleteDbId); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get the details of a specific batch delete (asynchronously) + * @param batchDeleteDbId The internal id of the batch delete (required) + + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call batchDeletebatchDeleteDbIdGetAsync(String batchDeleteDbId, final ApiCallback callback) throws ApiException { + Call call = batchDeleteBatchDeleteDbIdGetCall(batchDeleteDbId); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for batchDeleteBatchDeleteDbIdPut + * @param batchDeleteDbId The internal id of the batch delete (required) + * @param body (optional) + + + + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + private Call batchDeleteBatchDeleteDbIdPutCall(String batchDeleteDbId, BrAPIBatchDelete body) throws ApiException { + if(batchDeleteDbId == null) { + throw new IllegalArgumentException("batchDeleteDbId cannot be null"); + } + if(body == null) { + throw new IllegalArgumentException("body cannot be null"); + } + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/batchdeletes/{batchDeleteDbId}" + .replaceAll("\\{" + "batchDeleteDbId" + "\\}", apiClient.escapeString(batchDeleteDbId)); + + Map localVarQueryParams = new HashMap<>(); + Map localVarCollectionQueryParams = new HashMap<>(); + + Map localVarHeaderParams = new HashMap(); + + + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "AuthorizationToken" }; + return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames); + } + + /** + * Update the details of an existing batch delete + * @param batchDeleteDbId The internal id of the batch delete (required) + * @param body (optional) + * @return ApiResponse<BatchDeleteSingleResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse batchDeleteBatchDeleteDbIdPut(String batchDeleteDbId, BrAPIBatchDelete body) throws ApiException { + Call call = batchDeleteBatchDeleteDbIdPutCall(batchDeleteDbId, body); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Update the details of an existing batch delete (asynchronously) + * @param batchDeleteDbId The internal id of the batch delete(required) + * @param body (optional) + + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call batchDeleteBatchDeleteDbIdPutAsync(String batchDeleteDbId, BrAPIBatchDelete body, final ApiCallback callback) throws ApiException { + Call call = batchDeleteBatchDeleteDbIdPutCall(batchDeleteDbId, body); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /** + * Build call for batchDeletePost + * @param body (optional) + + + + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + private Call batchDeletePostCall(List body) throws ApiException { + if(body == null) { + throw new IllegalArgumentException("body cannot be null"); + } + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/batchdeletes"; + + Map localVarQueryParams = new HashMap<>(); + Map localVarCollectionQueryParams = new HashMap<>(); + + Map localVarHeaderParams = new HashMap(); + + + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "AuthorizationToken" }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames); + } + + /** + * Create new batch delete entities on this server + * @param body (optional) + + * @return ApiResponse<BatchDeleteListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse batchDeletePost(List body) throws ApiException { + Call call = batchDeletePostCall(body); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Create new batch delete entities on this server (asynchronously) + * Create new batch delete entities on this server + * @param body (optional) + + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call batchDeletePostAsync(List body, final ApiCallback callback) throws ApiException { + Call call = batchDeletePostCall(body); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + + /* + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + private Call batchDeletesDeleteByDbIdCall(String batchDeleteDbId, boolean hardDelete) throws ApiException { + if(batchDeleteDbId == null) { + throw new IllegalArgumentException("batchDeleteDbId cannot be null"); + } + Object localVarPostBody = null; + + String localVarPath = String.format("/batchDeletes/%s?hardDelete=%s",apiClient.escapeString(batchDeleteDbId), hardDelete); + + Map localVarQueryParams = new HashMap<>(); + Map localVarCollectionQueryParams = new HashMap<>(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "AuthorizationToken" }; + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames); + } + + /** + * Delete + * @param batchDeleteDbId Unique identifier which references batch delete to be deleted + * @param hardDelete Indicates whether delete is a hard or soft delete + + * @return ApiResponse; + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse batchDeletesDeleteByDbId(String batchDeleteDbId, boolean hardDelete) throws ApiException { + Call call = batchDeletesDeleteByDbIdCall(batchDeleteDbId, hardDelete); + return apiClient.execute(call); + } + +} diff --git a/brapi-java-client/src/main/java/org/brapi/client/v2/modules/germplasm/GermplasmApi.java b/brapi-java-client/src/main/java/org/brapi/client/v2/modules/germplasm/GermplasmApi.java index 01dd3048..3f339773 100644 --- a/brapi-java-client/src/main/java/org/brapi/client/v2/modules/germplasm/GermplasmApi.java +++ b/brapi-java-client/src/main/java/org/brapi/client/v2/modules/germplasm/GermplasmApi.java @@ -924,4 +924,54 @@ public Call searchGermplasmSearchResultsDbIdGetAsync(String searchResultsDbId, I apiClient.executeAsync(call, localVarReturnType, callback); return call; } + + /* + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + private Call germplasmDeleteByDbIdCall(String germplasmDbId, boolean hardDelete) throws ApiException { + if(germplasmDbId == null) { + throw new IllegalArgumentException("germplasmDbId cannot be null"); + } + Object localVarPostBody = null; + + String localVarPath = String.format("/germplasm/%s?hardDelete=%s",apiClient.escapeString(germplasmDbId), hardDelete); + + Map localVarQueryParams = new HashMap<>(); + Map localVarCollectionQueryParams = new HashMap<>(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "AuthorizationToken" }; + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames); + } + + /** + * Delete + * @param germplasmDbId Unique identifier which references germplasm to be deleted + * @param hardDelete Indicates whether the delete is a hard or soft delete + * + * @return ApiResponse; + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body germplasmDelete germplasmDeleteCall + */ + public ApiResponse germplasmDeleteByDbId(String germplasmDbId, boolean hardDelete) throws ApiException { + Call call = germplasmDeleteByDbIdCall(germplasmDbId, hardDelete); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + } diff --git a/brapi-java-client/src/test/java/org/brapi/client/v2/modules/core/BatchDeletesApiTest.java b/brapi-java-client/src/test/java/org/brapi/client/v2/modules/core/BatchDeletesApiTest.java new file mode 100644 index 00000000..22edab75 --- /dev/null +++ b/brapi-java-client/src/test/java/org/brapi/client/v2/modules/core/BatchDeletesApiTest.java @@ -0,0 +1,102 @@ +/* + * BrAPI-Core + * 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.0

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.0

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.0

BrAPI Germplasm

The BrAPI Germplasm module contains entities related to germplasm management. This includes Germplasm, Germplasm Attributes, Seed Lots, Crosses, Pedigree, and Progeny
V2.0
+ * + * OpenAPI spec version: 2.0 + * + * + * 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.client.v2.modules.core; + +import org.brapi.client.v2.ApiResponse; +import org.brapi.client.v2.BrAPIClientTest; +import org.brapi.client.v2.model.exceptions.ApiException; +import org.brapi.v2.model.core.BrAPIBatchDelete; +import org.brapi.v2.model.core.request.BrAPIBatchDeleteNewRequest; +import org.brapi.v2.model.core.response.BrAPIBatchDeleteListResponse; +import org.brapi.v2.model.core.response.BrAPIBatchDeleteSingleResponse; +import org.junit.jupiter.api.*; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.Arrays; +import java.util.List; + +/** + * API tests for BatchDeletesApi + */ +@Nested +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +class BatchDeletesApiTest extends BrAPIClientTest { + + private final BatchDeletesApi batchDeletesAPI = new BatchDeletesApi(this.apiClient); + private BrAPIBatchDelete brAPIBatchDelete = new BrAPIBatchDelete(); + + @Test + public void batchDeletesGetTest() throws ApiException { + String batchDeleteDbId = "batchDeleteSample1"; + + ApiResponse response = batchDeletesAPI.batchDeleteBatchDeleteDbIdGet(batchDeleteDbId); + + assertEquals(batchDeleteDbId, response.getBody().getResult().getBatchDeleteDbId()); + } + + @Test + public void batchDeletesPostTest() throws ApiException { + BrAPIBatchDeleteNewRequest batchDelete = new BrAPIBatchDeleteNewRequest(); + batchDelete.batchDeleteName("new batch delete name"); + List body = Arrays.asList(batchDelete); + + //loaded sql + + ApiResponse response = batchDeletesAPI.batchDeletePost(body); + + //todo need to set up data + assertEquals(1, response.getBody().getResult().getData().size()); + assertEquals(batchDelete.getBatchDeleteName(), response.getBody().getResult().getData().get(0).getBatchDeleteName()); + assertNotNull(response.getBody().getResult().getData().get(0).getBatchDeleteDbId()); + assertEquals(6, response.getBody().getResult().getData().size()); + } + + @Test + public void batchDeletesBatchDeleteDbIdPutTest() throws ApiException { + String batchDeleteDbId = "batchDeleteSample1"; + BrAPIBatchDeleteNewRequest body = new BrAPIBatchDeleteNewRequest(); + body.setBatchDeleteName("new test name"); + + ApiResponse response = batchDeletesAPI.batchDeleteBatchDeleteDbIdPut(batchDeleteDbId, body); + + assertEquals(batchDeleteDbId, response.getBody().getResult().getBatchDeleteDbId()); + assertEquals(body.getBatchDeleteName(), response.getBody().getResult().getBatchDeleteName()); + } + + @Test + public void batchDeletesSoftDeleteTest() throws ApiException { + String batchDeleteDbId = "batchDeleteSample1"; + + ApiResponse deleteResult = batchDeletesAPI.batchDeletesDeleteByDbId(batchDeleteDbId, false); + //assertEquals(todo, deleteResult, "Wrong output"); + + //todo also do a get and assert + //todo do test for missing dbid + } + + public void batchDeletesHardDeleteTest() throws ApiException { + String batchDeleteDbId = "batchDeleteSample1"; + + ApiResponse deleteResult = batchDeletesAPI.batchDeletesDeleteByDbId(batchDeleteDbId, true); + + //assertEquals(todo, deleteResult, "Wrong output"); + + //todo also do a get and assert + //todo do test for missing dbid + } +} diff --git a/brapi-java-client/src/test/java/org/brapi/client/v2/modules/germplasm/GermplasmAPITests.java b/brapi-java-client/src/test/java/org/brapi/client/v2/modules/germplasm/GermplasmAPITests.java index c0e6ec34..abd22810 100644 --- a/brapi-java-client/src/test/java/org/brapi/client/v2/modules/germplasm/GermplasmAPITests.java +++ b/brapi-java-client/src/test/java/org/brapi/client/v2/modules/germplasm/GermplasmAPITests.java @@ -363,4 +363,24 @@ public void updateGermplasmMissingId() throws Exception { assertEquals(updateGermplasmIdMissingError, exception.getMessage(), "Wrong error message"); } + + public void softDeleteGermplasm() throws Exception { + String germplasmDbId = "todo"; + + ApiResponse deleteResult = this.germplasmAPI.germplasmDeleteByDbId(germplasmDbId, false); + + //assertEquals(todo, deleteResult, "Wrong output"); + + //todo also do a get and assert + //todo do test for missing dbid? + } + + public void hardDeleteGermplasm() throws Exception { + String germplasmDbId = "todo"; + + ApiResponse deleteResult = this.germplasmAPI.germplasmDeleteByDbId(germplasmDbId, true); + + //assertEquals(todo, deleteResult, "Wrong output"); + } + } diff --git a/brapi-java-client/src/test/resources/sql/batchDeletes.sql b/brapi-java-client/src/test/resources/sql/batchDeletes.sql new file mode 100644 index 00000000..233d7805 --- /dev/null +++ b/brapi-java-client/src/test/resources/sql/batchDeletes.sql @@ -0,0 +1,8 @@ +--batchDeleteList1 +INSERT INTO batchDelete + +--batchDeleteGermplasm1 + +--batchDeleteTrial1 + +--batchDeleteSample1 \ No newline at end of file diff --git a/brapi-java-model/src/main/java/org/brapi/v2/model/core/BrAPIBatchDelete.java b/brapi-java-model/src/main/java/org/brapi/v2/model/core/BrAPIBatchDelete.java new file mode 100644 index 00000000..a157f441 --- /dev/null +++ b/brapi-java-model/src/main/java/org/brapi/v2/model/core/BrAPIBatchDelete.java @@ -0,0 +1,359 @@ +package org.brapi.v2.model.core; + +import java.time.OffsetDateTime; +import java.util.*; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.Gson; +import org.brapi.v2.model.BrAPIExternalReference; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import javax.validation.Valid; + +/** + * BatchDelete + */ + +public class BrAPIBatchDelete { + @JsonProperty("batchDeleteDbId") + private String batchDeleteDbId = null; + + @JsonProperty("dateCreated") + private Date dateCreated; + + @JsonProperty("dateModified") + private Date dateModified; + + @JsonProperty("batchDeleteDescription") + private String batchDeleteDescription; + + @JsonProperty("batchDeleteName") + private String batchDeleteName; + + @JsonProperty("batchDeleteOwnerName") + private String batchDeleteOwnerName; + + @JsonProperty("batchDeleteSource") + private String batchDeleteSource; + + @JsonProperty("additionalInfo") + private Object additionalInfo; + + @JsonProperty("externalReferences") + private List externalReferences = null; + + @JsonProperty("batchDeleteOwnerPersonDbId") + private String batchDeleteOwnerPersonDbId; + + @JsonProperty("batchDeleteSize") + private Integer batchDeleteSize; + + public enum BatchDeleteTypes { + GERMPLASM("germplasm"), + LISTS("lists"), + TRIALS("trials"), + SAMPLES("samples"); + + + private final String value; + + BatchDeleteTypes(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static BatchDeleteTypes fromValue(String text) { + for (BatchDeleteTypes b : BatchDeleteTypes.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + @JsonProperty("batchDeleteType") + private BatchDeleteTypes batchDeleteType; + + private final transient Gson gson = new Gson(); + + + public BrAPIBatchDelete batchDeleteDbId(String batchDeleteDbId) { + this.batchDeleteDbId = batchDeleteDbId; + return this; + } + + /** + * The ID which uniquely identifies a batch delete within the given database server + * @return batchDeleteDbId + **/ + public String getBatchDeleteDbId() { + return batchDeleteDbId; + } + + public void setBatchDeleteDbId(String batchDeleteDbId) { + this.batchDeleteDbId = batchDeleteDbId; + } + + public BrAPIBatchDelete additionalInfo(Object additionalInfo) { + this.additionalInfo = additionalInfo; + return this; + } + + /** + * Additional arbitrary info + * + * @return additionalInfo + **/ + public Object getAdditionalInfo() { + return additionalInfo; + } + + public void setAdditionalInfo(Object additionalInfo) { + this.additionalInfo = additionalInfo; + } + + public BrAPIBatchDelete dateCreated(Date dateCreated) { + this.dateCreated = dateCreated; + return this; + } + + /** + * Timestamp when the entity was first created + * @return dateCreated + **/ + @Valid + public Date getDateCreated() { + return dateCreated; + } + + public void setDateCreated(Date dateCreated) { + this.dateCreated = dateCreated; + } + + + public BrAPIBatchDelete dateModified(Date dateModified) { + this.dateModified = dateModified; + return this; + } + + /** + * Timestamp when the entity was last updated + * @return dateModified + **/ + @Valid + public Date getDateModified() { + return dateModified; + } + + public void setDateModified(Date dateModified) { + this.dateModified = dateModified; + } + + public BrAPIBatchDelete 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 BrAPIBatchDelete batchDeleteDescription(String batchDeleteDescription) { + this.batchDeleteDescription = batchDeleteDescription; + return this; + } + + /** + * Description of a Batch + * @return batchDescription + **/ + + public String getBatchDeleteDescription() { + return batchDeleteDescription; + } + + public void setBatchDeleteDescription(String batchDeleteDescription) { + this.batchDeleteDescription = batchDeleteDescription; + } + + public BrAPIBatchDelete batchDeleteName(String batchDeleteName) { + this.batchDeleteName = batchDeleteName; + return this; + } + + /** + * Human readable name of a Batch + * @return batchName + **/ + + public String getBatchDeleteName() { + return batchDeleteName; + } + + public void setBatchDeleteName(String batchDeleteName) { + this.batchDeleteName = batchDeleteName; + } + + public BrAPIBatchDelete batchDeleteOwnerName(String batchDeleteOwnerName) { + this.batchDeleteOwnerName = batchDeleteOwnerName; + return this; + } + + /** + * Human readable name of a Batch Owner. (usually a user or person) + * @return batchOwnerName + **/ + + public String getBatchDeleteOwnerName() { + return batchDeleteOwnerName; + } + + public void setBatchDeleteOwnerName(String batchDeleteOwnerName) { + this.batchDeleteOwnerName = batchDeleteOwnerName; + } + + public BrAPIBatchDelete batchDeleteOwnerPersonDbId(String batchDeleteOwnerPersonDbId) { + this.batchDeleteOwnerPersonDbId = batchDeleteOwnerPersonDbId; + return this; + } + + /** + * The unique identifier for a Batch Owner. (usually a user or person) + * @return batchOwnerPersonDbId + **/ + public String getBatchDeleteOwnerPersonDbId() { + return batchDeleteOwnerPersonDbId; + } + + public void setBatchDeleteOwnerPersonDbId(String batchDeleteOwnerPersonDbId) { + this.batchDeleteOwnerPersonDbId = batchDeleteOwnerPersonDbId; + } + + public BrAPIBatchDelete batchDeleteSize(Integer batchDeleteSize) { + this.batchDeleteSize = batchDeleteSize; + return this; + } + + /** + * The number of elements in a Batch + * @return batchSize + **/ + public Integer getBatchDeleteSize() { + return batchDeleteSize; + } + + public void setBatchDeleteSize(Integer batchDeleteSize) { + this.batchDeleteSize = batchDeleteSize; + } + + public BrAPIBatchDelete batchDeleteSource(String batchDeleteSource) { + this.batchDeleteSource = batchDeleteSource; + return this; + } + + /** + * The description of where a Batch originated from + * @return batchSource + **/ + public String getBatchDeleteSource() { + return batchDeleteSource; + } + + public void setBatchDeleteSource(String batchDeleteSource) { + this.batchDeleteSource = batchDeleteSource; + } + + public BrAPIBatchDelete batchDeleteType(BatchDeleteTypes batchDeleteType) { + this.batchDeleteType = batchDeleteType; + return this; + } + + /** + * Get batchType + * @return batchType + **/ + @Valid + public BatchDeleteTypes getBatchDeleteType() { + return batchDeleteType; + } + + public void setBatchDeleteType(BatchDeleteTypes batchDeleteType) { + this.batchDeleteType = batchDeleteType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrAPIBatchDelete batchDelete = (BrAPIBatchDelete) o; + return Objects.equals(this.additionalInfo, batchDelete.additionalInfo) && + Objects.equals(this.dateCreated, batchDelete.dateCreated) && + Objects.equals(this.dateModified, batchDelete.dateModified) && + Objects.equals(this.externalReferences, batchDelete.externalReferences) && + Objects.equals(this.batchDeleteDescription, batchDelete.batchDeleteDescription) && + Objects.equals(this.batchDeleteName, batchDelete.batchDeleteName) && + Objects.equals(this.batchDeleteOwnerName, batchDelete.batchDeleteOwnerName) && + Objects.equals(this.batchDeleteOwnerPersonDbId, batchDelete.batchDeleteOwnerPersonDbId) && + Objects.equals(this.batchDeleteSize, batchDelete.batchDeleteSize) && + Objects.equals(this.batchDeleteSource, batchDelete.batchDeleteSource) && + Objects.equals(this.batchDeleteType, batchDelete.batchDeleteType); + } + + @Override + public int hashCode() { + return Objects.hash(additionalInfo, dateCreated, dateModified, externalReferences, batchDeleteDescription, batchDeleteName, batchDeleteOwnerName, batchDeleteOwnerPersonDbId, batchDeleteSize, batchDeleteSource, batchDeleteType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchBaseFields {\n"); + + sb.append(" additionalInfo: ").append(toIndentedString(additionalInfo)).append("\n"); + sb.append(" dateCreated: ").append(toIndentedString(dateCreated)).append("\n"); + sb.append(" dateModified: ").append(toIndentedString(dateModified)).append("\n"); + sb.append(" externalReferences: ").append(toIndentedString(externalReferences)).append("\n"); + sb.append(" batchDescription: ").append(toIndentedString(batchDeleteDescription)).append("\n"); + sb.append(" batchName: ").append(toIndentedString(batchDeleteName)).append("\n"); + sb.append(" batchOwnerName: ").append(toIndentedString(batchDeleteOwnerName)).append("\n"); + sb.append(" batchOwnerPersonDbId: ").append(toIndentedString(batchDeleteOwnerPersonDbId)).append("\n"); + sb.append(" batchSize: ").append(toIndentedString(batchDeleteSize)).append("\n"); + sb.append(" batchSource: ").append(toIndentedString(batchDeleteSource)).append("\n"); + sb.append(" batchType: ").append(toIndentedString(batchDeleteType)).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/core/request/BrAPIBatchDeleteNewRequest.java b/brapi-java-model/src/main/java/org/brapi/v2/model/core/request/BrAPIBatchDeleteNewRequest.java new file mode 100644 index 00000000..8b7af0cf --- /dev/null +++ b/brapi-java-model/src/main/java/org/brapi/v2/model/core/request/BrAPIBatchDeleteNewRequest.java @@ -0,0 +1,88 @@ +package org.brapi.v2.model.core.request; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.brapi.v2.model.core.BrAPIBatchDelete; + +import java.util.ArrayList; +import java.util.List; + +import javax.validation.Valid; + +/** + * BatchDeleteNewRequest + */ + + +public class BrAPIBatchDeleteNewRequest extends BrAPIBatchDelete { + @JsonProperty("data") + @Valid + private List data = null; + + public BrAPIBatchDeleteNewRequest data(List data) { + this.data = data; + return this; + } + + public BrAPIBatchDeleteNewRequest addDataItem(String dataItem) { + if (this.data == null) { + this.data = new ArrayList(); + } + this.data.add(dataItem); + return this; + } + + /** + * The list of DbIds contained in this batchDelete + * @return data + **/ + + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrAPIBatchDeleteNewRequest batchDeleteNewRequest = (BrAPIBatchDeleteNewRequest) o; + return Objects.equals(this.data, batchDeleteNewRequest.data) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(data, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchDeleteNewRequest {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).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/core/response/BrAPIBatchDeleteListResponse.java b/brapi-java-model/src/main/java/org/brapi/v2/model/core/response/BrAPIBatchDeleteListResponse.java new file mode 100644 index 00000000..63a016e1 --- /dev/null +++ b/brapi-java-model/src/main/java/org/brapi/v2/model/core/response/BrAPIBatchDeleteListResponse.java @@ -0,0 +1,121 @@ +package org.brapi.v2.model.core.response; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + +import javax.validation.Valid; + +import org.brapi.v2.model.BrAPIResponse; +import org.brapi.v2.model.BrAPIContext; +import org.brapi.v2.model.BrAPIMetadata; + +/** + * BatchDeleteListResponse + */ + + +public class BrAPIBatchDeleteListResponse implements BrAPIResponse { + @JsonProperty("@context") + private BrAPIContext _atContext = null; + + @JsonProperty("metadata") + private BrAPIMetadata metadata = null; + + @JsonProperty("result") + private BrAPIBatchDeleteListResponseResult result = null; + + public BrAPIBatchDeleteListResponse() { + this._atContext = new BrAPIContext(); + this._atContext.add("context"); + } + + + public void set_atContext(BrAPIContext _atContext) { + this._atContext = _atContext; + } + public BrAPIBatchDeleteListResponse metadata(BrAPIMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get metadata + * + * @return metadata + **/ + + + + @Valid + public BrAPIMetadata getMetadata() { + return metadata; + } + + public void setMetadata(BrAPIMetadata metadata) { + this.metadata = metadata; + } + + public BrAPIBatchDeleteListResponse result(BrAPIBatchDeleteListResponseResult result) { + this.result = result; + return this; + } + + /** + * Get result + * + * @return result + **/ + + + + @Valid + public BrAPIBatchDeleteListResponseResult getResult() { + return result; + } + + public void setResult(BrAPIBatchDeleteListResponseResult 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; + } + BrAPIBatchDeleteListResponse brAPIBatchDeleteListResponse = (BrAPIBatchDeleteListResponse) o; + return Objects.equals(this._atContext, brAPIBatchDeleteListResponse._atContext) + && Objects.equals(this.metadata, brAPIBatchDeleteListResponse.metadata) + && Objects.equals(this.result, brAPIBatchDeleteListResponse.result); + } + + @Override + public int hashCode() { + return Objects.hash(_atContext, metadata, result); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchDeleteListResponse {\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 "); + } +} diff --git a/brapi-java-model/src/main/java/org/brapi/v2/model/core/response/BrAPIBatchDeleteListResponseResult.java b/brapi-java-model/src/main/java/org/brapi/v2/model/core/response/BrAPIBatchDeleteListResponseResult.java new file mode 100644 index 00000000..2286be4d --- /dev/null +++ b/brapi-java-model/src/main/java/org/brapi/v2/model/core/response/BrAPIBatchDeleteListResponseResult.java @@ -0,0 +1,88 @@ +package org.brapi.v2.model.core.response; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.ArrayList; +import java.util.List; + +import javax.validation.Valid; + +import org.brapi.v2.model.BrAPIResponseResult; +import org.brapi.v2.model.core.BrAPIBatchDelete; + +/** + * BatchDeleteListResponseResult + */ + + +public class BrAPIBatchDeleteListResponseResult implements BrAPIResponseResult { + @JsonProperty("data") + @Valid + private List data = new ArrayList(); + + public BrAPIBatchDeleteListResponseResult data(List data) { + this.data = data; + return this; + } + + public BrAPIBatchDeleteListResponseResult addDataItem(BrAPIBatchDelete dataItem) { + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + + + @Valid + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + BrAPIBatchDeleteListResponseResult batchDeleteListResponseResult = (BrAPIBatchDeleteListResponseResult) o; + return Objects.equals(this.data, batchDeleteListResponseResult.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchDeleteListResponseResult {\n"); + + sb.append(" data: ").append(toIndentedString(data)).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/core/response/BrAPIBatchDeleteSingleResponse.java b/brapi-java-model/src/main/java/org/brapi/v2/model/core/response/BrAPIBatchDeleteSingleResponse.java new file mode 100644 index 00000000..e81aa9c7 --- /dev/null +++ b/brapi-java-model/src/main/java/org/brapi/v2/model/core/response/BrAPIBatchDeleteSingleResponse.java @@ -0,0 +1,125 @@ +package org.brapi.v2.model.core.response; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; + +import javax.validation.Valid; + +import org.brapi.v2.model.BrAPIResponse; +import org.brapi.v2.model.BrAPIContext; +import org.brapi.v2.model.BrAPIMetadata; + +import org.brapi.v2.model.core.BrAPIBatchDelete; + + +/** + * BatchDeleteSingleResponse + */ + + +public class BrAPIBatchDeleteSingleResponse implements BrAPIResponse { + @JsonProperty("@context") + private BrAPIContext _atContext = null; + + @JsonProperty("metadata") + private BrAPIMetadata metadata = null; + + @JsonProperty("result") + private BrAPIBatchDelete result = null; + + public BrAPIBatchDeleteSingleResponse _atContext(BrAPIContext _atContext) { + this._atContext = _atContext; + return this; + } + + + + public void setAtContext(BrAPIContext _atContext) { + this._atContext = _atContext; + } + + public BrAPIBatchDeleteSingleResponse metadata(BrAPIMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get metadata + * @return metadata + **/ + + + + @Valid + public BrAPIMetadata getMetadata() { + return metadata; + } + + public void setMetadata(BrAPIMetadata metadata) { + this.metadata = metadata; + } + + public BrAPIBatchDeleteSingleResponse result(BrAPIBatchDelete result) { + this.result = result; + return this; + } + + /** + * Get result + * @return result + **/ + + + + @Valid + public BrAPIBatchDelete getResult() { + return result; + } + + public void setResult(BrAPIBatchDelete 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; + } + BrAPIBatchDeleteSingleResponse germplasmSingleResponse = (BrAPIBatchDeleteSingleResponse) o; + return Objects.equals(this._atContext, germplasmSingleResponse._atContext) && + Objects.equals(this.metadata, germplasmSingleResponse.metadata) && + Objects.equals(this.result, germplasmSingleResponse.result); + } + + @Override + public int hashCode() { + return Objects.hash(_atContext, metadata, result); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchDeleteSingleResponse {\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 "); + } +}