本文整理汇总了Java中com.google.gdata.data.docs.DocumentListFeed.getEntries方法的典型用法代码示例。如果您正苦于以下问题:Java DocumentListFeed.getEntries方法的具体用法?Java DocumentListFeed.getEntries怎么用?Java DocumentListFeed.getEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gdata.data.docs.DocumentListFeed
的用法示例。
在下文中一共展示了DocumentListFeed.getEntries方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeSearch
import com.google.gdata.data.docs.DocumentListFeed; //导入方法依赖的package包/类
/**
* Execute the "search" command.
*
* @param args arguments for the "search" command.
* args[0] = "search"
* args[1] = searchString
*
* @throws IOException when an error occurs in communication with the Doclist
* service.
* @throws MalformedURLException when an malformed URL is used.
* @throws ServiceException when the request causes an error in the Doclist
* service.
* @throws DocumentListException
*/
private void executeSearch(String[] args) throws IOException,
ServiceException, DocumentListException {
if (args.length == 2) {
HashMap<String, String> searchParameters = new HashMap<String, String>();
searchParameters.put("q", args[1]);
DocumentListFeed feed = documentList.search(searchParameters);
out.println("Results for [" + args[1] + "]");
for (DocumentListEntry entry : feed.getEntries()) {
printDocumentEntry(entry);
}
} else {
printMessage(COMMAND_HELP_SEARCH);
}
}
示例2: executeAdvancedSearch
import com.google.gdata.data.docs.DocumentListFeed; //导入方法依赖的package包/类
/**
* Execute the "asearch" (advanced search) command.
*
* @param args arguments for the "asearch" command.
* args[0] = "asearch"
*
* @throws IOException when an error occurs in communication with the Doclist
* service.
* @throws MalformedURLException when an malformed URL is used.
* @throws ServiceException when the request causes an error in the Doclist
* service.
* @throws DocumentListException
*/
private void executeAdvancedSearch(String[] args) throws IOException,
ServiceException, DocumentListException {
if (args.length <= 1) {
printMessage(COMMAND_HELP_ASEARCH);
return;
}
HashMap<String, String> searchParameters = new HashMap<String, String>();
for (int i = 1; i < args.length; ++i) {
searchParameters.put(args[i].substring(0, args[i].indexOf("=")), args[i]
.substring(args[i].indexOf("=") + 1));
}
DocumentListFeed feed = documentList.search(searchParameters);
out.println("Results for advanced search:");
for (DocumentListEntry entry : feed.getEntries()) {
printDocumentEntry(entry);
}
}
示例3: getDocumentEntries
import com.google.gdata.data.docs.DocumentListFeed; //导入方法依赖的package包/类
/**
* Get a List of SpreadsheetEntry from one folder with exact title. (folder and title can be null).
* @param service
* @param title
* @param folder_id
* @return
* @throws MalformedURLException
* @throws IOException
* @throws ServiceException
*/
public List<DocumentListEntry> getDocumentEntries(DocsService service, String title, String folder_id) throws MalformedURLException, IOException, ServiceException
{
URL url = new URL("https://docs.google.com/feeds/default/private/full/" + (folder_id == null ? "" : "folder%3A" + folder_id + "/contents"));
DocumentQuery query = new DocumentQuery(url);
if(title != null)
{
query.setTitleQuery(title);
query.setTitleExact(true);
}
DocumentListFeed feed = service.getFeed(query, DocumentListFeed.class);
return feed.getEntries();
}
示例4: getSpreadsheet2
import com.google.gdata.data.docs.DocumentListFeed; //导入方法依赖的package包/类
/**
*
* @param docsService
* @param name
* @param parent
* @return
* @throws IOException
* @throws ServiceException
*/
public DocumentListEntry getSpreadsheet2(DocsService docsService, String name, String parent) throws IOException, ServiceException
{
DocumentListFeed feed = docsService.getFeed(new URL("https://docs.google.com/feeds/default/private/full/-/spreadsheet"),
DocumentListFeed.class);
boolean found = false;
DocumentListEntry result = null;
for(DocumentListEntry entry : feed.getEntries())
{
String folder_name = entry.getTitle().getPlainText();
if(folder_name.equals(name))
{
result = entry;
break;
}
}
return result;
}
示例5: executeList
import com.google.gdata.data.docs.DocumentListFeed; //导入方法依赖的package包/类
/**
* Execute the "list" command.
*
* @param args arguments for the "list" command.
* args[0] = "list"
* args[1] = category ("all", "folders", "documents", "spreadsheets", "pdfs",
* "presentations", "starred", "trashed")
* args[2] = folderId (required if args[1] is "folder")
*
* @throws IOException when an error occurs in communication with the Doclist
* service.
* @throws MalformedURLException when an malformed URL is used.
* @throws ServiceException when the request causes an error in the Doclist
* service.
* @throws DocumentListException
*/
private void executeList(String[] args) throws IOException,
ServiceException, DocumentListException {
DocumentListFeed feed = null;
String msg = "";
switch (args.length) {
case 1:
msg = "List of docs: ";
feed = documentList.getDocsListFeed("all");
break;
case 2:
msg = "List of all " + args[1] + ": ";
feed = documentList.getDocsListFeed(args[1]);
break;
case 3:
if (args[1].equals("folder")) {
msg = "Contents of folder_id '" + args[2] + "': ";
feed = documentList.getFolderDocsListFeed(args[2]);
}
break;
}
if (feed != null) {
out.println(msg);
for (DocumentListEntry entry : feed.getEntries()) {
printDocumentEntry(entry);
}
} else {
printMessage(COMMAND_HELP_LIST);
}
}
示例6: executeList
import com.google.gdata.data.docs.DocumentListFeed; //导入方法依赖的package包/类
/**
* Execute 'list' command.
*/
private void executeList(String[] args) throws IOException,
ServiceException, DocumentListException {
DocumentListFeed feed = null;
String msg = "";
switch (args.length) {
case 1:
msg = "List of docs: ";
feed = docs.getDocsListFeed("all");
break;
case 2:
msg = "List of all " + args[1] + ": ";
feed = docs.getDocsListFeed(args[1]);
break;
case 3:
if (args[1].equals("folder")) {
msg = "Contents of folder_id '" + args[2] + "': ";
feed = docs.getFolderDocsListFeed(args[2]);
}
break;
}
if (feed != null) {
output.println(msg);
for (DocumentListEntry entry : feed.getEntries()) {
printDocumentEntry(entry);
}
} else {
printMessage(COMMAND_HELP_MESSAGE);
}
}
示例7: listFolders
import com.google.gdata.data.docs.DocumentListFeed; //导入方法依赖的package包/类
/**
*
* @param docsService
* @throws MalformedURLException
* @throws IOException
* @throws ServiceException
*/
public void listFolders(DocsService docsService) throws MalformedURLException, IOException, ServiceException
{
// Instantiate a DocumentsListQuery object to retrieve documents.
// DocumentQuery query = new DocumentQuery(new URL("https://spreadsheets.google.com/feeds/spreadsheets/private/full"));
//
// Category category = new Category("http://schemas.google.com/docs/2007#folder");
// CategoryFilter category_filter = new CategoryFilter();
// category_filter.addCategory(category);
// query.getCategoryFilters().add(category_filter);
DocumentListFeed feed = docsService.getFeed(new URL("https://docs.google.com/feeds/default/private/full/-/folder"),
DocumentListFeed.class);
//See in com.google.gdata.data.docs (it must wear something like that @com.google.gdata.data.Kind.Term(value = "http://schemas.google.com/docs/2007#folder"))
//FolderEntry feed = docsService.getFeed(query, FolderEntry.class);
for(DocumentListEntry entry : feed.getEntries())
{
List<Link> lst = entry.getParentLinks();
System.out.println(entry.getTitle().getPlainText());
}
// // Set the trashed category
// query.Trashed = true;
//
// // Make a request to the API and get all documents.
// DocumentsFeed feed = service.Query(query);
//
// // Iterate through all of the documents returned
// foreach (DocumentEntry entry in feed.Entries)
// {
// // Print the title of this document to the screen
// Console.WriteLine(entry.Title.Text);
// }
}
示例8: getFolder
import com.google.gdata.data.docs.DocumentListFeed; //导入方法依赖的package包/类
/**
*
* @param docsService
* @param name
* @param parent
* @return
* @throws IOException
* @throws ServiceException
*/
public DocumentListEntry getFolder(DocsService docsService, String name, String parent) throws IOException, ServiceException
{
DocumentListFeed feed = docsService.getFeed(new URL("https://docs.google.com/feeds/default/private/full/-/folder"),
DocumentListFeed.class);
boolean found = false;
DocumentListEntry result = null;
for(DocumentListEntry entry : feed.getEntries())
{
String folder_name = entry.getTitle().getPlainText();
if(folder_name.equals(name))
{
if(entry.getParentLinks().size() == 0)
{
if(parent != null && !parent.equals(""))
{
found = false;
}
else
{
result = entry;
found = true;
}
}
else
{
if(parent != null && !parent.equals(""))
{
for(Link link : entry.getParentLinks())
{
String link_title = link.getTitle();
if(link_title.equals(parent))
{
found = true;
result = entry;
break;
}
}
}
else
{
result = entry;
found = true;
}
}
}
}
return result;
}