public class TableBatchOperation extends ArrayList<TableOperation>
A batch operation may contain up to 100 individual table operations, with the requirement that each operation entity must have same partition key. A batch with a retrieve operation cannot contain any other operations. Note that the total payload of a batch operation is limited to 4MB.
modCount
Constructor and Description |
---|
TableBatchOperation() |
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
TableOperation element)
Adds the table operation at the specified index in the batch operation
ArrayList . |
boolean |
add(TableOperation element)
Adds the table operation to the batch operation
ArrayList . |
boolean |
addAll(Collection<? extends TableOperation> c)
Adds the collection of table operations to the batch operation
ArrayList . |
boolean |
addAll(int index,
Collection<? extends TableOperation> c)
Adds the collection of table operations to the batch operation
ArrayList starting at the specified
index. |
void |
clear()
Clears all table operations from the batch operation.
|
void |
delete(TableEntity entity)
Adds a table operation to delete the specified entity to the batch operation.
|
protected ArrayList<TableResult> |
execute(CloudTableClient client,
String tableName,
TableRequestOptions options,
OperationContext opContext)
Reserved for internal use.
|
void |
insert(TableEntity entity)
Adds a table operation to insert the specified entity to the batch operation.
|
void |
insert(TableEntity entity,
boolean echoContent)
Adds a table operation to insert the specified entity to the batch operation.
|
void |
insertOrMerge(TableEntity entity)
Adds a table operation to insert or merge the specified entity to the batch operation.
|
void |
insertOrReplace(TableEntity entity)
Adds a table operation to insert or replace the specified entity to the batch operation.
|
void |
merge(TableEntity entity)
Adds a table operation to merge the specified entity to the batch operation.
|
TableOperation |
remove(int index)
Removes the table operation at the specified index from the batch operation.
|
boolean |
remove(Object o)
Removes the specified
Object from the batch operation. |
boolean |
removeAll(Collection<?> c)
Removes all elements of the specified collection from the batch operation.
|
protected void |
removeRange(int fromIndex,
int toIndex)
Reserved for internal use.
|
void |
replace(TableEntity entity)
Adds a table operation to replace the specified entity to the batch operation.
|
void |
retrieve(String partitionKey,
String rowKey,
Class<? extends TableEntity> clazzType)
Adds a table operation to retrieve an entity of the specified class type with the specified PartitionKey and
RowKey to the batch operation.
|
void |
retrieve(String partitionKey,
String rowKey,
EntityResolver<?> resolver)
Adds a table operation to retrieve an entity of the specified class type with the specified PartitionKey and
RowKey to the batch operation.
|
clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeIf, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
equals, hashCode
containsAll, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
containsAll, equals, hashCode
parallelStream, stream
public void add(int index, TableOperation element)
ArrayList
.add
in interface List<TableOperation>
add
in class ArrayList<TableOperation>
index
- An int
which represents the index in the batch operation ArrayList
to add
the table operation at.element
- The TableOperation
to add to the batch operation.public boolean add(TableOperation element)
ArrayList
.add
in interface Collection<TableOperation>
add
in interface List<TableOperation>
add
in class ArrayList<TableOperation>
element
- The TableOperation
to add to the batch operation.true
if the operation was added successfully.public boolean addAll(int index, Collection<? extends TableOperation> c)
ArrayList
starting at the specified
index.addAll
in interface List<TableOperation>
addAll
in class ArrayList<TableOperation>
index
- An int
which represents the index in the batch operation ArrayList
to add
the table operation at.c
- A java.util.Collection
of TableOperation
objects to add to the batch operation.true
if the operations were added successfully.public boolean addAll(Collection<? extends TableOperation> c)
ArrayList
.addAll
in interface Collection<TableOperation>
addAll
in interface List<TableOperation>
addAll
in class ArrayList<TableOperation>
c
- A java.util.Collection
of TableOperation
objects to add to the batch operation.true
if the operations were added successfully.public void clear()
clear
in interface Collection<TableOperation>
clear
in interface List<TableOperation>
clear
in class ArrayList<TableOperation>
public void delete(TableEntity entity)
entity
- The TableEntity
to delete.public void insert(TableEntity entity)
entity
- The TableEntity
to insert.public void insert(TableEntity entity, boolean echoContent)
entity
- The TableEntity
to insert.echoContent
- The boolean representing whether the message payload should be returned in the response.public void insertOrMerge(TableEntity entity)
entity
- The TableEntity
to insert if not found or to merge if it exists.public void insertOrReplace(TableEntity entity)
entity
- The TableEntity
to insert if not found or to replace if it exists.public void merge(TableEntity entity)
entity
- The TableEntity
to merge.public void retrieve(String partitionKey, String rowKey, Class<? extends TableEntity> clazzType)
partitionKey
- A String
containing the PartitionKey of the entity to retrieve.rowKey
- A String
containing the RowKey of the entity to retrieve.clazzType
- The class of the TableEntity
type for the entity to retrieve.public void retrieve(String partitionKey, String rowKey, EntityResolver<?> resolver)
partitionKey
- A String
containing the PartitionKey of the entity to retrieve.rowKey
- A String
containing the RowKey of the entity to retrieve.resolver
- The EntityResolver
implementation to project the entity to retrieve as a particular type in
the result.public TableOperation remove(int index)
remove
in interface List<TableOperation>
remove
in class ArrayList<TableOperation>
index
- An int
which represents the index in the ArrayList
of the table operation to
remove from the batch operation.public boolean remove(Object o)
Object
from the batch operation.remove
in interface Collection<TableOperation>
remove
in interface List<TableOperation>
remove
in class ArrayList<TableOperation>
o
- The Object
to remove from the batch operation.true
if the object was removed successfully.public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<TableOperation>
removeAll
in interface List<TableOperation>
removeAll
in class ArrayList<TableOperation>
c
- The collection of elements to remove from the batch operation.true
if the objects in the collection were removed successfully.public void replace(TableEntity entity)
entity
- The TableEntity
to replace.protected ArrayList<TableResult> execute(CloudTableClient client, String tableName, TableRequestOptions options, OperationContext opContext) throws StorageException
TableRequestOptions
and OperationContext
.
This method will invoke the Storage Service REST API to execute this batch operation, using the Table service
endpoint and storage account credentials in the CloudTableClient
object.
client
- A CloudTableClient
instance specifying the Table service endpoint and storage account
credentials to use.tableName
- A String
containing the name of the table.options
- A TableRequestOptions
object that specifies execution options such as retry policy and timeout
settings for the operation.opContext
- An OperationContext
object for tracking the current operation.ArrayList
of TableResult
containing the results of executing the operation.StorageException
- if an error occurs in the storage operation.protected void removeRange(int fromIndex, int toIndex)
ArrayList
.removeRange
in class ArrayList<TableOperation>
fromIndex
- An int
which represents the inclusive lower bound of the range of TableOperation
objects to remove from the batch operation ArrayList
.toIndex
- An int
which represents the exclusive upper bound of the range of TableOperation
objects to remove from the batch operation ArrayList
.Copyright © 2019. All rights reserved.