org.apache.abdera.model
Interface Feed

All Superinterfaces:
Base, Cloneable, Element, ExtensibleElement, Iterable<Element>, Source

public interface Feed
extends Source

Represents an Atom Feed Element

Per RFC4287:

 The "atom:feed" element is the document (i.e., top-level) element of
 an Atom Feed Document, acting as a container for metadata and data
 associated with the feed.  Its element children consist of metadata
 elements followed by zero or more atom:entry child elements.
 
 atomFeed =
   element atom:feed {
       atomCommonAttributes,
       (atomAuthor*
        & atomCategory*
        & atomContributor*
        & atomGenerator?
        & atomIcon?
        & atomId
        & atomLink*
        & atomLogo?
        & atomRights?
        & atomSubtitle?
        & atomTitle
        & atomUpdated
        & extensionElement*),
       atomEntry*
   }
 
 This specification assigns no significance to the order of atom:entry
 elements within the feed.
 
 The following child elements are defined by this specification (note
 that the presence of some of these elements is required):
 
 o  atom:feed elements MUST contain one or more atom:author elements,
    unless all of the atom:feed element's child atom:entry elements
    contain at least one atom:author element.
 o  atom:feed elements MAY contain any number of atom:category
    elements.
 o  atom:feed elements MAY contain any number of atom:contributor
    elements.
 o  atom:feed elements MUST NOT contain more than one atom:generator
    element.
 o  atom:feed elements MUST NOT contain more than one atom:icon
    element.
 o  atom:feed elements MUST NOT contain more than one atom:logo
    element.
 o  atom:feed elements MUST contain exactly one atom:id element.
 o  atom:feed elements SHOULD contain one atom:link element with a rel
    attribute value of "self".  This is the preferred URI for
    retrieving Atom Feed Documents representing this Atom feed.
 o  atom:feed elements MUST NOT contain more than one atom:link
    element with a rel attribute value of "alternate" that has the
    same combination of type and hreflang attribute values.
 o  atom:feed elements MAY contain additional atom:link elements
    beyond those described above.
 o  atom:feed elements MUST NOT contain more than one atom:rights
    element.
 o  atom:feed elements MUST NOT contain more than one atom:subtitle
    element.
 o  atom:feed elements MUST contain exactly one atom:title element.
 o  atom:feed elements MUST contain exactly one atom:updated element.
 
 If multiple atom:entry elements with the same atom:id value appear in
 an Atom Feed Document, they represent the same entry.  Their
 atom:updated timestamps SHOULD be different.  If an Atom Feed
 Document contains multiple entries with the same atom:id, Atom
 Processors MAY choose to display all of them or some subset of them.
 One typical behavior would be to display only the entry with the
 latest atom:updated timestamp.
 


Method Summary
 Entry addEntry()
          Adds a new Entry to the end of the Feeds collection of entries
 Feed addEntry(Entry entry)
          Adds a new Entry to the end of the Feeds collection of entries
 Source getAsSource()
          Creates a Source element from this Feed
 List<Entry> getEntries()
          Returns the complete set of entries contained in this feed
 Entry getEntry(String id)
          Retrieves the first entry in the feed with the given atom:id value
 Entry insertEntry()
          Adds a new Entry to the start of the Feeds collection of entries
 Feed insertEntry(Entry entry)
          Adds a new Entry to the start of the Feeds collection of entries
 Feed sortEntries(Comparator<Entry> comparator)
          Sorts entries using the given comparator
 Feed sortEntriesByEdited(boolean new_first)
          Sorts entries by the app:edited property. if app:edited is null, use app:updated
 Feed sortEntriesByUpdated(boolean new_first)
          Sorts entries by the atom:updated property
 
Methods inherited from interface org.apache.abdera.model.Source
addAuthor, addAuthor, addAuthor, addCategory, addCategory, addCategory, addContributor, addContributor, addContributor, addLink, addLink, addLink, addLink, getAlternateLink, getAlternateLink, getAlternateLinkResolvedHref, getAlternateLinkResolvedHref, getAsFeed, getAuthor, getAuthors, getCategories, getCategories, getCollection, getContributors, getGenerator, getIcon, getIconElement, getId, getIdElement, getLink, getLinkResolvedHref, getLinks, getLinks, getLinks, getLogo, getLogoElement, getRights, getRightsElement, getRightsType, getSelfLink, getSelfLinkResolvedHref, getSubtitle, getSubtitleElement, getSubtitleType, getTitle, getTitleElement, getTitleType, getUpdated, getUpdatedElement, getUpdatedString, newId, setCollection, setGenerator, setGenerator, setIcon, setIconElement, setId, setId, setIdElement, setLogo, setLogoElement, setRights, setRights, setRights, setRightsAsHtml, setRightsAsXhtml, setRightsElement, setSubtitle, setSubtitle, setSubtitle, setSubtitleAsHtml, setSubtitleAsXhtml, setSubtitleElement, setTitle, setTitle, setTitle, setTitleAsHtml, setTitleAsXhtml, setTitleElement, setUpdated, setUpdated, setUpdatedElement
 
Methods inherited from interface org.apache.abdera.model.ExtensibleElement
addExtension, addExtension, addExtension, addExtension, addExtension, addSimpleExtension, addSimpleExtension, getExtension, getExtension, getExtensions, getExtensions, getExtensions, getSimpleExtension, getSimpleExtension
 
Methods inherited from interface org.apache.abdera.model.Element
declareNS, discard, getAttributes, getAttributeValue, getAttributeValue, getBaseUri, getDocument, getElements, getExtensionAttributes, getFirstChild, getFirstChild, getLanguage, getLanguageTag, getLocale, getMustPreserveWhitespace, getNamespaces, getNextSibling, getNextSibling, getParentElement, getPreviousSibling, getPreviousSibling, getQName, getResolvedBaseUri, getText, removeAttribute, removeAttribute, setAttributeValue, setAttributeValue, setBaseUri, setBaseUri, setLanguage, setMustPreserveWhitespace, setParentElement, setText, setText
 
Methods inherited from interface org.apache.abdera.model.Base
addComment, clone, complete, getDefaultWriterOptions, getFactory, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

getEntries

List<Entry> getEntries()
Returns the complete set of entries contained in this feed

Returns:
A listing of atom:entry elements

addEntry

Feed addEntry(Entry entry)
Adds a new Entry to the end of the Feeds collection of entries

Parameters:
entry - Add an entry

addEntry

Entry addEntry()
Adds a new Entry to the end of the Feeds collection of entries

Returns:
A newly created atom:entry

insertEntry

Feed insertEntry(Entry entry)
Adds a new Entry to the start of the Feeds collection of entries

Parameters:
entry - An atom:entry to insert

insertEntry

Entry insertEntry()
Adds a new Entry to the start of the Feeds collection of entries

Returns:
A newly created atom:entry

getAsSource

Source getAsSource()
Creates a Source element from this Feed

Returns:
Returns a copy of this atom:feed as a atom:source element

sortEntriesByUpdated

Feed sortEntriesByUpdated(boolean new_first)
Sorts entries by the atom:updated property

Parameters:
new_first - If true, entries with newer atom:updated values will come first

sortEntriesByEdited

Feed sortEntriesByEdited(boolean new_first)
Sorts entries by the app:edited property. if app:edited is null, use app:updated


sortEntries

Feed sortEntries(Comparator<Entry> comparator)
Sorts entries using the given comparator

Parameters:
comparator - Sort the entries using the comparator

getEntry

Entry getEntry(String id)
Retrieves the first entry in the feed with the given atom:id value

Parameters:
id - The id to retrieve
Returns:
The matching atom:entry
Throws:
IRISyntaxException - if the id is malformed


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.