throws StorageException { final boolean isTableEntry = TableConstants.TABLES_SERVICE_TABLES_NAME.equals(tableName); final String tableIdentity = isTableEntry ? this.getEntity().writeEntity(opContext) .get(TableConstants.TABLE_NAME).getValueAsString() : null; Utility.assertNotNullOrEmpty(SR.ETAG_INVALID_FOR_DELETE, this.getEntity().getEtag()); Utility.assertNotNull(SR.PARTITIONKEY_MISSING_FOR_DELETE, this.getEntity().getPartitionKey()); Utility.assertNotNull(SR.ROWKEY_MISSING_FOR_DELETE, this.getEntity().getRowKey());
final boolean isTableEntry, final OperationContext opContext) throws StorageException, IOException { HashMap<String, EntityProperty> properties = entity.writeEntity(opContext); if (properties == null) { properties = new HashMap<String, EntityProperty>(); Utility.assertNotNull(TableConstants.PARTITION_KEY, entity.getPartitionKey()); Utility.assertNotNull(TableConstants.ROW_KEY, entity.getRowKey()); Utility.assertNotNull(TableConstants.TIMESTAMP, entity.getTimestamp()); generator.writeStringField(TableConstants.PARTITION_KEY, entity.getPartitionKey()); generator.writeStringField(TableConstants.ROW_KEY, entity.getRowKey()); generator.writeStringField(TableConstants.TIMESTAMP, Utility.getJavaISO8601Time(entity.getTimestamp()));
/** * Reserved for internal use. Sets the result to associate with the table operation as a {@link TableEntity}. * * @param ent * An instance of an object implementing {@link TableEntity} to associate with the table operation. * @throws UnsupportedEncodingException */ protected void updateResultObject(final TableEntity ent) throws UnsupportedEncodingException { this.result = ent; ent.setEtag(this.etag); if (this.etag != null) { ent.setTimestamp(parseETagForTimestamp(this.etag)); } }
private static Map<String, EntityProperty> getPropertiesFromDictionary(TableEntity entity, TableRequestOptions options, final OperationContext opContext) throws IOException, StorageException { Map<String, EntityProperty> properties = entity.writeEntity(opContext); if (properties == null) { properties = new HashMap<String, EntityProperty>(); } options.assertPolicyIfRequired(); // Check if encryption policy is set and invoke EncryptEnity if it is set. if (options.getEncryptionPolicy() != null) { properties = options.getEncryptionPolicy().encryptEntity(properties, entity.getPartitionKey(), entity.getRowKey(), options.getEncryptionResolver()); } return properties; } }
pk = this.getEntity().getPartitionKey(); rk = this.getEntity().getRowKey();
entity.setEtag(res.getEtag()); entity.setPartitionKey(partitionKey); entity.setRowKey(rowKey); entity.setTimestamp(timestamp); entity.readEntity(res.getProperties(), opContext);
private StorageRequest<CloudTableClient, TableOperation, TableResult> updateImpl(final CloudTableClient client, final String tableName, final TableRequestOptions options, final OperationContext opContext) throws StorageException { Utility.assertNotNullOrEmpty(SR.ETAG_INVALID_FOR_UPDATE, this.getEntity().getEtag()); Utility.assertNotNull(SR.PARTITIONKEY_MISSING_FOR_UPDATE, this.getEntity().getPartitionKey()); Utility.assertNotNull(SR.ROWKEY_MISSING_FOR_UPDATE, this.getEntity().getRowKey());
/** * Adds a table operation to insert or merge the specified entity to the batch operation. * * @param entity * The {@link TableEntity} to insert if not found or to merge if it exists. */ public void insertOrMerge(final TableEntity entity) { this.lockToPartitionKey(entity.getPartitionKey()); this.add(TableOperation.insertOrMerge(entity)); }
Utility.assertNotNull(TableConstants.PARTITION_KEY, entity.getPartitionKey()); Utility.assertNotNull(TableConstants.ROW_KEY, entity.getRowKey()); Utility.assertNotNull(TableConstants.TIMESTAMP, entity.getTimestamp()); generator.writeStringField(TableConstants.PARTITION_KEY, entity.getPartitionKey()); generator.writeStringField(TableConstants.ROW_KEY, entity.getRowKey()); generator.writeStringField(TableConstants.TIMESTAMP, Utility.getJavaISO8601Time(entity.getTimestamp()));
/** * A static factory method returning a {@link TableOperation} instance to replace the specified table entity. To * execute this {@link TableOperation} on a given table, call the * {@link CloudTable#execute(TableOperation)} method. * * @param entity * The object instance implementing {@link TableEntity} to associate with the operation. * @return * A new {@link TableOperation} instance for replacing the table entity. */ public static TableOperation replace(final TableEntity entity) { Utility.assertNotNullOrEmpty("entity etag", entity.getEtag()); return new TableOperation(entity, TableOperationType.REPLACE); }
entity.setEtag(res.getEtag()); entity.setPartitionKey(partitionKey); entity.setRowKey(rowKey); entity.setTimestamp(timestamp); entity.readEntity(properties, opContext);
private StorageRequest<CloudTableClient, TableOperation, TableResult> mergeImpl(final CloudTableClient client, final String tableName, final TableRequestOptions options, final OperationContext opContext) throws StorageException { Utility.assertNotNullOrEmpty(SR.ETAG_INVALID_FOR_MERGE, this.getEntity().getEtag()); Utility.assertNotNull(SR.PARTITIONKEY_MISSING_FOR_MERGE, this.getEntity().getPartitionKey()); Utility.assertNotNull(SR.ROWKEY_MISSING_FOR_MERGE, this.getEntity().getRowKey());
throws StorageException { final boolean isTableEntry = TableConstants.TABLES_SERVICE_TABLES_NAME.equals(tableName); final String tableIdentity = isTableEntry ? this.getEntity().writeEntity(opContext) .get(TableConstants.TABLE_NAME).getValueAsString() : null; Utility.assertNotNull(SR.PARTITIONKEY_MISSING_FOR_INSERT, this.getEntity().getPartitionKey()); Utility.assertNotNull(SR.ROWKEY_MISSING_FOR_INSERT, this.getEntity().getRowKey());
/** * Adds a table operation to merge the specified entity to the batch operation. * * @param entity * The {@link TableEntity} to merge. */ public void merge(final TableEntity entity) { this.lockToPartitionKey(entity.getPartitionKey()); this.add(TableOperation.merge(entity)); }
/** * A static factory method returning a {@link TableOperation} instance to replace the specified table entity. To * execute this {@link TableOperation} on a given table, call the * {@link CloudTable#execute(TableOperation)} method. * * @param entity * The object instance implementing {@link TableEntity} to associate with the operation. * @return * A new {@link TableOperation} instance for replacing the table entity. */ public static TableOperation replace(final TableEntity entity) { Utility.assertNotNullOrEmpty("entity etag", entity.getEtag()); return new TableOperation(entity, TableOperationType.REPLACE); }
pk = this.getEntity().getPartitionKey(); rk = this.getEntity().getRowKey();
private StorageRequest<CloudTableClient, TableOperation, TableResult> mergeImpl(final CloudTableClient client, final String tableName, final TableRequestOptions options, final OperationContext opContext) throws StorageException { Utility.assertNotNullOrEmpty(SR.ETAG_INVALID_FOR_MERGE, this.getEntity().getEtag()); Utility.assertNotNull(SR.PARTITIONKEY_MISSING_FOR_MERGE, this.getEntity().getPartitionKey()); Utility.assertNotNull(SR.ROWKEY_MISSING_FOR_MERGE, this.getEntity().getRowKey());
throws StorageException { final boolean isTableEntry = TableConstants.TABLES_SERVICE_TABLES_NAME.equals(tableName); final String tableIdentity = isTableEntry ? this.getEntity().writeEntity(opContext) .get(TableConstants.TABLE_NAME).getValueAsString() : null; Utility.assertNotNullOrEmpty(SR.ETAG_INVALID_FOR_DELETE, this.getEntity().getEtag()); Utility.assertNotNull(SR.PARTITIONKEY_MISSING_FOR_DELETE, this.getEntity().getPartitionKey()); Utility.assertNotNull(SR.ROWKEY_MISSING_FOR_DELETE, this.getEntity().getRowKey());
throws StorageException { final boolean isTableEntry = TableConstants.TABLES_SERVICE_TABLES_NAME.equals(tableName); final String tableIdentity = isTableEntry ? this.getEntity().writeEntity(opContext) .get(TableConstants.TABLE_NAME).getValueAsString() : null; Utility.assertNotNull(SR.PARTITIONKEY_MISSING_FOR_INSERT, this.getEntity().getPartitionKey()); Utility.assertNotNull(SR.ROWKEY_MISSING_FOR_INSERT, this.getEntity().getRowKey());
/** * Adds a table operation to insert the specified entity to the batch operation. * * @param entity * The {@link TableEntity} to insert. * @param echoContent * The boolean representing whether the message payload should be returned in the response. */ public void insert(final TableEntity entity, boolean echoContent) { this.lockToPartitionKey(entity.getPartitionKey()); this.add(TableOperation.insert(entity, echoContent)); }