Search in sources :

Example 1 with BatchDeleteRequestBuilder

use of com.linkedin.restli.client.BatchDeleteRequestBuilder in project rest.li by linkedin.

the class ExampleRequestResponseGenerator method batchDelete.

public ExampleRequestResponse batchDelete() {
    checkSupports(ResourceMethod.BATCH_DELETE);
    BatchDeleteRequestBuilder<Object, RecordTemplatePlaceholder> delete = new BatchDeleteRequestBuilder<Object, RecordTemplatePlaceholder>(_uriTemplate, RecordTemplatePlaceholder.class, _resourceSpec, _requestOptions);
    Object id1 = generateKey(0);
    Object id2 = generateKey(1);
    delete.ids(id1, id2);
    addParams(delete, ResourceMethod.BATCH_DELETE);
    addPathKeys(delete);
    BatchDeleteRequest<Object, RecordTemplatePlaceholder> request = delete.build();
    final Map<Object, UpdateResponse> bdResponseData = new HashMap<Object, UpdateResponse>();
    bdResponseData.put(id1, new UpdateResponse(HttpStatus.S_200_OK));
    bdResponseData.put(id2, new UpdateResponse(HttpStatus.S_200_OK));
    BatchUpdateResult<Object, RecordTemplatePlaceholder> result = new BatchUpdateResult<Object, RecordTemplatePlaceholder>(bdResponseData);
    return buildRequestResponse(request, result, buildResourceMethodDescriptorForRestMethod(request));
}
Also used : UpdateResponse(com.linkedin.restli.server.UpdateResponse) BatchUpdateResult(com.linkedin.restli.server.BatchUpdateResult) HashMap(java.util.HashMap) BatchDeleteRequestBuilder(com.linkedin.restli.client.BatchDeleteRequestBuilder)

Aggregations

BatchDeleteRequestBuilder (com.linkedin.restli.client.BatchDeleteRequestBuilder)1 BatchUpdateResult (com.linkedin.restli.server.BatchUpdateResult)1 UpdateResponse (com.linkedin.restli.server.UpdateResponse)1 HashMap (java.util.HashMap)1