本文整理汇总了Java中com.google.gdata.data.spreadsheet.ListFeed类的典型用法代码示例。如果您正苦于以下问题:Java ListFeed类的具体用法?Java ListFeed怎么用?Java ListFeed使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListFeed类属于com.google.gdata.data.spreadsheet包,在下文中一共展示了ListFeed类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSsEntryListHelper
import com.google.gdata.data.spreadsheet.ListFeed; //导入依赖的package包/类
/**
* Retrieves all <code>ListEntry</code> objects from the spreadsheet
*
* @return <code>List</code> of <code>ListEntry</code> instances
* @throws EPAuthenticationException
*/
private List<ListEntry> getSsEntryListHelper()
throws EPAuthenticationException {
List<ListEntry> returnList = null;
try {
SpreadsheetService ssService = getSsService();
ListFeed listFeed = ssService.getFeed(ssUrl, ListFeed.class);
returnList = listFeed.getEntries();
} catch (com.google.gdata.util.AuthenticationException authEx) {
throw new EPAuthenticationException("SS read access not available");
} catch (com.google.gdata.util.ServiceException svcex) {
System.err.println("ServiceException while retrieving " +
"entry list: " + svcex.getMessage());
returnList = null;
} catch (java.io.IOException ioex) {
System.err.println("IOException while retrieving " +
"entry list: " + ioex.getMessage());
returnList = null;
}
return returnList;
}
示例2: extractWorksheetData
import com.google.gdata.data.spreadsheet.ListFeed; //导入依赖的package包/类
private List<String> extractWorksheetData(SpreadsheetEntry spreadsheet, String worksheetId, String[] header) throws Throwable, IOException, ServiceException
{
List<String> returnValue = Lists.newArrayList();
WorksheetEntry worksheet = getWorksheet(spreadsheet, worksheetId);
if (worksheet != null) {
ListFeed listFeed = getListFeedForWorksheet(worksheet);
returnValue = getAllEntries(listFeed, header);
}
return returnValue;
}
示例3: getAllEntries
import com.google.gdata.data.spreadsheet.ListFeed; //导入依赖的package包/类
private List<String> getAllEntries(ListFeed listFeed, String[] headerDefault)
{
List<String> returnValue = Lists.newArrayList();
Joiner joiner = Joiner.on(Properties.inputDelimiter.get());
Set<String> header = null;
List<ListEntry> entries = listFeed.getEntries();
if (entries != null && entries.size() > 0) {
ListEntry listEntry = entries.get(0);
if (listEntry != null)
header = listEntry.getCustomElements().getTags();
}
if (header == null && headerDefault != null) {
header = new LinkedHashSet<String>();
for (String headerItem : headerDefault) {
header.add(headerItem);
}
}
returnValue.add(joiner.join(header));
for (ListEntry row : entries) {
List<String> rowValues = Lists.newArrayList();
for (String tag : header) {
String value = row.getCustomElements().getValue(tag);
if (value == null)
value = "";
rowValues.add(value);
}
String rowValuesString = joiner.join(rowValues);
returnValue.add(rowValuesString);
}
return returnValue;
}
示例4: reverseAllEntries
import com.google.gdata.data.spreadsheet.ListFeed; //导入依赖的package包/类
/**
* Lists all rows in the spreadsheet in reverse order.
*
* @throws ServiceException when the request causes an error in the Google
* Spreadsheets service.
* @throws IOException when an error occurs in communication with the Google
* Spreadsheets service.
*/
public void reverseAllEntries() throws IOException, ServiceException {
ListQuery query = new ListQuery(listFeedUrl);
query.setReverse(true);
ListFeed feed = service.query(query, ListFeed.class);
for (ListEntry entry : feed.getEntries()) {
printAndCacheEntry(entry);
}
}
示例5: search
import com.google.gdata.data.spreadsheet.ListFeed; //导入依赖的package包/类
/**
* Searches rows with a full text search string, finding any rows that match
* all the given words.
*
* @param fullTextSearchString a string like "Rosa 555" will look for the
* substrings Rosa and 555 to appear anywhere in the row
* @throws ServiceException when the request causes an error in the Google
* Spreadsheets service.
* @throws IOException when an error occurs in communication with the Google
* Spreadsheets service.
*/
public void search(String fullTextSearchString) throws IOException,
ServiceException {
ListQuery query = new ListQuery(listFeedUrl);
query.setFullTextQuery(fullTextSearchString);
ListFeed feed = service.query(query, ListFeed.class);
out.println("Results for [" + fullTextSearchString + "]");
for (ListEntry entry : feed.getEntries()) {
printAndCacheEntry(entry);
}
}
示例6: declareExtensions
import com.google.gdata.data.spreadsheet.ListFeed; //导入依赖的package包/类
/**
* Declare the extensions of the feeds for the Google Spreadsheets service.
*/
private void declareExtensions() {
new CellFeed().declareExtensions(extProfile);
new ListFeed().declareExtensions(extProfile);
new RecordFeed().declareExtensions(extProfile);
new SpreadsheetFeed().declareExtensions(extProfile);
new TableFeed().declareExtensions(extProfile);
new WorksheetFeed().declareExtensions(extProfile);
}
示例7: getListRows
import com.google.gdata.data.spreadsheet.ListFeed; //导入依赖的package包/类
public List getListRows(Object worksheetEntryObject) throws Exception {
WorksheetEntry worksheet = (WorksheetEntry) worksheetEntryObject;
// Fetch the list feed of the worksheet.
URL listFeedUrl = worksheet.getListFeedUrl();
ListFeed listFeed = service.getFeed(listFeedUrl, ListFeed.class);
return listFeed.getEntries();
}
示例8: getListFeedForWorksheet
import com.google.gdata.data.spreadsheet.ListFeed; //导入依赖的package包/类
private ListFeed getListFeedForWorksheet(WorksheetEntry worksheet) throws IOException, ServiceException
{
URL listFeedUrl = worksheet.getListFeedUrl();
ListFeed cellFeed = spreadsheetService.getFeed(listFeedUrl, ListFeed.class);
return cellFeed;
}
示例9: deleteSpreadsheetsRow
import com.google.gdata.data.spreadsheet.ListFeed; //导入依赖的package包/类
/**
* Deletes Google Spreadsheets row.
*
* @param context the context
* @param accountName the account name
* @param trackName the track name
* @return true if deletion is success.
*/
public static boolean deleteSpreadsheetsRow(
Context context, String accountName, String trackName) {
try {
// Get spreadsheet Id
List<File> files = searchSpreadsheets(context, accountName);
if (files == null || files.size() == 0) {
return false;
}
String spreadsheetId = files.get(0).getId();
// Get spreadsheet service
SpreadsheetService spreadsheetService = new SpreadsheetService(
"MyTracks-" + SystemUtils.getMyTracksVersion(context));
Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod());
credential.setAccessToken(
SendToGoogleUtils.getToken(context, accountName, SendToGoogleUtils.SPREADSHEETS_SCOPE));
spreadsheetService.setOAuth2Credentials(credential);
// Get work sheet
WorksheetFeed worksheetFeed = spreadsheetService.getFeed(new URL(
String.format(Locale.US, SendSpreadsheetsAsyncTask.GET_WORKSHEETS_URI, spreadsheetId)),
WorksheetFeed.class);
Iterator<WorksheetEntry> worksheetEntryIterator = worksheetFeed.getEntries().iterator();
while (worksheetEntryIterator.hasNext()) {
WorksheetEntry worksheetEntry = (WorksheetEntry) worksheetEntryIterator.next();
String worksheetTitle = worksheetEntry.getTitle().getPlainText();
if (worksheetTitle.equals(SPREADSHEETS_WORKSHEET_NAME)) {
URL url = worksheetEntry.getListFeedUrl();
Iterator<ListEntry> listEntryIterator = spreadsheetService.getFeed(url, ListFeed.class)
.getEntries().iterator();
while (listEntryIterator.hasNext()) {
ListEntry listEntry = (ListEntry) listEntryIterator.next();
String name = listEntry.getCustomElements().getValue(SPREADSHEETS_TRANCK_NAME_COLUMN);
if (name.equals(trackName)) {
listEntry.delete();
return true;
}
}
}
}
} catch (Exception e) {
Log.e(TAG, "Unable to delete spreadsheets row.", e);
}
return false;
}
示例10: doInBackground
import com.google.gdata.data.spreadsheet.ListFeed; //导入依赖的package包/类
@Override
protected Boolean doInBackground(String... params) {
// TODO Auto-generated method stub
try {
GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
oauthParameters.setOAuthConsumerKey (Config.CLIENT_ID);
oauthParameters.setOAuthConsumerSecret (Config.CLIENT_SECRET);
oauthParameters.setOAuthType (OAuthType.TWO_LEGGED_OAUTH);
oauthParameters.setScope ("https://spreadsheets.google.com/feeds/");
SpreadsheetService service = new SpreadsheetService("QRScanner");
service.useSsl();
service.setOAuthCredentials (oauthParameters, new OAuthHmacSha1Signer ());
// Notice that the url ends
// with default/public/values.
// That wasn't obvious (at least to me)
// from the documentation.
String urlString = Config.SPREADSHEET_PUBLIC_URL;
// turn the string into a URL
URL url = new URL(urlString);
// You could substitute a cell feed here in place of
// the list feed (TODO: Might be useful for updating)
ListFeed feed = service.getFeed(url, ListFeed.class);
//CellFeed cellfeed = service.getFeed(url, CellFeed.class);
for (ListEntry entry : feed.getEntries()) {
CustomElementCollection elements = entry.getCustomElements();
String qrcontent = elements.getValue("qrcontent");
String entrytimestamp = elements.getValue("entrytimestamp");
Guest guest = new Guest(elements);
m_eventGuests.addGuest(qrcontent, guest);
if(qrcontent.equals(params[0]) && (entrytimestamp == null || entrytimestamp.equals("")) ) {
//TODO: Need to update Entry Time stamp column (preferable move this somewhere else)
//elements.setValueLocal("entrytimestamp", getCurrentDateTime());
return true;
}
else if(qrcontent.equals(params[0])) {
return false;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
示例11: getSortedListRows
import com.google.gdata.data.spreadsheet.ListFeed; //导入依赖的package包/类
public List<ListEntry> getSortedListRows(WorksheetEntry worksheet, boolean isReverse, String columnSorted) throws IOException, ServiceException, URISyntaxException {
// Fetch the sorted list feed of the worksheet
URL listFeedUrl = new URI(worksheet.getListFeedUrl().toString() + "?reverse=" + (isReverse ? "true" : "false") + "?orderby=column:" + columnSorted).toURL();
ListFeed listFeed = service.getFeed(listFeedUrl, ListFeed.class);
return listFeed.getEntries();
}
示例12: getListRowsByQuery
import com.google.gdata.data.spreadsheet.ListFeed; //导入依赖的package包/类
public List<ListEntry> getListRowsByQuery(WorksheetEntry worksheet, String query) throws IOException, ServiceException, URISyntaxException {
// Fetch the sorted list feed of the worksheet
URL listFeedUrl = new URI(worksheet.getListFeedUrl().toString() + "?sq=" + query).toURL();
ListFeed listFeed = service.getFeed(listFeedUrl, ListFeed.class);
return listFeed.getEntries();
}
示例13: createRecordInSpreadsheet
import com.google.gdata.data.spreadsheet.ListFeed; //导入依赖的package包/类
/**
* Recording a copy of the information somebody used the Streetlight Seattle Reporter app to send to Seattle City Light.
* Google Docs approach inspired by: https://developers.google.com/google-apps/spreadsheets/#adding_a_list_row
* Spreadsheet viewable at: https://docs.google.com/spreadsheet/ccc?key=0AvDYc0olGEwRdE56dTlKMVVZdGYxQkc5eGJEQzJLNkE&usp=drive_web#gid=0
*
* @param parameters names and values from the activity; names are column headers in the spreadsheet.
* @throws AuthenticationException
* @throws MalformedURLException
* @throws IOException
* @throws ServiceException
*/
private void createRecordInSpreadsheet(List<NameValuePair> parameters)
throws AuthenticationException, MalformedURLException, IOException, ServiceException
{
String timeStamp = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(Calendar.getInstance().getTime());
parameters.add(new BasicNameValuePair("Date", timeStamp));
//parameters.remove(object)
SpreadsheetService service = new SpreadsheetService("CodeForSeattle-StreetlightSeattleReporter-v1");
// Authorize the service object for a specific user (see other sections)
final String user = "[email protected]";
final String pword = StringUtil.repeat(getString(R.string.app_initials), 3) + "333";
service.setUserCredentials(user, pword);
// Define the URL to request. This should never change.
URL SPREADSHEET_FEED_URL = new URL("https://spreadsheets.google.com/feeds/spreadsheets/private/full");
// Make a request to the API and get all spreadsheets.
SpreadsheetFeed feed = service.getFeed(SPREADSHEET_FEED_URL, SpreadsheetFeed.class);
List<SpreadsheetEntry> spreadsheets = feed.getEntries();
if (spreadsheets.size() == 0) {
// There were no spreadsheets, act accordingly.
return;
}
SpreadsheetEntry spreadsheet = null;
for (SpreadsheetEntry s : spreadsheets)
{
String title = s.getTitle().getPlainText();
if (title.equals("StreetlightSeattleReporter"))
{
spreadsheet = s;
break;
}
if (spreadsheet == null) // Backup plan.
spreadsheet = spreadsheets.get(0);
}
// Get the first worksheet of the first spreadsheet.
WorksheetFeed worksheetFeed = service.getFeed(spreadsheet.getWorksheetFeedUrl(), WorksheetFeed.class);
List<WorksheetEntry> worksheets = worksheetFeed.getEntries();
WorksheetEntry worksheet = worksheets.get(0);
// Fetch the list feed of the worksheet.
URL listFeedUrl = worksheet.getListFeedUrl();
ListFeed listFeed = service.getFeed(listFeedUrl, ListFeed.class);
// Create a local representation of the new row.
ListEntry row = new ListEntry();
// Set the values of the new row.
for (NameValuePair param : parameters) {
String key = param.getName();
// Refrain from storing these 3 fields in the Google Docs spreadsheet.
if (key.equals("LastName") || key.equals("Phone") || key.equals("Email"))
continue;
row.getCustomElements().setValueLocal(key, param.getValue());
}
// Send the new row to the API for insertion.
row = service.insert(listFeedUrl, row);
}
示例14: getListFeed
import com.google.gdata.data.spreadsheet.ListFeed; //导入依赖的package包/类
public static ListFeed getListFeed(TGSpreadConnection connection,
WorksheetEntry currentWorkSheet) throws SQLException {
ListQuery listQuery = new ListQuery(currentWorkSheet.getListFeedUrl());
return connection.getFeedProcessor().getFeed(listQuery, ListFeed.class);
}
示例15: listAllEntries
import com.google.gdata.data.spreadsheet.ListFeed; //导入依赖的package包/类
/**
* Lists all rows in the spreadsheet.
*
* @throws ServiceException when the request causes an error in the Google
* Spreadsheets service.
* @throws IOException when an error occurs in communication with the Google
* Spreadsheets service.
*/
public void listAllEntries() throws IOException, ServiceException {
ListFeed feed = service.getFeed(listFeedUrl, ListFeed.class);
for (ListEntry entry : feed.getEntries()) {
printAndCacheEntry(entry);
}
}