/** * 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)); }
/** * 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)); }
private TableOperation getTableOperation(DynamicTableEntity entity) { TableOperation tableOpe = null; switch (actionData) { case Insert: tableOpe = TableOperation.insert(entity); break; case Insert_Or_Merge: tableOpe = TableOperation.insertOrMerge(entity); break; case Insert_Or_Replace: tableOpe = TableOperation.insertOrReplace(entity); break; case Merge: tableOpe = TableOperation.merge(entity); break; case Replace: tableOpe = TableOperation.replace(entity); break; case Delete: tableOpe = TableOperation.delete(entity); break; default: LOGGER.error("No specified operation for table"); } return tableOpe; }
private TableOperation getTableOperation(DynamicTableEntity entity) { TableOperation tableOpe = null; switch (actionData) { case Insert: tableOpe = TableOperation.insert(entity); break; case Insert_Or_Merge: tableOpe = TableOperation.insertOrMerge(entity); break; case Insert_Or_Replace: tableOpe = TableOperation.insertOrReplace(entity); break; case Merge: tableOpe = TableOperation.merge(entity); break; case Replace: tableOpe = TableOperation.replace(entity); break; case Delete: tableOpe = TableOperation.delete(entity); break; default: LOGGER.error("No specified operation for table"); } return tableOpe; }
/** * Illustrates how to form and execute an upsert operation. * * @throws StorageException */ public void BasicUpsert() throws StorageException { // Retrieve the entity with partition key of "Smith" and row key of // "Jeff". TableOperation retrieveSmithJeff = TableOperation.retrieve("Smith", "Jeff", CustomerEntity.class); // Submit the operation to the table service and get the specific // entity. CustomerEntity specificEntity = table.execute(retrieveSmithJeff) .getResultAsType(); // Specify a new phone number. specificEntity.setPhoneNumber("425-555-0105"); // Create an operation to replace the entity. TableOperation replaceEntity = TableOperation.merge(specificEntity); // Submit the operation to the table service. table.execute(replaceEntity); }
ops.add(TableOperation.merge(createEntityToReplaceOrMerge(baseEntity)));
secondEntity.setEtag(baseEntity.getEtag()); TableResult mergeResult = this.table.execute(TableOperation.merge(secondEntity), options, null);
op = TableOperation.merge(entity); if (policy.getPermissions().contains(SharedAccessAccountPermissions.UPDATE)) { sasTable.execute(op);
String oldEtag = baseEntity.getEtag(); this.table.execute(TableOperation.merge(secondEntity), options, null); this.table.execute(TableOperation.merge(secondEntity), options, null); fail(); } catch (TableServiceException ex) { this.table.execute(TableOperation.merge(secondEntity), options, null); fail(); } catch (TableServiceException ex) {
@Test public void testEntityWithSingleQuote() throws StorageException { TableRequestOptions options = new TableRequestOptions(); options.setTablePayloadFormat(TablePayloadFormat.Json); EmptyClass ref = new EmptyClass(); ref.setPartitionKey("partition'key"); ref.setRowKey("row'key"); this.table.execute(TableOperation.insert(ref), options, null); this.table.execute(TableOperation.merge(ref), options, null); this.table.execute(TableOperation.insertOrReplace(ref), options, null); this.table.execute(TableOperation.insertOrMerge(ref), options, null); this.table.execute(TableOperation.replace(ref), options, null); this.table.execute(TableOperation.retrieve(ref.getPartitionKey(), ref.getRowKey(), EmptyClass.class), options, null); this.table.execute(TableOperation.delete(ref), options, null); }
this.table.execute(TableOperation.merge(ref), options, null);