Package com.google.gdata.data

Examples of com.google.gdata.data.Content


    map.put(SpiConstants.PROPNAME_DISPLAYURL,
        makeProperty(entry.getHtmlLink().getHref()));
   
    // Build PROPNAME_MIMETYPE and PROPNAME_CONTENT from entry.
   
    Content content = entry.getContent();
   
    if (content instanceof TextContent) {
     
      TextContent textContent = (TextContent) content;
     
View Full Code Here


    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();
      }
View Full Code Here

        if (target== null) throw new IllegalArgumentException("target==null");
        if (entry== null) throw new IllegalArgumentException("entry==null");
        if (htmlTmpl== null) throw new IllegalArgumentException("htmlTmpl==null");
        if (metaTmpl== null) throw new IllegalArgumentException("metaTmpl==null");
       
        Content content = entry.getContent();
        if( !(content instanceof TextContent) )
            throw new Error(
                    CLI.messages().contentNotInstanceOfText() );
        try{
            String htmlBody = getHtmlBodyOf((TextContent)content);
View Full Code Here

      map.put(SpiConstants.PROPNAME_DISPLAYURL,
          makeProperty(entry.getHtmlLink().getHref()));
     
      // Build PROPNAME_MIMETYPE and PROPNAME_CONTENT from entry.
     
      Content content = entry.getContent();
     
      if (content instanceof TextContent) {
       
        TextContent textContent = (TextContent) content;
       
View Full Code Here

        // and Mylyn doesn't like "-" in the id
        return StringUtils.substringAfterLast(issueEntry.getId(), "/");
    }

    private static String getPlainTextContent(BaseEntry<?> issueEntry, boolean stripHtml) {
        Content content = issueEntry.getContent();
        if (content instanceof TextContent) {
            // getTextContent() does the same thing and throws an
            // IllegalStateException
            // when the content is not TextContent
            TextContent textContent = (TextContent) content;
View Full Code Here

   * @throws FeedServerClientException if the XML parse fails.
   */
  private Map<String, Object> getMapFromEntry(FeedServerEntry entry)
      throws FeedServerClientException {
    // Get XML and convert to primitive Object map.
    Content content = entry.getContent();
    if (content instanceof OtherContent) {
      OtherContent otherContent = (OtherContent) content;
      log.info("Entry info " + otherContent.getXml().getBlob());
      XmlUtil xmlUtil = new XmlUtil();
      try {
        String xmlText = otherContent.getXml().getBlob();
        // TODO : This is a temporary work-around till a solution for escaping the
        // '>' by the GData client library is worked
        xmlText = xmlText.replaceAll("]]>", "]]&gt;");
        Map<String, Object> entity = xmlUtil.convertXmlToProperties(xmlText);
        if (entity == null) {
          entity = new HashMap<String, Object>();
        }
        // copy id which is the same as self and edit link
        entity.put(ContentUtil.ID, entry.getId());
        return entity;
      } catch (SAXException e) {
        throw new FeedServerClientException(e);
      } catch (IOException e) {
        throw new FeedServerClientException(e);
      } catch (ParserConfigurationException e) {
        throw new RuntimeException(e);
      }
    } else if (content instanceof TextContent) {
      TextContent textContent = (TextContent) content;
      TextConstruct textConstruct = textContent.getContent();

      int type = textContent.getContent().getType();
      String typeName;
      String text;
      switch (type) {
        case TextConstruct.Type.HTML:
          typeName = "html";
          text = ((HtmlTextConstruct) textConstruct).getHtml();
          break;

        case TextConstruct.Type.TEXT:
          typeName = "text";
          text = ((PlainTextConstruct) textConstruct).getPlainText();
          break;

        case TextConstruct.Type.XHTML:
          typeName = "xhtml";
          text = ((XhtmlTextConstruct) textConstruct).getXhtml().getBlob();
          break;

        default:
          typeName = "unknown";
          text = textConstruct.toString();
      }

      Map<String, Object> entity = new HashMap<String, Object>();
      entity.put("content", text);
      entity.put("type", typeName);

      String lang = textContent.getContent().getLang();
      if (lang != null) {
        entity.put("lang", lang);
      }

      return entity;
    } else {
      throw new FeedServerClientException("Unsupported content class " +
          content.getClass().getName());
    }
  }
View Full Code Here

   */
  public void fillBean(Entry entry, Object bean)
      throws IllegalArgumentException, SAXException, IOException,
          ParserConfigurationException, IntrospectionException,
          IllegalAccessException, InvocationTargetException, ParseException {
    Content content = entry.getContent();
    if (content instanceof OtherContent) {
      fillBean((OtherContent) content, bean);
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gdata.data.Content

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.