コード例 #1
0
 public CellEntry addCellEntry(CellEntry cellEntry, SpreadsheetUrl cellfeedUrl)
     throws IOException {
   AtomContent content = AtomContent.forEntry(DICTIONARY, cellEntry);
   HttpRequest request = requestFactory.buildPostRequest(cellfeedUrl, content);
   request.getHeaders().setIfNoneMatch(((CellEntry) cellEntry).etag);
   return request.execute().parseAs(cellEntry.getClass());
 }
コード例 #2
0
 public WorksheetEntry addWorksheet(WorksheetEntry worksheetEntry, SpreadsheetUrl worksheetfeedUrl)
     throws IOException {
   AtomContent content = AtomContent.forEntry(DICTIONARY, worksheetEntry);
   HttpRequest request = requestFactory.buildPostRequest(worksheetfeedUrl, content);
   // request.getHeaders().setIfNoneMatch(worksheetEntry.etag);
   return request.execute().parseAs(worksheetEntry.getClass());
 }
コード例 #3
0
  public CellEntry executeInsert(CellEntry entry, boolean matchTag) throws IOException {
    AtomContent content = AtomContent.forEntry(DICTIONARY, entry);
    HttpRequest request =
        requestFactory.buildPutRequest(new SpreadsheetUrl(entry.getEditLink()), content);

    if (matchTag) {
      // this will only insert if there has been no modification.
      request.getHeaders().setIfMatch(((CellEntry) entry).etag);
    } else {
      // this will only insert if there has been a modification
      request.getHeaders().setIfNoneMatch(((CellEntry) entry).etag);
    }
    return request.execute().parseAs(entry.getClass());
  }