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


Java OtherContent類代碼示例

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


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

示例1: createPhoto

import com.google.gdata.data.OtherContent; //導入依賴的package包/類
private void createPhoto(AlbumEntry albumEntry) throws Exception {
  PhotoEntry photo = new PhotoEntry();

  String title = getString("Title");
  photo.setTitle(new PlainTextConstruct(title));
  String description = getString("Description");
  photo.setDescription(new PlainTextConstruct(description));
  photo.setTimestamp(new Date());

  OtherContent content = new OtherContent();


  File file = null;
  while (file == null || !file.canRead()) {
    file = new File(getString("Photo location"));
  }
  content.setBytes(getBytes(file));
  content.setMimeType(new ContentType("image/jpeg"));
  photo.setContent(content);

  insert(albumEntry, photo);
}
 
開發者ID:google,項目名稱:gdata-java-client,代碼行數:23,代碼來源:PicasawebCommandLine.java

示例2: fillBean

import com.google.gdata.data.OtherContent; //導入依賴的package包/類
/**
 * Sets properties on the JavaBean by extracting them from a GData
 * {@code OtherContent} description of the payload
 * @param content a GData {@code  OtherContent} representation of the payload
 * @param bean a JavaBean to set the properties on
 * @param id optional id of entity
 */
public void fillBean(OtherContent content, Object bean, String id)
    throws SAXException, IOException, ParserConfigurationException,
        IllegalArgumentException, IntrospectionException,
        IllegalAccessException, InvocationTargetException, ParseException {
  String xmlText = getXmlFromContent(content);
  xmlText = fixEscaping(xmlText);
  Map<String, Object> properties = xmlUtil.convertXmlToProperties(xmlText);
  if (properties == null) {
    properties = new HashMap<String, Object>();
  }
  if (id != null) {
    properties.put(ID, id);
    properties.put(NAME, id);
  }
  beanUtil.convertPropertiesToBean(properties, bean);
}
 
開發者ID:jyang,項目名稱:google-feedserver,代碼行數:24,代碼來源:ContentUtil.java

示例3: Recipe

import com.google.gdata.data.OtherContent; //導入依賴的package包/類
/**
 * Creates a recipe out of a GoogleBaseEntry.
 * 
 * @param entry an entry that represents a recipe
 */
public Recipe(GoogleBaseEntry entry) {
  id = extractIdFromUrl(entry.getId());
  title = entry.getTitle().getPlainText();
  url = entry.getHtmlLink().getHref();
  String description = null;
  if (entry.getContent() != null) {
    Content content = entry.getContent();
    if (content instanceof TextContent) {
      description = ((TextContent)content).getContent().getPlainText();
    } else if (content instanceof OtherContent) {
      description = ((OtherContent)content).getText();
    }
  }
  this.description = description;
  mainIngredient = new HashSet<String>(entry.getGoogleBaseAttributes().
      getTextAttributeValues(MAIN_INGREDIENT_ATTRIBUTE));
  cuisine = new HashSet<String>(entry.getGoogleBaseAttributes().
      getTextAttributeValues(CUISINE_ATTRIBUTE));
  cookingTime = entry.getGoogleBaseAttributes().
      getIntUnitAttribute(COOKING_TIME_ATTRIBUTE);
  postedOn = entry.getPublished();

  // if an entry has no author specified, will set it to empty string
  List<Person> authors = entry.getAuthors();
  postedBy = (authors.isEmpty() ? AUTHOR_UNKNOWN : authors.get(0).getName());
}
 
開發者ID:google,項目名稱:gdata-java-client,代碼行數:32,代碼來源:Recipe.java

示例4: getKml

import com.google.gdata.data.OtherContent; //導入依賴的package包/類
/**
 * @return the content of the feature in KML format as an XmlBlob.
 */
public XmlBlob getKml() {
  Content content = getContent();
  if (null == content || !(content instanceof OtherContent)) {
    return null;
  }
  return ((OtherContent) getContent()).getXml();
}
 
開發者ID:google,項目名稱:gdata-java-client,代碼行數:11,代碼來源:FeatureEntry.java

示例5: getEntryFromMap

import com.google.gdata.data.OtherContent; //導入依賴的package包/類
/**
 * Returns a gdata entry object populated with contents generated from a
 * "typeless" map.
 * 
 * @param entryMap the "typeless" map to convert.
 * @return a populated gdata entry object.
 */
private FeedServerEntry getEntryFromMap(Map<String, Object> entryMap) {
  // XMLutil expects entries in map form of string -> object. For repeatable
  // elements
  // the object is really an "object[]" but for single elements its a
  // "String".
  // This loop prepares this very hacky map representation from the passed in
  // more sane
  // typed implementation.
  OtherContent content = contentUtil.createXmlContent(xmlUtil.convertPropertiesToXml(entryMap));
  FeedServerEntry entry = new FeedServerEntry(content);
  return entry;
}
 
開發者ID:jyang,項目名稱:google-feedserver,代碼行數:20,代碼來源:TypelessFeedServerClient.java

示例6: createXmlContent

import com.google.gdata.data.OtherContent; //導入依賴的package包/類
/**
 * Converts XML text to a GData {@code  OtherContent} description of the
 * payload
 * @param xmlSource XML source of the payload
 * @return A GData {@code OtherContent} representation of the payload
 */
public OtherContent createXmlContent(String xmlSource) {
  OtherContent xmlContent = new OtherContent();
  XmlBlob xmlBlob = new XmlBlob();
  xmlBlob.setBlob(xmlSource);
  xmlContent.setXml(xmlBlob);
  xmlContent.setMimeType(APPLICATION_XML);
  return xmlContent;
}
 
開發者ID:jyang,項目名稱:google-feedserver,代碼行數:15,代碼來源:ContentUtil.java

示例7: FeedServerClientTestUtil

import com.google.gdata.data.OtherContent; //導入依賴的package包/類
/**
 * Populates bean with static info to match XML. The XML and the bean should
 * be interchangable using utilities provided by FeedServerClient.
 */
public FeedServerClientTestUtil() {
  // Setup sample bean.
  sampleVehicleBean = new VehicleBean();
  sampleVehicleBean.setName(NAME);
  sampleVehicleBean.setOwner(OWNER);
  sampleVehicleBean.setPrice(PRICE);
  sampleVehicleBean.setPropertyName(PROPERTY_NAMES);
  sampleVehicleBean.setPropertyValue(PROPERTY_VALUES);

  // Setup sample map.
  sampleVehicleMap = new HashMap<String, Object>();
  sampleVehicleMap.put("name", NAME);
  sampleVehicleMap.put("owner", OWNER);
  sampleVehicleMap.put("price", PRICE);
  sampleVehicleMap.put("propertyName", PROPERTY_NAMES);
  sampleVehicleMap.put("propertyValue", PROPERTY_VALUES);

  // Create populated gdata entry.
  XmlBlob xmlBlob = new XmlBlob();
  xmlBlob.setBlob(ENTRY_XML);
  OtherContent xmlContent = new OtherContent();
  xmlContent.setXml(xmlBlob);
  xmlContent.setXml(xmlBlob);
  xmlContent.setMimeType(ContentUtil.APPLICATION_XML);
  vehicleEntry = new FeedServerEntry();
  vehicleEntry.setXmlBlob(xmlBlob);
  vehicleEntry.setContent(xmlContent);
}
 
開發者ID:jyang,項目名稱:google-feedserver,代碼行數:33,代碼來源:FeedServerClientTestUtil.java

示例8: setKml

import com.google.gdata.data.OtherContent; //導入依賴的package包/類
/**
 * Sets the KML content of the feature as an XmlBlob.  Unless
 * overridden by setKmlDefault, the default namespace of the entry
 * is kml, so the KML placemarks don't need any namespace prefix.
 *
 * @param kml A string representing a KML placemark.
 */
public void setKml(XmlBlob kml) {
  OtherContent content = new OtherContent();
  content.setXml(kml);
  content.setMimeType(KML_CONTENT);
  setContent(content);
}
 
開發者ID:google,項目名稱:gdata-java-client,代碼行數:14,代碼來源:FeatureEntry.java

示例9: FeedServerEntry

import com.google.gdata.data.OtherContent; //導入依賴的package包/類
/**
 * Creates entry from provided populated content.
 * 
 * @param content populated content.
 */
public FeedServerEntry(OtherContent content) {
  this.setContent(content);
}
 
開發者ID:jyang,項目名稱:google-feedserver,代碼行數:9,代碼來源:FeedServerEntry.java

示例10: getXmlFromContent

import com.google.gdata.data.OtherContent; //導入依賴的package包/類
/**
 * Gets an XML description of the payload from a GData {@code  OtherContent}
 * @param content a GData {@code  OtherContent} representation of the payload
 * @return An XML string describing the payload
 */
public String getXmlFromContent(OtherContent content) {
  XmlBlob xmlBlob = content.getXml();
  return xmlBlob.getBlob();
}
 
開發者ID:jyang,項目名稱:google-feedserver,代碼行數:10,代碼來源:ContentUtil.java


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