當前位置: 首頁>>代碼示例>>Java>>正文


Java BaseContentEntry.setContent方法代碼示例

本文整理匯總了Java中com.google.gdata.data.sites.BaseContentEntry.setContent方法的典型用法代碼示例。如果您正苦於以下問題:Java BaseContentEntry.setContent方法的具體用法?Java BaseContentEntry.setContent怎麽用?Java BaseContentEntry.setContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gdata.data.sites.BaseContentEntry的用法示例。


在下文中一共展示了BaseContentEntry.setContent方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setContent

import com.google.gdata.data.sites.BaseContentEntry; //導入方法依賴的package包/類
/**
 * Sets the content of the given entry to the given String.
 */
public static void setContent(BaseContentEntry<?> entry, String content) {
  XmlBlob blob = new XmlBlob();
  blob.setBlob(content);
  TextConstruct textConstruct = new XhtmlTextConstruct(blob);
  entry.setContent(textConstruct);
}
 
開發者ID:sih4sing5hong5,項目名稱:google-sites-liberation,代碼行數:10,代碼來源:EntryUtils.java

示例2: setContentBlob

import com.google.gdata.data.sites.BaseContentEntry; //導入方法依賴的package包/類
private void setContentBlob(BaseContentEntry<?> entry) {
  XmlBlob xml = new XmlBlob();
  xml.setBlob(String.format(
      "content for %s", entry.getCategories().iterator().next().getLabel()));
  entry.setContent(new XhtmlTextConstruct(xml));
}
 
開發者ID:google,項目名稱:gdata-java-client,代碼行數:7,代碼來源:SitesHelper.java

示例3: importPage

import com.google.gdata.data.sites.BaseContentEntry; //導入方法依賴的package包/類
@Override
public BasePageEntry<?> importPage(File directory, boolean importRevisions, 
    List<BasePageEntry<?>> ancestors, URL feedUrl, URL siteUrl, 
    SitesService sitesService) {
  checkNotNull(directory);
  File file = new File(directory, "index.html");
  if (!file.isFile()) {
    LOGGER.log(Level.WARNING, "No valid file in directory: " + directory);
    return null;
  }
  List<BaseContentEntry<?>> entries = pageParser.parsePage(file);
  BasePageEntry<?> page = getFirstPageEntry(entries);
  if (page == null) {
    LOGGER.log(Level.WARNING, "No valid page entry!");
    return null;
  }
  
  page.setPageName(new PageName(directory.getName()));
  linkConverter.convertLinks(page, ancestors, siteUrl, false);
  if (!ancestors.isEmpty()) {
    EntryUtils.setParent(page, ancestors.get(ancestors.size() - 1));
  }
  BasePageEntry<?> returnedEntry = null;
  if (importRevisions && new File(directory, "_revisions").isDirectory()) {
    returnedEntry = revisionsImporter.importRevisions(
        directory, ancestors, feedUrl, siteUrl, sitesService);
  }
  if (returnedEntry == null) {
    returnedEntry = (BasePageEntry<?>) entryUploader.uploadEntry(
        page, ancestors, feedUrl, sitesService);
  } else {
    returnedEntry = (BasePageEntry<?>) entryUpdater.updateEntry(
        returnedEntry, page, sitesService);
  }
  
  List<BasePageEntry<?>> newAncestors = Lists.newLinkedList(ancestors);
  newAncestors.add(returnedEntry);
  for (BaseContentEntry<?> child : getNonPageEntries(entries)) {
    if (getType(child) == ATTACHMENT) {
      if (child.getContent() != null) {
        String src = ((OutOfLineContent) child.getContent()).getUri();
        File attachmentFile = new File(directory, src);
        MediaSource mediaSource = new MediaFileSource(attachmentFile, 
            "application/octet-stream");
        child.setContent((Content) null);
        child.setMediaSource(mediaSource);
      } else {
        System.out.println(child.getTitle().getPlainText());
      }
    }
    EntryUtils.setParent(child, returnedEntry);
    entryUploader.uploadEntry(child, newAncestors, feedUrl, sitesService);
  }
  return returnedEntry;
}
 
開發者ID:sih4sing5hong5,項目名稱:google-sites-liberation,代碼行數:56,代碼來源:PageImporterImpl.java

示例4: parseElement

import com.google.gdata.data.sites.BaseContentEntry; //導入方法依賴的package包/類
/**
 * Parses the given element, populating the given entry with its data.
 */
private void parseElement(Element element, BaseContentEntry<?> entry) {
  NodeList nodeList = element.getChildNodes();
  for (int i = 0; i < nodeList.getLength(); i++) {
    Node node = nodeList.item(i);
    if (node.getNodeType() == Node.ELEMENT_NODE) {
      Element child = (Element) node;
      if (!hasClass(child, "hentry") && !child.getTagName().equals("q")
          && !child.getTagName().equals("blockquote")) {
        boolean parseDeeper = true;
        if (hasClass(child, "entry-title")) {
          entry.setTitle(titleParser.parseTitle(child));
          parseDeeper = false;
        } 
        if (hasClass(child, "entry-content")) {
          entry.setContent(contentParser.parseContent(child));
          parseDeeper = false;
        } 
        if (hasClass(child, "updated")) {
          entry.setUpdated(updatedParser.parseUpdated(child));
          parseDeeper = false;
        } 
        if (hasClass(child, "vcard")) {
          entry.getAuthors().add(authorParser.parseAuthor(child));
          parseDeeper = false;
        } 
        if (hasClass(child, "entry-summary")) {
          entry.setSummary(summaryParser.parseSummary(child));
          parseDeeper = false;
        } 
        if (hasClass(child, "gs:data")) {
          if (getType(entry) == LIST_PAGE) {
            // TODO(gk5885): remove extra cast for
            // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214
            ((ListPageEntry) (BaseContentEntry) entry).setData(dataParser.parseData(child));
          }
          parseDeeper = false;
        } 
        if (hasClass(child, "gs:field")) {
          if (getType(entry) == LIST_ITEM) {
            // TODO(gk5885): remove extra cast for
            // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214
            ((ListItemEntry) (BaseContentEntry) entry).addField(fieldParser.parseField(child));
          }
          parseDeeper = false;
        }
        if (parseDeeper) {
          parseElement(child, entry);
        }
      }
    }
  }
}
 
開發者ID:sih4sing5hong5,項目名稱:google-sites-liberation,代碼行數:56,代碼來源:EntryParserImpl.java


注:本文中的com.google.gdata.data.sites.BaseContentEntry.setContent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。