Skip to content

Commit

Permalink
code changes for BulkResponse in client
Browse files Browse the repository at this point in the history
  • Loading branch information
Shailesh Jagannath Padave committed Nov 18, 2024
1 parent f878d5c commit c29b2b4
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@
/**
* Response object to return a list of succeeded entities and a map of failed ones, including error
* message, for the bulk request.
*
* @param <T> the type of entities included in the successful results
*/
public class BulkResponse {
public class BulkResponse<T> {

/**
* Key - entityId Value - error message processing this entity
*/
private final Map<String, String> bulkErrorResults;

private final List<String> bulkSuccessfulResults;
private final List<T> bulkSuccessfulResults;

private final String message = "Bulk Request has been processed.";

Expand All @@ -38,16 +40,16 @@ public BulkResponse() {
this.bulkErrorResults = new HashMap<>();
}

public List<String> getBulkSuccessfulResults() {
public List<T> getBulkSuccessfulResults() {
return bulkSuccessfulResults;
}

public Map<String, String> getBulkErrorResults() {
return bulkErrorResults;
}

public void appendSuccessResponse(String id) {
bulkSuccessfulResults.add(id);
public void appendSuccessResponse(T result) {
bulkSuccessfulResults.add(result);
}

public void appendFailedResponse(String id, String errorMessage) {
Expand Down

0 comments on commit c29b2b4

Please sign in to comment.