Пример #1
0
 private void removeEntry(String rowKey, String tableName) {
   try {
     CloudTableClient tableClient = getTableClient();
     Album specificAlbum =
         tableClient
             .execute(tableName, TableOperation.retrieve("1", rowKey, Album.class))
             .getResultAsType();
     tableClient.execute(tableName, TableOperation.delete(specificAlbum));
   } catch (Exception e) {
     System.out.print("Exception encountered: ");
     System.out.println(e.getMessage());
   }
 }
Пример #2
0
 private void insertEntry(Album album) throws StorageException, Exception {
   CloudTableClient tableClient = getTableClient();
   CloudTable table = tableClient.getTableReference(this.tableName);
   table.createIfNotExist();
   TableOperation insertAlbum1 = TableOperation.insert(album);
   tableClient.execute(this.tableName, insertAlbum1);
 }
Пример #3
0
  private Album getAlbumInfo(String rowKey, String tableName) {
    try {
      CloudTableClient tableClient = getTableClient();
      Album specificAlbum =
          tableClient
              .execute(tableName, TableOperation.retrieve("1", rowKey, Album.class))
              .getResultAsType();

      return specificAlbum;
    } catch (StorageException storageException) {
      System.out.print("StorageException encountered: ");
      System.out.println(storageException.getMessage());
      return null;
    } catch (Exception e) {
      System.out.print("Exception encountered:\n");
      System.out.println(
          "Exception class: "
              + e.getClass()
              + "\nException message: "
              + e.getMessage()
              + "\nStack trace: "
              + e.getStackTrace());
      return null;
    }
  }