Package org.apache.abdera.model

Examples of org.apache.abdera.model.Content

Per RFC4287:

 The "atom:content" element either contains or links to the content of the entry.  The content of atom:content is Language-Sensitive. atomInlineTextContent = element atom:content { atomCommonAttributes, attribute type { "text" | "html" }?, (text) } atomInlineXHTMLContent = element atom:content { atomCommonAttributes, attribute type { "xhtml" }, xhtmlDiv } atomInlineOtherContent = element atom:content { atomCommonAttributes, attribute type { atomMediaType }?, (text|anyElement) } atomOutOfLineContent = element atom:content { atomCommonAttributes, attribute type { atomMediaType }?, attribute src { atomUri }, empty } atomContent = atomInlineTextContent | atomInlineXHTMLContent | atomInlineOtherContent | atomOutOfLineContent 

            
            
             // Convert the item to XML
             String value = mediator.mediate(data, itemClassType, itemXMLType, null).toString();
            
             Content content = factory.newContent();
             content.setContentType(Content.Type.XML);
             content.setValue(value);
            
             feedEntry.setContentElement(content);
   
             feedEntry.addLink(key.toString());
                 
View Full Code Here


           
            Entry entry = abdera.getFactory().newEntry();
            entry.setId(id);
            entry.setTitle("customer " + "Jane Doe_" + String.valueOf(i));
           
            Content content = this.abdera.getFactory().newContent();
            content.setContentType(Content.Type.TEXT);
            content.setValue("Jane Doe_" + String.valueOf(i));
           
            entry.setContentElement(content);
           
            entry.addLink("" + id, "edit");
            entry.addLink("" + id, "alternate");
View Full Code Here

    private Entry newEntry(String value) {

        Entry entry = this.abdera.newEntry();
        entry.setTitle("customer " + value);

        Content content = this.abdera.getFactory().newContent();
        content.setContentType(Content.Type.TEXT);
        content.setValue(value);
       
        entry.setContentElement(content);

        return entry;
    }
View Full Code Here

    private Entry updateEntry(Entry entry, String value) {

        entry.setTitle("customer " + value);

        Content content = this.abdera.getFactory().newContent();
        content.setContentType(Content.Type.TEXT);
        content.setValue(value);

        entry.setContentElement(content);

        return entry;
    }
View Full Code Here

    IRI uri = new IRI("http://www.snellspace.com/public/contentsummary.xml");
    Document<Feed> doc = parse(uri);
    Feed feed = doc.getRoot();
    int n = 1;
    for (Entry entry : feed.getEntries()) {
      Content content = entry.getContentElement();
      Text summary = entry.getSummaryElement();
      switch (n) {
        case 1:
          // XML Content Type
          assertEquals(Content.Type.XML, content.getContentType());
          assertTrue(content.getMimeType().match("application/xml"));
          assertEquals(Text.Type.TEXT, summary.getTextType());
          break;
        case 2:
          // XML Content Type by src reference
          assertEquals(Content.Type.XML, content.getContentType());
          assertNotNull(content.getResolvedSrc());
          assertEquals(Text.Type.TEXT, summary.getTextType());
          break;
        case 3:
          // Text Content Type. This is really an order test,
          // to determine how a reader selects which text to show
          assertEquals(Content.Type.TEXT, content.getContentType());
          assertEquals(Text.Type.TEXT, summary.getTextType());
          break;
        case 4:
          // Text Content Type. This is really an order test,
          // to determine how a reader selects which text to show
          assertEquals(Content.Type.TEXT, content.getContentType());
          assertEquals(Text.Type.TEXT, summary.getTextType());
          break;
        case 5:
          // Embedded iCalendar
          assertEquals(Content.Type.MEDIA, content.getContentType());
          assertTrue(content.getMimeType().match("text/calendar"));
          assertEquals(Text.Type.TEXT, summary.getTextType());
          break;
        case 6:
          // Embedded Base64 encoded GIF
          assertEquals(Content.Type.MEDIA, content.getContentType());
          assertTrue(content.getMimeType().match("image/gif"));
          assertEquals(Text.Type.TEXT, summary.getTextType());
          break;
      }
      n++;
    }
View Full Code Here

   * @throws MimeTypeParseException
* @throws IRISyntaxException
   */
  public Content setContent(IRI uri, String mediatype) throws MimeTypeParseException, IRISyntaxException {
    FOMFactory factory = (FOMFactory) this.factory;
    Content content = factory.newContent(new MimeType(mediatype));
    content.setSrc(uri.toString());
    setContentElement(content);
    return content;
  }
View Full Code Here

    Link link = getSelfLink();
    return (link != null) ? link.getResolvedHref() : null;
  }
 
  public String getContent() {
    Content content = getContentElement();
    return (content != null) ? content.getValue() : null;
  }
View Full Code Here

    Content content = getContentElement();
    return (content != null) ? content.getValue() : null;
  }
 
  public IRI getContentSrc() throws IRISyntaxException {
    Content content = getContentElement();
    return (content != null) ? content.getResolvedSrc() : null;
  }
View Full Code Here

    Content content = getContentElement();
    return (content != null) ? content.getResolvedSrc() : null;
  }
 
  public Type getContentType() {
    Content content = getContentElement();
    return (content != null) ? content.getContentType() : null;
  }
View Full Code Here

    Text text = getTitleElement();
    return (text != null) ? text.getTextType() : null;
  }

  public MimeType getContentMimeType() {
    Content content = getContentElement();
    return (content != null) ? content.getMimeType() : null;
  }
View Full Code Here

TOP

Related Classes of org.apache.abdera.model.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.