TableOperation Class
- java.
lang. Object - com.
microsoft. azure. storage. table. TableOperation
- com.
public class TableOperation
A class which represents a single table operation.
Use the static factory methods to construct TableOperation instances for operations on tables that insert, update, merge, delete, replace or retrieve table entities. To execute a TableOperation instance, call the method on a CloudTableClient instance. A TableOperation may be executed directly or as part of a TableBatchOperation. If a TableOperation returns an entity result, it is stored in the corresponding TableResult returned by the method.
Constructor Summary
Constructor | Description |
---|---|
TableOperation() |
Nullary Default Constructor. |
TableOperation(final TableEntity entity, final TableOperationType opType) |
Reserved for internal use. Constructs a TableOperation with the specified table entity and operation type. |
TableOperation(final TableEntity entity, final TableOperationType opType, final boolean echoContent) |
Reserved for internal use. Constructs a TableOperation with the specified table entity and operation type. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Table |
delete(final TableEntity entity)
A static factory method returning a TableOperation instance to delete the specified entity from Microsoft Azure storage. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the |
Table |
execute(final CloudTableClient client, final String tableName, TableRequestOptions options, OperationContext opContext)
Reserved for internal use. Execute this table operation on the specified table, using the specified TableRequestOptions and OperationContext. This method will invoke the Storage Service REST API to execute this table operation, using the Table service endpoint and storage account credentials in the CloudTableClient object. |
String |
generateRequestIdentity(boolean isSingleIndexEntry, final String entryName)
Reserved for internal use. Generates the request identity, consisting of the specified entry name, or the PartitionKey and RowKey pair from the operation, to identify the operation target. |
String |
generateRequestIdentityWithTable(final String tableName)
Reserved for internal use. Generates the request identity string for the specified table. The request identity string combines the table name with the PartitionKey and RowKey from the operation to identify specific table entities. This request identity is already UrlEncoded. |
boolean |
getEchoContent()
Gets the boolean representing whether the message payload should be returned in the response. |
synchronized final Table |
getEntity()
Reserved for internal use. Gets the table entity associated with this operation. |
synchronized final TableOperationType |
getOperationType()
Reserved for internal use. Gets the operation type for this operation. |
Table |
insert(final TableEntity entity)
A static factory method returning a TableOperation instance to insert the specified entity into Microsoft Azure storage. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the |
Table |
insert(final TableEntity entity, boolean echoContent)
A static factory method returning a TableOperation instance to insert the specified entity into Microsoft Azure storage. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the |
Table |
insertOrMerge(final TableEntity entity)
A static factory method returning a TableOperation instance to merge the specified entity into Microsoft Azure storage, or insert it if it does not exist. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the table name and the TableOperation as arguments. |
Table |
insertOrReplace(final TableEntity entity)
A static factory method returning a TableOperation instance to replace the specified entity in Microsoft Azure storage, or insert it if it does not exist. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the table name and the TableOperation as arguments. |
Table |
merge(final TableEntity entity)
A static factory method returning a TableOperation instance to merge the specified table entity into Microsoft Azure storage. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the |
Table |
parseResponse(final InputStream inStream, final int httpStatusCode, String etagFromHeader, final OperationContext opContext, final TableRequestOptions options)
Reserved for internal use. Parses the table operation response into a TableResult to return. |
Table |
replace(final TableEntity entity)
A static factory method returning a TableOperation instance to replace the specified table entity. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method. |
Table |
retrieve(final String partitionKey, final String rowKey, final Class<? extends TableEntity> clazzType)
A static factory method returning a TableOperation instance to retrieve the specified table entity and return it as the specified type. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the |
Table |
retrieve(final String partitionKey, final String rowKey, final EntityResolver<?> resolver)
A static factory method returning a TableOperation instance to retrieve the specified table entity and return a projection of it using the specified resolver. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the table name and the TableOperation as arguments. |
void |
setEchoContent(boolean echoContent)
Sets the boolean representing whether the message payload should be returned in the response. |
synchronized final void |
setEntity(final TableEntity entity)
Reserved for internal use. Sets the TableEntity instance for the table operation. |
Constructor Details
TableOperation
protected TableOperation()
Nullary Default Constructor.
TableOperation
protected TableOperation(final TableEntity entity, final TableOperationType opType)
Reserved for internal use. Constructs a TableOperation with the specified table entity and operation type.
Parameters:
TableOperation
protected TableOperation(final TableEntity entity, final TableOperationType opType, final boolean echoContent)
Reserved for internal use. Constructs a TableOperation with the specified table entity and operation type.
Parameters:
Method Details
delete
public static TableOperation delete(final TableEntity entity)
A static factory method returning a TableOperation instance to delete the specified entity from Microsoft Azure storage. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the
Parameters:
Returns:
execute
protected TableResult execute(final CloudTableClient client, final String tableName, TableRequestOptions options, OperationContext opContext)
Reserved for internal use. Execute this table operation on the specified table, using the specified TableRequestOptions and OperationContext.
This method will invoke the Storage Service REST API to execute this table operation, using the Table service endpoint and storage account credentials in the CloudTableClient object.
Parameters:
String
which specifies the name of the table.
Returns:
Throws:
generateRequestIdentity
protected String generateRequestIdentity(boolean isSingleIndexEntry, final String entryName)
Reserved for internal use. Generates the request identity, consisting of the specified entry name, or the PartitionKey and RowKey pair from the operation, to identify the operation target.
Parameters:
true
to use the specified entryName
parameter, or false
to use PartitionKey and RowKey values from the operation as the request identity.
isSingleIndexEntry
parameter is true
.
Returns:
String
which represents the formatted request identity string.Throws:
generateRequestIdentityWithTable
protected String generateRequestIdentityWithTable(final String tableName)
Reserved for internal use. Generates the request identity string for the specified table. The request identity string combines the table name with the PartitionKey and RowKey from the operation to identify specific table entities. This request identity is already UrlEncoded.
Parameters:
String
which specifies the name of the table.
Returns:
String
which represents the formatted request identity string for the specified table.Throws:
getEchoContent
protected boolean getEchoContent()
Gets the boolean representing whether the message payload should be returned in the response.
Returns:
true
if the message payload should be returned in the response; otherwise false
getEntity
protected synchronized final TableEntity getEntity()
Reserved for internal use. Gets the table entity associated with this operation.
Returns:
getOperationType
protected synchronized final TableOperationType getOperationType()
Reserved for internal use. Gets the operation type for this operation.
Returns:
insert
public static TableOperation insert(final TableEntity entity)
A static factory method returning a TableOperation instance to insert the specified entity into Microsoft Azure storage. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the
Parameters:
Returns:
insert
public static TableOperation insert(final TableEntity entity, boolean echoContent)
A static factory method returning a TableOperation instance to insert the specified entity into Microsoft Azure storage. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the
Parameters:
Returns:
insertOrMerge
public static TableOperation insertOrMerge(final TableEntity entity)
A static factory method returning a TableOperation instance to merge the specified entity into Microsoft Azure storage, or insert it if it does not exist. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the table name and the TableOperation as arguments.
Parameters:
Returns:
insertOrReplace
public static TableOperation insertOrReplace(final TableEntity entity)
A static factory method returning a TableOperation instance to replace the specified entity in Microsoft Azure storage, or insert it if it does not exist. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the table name and the TableOperation as arguments.
Parameters:
Returns:
merge
public static TableOperation merge(final TableEntity entity)
A static factory method returning a TableOperation instance to merge the specified table entity into Microsoft Azure storage. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the
Parameters:
Returns:
parseResponse
protected TableResult parseResponse(final InputStream inStream, final int httpStatusCode, String etagFromHeader, final OperationContext opContext, final TableRequestOptions options)
Reserved for internal use. Parses the table operation response into a TableResult to return.
Parameters:
InputStream
which specifies the response to an insert operation.
int
which represents the HTTP status code returned from the operation request.
String
which specifies the Etag returned with the operation response.
Returns:
Throws:
replace
public static TableOperation replace(final TableEntity entity)
A static factory method returning a TableOperation instance to replace the specified table entity. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method.
Parameters:
Returns:
retrieve
public static TableOperation retrieve(final String partitionKey, final String rowKey, final Class clazzType)
A static factory method returning a TableOperation instance to retrieve the specified table entity and return it as the specified type. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the
Parameters:
String
which specifies the PartitionKey value for the entity to retrieve.
String
which specifies the RowKey value for the entity to retrieve.
Returns:
retrieve
public static TableOperation retrieve(final String partitionKey, final String rowKey, final EntityResolver resolver)
A static factory method returning a TableOperation instance to retrieve the specified table entity and return a projection of it using the specified resolver. To execute this TableOperation on a given table, call the execute(final TableOperation operation) method on a CloudTableClient instance with the table name and the TableOperation as arguments.
Parameters:
String
which specifies the PartitionKey value for the entity to retrieve.
String
which specifies the RowKey value for the entity to retrieve.
Returns:
setEchoContent
protected void setEchoContent(boolean echoContent)
Sets the boolean representing whether the message payload should be returned in the response.
Parameters:
true
if the message payload should be returned in the response; otherwise false
.
setEntity
protected synchronized final void setEntity(final TableEntity entity)
Reserved for internal use. Sets the TableEntity instance for the table operation.
Parameters: