public class TableOperation extends Object
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
execute
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 execute
method.
Modifier | Constructor and Description |
---|---|
protected |
TableOperation()
Nullary Default Constructor.
|
protected |
TableOperation(TableEntity entity,
com.microsoft.azure.storage.table.TableOperationType opType)
Reserved for internal use.
|
protected |
TableOperation(TableEntity entity,
com.microsoft.azure.storage.table.TableOperationType opType,
boolean echoContent)
Reserved for internal use.
|
Modifier and Type | Method and Description |
---|---|
static TableOperation |
delete(TableEntity entity)
A static factory method returning a
TableOperation instance to delete the specified entity from Microsoft
Azure storage. |
protected TableResult |
execute(CloudTableClient client,
String tableName,
TableRequestOptions options,
OperationContext opContext)
Reserved for internal use.
|
protected String |
generateRequestIdentity(boolean isSingleIndexEntry,
String entryName)
Reserved for internal use.
|
protected String |
generateRequestIdentityWithTable(String tableName)
Reserved for internal use.
|
protected boolean |
getEchoContent()
Gets the boolean representing whether the message payload should be returned in the response.
|
protected TableEntity |
getEntity()
Reserved for internal use.
|
protected com.microsoft.azure.storage.table.TableOperationType |
getOperationType()
Reserved for internal use.
|
static TableOperation |
insert(TableEntity entity)
A static factory method returning a
TableOperation instance to insert the specified entity into
Microsoft Azure storage. |
static TableOperation |
insert(TableEntity entity,
boolean echoContent)
A static factory method returning a
TableOperation instance to insert the specified entity into
Microsoft Azure storage. |
static TableOperation |
insertOrMerge(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. |
static TableOperation |
insertOrReplace(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. |
static TableOperation |
merge(TableEntity entity)
A static factory method returning a
TableOperation instance to merge the specified table entity into
Microsoft Azure storage. |
protected TableResult |
parseResponse(InputStream inStream,
int httpStatusCode,
String etagFromHeader,
OperationContext opContext,
TableRequestOptions options)
Reserved for internal use.
|
static TableOperation |
replace(TableEntity entity)
A static factory method returning a
TableOperation instance to replace the specified table entity. |
static TableOperation |
retrieve(String partitionKey,
String rowKey,
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. |
static TableOperation |
retrieve(String partitionKey,
String rowKey,
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. |
protected void |
setEchoContent(boolean echoContent)
Sets the boolean representing whether the message payload should be returned in the response.
|
protected void |
setEntity(TableEntity entity)
Reserved for internal use.
|
protected TableOperation()
protected TableOperation(TableEntity entity, com.microsoft.azure.storage.table.TableOperationType opType)
TableOperation
with the specified table entity and operation
type.entity
- The object instance implementing TableEntity
to associate with the operation.opType
- The TableOperationType
enumeration value for the operation type.protected TableOperation(TableEntity entity, com.microsoft.azure.storage.table.TableOperationType opType, boolean echoContent)
TableOperation
with the specified table entity and operation
type.entity
- The object instance implementing TableEntity
to associate with the operation.opType
- The TableOperationType
enumeration value for the operation type.echoContent
- The boolean representing whether the message payload should be returned in the response.public static TableOperation delete(TableEntity entity)
TableOperation
instance to delete the specified entity from Microsoft
Azure storage. To execute this TableOperation
on a given table, call the
CloudTable.execute(TableOperation)
method on a CloudTableClient
instance with theentity
- The object instance implementing TableEntity
to associate with the operation.TableOperation
instance to insert the table entity.public static TableOperation insert(TableEntity entity)
TableOperation
instance to insert the specified entity into
Microsoft Azure storage. To execute this TableOperation
on a given table, call the
CloudTable.execute(TableOperation)
method on a CloudTableClient
instance with theentity
- The object instance implementing TableEntity
to associate with the operation.TableOperation
instance to insert the table entity.public static TableOperation insert(TableEntity entity, boolean echoContent)
TableOperation
instance to insert the specified entity into
Microsoft Azure storage. To execute this TableOperation
on a given table, call the
CloudTable.execute(TableOperation)
method on a CloudTableClient
instance with theentity
- The object instance implementing TableEntity
to associate with the operation.echoContent
- The boolean representing whether the message payload should be returned in the response.TableOperation
instance to insert the table entity.public static TableOperation insertOrMerge(TableEntity entity)
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 CloudTable.execute(TableOperation)
method on a CloudTableClient
instance with
the table name and the TableOperation
as arguments.entity
- The object instance implementing TableEntity
to associate with the operation.TableOperation
instance for inserting or merging the table entity.public static TableOperation insertOrReplace(TableEntity entity)
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 CloudTable.execute(TableOperation)
method on a CloudTableClient
instance with
the table name and the TableOperation
as arguments.entity
- The object instance implementing TableEntity
to associate with the operation.TableOperation
instance for inserting or replacing the table entity.public static TableOperation merge(TableEntity entity)
TableOperation
instance to merge the specified table entity into
Microsoft Azure storage. To execute this TableOperation
on a given table, call the
CloudTable.execute(TableOperation)
method on a CloudTableClient
instance with theentity
- The object instance implementing TableEntity
to associate with the operation.TableOperation
instance for merging the table entity.public static TableOperation retrieve(String partitionKey, String rowKey, Class<? extends TableEntity> clazzType)
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
CloudTable.execute(TableOperation)
method on a CloudTableClient
instance with thepartitionKey
- A String
which specifies the PartitionKey value for the entity to retrieve.rowKey
- A String
which specifies the RowKey value for the entity to retrieve.clazzType
- The class type of the table entity object to retrieve.TableOperation
instance for retrieving the table entity.public static TableOperation retrieve(String partitionKey, String rowKey, EntityResolver<?> resolver)
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 CloudTable.execute(TableOperation)
method on a CloudTableClient
instance
with the table name and the TableOperation
as arguments.partitionKey
- A String
which specifies the PartitionKey value for the entity to retrieve.rowKey
- A String
which specifies the RowKey value for the entity to retrieve.resolver
- The implementation of EntityResolver
to use to project the result entity as type T.TableOperation
instance for retrieving the table entity.public static TableOperation replace(TableEntity entity)
TableOperation
instance to replace the specified table entity. To
execute this TableOperation
on a given table, call the
CloudTable.execute(TableOperation)
method.entity
- The object instance implementing TableEntity
to associate with the operation.TableOperation
instance for replacing the table entity.protected 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 table operation, using the Table service
endpoint and storage account credentials in the CloudTableClient
object.
client
- A CloudTableClient
instance specifying the Table service endpoint, storage account
credentials, and any additional query parameters.tableName
- A String
which specifies 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.TableResult
which represents the results of executing the operation.StorageException
- if an error occurs in the storage operation.protected String generateRequestIdentity(boolean isSingleIndexEntry, String entryName) throws StorageException
isSingleIndexEntry
- Pass true
to use the specified entryName
parameter, or false
to
use PartitionKey and RowKey values from the operation as the request identity.entryName
- The entry name to use as the request identity if the isSingleIndexEntry
parameter is
true
.String
which represents the formatted request identity string.StorageException
- If a storage service error occurred.protected String generateRequestIdentityWithTable(String tableName) throws StorageException
tableName
- A String
which specifies the name of the table.String
which represents the formatted request identity string for the specified table.StorageException
protected final TableEntity getEntity()
TableEntity
instance associated with this operation.protected final com.microsoft.azure.storage.table.TableOperationType getOperationType()
TableOperationType
instance associated with this operation.protected TableResult parseResponse(InputStream inStream, int httpStatusCode, String etagFromHeader, OperationContext opContext, TableRequestOptions options) throws InstantiationException, IllegalAccessException, StorageException, com.fasterxml.jackson.core.JsonParseException, IOException
TableResult
to return.inStream
- An InputStream
which specifies the response to an insert operation.httpStatusCode
- An int
which represents the HTTP status code returned from the operation request.etagFromHeader
- The String
which specifies the Etag returned with the operation response.opContext
- An OperationContext
object that represents the context for the current operation.TableResult
representing the result of the operation.InstantiationException
- if an error occurs in object construction.IllegalAccessException
- if an error occurs in reflection on an object type.StorageException
- if an error occurs in the storage operation.IOException
- if an error occurs while accessing the InputStream
with Json.com.fasterxml.jackson.core.JsonParseException
- if an error occurs while parsing the Json, if Json is used.protected final void setEntity(TableEntity entity)
TableEntity
instance for the table operation.entity
- The TableEntity
instance to set.protected boolean getEchoContent()
true
if the message payload should be returned in the response; otherwise false
protected void setEchoContent(boolean echoContent)
echoContent
- true
if the message payload should be returned in the response; otherwise
false
.Copyright © 2019. All rights reserved.