TableBatchOperation Class
- java.
lang. Object - java.
util. ArrayList<TableOperation> - com.
microsoft. azure. storage. table. TableBatchOperation
- com.
- java.
public class TableBatchOperation
A class which represents a batch operation. A batch operation is a collection of table operations which are executed by the Storage Service REST API as a single atomic operation, by invoking an Entity Group Transaction.
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.
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
add(final int index, final TableOperation element)
Adds the table operation at the specified index in the batch operation . |
boolean |
add(final TableOperation element)
Adds the table operation to the batch operation . |
boolean |
addAll(final int index, final java.util.Collection<? extends TableOperation> c)
Adds the collection of table operations to the batch operation starting at the specified index. |
boolean |
addAll(final java.util.Collection<? extends TableOperation> c)
Adds the collection of table operations to the batch operation . |
void |
clear()
Clears all table operations from the batch operation. |
void |
delete(final TableEntity entity)
Adds a table operation to delete the specified entity to the batch operation. |
ArrayList<Table |
execute(final CloudTableClient client, final String tableName, final TableRequestOptions options, final OperationContext opContext)
Reserved for internal use. Executes this batch operation on the specified table, using the specified 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. |
void |
insert(final TableEntity entity)
Adds a table operation to insert the specified entity to the batch operation. |
void |
insert(final TableEntity entity, boolean echoContent)
Adds a table operation to insert the specified entity to the batch operation. |
void |
insertOrMerge(final TableEntity entity)
Adds a table operation to insert or merge the specified entity to the batch operation. |
void |
insertOrReplace(final TableEntity entity)
Adds a table operation to insert or replace the specified entity to the batch operation. |
void |
merge(final TableEntity entity)
Adds a table operation to merge the specified entity to the batch operation. |
Table |
remove(int index)
Removes the table operation at the specified index from the batch operation. |
boolean |
remove(Object o)
Removes the specified from the batch operation. |
boolean |
removeAll(java.util.Collection<?> c)
Removes all elements of the specified collection from the batch operation. |
void |
removeRange(int fromIndex, int toIndex)
Reserved for internal use. Removes all the table operations at indexes in the specified range from the batch operation . |
void |
replace(final TableEntity entity)
Adds a table operation to replace the specified entity to the batch operation. |
void |
retrieve(final String partitionKey, final String rowKey, final 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(final String partitionKey, final String rowKey, final 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. |
Method Details
add
public void add(final int index, final TableOperation element)
Adds the table operation at the specified index in the batch operation .
Parameters:
int
which represents the index in the batch operation ArrayList
to add the table operation at.
add
public boolean add(final TableOperation element)
Adds the table operation to the batch operation .
Parameters:
Returns:
true
if the operation was added successfully.
addAll
public boolean addAll(final int index, final java.util.Collection c)
Adds the collection of table operations to the batch operation starting at the specified index.
Parameters:
int
which represents the index in the batch operation ArrayList
to add the table operation at.
Returns:
true
if the operations were added successfully.
addAll
public boolean addAll(final java.util.Collection c)
Adds the collection of table operations to the batch operation .
Parameters:
Returns:
true
if the operations were added successfully.
clear
public void clear()
Clears all table operations from the batch operation.
delete
public void delete(final TableEntity entity)
Adds a table operation to delete the specified entity to the batch operation.
Parameters:
execute
protected ArrayList
Reserved for internal use. Executes this batch operation on the specified table, using the specified 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.
Parameters:
String
containing the name of the table.
Returns:
ArrayList
of TableResult containing the results of executing the operation.Throws:
insert
public void insert(final TableEntity entity)
Adds a table operation to insert the specified entity to the batch operation.
Parameters:
insert
public void insert(final TableEntity entity, boolean echoContent)
Adds a table operation to insert the specified entity to the batch operation.
Parameters:
insertOrMerge
public void insertOrMerge(final TableEntity entity)
Adds a table operation to insert or merge the specified entity to the batch operation.
Parameters:
insertOrReplace
public void insertOrReplace(final TableEntity entity)
Adds a table operation to insert or replace the specified entity to the batch operation.
Parameters:
merge
public void merge(final TableEntity entity)
Adds a table operation to merge the specified entity to the batch operation.
Parameters:
remove
public TableOperation remove(int index)
Removes the table operation at the specified index from the batch operation.
Parameters:
int
which represents the index in the ArrayList
of the table operation to remove from the batch operation.
remove
public boolean remove(Object o)
Removes the specified from the batch operation.
Parameters:
Object
to remove from the batch operation.
Returns:
true
if the object was removed successfully.
removeAll
public boolean removeAll(java.util.Collection c)
Removes all elements of the specified collection from the batch operation.
Parameters:
Returns:
true
if the objects in the collection were removed successfully.
removeRange
protected void removeRange(int fromIndex, int toIndex)
Reserved for internal use. Removes all the table operations at indexes in the specified range from the batch operation .
Parameters:
int
which represents the inclusive lower bound of the range of TableOperation objects to remove from the batch operation ArrayList
.
int
which represents the exclusive upper bound of the range of TableOperation objects to remove from the batch operation ArrayList
.
replace
public void replace(final TableEntity entity)
Adds a table operation to replace the specified entity to the batch operation.
Parameters:
retrieve
public void retrieve(final String partitionKey, final String rowKey, final Class clazzType)
Adds a table operation to retrieve an entity of the specified class type with the specified PartitionKey and RowKey to the batch operation.
Parameters:
String
containing the PartitionKey of the entity to retrieve.
String
containing the RowKey of the entity to retrieve.
retrieve
public void retrieve(final String partitionKey, final String rowKey, final 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.
Parameters:
String
containing the PartitionKey of the entity to retrieve.
String
containing the RowKey of the entity to retrieve.