本文整理汇总了Java中com.google.gdata.data.docs.DocumentListFeed类的典型用法代码示例。如果您正苦于以下问题:Java DocumentListFeed类的具体用法?Java DocumentListFeed怎么用?Java DocumentListFeed使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DocumentListFeed类属于com.google.gdata.data.docs包,在下文中一共展示了DocumentListFeed类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: declareExtensions
import com.google.gdata.data.docs.DocumentListFeed; //导入依赖的package包/类
/**
* Declare the extensions of the feeds for the Google Documents List Data API.
*/
private void declareExtensions() {
new AclFeed().declareExtensions(extProfile);
new DocumentExportFeed().declareExtensions(extProfile);
new MetadataFeed().declareExtensions(extProfile);
new RevisionFeed().declareExtensions(extProfile);
/* Declarations for extensions that need to be handled as specific type
* should be done before call to {@see ExtensionProfile#setAutoExtending}.
* Order of declaration is important. */
extProfile.setAutoExtending(true);
new AudioEntry().declareExtensions(extProfile);
new DocumentEntry().declareExtensions(extProfile);
new DocumentListFeed().declareExtensions(extProfile);
new FolderEntry().declareExtensions(extProfile);
new PdfEntry().declareExtensions(extProfile);
new PresentationEntry().declareExtensions(extProfile);
new SpreadsheetEntry().declareExtensions(extProfile);
BatchUtils.declareExtensions(extProfile);
}
示例4: 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();
}
示例5: 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;
}
示例6: 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);
}
}
示例7: getDocsListFeed
import com.google.gdata.data.docs.DocumentListFeed; //导入依赖的package包/类
/**
* Gets a feed containing the documents.
*
* @param category what types of documents to list:
* "all": lists all the doc objects (documents, spreadsheets, presentations)
* "folders": lists all doc objects including folders.
* "documents": lists only documents.
* "spreadsheets": lists only spreadsheets.
* "pdfs": lists only pdfs.
* "presentations": lists only presentations.
* "starred": lists only starred objects.
* "trashed": lists trashed objects.
*
* @throws IOException
* @throws MalformedURLException
* @throws ServiceException
* @throws DocumentListException
*/
public DocumentListFeed getDocsListFeed(String category) throws IOException,
MalformedURLException, ServiceException, DocumentListException {
if (category == null) {
throw new DocumentListException("null category");
}
URL url;
if (category.equals("all")) {
url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED);
} else if (category.equals("folders")) {
String[] parameters = {PARAMETER_SHOW_FOLDERS};
url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + URL_CATEGORY_FOLDER, parameters);
} else if (category.equals("documents")) {
url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + URL_CATEGORY_DOCUMENT);
} else if (category.equals("spreadsheets")) {
url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + URL_CATEGORY_SPREADSHEET);
} else if (category.equals("pdfs")) {
url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + URL_CATEGORY_PDF);
} else if (category.equals("presentations")) {
url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + URL_CATEGORY_PRESENTATION);
} else if (category.equals("starred")) {
url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + URL_CATEGORY_STARRED);
} else if (category.equals("trashed")) {
url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + URL_CATEGORY_TRASHED);
} else {
return null;
}
return service.getFeed(url, DocumentListFeed.class);
}
示例8: 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);
}
}
示例9: 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);
// }
}
示例10: exportURL
import com.google.gdata.data.docs.DocumentListFeed; //导入依赖的package包/类
private String exportURL(String title) throws IOException, ServiceException, MalformedURLException {
DocumentQuery query = documentQuery(title);
List<DocumentListEntry> entries = service.getFeed(query, DocumentListFeed.class).getEntries();
if (entries.isEmpty()) {
throw new GoogleDocumentNotFound(title);
}
return ((MediaContent) entries.get(0).getContent()).getUri() + "&exportFormat=odt";
}
示例11: shouldGetResourceFromDocsService
import com.google.gdata.data.docs.DocumentListFeed; //导入依赖的package包/类
@Test
public void shouldGetResourceFromDocsService() throws IOException, ServiceException {
DocsService service = mock(DocsService.class);
DocumentListFeed feed = mock(DocumentListFeed.class);
DocumentListEntry entry = mock(DocumentListEntry.class);
MediaSource mediaSource = mock(MediaSource.class);
InputStream inputStream = mock(InputStream.class);
final MediaContent content = mock(MediaContent.class);
final DocumentQuery query = mock(DocumentQuery.class);
when(service.getFeed(query, DocumentListFeed.class)).thenReturn(feed);
when(service.getMedia(content)).thenReturn(mediaSource);
when(feed.getEntries()).thenReturn(asList(entry));
when(entry.getContent()).thenReturn(content);
when(content.getUri()).thenReturn("http://docs.google.com");
when(mediaSource.getInputStream()).thenReturn(inputStream);
LoadOdtFromGoogle storyLoader = new LoadOdtFromGoogle("user", "password", "https://docs.google.com/feeds/default/private/full/", service){
@Override
DocumentQuery documentQuery(String title) throws MalformedURLException {
return query;
}
@Override
protected MediaContent mediaContent(String url) {
return content;
}
};
InputStream resourceStream = storyLoader.resourceAsStream("a_story");
MatcherAssert.assertThat(resourceStream, Matchers.equalTo(inputStream));
}
示例12: 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;
}
示例13: getFolderDocsListFeed
import com.google.gdata.data.docs.DocumentListFeed; //导入依赖的package包/类
/**
* Gets the feed for all the objects contained in a folder.
*
* @param folderResourceId the resource id of the folder to return the feed
* for the contents.
*
* @throws IOException
* @throws MalformedURLException
* @throws ServiceException
* @throws DocumentListException
*/
public DocumentListFeed getFolderDocsListFeed(String folderResourceId) throws IOException,
MalformedURLException, ServiceException, DocumentListException {
if (folderResourceId == null) {
throw new DocumentListException("null folderResourceId");
}
URL url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + "/" + folderResourceId
+ URL_FOLDERS);
return service.getFeed(url, DocumentListFeed.class);
}
示例14: search
import com.google.gdata.data.docs.DocumentListFeed; //导入依赖的package包/类
/**
* Search the documents, and return a feed of docs that match.
*
* @param searchParameters parameters to be used in searching criteria.
* accepted parameters are:
* "q": Typical search query
* "alt":
* "author":
* "updated-min": Lower bound on the last time a document' content was changed.
* "updated-max": Upper bound on the last time a document' content was changed.
* "edited-min": Lower bound on the last time a document was edited by the
* current user. This value corresponds to the app:edited value in the
* Atom entry, which represents changes to the document's content or metadata.
* "edited-max": Upper bound on the last time a document was edited by the
* current user. This value corresponds to the app:edited value in the
* Atom entry, which represents changes to the document's content or metadata.
* "title": Specifies the search terms for the title of a document.
* This parameter used without title-exact will only submit partial queries, not exact
* queries.
* "title-exact": Specifies whether the title query should be taken as an exact string.
* Meaningless without title. Possible values are true and false.
* "opened-min": Bounds on the last time a document was opened by the current user.
* Use the RFC 3339 timestamp format. For example: 2005-08-09T10:57:00-08:00
* "opened-max": Bounds on the last time a document was opened by the current user.
* Use the RFC 3339 timestamp format. For example: 2005-08-09T10:57:00-08:00
* "owner": Searches for documents with a specific owner.
* Use the email address of the owner.
* "writer": Searches for documents which can be written to by specific users.
* Use a single email address or a comma separated list of email addresses.
* "reader": Searches for documents which can be read by specific users.
* Use a single email address or a comma separated list of email addresses.
* "showfolders": Specifies whether the query should return folders as well as documents.
* Possible values are true and false.
* @param category define the category to search. (documents, spreadsheets, presentations,
* starred, trashed, folders)
*
* @throws IOException
* @throws MalformedURLException
* @throws ServiceException
* @throws DocumentListException
*/
public DocumentListFeed search(Map<String, String> searchParameters, String category)
throws IOException, MalformedURLException, ServiceException, DocumentListException {
if (searchParameters == null) {
throw new DocumentListException("searchParameters null");
}
URL url;
if (category == null || category.equals("")) {
url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED);
} else if (category.equals("documents")) {
url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + URL_CATEGORY_DOCUMENT);
} else if (category.equals("spreadsheets")) {
url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + URL_CATEGORY_SPREADSHEET);
} else if (category.equals("presentations")) {
url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + URL_CATEGORY_PRESENTATION);
} else if (category.equals("starred")) {
url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + URL_CATEGORY_STARRED);
} else if (category.equals("trashed")) {
url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + URL_CATEGORY_TRASHED);
} else if (category.equals("folders")) {
url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + URL_CATEGORY_FOLDER);
} else {
throw new DocumentListException("invaild category");
}
Query qry = new Query(url);
for (String key : searchParameters.keySet()) {
qry.setStringCustomParameter(key, searchParameters.get(key));
}
return service.query(qry, DocumentListFeed.class);
}