public class ImportBatchSubmitter
extends java.lang.Object
Constructor and Description |
---|
ImportBatchSubmitter(ImportRequestor service)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
util.object.Either<Error,ImportResponse[]> |
submit(ImportRequest... batch)
Submits the given import requests as a batch to the underlying service.
|
public ImportBatchSubmitter(ImportRequestor service)
service
- the underlying import service.java.lang.NullPointerException
- if the argument is null
.public util.object.Either<Error,ImportResponse[]> submit(ImportRequest... batch)
null
or empty, or if it only contains
null
elements, no batch will be submitted and an empty array
will be returned. Otherwise any null
elements are filtered out,
while the remaining non-null
requests are validated
. If validation fails for some of them,
an Error
will be returned that details the detected validation
errors for each request that didn't pass validation. On the other hand,
if all the non-null
requests pass validation, they're submitted
as a batch to the underlying service and an import response is generated
in correspondence of each of them. Note that the responses may be
produced in a different sequence than the original requests.batch
- the requests to submit.