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()); }
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()); }
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()); }