本文整理匯總了Java中com.google.gdata.client.spreadsheet.SpreadsheetQuery類的典型用法代碼示例。如果您正苦於以下問題:Java SpreadsheetQuery類的具體用法?Java SpreadsheetQuery怎麽用?Java SpreadsheetQuery使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SpreadsheetQuery類屬於com.google.gdata.client.spreadsheet包,在下文中一共展示了SpreadsheetQuery類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getSpreadsheet
import com.google.gdata.client.spreadsheet.SpreadsheetQuery; //導入依賴的package包/類
/**
* Gets the SpreadsheetEntry for the first spreadsheet with that name
* retrieved in the feed.
*
* @param spreadsheet the name of the spreadsheet
* @return the first SpreadsheetEntry in the returned feed, so latest
* spreadsheet with the specified name
* @throws Exception if error is encountered, such as no spreadsheets with the
* name
*/
public SpreadsheetEntry getSpreadsheet(String spreadsheet)
throws Exception {
SpreadsheetQuery spreadsheetQuery
= new SpreadsheetQuery(factory.getSpreadsheetsFeedUrl());
spreadsheetQuery.setTitleQuery(spreadsheet);
SpreadsheetFeed spreadsheetFeed = service.query(spreadsheetQuery,
SpreadsheetFeed.class);
List<SpreadsheetEntry> spreadsheets = spreadsheetFeed.getEntries();
if (spreadsheets.isEmpty()) {
throw new Exception("No spreadsheets with that name");
}
return spreadsheets.get(0);
}
示例2: getSpreadsheetFeedQuery
import com.google.gdata.client.spreadsheet.SpreadsheetQuery; //導入依賴的package包/類
private BaseFeed<?, ?> getSpreadsheetFeedQuery(SpreadsheetQuery squery, Class<? extends BaseFeed<?, ?>> feedClass) {
try {
return service.getFeed(squery, feedClass);
} catch (Exception ex) {
try {
Thread.sleep(RETRY_DELAY);
} catch (InterruptedException e) {
}
// Try to relogin
reauthenticate();
try {
return service.getFeed(squery, SpreadsheetFeed.class);
} catch (Exception ex2) {
throw new SpreadsheetOperationException("Error getting spreadsheet feed. Possibly bad authentication or connection problems. " + ex2);
}
}
}
示例3: getSpreadsheetEntryByTitle
import com.google.gdata.client.spreadsheet.SpreadsheetQuery; //導入依賴的package包/類
public SpreadsheetEntry getSpreadsheetEntryByTitle(String sheetTitle) {
SpreadsheetQuery squery = new SpreadsheetQuery(factory.getSpreadsheetsFeedUrl());
squery.setTitleExact(true);
squery.setTitleQuery(sheetTitle);
SpreadsheetFeed feed = (SpreadsheetFeed) getSpreadsheetFeedQuery(squery, SpreadsheetFeed.class);
List<SpreadsheetEntry> entry = feed.getEntries();
if (entry.size() == 0)
throw new SpreadsheetOperationException("Couldn't find spreadsheet:" + sheetTitle);
return entry.get(0);
}
示例4: extractSpreadSheetFeed
import com.google.gdata.client.spreadsheet.SpreadsheetQuery; //導入依賴的package包/類
private SpreadsheetFeed extractSpreadSheetFeed() throws SQLException {
URL spreadSheetFeedUrl;
try {
spreadSheetFeedUrl = this.feedProcessor.getSpreadSheetFeedUrl();
} catch (MalformedURLException e) {
throw new SQLException("Error occurred while constructing the Spread Sheet Feed URL");
}
SpreadsheetQuery spreadSheetQuery =
TDriverUtil.createSpreadSheetQuery(this.getSpreadSheetName(), spreadSheetFeedUrl);
return this.feedProcessor.getFeed(spreadSheetQuery, SpreadsheetFeed.class);
}