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


Java Link类代码示例

本文整理汇总了Java中com.google.gdata.data.Link的典型用法代码示例。如果您正苦于以下问题:Java Link类的具体用法?Java Link怎么用?Java Link使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: updateWorksheetWithAllItems

import com.google.gdata.data.Link; //导入依赖的package包/类
private void updateWorksheetWithAllItems(WorksheetEntry worksheet, String[] header, List<ReportItem> reportItems, int numberOfRows, int numberOfColumns, String reportSpreadsheetName)
        throws BatchInterruptedException, MalformedURLException, IOException, ServiceException
{
    URL cellFeedUrl = worksheet.getCellFeedUrl();
    CellFeed cellFeed = spreadsheetService.getFeed(cellFeedUrl, CellFeed.class);

    Map<String, CellEntry> cellEntries = prepareBatchByQueringWorksheet(cellFeedUrl, numberOfRows, numberOfColumns);

    int startingRow = 1;
    int rowsInBatch = ((Double) Math.ceil((double)numberOfRows / Properties.googleSheetsBatchUploadSizeSplitFactor.get())).intValue();
    int endingRow = rowsInBatch;
    for (int i = 0; i < Properties.googleSheetsBatchUploadSizeSplitFactor.get(); i++) {
        CellFeed batchRequest = createBatchRequest(header, reportItems, startingRow, endingRow, numberOfColumns, cellEntries);
        Link batchLink = cellFeed.getLink(Link.Rel.FEED_BATCH, Link.Type.ATOM);
        CellFeed batchResponse = spreadsheetService.batch(new URL(batchLink.getHref()), batchRequest);
        boolean isSuccess = checkResults(batchResponse);
        logger.info((isSuccess ? "Batch operations successful: " : "Batch operations failed: ") + reportSpreadsheetName + " " + worksheet.getTitle().getPlainText() + " starting row: " + startingRow +", through row: " + endingRow);
        startingRow = startingRow + rowsInBatch;
        endingRow = Math.min(numberOfRows, endingRow + rowsInBatch);
    }
}
 
开发者ID:Netflix,项目名称:q,代码行数:22,代码来源:GoogleSheetsService.java

示例2: prepareBatchByQueringWorksheet

import com.google.gdata.data.Link; //导入依赖的package包/类
private Map<String, CellEntry> prepareBatchByQueringWorksheet(URL cellFeedUrl, int numberOfRows, int numberOfColumns) throws IOException, ServiceException
{
    CellFeed batchRequest = new CellFeed();
    for (int rowIndex = 1; rowIndex <= numberOfRows; rowIndex++) {
        for (int columnIndex = 1; columnIndex <= numberOfColumns; columnIndex++) {
            String id = getR1C1Id(rowIndex, columnIndex);
            CellEntry batchEntry = new CellEntry(rowIndex, columnIndex, id);
            batchEntry.setId(String.format("%s/%s", cellFeedUrl.toString(), id));
            BatchUtils.setBatchId(batchEntry, id);
            BatchUtils.setBatchOperationType(batchEntry, BatchOperationType.QUERY);
            batchRequest.getEntries().add(batchEntry);
        }
    }

    CellFeed cellFeed = spreadsheetService.getFeed(cellFeedUrl, CellFeed.class);
    CellFeed queryBatchResponse = spreadsheetService.batch(new URL(cellFeed.getLink(Link.Rel.FEED_BATCH, Link.Type.ATOM).getHref()), batchRequest);

    Map<String, CellEntry> cellEntryMap = new HashMap<String, CellEntry>(numberOfColumns);
    for (CellEntry entry : queryBatchResponse.getEntries()) {
        cellEntryMap.put(BatchUtils.getBatchId(entry), entry);
    }
    return cellEntryMap;
}
 
开发者ID:Netflix,项目名称:q,代码行数:24,代码来源:GoogleSheetsService.java

示例3: retrieveAllUsers

import com.google.gdata.data.Link; //导入依赖的package包/类
/**
 * Retrieves all users in domain.  This method may be very slow for domains
 * with a large number of users.  Any changes to users, including creations
 * and deletions, which are made after this method is called may or may not be
 * included in the Feed which is returned.
 *
 * @return A UserFeed object of the retrieved users.
 * @throws AppsForYourDomainException If a Provisioning API specific occurs.
 * @throws ServiceException If a generic GData framework error occurs.
 * @throws IOException If an error occurs communicating with the GData
 * service.
 */
public UserFeed retrieveAllUsers()
    throws AppsForYourDomainException, ServiceException, IOException {

  LOGGER.log(Level.INFO,
      "Retrieving all users.");

  URL retrieveUrl = new URL(domainUrlBase + "user/" + SERVICE_VERSION + "/");
  UserFeed allUsers = new UserFeed();
  UserFeed currentPage;
  Link nextLink;

  do {
    currentPage = userService.getFeed(retrieveUrl, UserFeed.class);
    allUsers.getEntries().addAll(currentPage.getEntries());
    nextLink = currentPage.getLink(Link.Rel.NEXT, Link.Type.ATOM);
    if (nextLink != null) {
      retrieveUrl = new URL(nextLink.getHref());
    }
  } while (nextLink != null);

  return allUsers;
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:35,代码来源:AppsForYourDomainClient.java

示例4: retrieveAllNicknames

import com.google.gdata.data.Link; //导入依赖的package包/类
/**
 * Retrieves all nicknames in domain.  This method may be very slow for
 * domains with a large number of nicknames.  Any changes to nicknames,
 * including creations and deletions, which are made after this method is
 * called may or may not be included in the Feed which is returned.
 *
 * @return A NicknameFeed object of the retrieved nicknames.
 * @throws AppsForYourDomainException If a Provisioning API specific occurs.
 * @throws ServiceException If a generic GData framework error occurs.
 * @throws IOException If an error occurs communicating with the GData
 * service.
 */
public NicknameFeed retrieveAllNicknames()
    throws AppsForYourDomainException, ServiceException, IOException {

  LOGGER.log(Level.INFO,
      "Retrieving all nicknames.");

  URL retrieveUrl = new URL(domainUrlBase + "nickname/"
      + SERVICE_VERSION + "/");
  NicknameFeed allNicknames = new NicknameFeed();
  NicknameFeed currentPage;
  Link nextLink;

  do {
    currentPage = nicknameService.getFeed(retrieveUrl, NicknameFeed.class);
    allNicknames.getEntries().addAll(currentPage.getEntries());
    nextLink = currentPage.getLink(Link.Rel.NEXT, Link.Type.ATOM);
    if (nextLink != null) {
      retrieveUrl = new URL(nextLink.getHref());
    }
  } while (nextLink != null);

  return allNicknames;
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:36,代码来源:AppsForYourDomainClient.java

示例5: retrieveAllEmailLists

import com.google.gdata.data.Link; //导入依赖的package包/类
/**
 * Retrieves all email lists in domain. This method may be very slow for
 * domains with a large number of email lists. Any changes to email lists,
 * including creations and deletions, which are made after this method is
 * called may or may not be included in the Feed which is returned.
 *
 * @return A EmailListFeed object of the retrieved email lists.
 * @throws AppsForYourDomainException If a Provisioning API specific occurs.
 * @throws ServiceException If a generic GData framework error occurs.
 * @throws IOException If an error occurs communicating with the GData
 *         service.
 * @deprecated Email lists have been replaced by Groups. Use
 *             {@link AppsGroupsService#retrieveAllGroups()}
 *             with Groups instead.
 */
@Deprecated
public EmailListFeed retrieveAllEmailLists()
    throws AppsForYourDomainException, ServiceException, IOException {

  LOGGER.log(Level.INFO,
      "Retrieving all email lists.");

  URL retrieveUrl = new URL(domainUrlBase + "emailList/"
      + SERVICE_VERSION + "/");
  EmailListFeed allEmailLists = new EmailListFeed();
  EmailListFeed currentPage;
  Link nextLink;

  do {
    currentPage = emailListService.getFeed(retrieveUrl, EmailListFeed.class);
    allEmailLists.getEntries().addAll(currentPage.getEntries());
    nextLink = currentPage.getLink(Link.Rel.NEXT, Link.Type.ATOM);
    if (nextLink != null) {
      retrieveUrl = new URL(nextLink.getHref());
    }
  } while (nextLink != null);

  return allEmailLists;
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:40,代码来源:AppsForYourDomainClient.java

示例6: retrieveAllRecipients

import com.google.gdata.data.Link; //导入依赖的package包/类
/**
 * Retrieves all recipients in an email list. This method may be very slow for
 * email lists with a large number of recipients. Any changes to the email
 * list contents, including adding or deleting recipients which are made after
 * this method is called may or may not be included in the Feed which is
 * returned.
 * 
 * @return An EmailListRecipientFeed object of the retrieved recipients.
 * @throws AppsForYourDomainException If a Provisioning API specific occurs.
 * @throws ServiceException If a generic GData framework error occurs.
 * @throws IOException If an error occurs communicating with the GData
 *         service.
 * @deprecated Email lists have been replaced by Groups. Use
 *             {@link AppsGroupsService#retrieveAllMembers(String)}
 *             with Groups instead.
 */
@Deprecated
public EmailListRecipientFeed retrieveAllRecipients(String emailList)
    throws AppsForYourDomainException, ServiceException, IOException {

  LOGGER.log(Level.INFO,
      "Retrieving all recipients in emailList '" + emailList + "'.");

  URL retrieveUrl = new URL(domainUrlBase + "emailList/"
      + SERVICE_VERSION + "/" + emailList + "/recipient/");

  EmailListRecipientFeed allRecipients = new EmailListRecipientFeed();
  EmailListRecipientFeed currentPage;
  Link nextLink;

  do {
    currentPage = emailListRecipientService.getFeed(retrieveUrl, EmailListRecipientFeed.class);
    allRecipients.getEntries().addAll(currentPage.getEntries());
    nextLink = currentPage.getLink(Link.Rel.NEXT, Link.Type.ATOM);
    if (nextLink != null) {
      retrieveUrl = new URL(nextLink.getHref());
    }
  } while (nextLink != null);

  return allRecipients;
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:42,代码来源:AppsForYourDomainClient.java

示例7: getComments

import com.google.gdata.data.Link; //导入依赖的package包/类
/**
 * Retrieves the comments for the given photo.
 */
public List<CommentEntry> getComments(PhotoEntry photo) throws IOException,
        ServiceException {

    String feedHref = getLinkByRel(photo.getLinks(), Link.Rel.FEED);
    AlbumFeed albumFeed = getFeed(feedHref, AlbumFeed.class);

    List<GphotoEntry> entries = albumFeed.getEntries();
    List<CommentEntry> comments = new ArrayList<CommentEntry>();
    for (GphotoEntry entry : entries) {
        GphotoEntry adapted = entry.getAdaptedEntry();
        if (adapted instanceof CommentEntry) {
            comments.add((CommentEntry) adapted);
        }
    }
    return comments;
}
 
开发者ID:Webreaper,项目名称:GooglePhotoSync,代码行数:20,代码来源:PicasawebClient.java

示例8: getComments

import com.google.gdata.data.Link; //导入依赖的package包/类
/**
 * Retrieves the comments for the given photo.
 */
public List<CommentEntry> getComments(PhotoEntry photo) throws IOException,
    ServiceException {

  String feedHref = getLinkByRel(photo.getLinks(), Link.Rel.FEED);
  AlbumFeed albumFeed = getFeed(feedHref, AlbumFeed.class);

  List<GphotoEntry> entries = albumFeed.getEntries();
  List<CommentEntry> comments = new ArrayList<CommentEntry>();
  for (GphotoEntry entry : entries) {
    GphotoEntry adapted = entry.getAdaptedEntry();
    if (adapted instanceof CommentEntry) {
      comments.add((CommentEntry) adapted);
    }
  }
  return comments;
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:20,代码来源:PicasawebClient.java

示例9: getTags

import com.google.gdata.data.Link; //导入依赖的package包/类
/**
 * Retrieves the tags for the given taggable entry.  This is valid on user,
 * album, and photo entries only.
 */
public List<TagEntry> getTags(GphotoEntry<?> parent) throws IOException,
    ServiceException {

  String feedHref = getLinkByRel(parent.getLinks(), Link.Rel.FEED);
  feedHref = addKindParameter(feedHref, "tag");
  AlbumFeed albumFeed = getFeed(feedHref, AlbumFeed.class);

  List<GphotoEntry> entries = albumFeed.getEntries();
  List<TagEntry> tags = new ArrayList<TagEntry>();
  for (GphotoEntry entry : entries) {
    GphotoEntry adapted = entry.getAdaptedEntry();
    if (adapted instanceof TagEntry) {
      tags.add((TagEntry) adapted);
    }
  }
  return tags;
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:22,代码来源:PicasawebClient.java

示例10: printBasicEntryDetails

import com.google.gdata.data.Link; //导入依赖的package包/类
/**
 * Prints detailed information regarding a Generic Entry
 *
 * @param entry The entry of interest
 **/
private static void printBasicEntryDetails(BaseEntry entry){
  System.out.println("\tTitle: " + entry.getTitle().getPlainText());
  System.out.println("\tAtom ID: " + entry.getId());
  System.out.println("\tLast updated: " + entry.getUpdated());
  System.out.println("\tEntry Categories:");
  Iterator it = entry.getCategories().iterator();
  while (it.hasNext()) {
    System.out.println("\t\t" + it.next().toString());
  }
  System.out.println("\tLinks:");
  if (entry.getLinks().size() == 0) {
    System.out.println("\t\t<No links, sorry!>");
  }
  for (int i = 0; i < entry.getLinks().size(); i++) {
    System.out.println("\t\t" + ((Link) (entry.getLinks().get(i))).getHref());
  }
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:23,代码来源:FinancePortfoliosClient.java

示例11: uploadWebAttachment

import com.google.gdata.data.Link; //导入依赖的package包/类
/**
 * Creates a web attachment under the selected file cabinet.
 *
 * @param contentUrl The full URL of the hosted file.
 * @param filecabinet File cabinet to create the web attachment on.
 * @param title A title for the attachment.
 * @param description A description for the attachment.
 * @return The created web attachment.
 * @throws ServiceException
 * @throws IOException
 * @throws MalformedURLException
 */
public WebAttachmentEntry uploadWebAttachment(String contentUrl,
    FileCabinetPageEntry filecabinet, String title, String description)
    throws MalformedURLException, IOException, ServiceException {
  MediaContent content = new MediaContent();
  content.setUri(contentUrl);

  WebAttachmentEntry webAttachment = new WebAttachmentEntry();
  webAttachment.setTitle(new PlainTextConstruct(title));
  webAttachment.setSummary(new PlainTextConstruct(description));
  webAttachment.setContent(content);
  webAttachment.addLink(SitesLink.Rel.PARENT, Link.Type.ATOM,
      filecabinet.getSelfLink().getHref());

  return service.insert(new URL(getContentFeedUrl()), webAttachment);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:28,代码来源:SitesHelper.java

示例12: setWebContent

import com.google.gdata.data.Link; //导入依赖的package包/类
/**
 * Set the web content for this entry
 */
public void setWebContent(WebContent wc) {
  Link oldWebContentLink = getWebContentLink();
  if (wc == null) {
    // option 1: remove old Link
    if (oldWebContentLink != null) {
      getLinks().remove(oldWebContentLink);
    }
  } else if (oldWebContentLink == null) {
    // option 2: add new Link
    getLinks().add(wc.getLink());
  } else if (oldWebContentLink != wc.getLink()) {
    // option 3: replace old Link
    getLinks().remove(oldWebContentLink);
    getLinks().add(wc.getLink());
  }
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:20,代码来源:CalendarEventEntry.java

示例13: getTags

import com.google.gdata.data.Link; //导入依赖的package包/类
/**
 * Retrieves the tags for the given taggable entry.  This is valid on user,
 * album, and photo entries only.
 */
public List<TagEntry> getTags(GphotoEntry<?> parent) throws IOException,
        ServiceException {

    String feedHref = getLinkByRel(parent.getLinks(), Link.Rel.FEED);
    feedHref = addKindParameter(feedHref, "tag");
    AlbumFeed albumFeed = getFeed(feedHref, AlbumFeed.class);

    List<GphotoEntry> entries = albumFeed.getEntries();
    List<TagEntry> tags = new ArrayList<TagEntry>();
    for (GphotoEntry entry : entries) {
        GphotoEntry adapted = entry.getAdaptedEntry();
        if (adapted instanceof TagEntry) {
            tags.add((TagEntry) adapted);
        }
    }
    return tags;
}
 
开发者ID:Dotosoft,项目名称:dotoquiz-tools,代码行数:22,代码来源:PicasawebClient.java

示例14: printContact

import com.google.gdata.data.Link; //导入依赖的package包/类
/**
 * Print the contents of a ContactEntry to System.err.
 *
 * @param contact The ContactEntry to display.
 */
private static void printContact(ContactEntry contact) {
  System.err.println("Id: " + contact.getId()); 
  if (contact.getTitle() != null) {
    System.err.println("Contact name: " + contact.getTitle().getPlainText());
  } else {
    System.err.println("Contact has no name");
    
  }
  System.err.println("Last updated: " + contact.getUpdated().toUiString());
  if (contact.hasDeleted()) {
    System.err.println("Deleted:");
  }

  ElementHelper.printContact(System.err, contact);
  
  Link photoLink = contact.getLink(
      "http://schemas.google.com/contacts/2008/rel#photo", "image/*");
  System.err.println("Photo link: " + photoLink.getHref());
  String photoEtag = photoLink.getEtag();
  System.err.println("  Photo ETag: "
      + (photoEtag != null ? photoEtag : "(No contact photo uploaded)"));
  System.err.println("Self link: " + contact.getSelfLink().getHref());
  System.err.println("Edit link: " + contact.getEditLink().getHref());
  System.err.println("ETag: " + contact.getEtag());
  System.err.println("-------------------------------------------\n");
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:32,代码来源:ContactsExample.java

示例15: printDocumentEntry

import com.google.gdata.data.Link; //导入依赖的package包/类
/**
 * Prints out the specified document entry.
 *
 * @param doc the document entry to print.
 */
public void printDocumentEntry(DocumentListEntry doc) {
  StringBuffer output = new StringBuffer();

  output.append(" -- " + doc.getTitle().getPlainText() + " ");
  if (!doc.getParentLinks().isEmpty()) {
    for (Link link : doc.getParentLinks()) {
      output.append("[" + link.getTitle() + "] ");
    }
  }
  output.append(doc.getResourceId());

  out.println(output);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:19,代码来源:DocumentListDemo.java


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