当前位置: 首页>>代码示例>>Java>>正文


Java WorksheetFeed.getEntries方法代码示例

本文整理汇总了Java中com.google.gdata.data.spreadsheet.WorksheetFeed.getEntries方法的典型用法代码示例。如果您正苦于以下问题:Java WorksheetFeed.getEntries方法的具体用法?Java WorksheetFeed.getEntries怎么用?Java WorksheetFeed.getEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gdata.data.spreadsheet.WorksheetFeed的用法示例。


在下文中一共展示了WorksheetFeed.getEntries方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateWorksheet

import com.google.gdata.data.spreadsheet.WorksheetFeed; //导入方法依赖的package包/类
/**
 * Updates the worksheet specified by the oldTitle parameter, with the given
 * title and sizes. Note that worksheet titles are not unique, so this method
 * just updates the first worksheet it finds. Hey, it's just sample code - no
 * refunds!
 * 
 * @param oldTitle a String specifying the worksheet to update.
 * @param newTitle a String containing the new name for the worksheet.
 * @param rowCount the number of rows the new worksheet should have.
 * @param colCount the number of columns the new worksheet should have.
 * 
 * @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.
 */
private void updateWorksheet(String oldTitle, String newTitle, int rowCount,
    int colCount) throws IOException, ServiceException {
  WorksheetFeed worksheetFeed = service.getFeed(worksheetFeedUrl,
      WorksheetFeed.class);
  for (WorksheetEntry worksheet : worksheetFeed.getEntries()) {
    String currTitle = worksheet.getTitle().getPlainText();
    if (currTitle.equals(oldTitle)) {
      worksheet.setTitle(new PlainTextConstruct(newTitle));
      worksheet.setRowCount(rowCount);
      worksheet.setColCount(colCount);
      worksheet.update();
      System.out.println("Worksheet updated.");
      return;
    }
  }

  // If it got this far, the worksheet wasn't found.
  System.out.println("Worksheet not found: " + oldTitle);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:36,代码来源:WorksheetDemo.java

示例2: deleteWorksheet

import com.google.gdata.data.spreadsheet.WorksheetFeed; //导入方法依赖的package包/类
/**
 * Deletes the worksheet specified by the title parameter. Note that worksheet
 * titles are not unique, so this method just updates the first worksheet it
 * finds.
 * 
 * @param title a String containing the name of the worksheet to delete.
 * 
 * @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.
 */
private void deleteWorksheet(String title) throws IOException,
    ServiceException {
  WorksheetFeed worksheetFeed = service.getFeed(worksheetFeedUrl,
      WorksheetFeed.class);
  for (WorksheetEntry worksheet : worksheetFeed.getEntries()) {
    String currTitle = worksheet.getTitle().getPlainText();
    if (currTitle.equals(title)) {
      worksheet.delete();
      System.out.println("Worksheet deleted.");
      return;
    }
  }

  // If it got this far, the worksheet wasn't found.
  System.out.println("Worksheet not found: " + title);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:29,代码来源:WorksheetDemo.java

示例3: getWorksheet

import com.google.gdata.data.spreadsheet.WorksheetFeed; //导入方法依赖的package包/类
/**
 * Get the WorksheetEntry for the worksheet in the spreadsheet with the
 * specified name.
 *
 * @param spreadsheet the name of the spreadsheet
 * @param worksheet the name of the worksheet in the spreadsheet
 * @return worksheet with the specified name in the spreadsheet with the
 * specified name
 * @throws Exception if error is encountered, such as no spreadsheets with the
 * name, or no worksheet wiht the name in the spreadsheet
 */
public WorksheetEntry getWorksheet(String spreadsheet, String worksheet) 
    throws Exception {

  SpreadsheetEntry spreadsheetEntry = getSpreadsheet(spreadsheet);

  WorksheetQuery worksheetQuery
    = new WorksheetQuery(spreadsheetEntry.getWorksheetFeedUrl());

  worksheetQuery.setTitleQuery(worksheet);
  WorksheetFeed worksheetFeed = service.query(worksheetQuery,
      WorksheetFeed.class);
  List<WorksheetEntry> worksheets = worksheetFeed.getEntries();
  if (worksheets.isEmpty()) {
    throw new Exception("No worksheets with that name in spreadhsheet "
        + spreadsheetEntry.getTitle().getPlainText());
  }

  return worksheets.get(0);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:31,代码来源:ImportClient.java

示例4: getWsListHelper

import com.google.gdata.data.spreadsheet.WorksheetFeed; //导入方法依赖的package包/类
/**
 * Retrieves a <code>List</code> of <code>WorksheetEntry</code> instances
 * available from the list of Worksheets in the specified feed
 *
 * @param wsFeedUrl The feed of worksheets
 * @throws EPAuthenticationException 
 * @return List of worksheets in the specified feed
 */
private List<WorksheetEntry> getWsListHelper(String wsFeedUrl) 
throws EPAuthenticationException {
  List<WorksheetEntry> returnList = null;

  try {
    SpreadsheetService ssService = getSsService();
    WorksheetFeed wsFeed = ssService.getFeed(
        new URL(wsFeedUrl), 
        WorksheetFeed.class);
    returnList = wsFeed.getEntries();
  } catch (com.google.gdata.util.AuthenticationException authEx) {
    throw new EPAuthenticationException(
        "WS list read access not available");
  } catch (com.google.gdata.util.ServiceException svcex) {
    System.err.println("ServiceException while retrieving " +
        "available worksheets: " + svcex.getMessage());
    returnList = null;
  } catch (java.io.IOException ioex) {
    System.err.println("IOException while retrieving " +
        "available worksheets: " + ioex.getMessage());
    returnList = null;
  }
  return returnList;    
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:33,代码来源:EventPublisher.java

示例5: connectWorksheetFeed

import com.google.gdata.data.spreadsheet.WorksheetFeed; //导入方法依赖的package包/类
public static WorksheetEntry connectWorksheetFeed(String user, String password, String documentId, String sheet) throws AuthenticationException
{

	WorksheetFeed feed = connectWorksheetFeed(user, password, documentId);
	List<WorksheetEntry> worksheets = feed.getEntries();

	WorksheetEntry worksheet = null;
	if (sheet == null || sheet.isEmpty())
	{
		worksheet = worksheets.get(0);
	} else
	{
		for (WorksheetEntry we : worksheets)
		{
			if (we.getTitle().getPlainText().equalsIgnoreCase(sheet))
			{
				worksheet = we;
			}
		}
	}
	return worksheet;

}
 
开发者ID:intuitivus,项目名称:pdi-spreadsheet-plugin,代码行数:24,代码来源:SpreadsheetUtil.java

示例6: getWorksheetUrl

import com.google.gdata.data.spreadsheet.WorksheetFeed; //导入方法依赖的package包/类
/**
 * Gets the worksheet url.
 * 
 * @param spreadsheetService the spreadsheet service
 * @param spreadsheetId the spreadsheet id
 */
private URL getWorksheetUrl(SpreadsheetService spreadsheetService, String spreadsheetId)
    throws IOException, ServiceException {
  if (isCancelled()) {
    return null;
  }
  URL url = new URL(String.format(Locale.US, GET_WORKSHEETS_URI, spreadsheetId));
  WorksheetFeed feed = spreadsheetService.getFeed(url, WorksheetFeed.class);
  List<WorksheetEntry> worksheets = feed.getEntries();

  if (worksheets.size() > 0) {
    return worksheets.get(0).getListFeedUrl();
  }
  return null;
}
 
开发者ID:Plonk42,项目名称:mytracks,代码行数:21,代码来源:SendSpreadsheetsAsyncTask.java

示例7: listAllWorksheets

import com.google.gdata.data.spreadsheet.WorksheetFeed; //导入方法依赖的package包/类
/**
 * Lists all the worksheets in the loaded 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.
 */
private void listAllWorksheets() throws IOException, ServiceException {
  WorksheetFeed worksheetFeed = service.getFeed(worksheetFeedUrl,
      WorksheetFeed.class);
  for (WorksheetEntry worksheet : worksheetFeed.getEntries()) {
    String title = worksheet.getTitle().getPlainText();
    int rowCount = worksheet.getRowCount();
    int colCount = worksheet.getColCount();
    System.out.println("\t" + title + " - rows:" + rowCount + " cols: "
        + colCount);
  }
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:20,代码来源:WorksheetDemo.java

示例8: getCells

import com.google.gdata.data.spreadsheet.WorksheetFeed; //导入方法依赖的package包/类
/**
 * Retrieve the cells of the worksheet designated by the current month from the spreadsheet
 * specified in the parameter spreadsheet argument.
 * For the specifics of my example, the empty cells of the sheet are retrieved as well.
 * @param spreadsheet the spreadsheet to read the cells from (obtained by running getSpreadsheet)
 * @param service SpreadsheetService obtained with token to manipulate Google spreadsheets (created in doInBackground)
 * @return the cells from the spreadsheet
 * @throws IOException
 * @throws URISyntaxException
 * @throws ServiceException
 */
private List<CellEntry> getCells( SpreadsheetEntry spreadsheet, SpreadsheetService service )
        throws IOException, URISyntaxException, ServiceException {
    // Get all the worksheets from the spreadsheet
    WorksheetFeed worksheetFeed = service.getFeed(spreadsheet.getWorksheetFeedUrl(), WorksheetFeed.class);
    List<WorksheetEntry> worksheets = worksheetFeed.getEntries();

    // Fetch the desired worksheet (here corresponds to the current month)
    WorksheetEntry worksheet = null;
    Calendar cal = Calendar.getInstance();
    String monthShort =  new SimpleDateFormat("MMM").format(cal.getTime()).toLowerCase();
    for (WorksheetEntry entry : worksheets) {
        String worksheetTitle = entry.getTitle().getPlainText().toLowerCase();
        if ( worksheetTitle.startsWith(monthShort) ) {
            worksheet = entry;
            break;
        }
    }

    // Fetch the cell feed of the worksheet.
    if ( worksheet == null )
        return null;
    else {
        // For particular reasons linked to this example we also fetch the empty cells of the sheet
        // remove + "?return-empty=true" if you do not need those.
        URL cellFeedUrl = new URI(worksheet.getCellFeedUrl().toString() + "?return-empty=true").toURL();
        CellFeed cellFeed = service.getFeed(cellFeedUrl, CellFeed.class);

        return cellFeed.getEntries();
    }
}
 
开发者ID:gregriggins36,项目名称:to-google-spreadsheet,代码行数:42,代码来源:MySpreadsheetIntegration.java

示例9: getCurrentWorkSheetEntry

import com.google.gdata.data.spreadsheet.WorksheetFeed; //导入方法依赖的package包/类
public static WorksheetEntry getCurrentWorkSheetEntry(TGSpreadConnection connection,
                                                      String sheetName) throws SQLException {
    SpreadsheetEntry spreadsheetEntry = connection.getSpreadSheetFeed().getEntries().get(0);
    WorksheetQuery worksheetQuery =
            TDriverUtil.createWorkSheetQuery(spreadsheetEntry.getWorksheetFeedUrl());
    WorksheetFeed worksheetFeed = connection.getFeedProcessor().getFeed(worksheetQuery,
                                                                        WorksheetFeed.class);
    for (WorksheetEntry entry : worksheetFeed.getEntries()) {
        if (sheetName.equals(entry.getTitle().getPlainText())) {
            return entry;
        }
    }
    return null;
}
 
开发者ID:wso2,项目名称:carbon-data,代码行数:15,代码来源:TDriverUtil.java

示例10: createRecordInSpreadsheet

import com.google.gdata.data.spreadsheet.WorksheetFeed; //导入方法依赖的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);
}
 
开发者ID:jsfrost,项目名称:StreetlightSeattleReporter,代码行数:73,代码来源:SubmitService.java

示例11: getWorksheets

import com.google.gdata.data.spreadsheet.WorksheetFeed; //导入方法依赖的package包/类
/**
 * Gets all worksheet entries that are part of this spreadsheet.
 * 
 * You must be online for this to work.
 * 
 * @return the list of worksheet entries
 */
public List<WorksheetEntry> getWorksheets()
    throws IOException, ServiceException {
  WorksheetFeed feed = state.service.getFeed(getWorksheetFeedUrl(),
      WorksheetFeed.class);
  return feed.getEntries();
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:14,代码来源:SpreadsheetEntry.java


注:本文中的com.google.gdata.data.spreadsheet.WorksheetFeed.getEntries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。