org.apache.abdera.model
Interface Collection

All Superinterfaces:
Base, java.lang.Cloneable, Element, ExtensibleElement

public interface Collection
extends ExtensibleElement

Represents an collection element in an Atom Publishing Protocol introspection document.

  The "app:collection" describes an Atom Protocol collection.  One
  child element is defined here for app:collection: "app:member-type".

  appCollection =
     element app:collection {
        appCommonAttributes,
        attribute href { text },
        ( atomTitle
          & appAccept
          & extensionElement* )
     }
 


Method Summary
 boolean accepts(javax.activation.MimeType mediaType)
          Returns true if the collection accepts the given media-type
 boolean accepts(java.lang.String mediaType)
          Returns true if the collection accepts the given media-type
 boolean acceptsEntry()
          Returns true if the collection accepts Atom entry documents (equivalent to calling accepts("application/atom+xml;type=entry");)
 boolean acceptsNothing()
          Returns true if the collection accepts nothing (i.e.
 void addAccepts(java.lang.String... mediaRanges)
          Adds new accept elements to the collection
 void addAccepts(java.lang.String mediaRange)
          Adds a new accept element to the collection
 void addAcceptsEntry()
          Same as setAcceptsEntry except the existing accepts are not discarded
 Categories addCategories()
          Add an app:categories element
 void addCategories(Categories categories)
          Add the app:categories element to the collection
 Categories addCategories(java.util.List<Category> categories, boolean fixed, java.lang.String scheme)
          Add a listing of categories to the collection
 Categories addCategories(java.lang.String href)
          Add an app:categories element that links to an external Category Document
 java.lang.String[] getAccept()
          Returns the listing of media-ranges allowed for this collection
 java.util.List<Categories> getCategories()
          Returns the app:categories element
 org.apache.abdera.i18n.iri.IRI getHref()
          Return the value of the app:collection elements href attribute
 org.apache.abdera.i18n.iri.IRI getResolvedHref()
          Return the href attribute resolved against the in-scope Base URI
 java.lang.String getTitle()
          The text value of the collections atom:title element
 Text getTitleElement()
          Return the title element
 void setAccept(java.lang.String... mediaRanges)
          Set the listing of media-ranges allowed for this collection.
 void setAcceptsEntry()
          Sets the appropriate accept element to indicate that entries are accepted (equivalent to calling setAccept("application/atom+xml;type=entry");)
 void setAcceptsNothing()
          Sets the collection so that nothing is accepted (equivalent to calling setAccept(""); )
 void setHref(java.lang.String href)
          Set the value of the href attribute
 Text setTitle(java.lang.String title)
          Set the value of the collections atom:title element using type="text"
 Text setTitleAsHtml(java.lang.String title)
          Set the value of the collections atom:title element using type="html".
 Text setTitleAsXHtml(java.lang.String title)
          Set the value of the collections atom:title element using type="xhtml".
 
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, setAttributeValue, setAttributeValue, setBaseUri, setBaseUri, setLanguage, setMustPreserveWhitespace, setParentElement, setText, setText
 
Methods inherited from interface org.apache.abdera.model.Base
addComment, clone, getDefaultWriterOptions, getFactory, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo
 

Method Detail

getTitle

java.lang.String getTitle()
The text value of the collections atom:title element

Returns:
The atom:title value

setTitle

Text setTitle(java.lang.String title)
Set the value of the collections atom:title element using type="text"

Parameters:
title - The value of the atom:title
Returns:
The newly created title element

setTitleAsHtml

Text setTitleAsHtml(java.lang.String title)
Set the value of the collections atom:title element using type="html". Special characters in the value will be automatically escaped (e.g. & will become &

Parameters:
title - The value of the atom:title
Returns:
The newly created title element

setTitleAsXHtml

Text setTitleAsXHtml(java.lang.String title)
Set the value of the collections atom:title element using type="xhtml". The title text will be wrapped in a xhtml:div and parsed to ensure that it is welformed XML. A ParseException (RuntimeException) could be thrown

Parameters:
title - The value of the atom:title
Returns:
The newly created title element

getTitleElement

Text getTitleElement()
Return the title element

Returns:
The title element

getHref

org.apache.abdera.i18n.iri.IRI getHref()
Return the value of the app:collection elements href attribute

Returns:
The href attribute IRI value
Throws:
IRISyntaxException - if the value of the href attribute is malformed

getResolvedHref

org.apache.abdera.i18n.iri.IRI getResolvedHref()
Return the href attribute resolved against the in-scope Base URI

Returns:
The href attribute IRI value
Throws:
IRISyntaxException - if the value of the href attribute is malformed

setHref

void setHref(java.lang.String href)
Set the value of the href attribute

Parameters:
href - The value of href attribute
Throws:
IRISyntaxException - if the href attribute is malformed

getAccept

java.lang.String[] getAccept()
Returns the listing of media-ranges allowed for this collection

Returns:
An array listing the media-ranges allowed for this collection

setAccept

void setAccept(java.lang.String... mediaRanges)
Set the listing of media-ranges allowed for this collection. The special value "entry" is used to indicate Atom Entry Documents.

Parameters:
mediaRanges - a listing of media-ranges
Throws:
MimeTypeParseException

accepts

boolean accepts(java.lang.String mediaType)
Returns true if the collection accepts the given media-type

Parameters:
mediaType - The media-type to check
Returns:
True if the media-type is acceptable

acceptsEntry

boolean acceptsEntry()
Returns true if the collection accepts Atom entry documents (equivalent to calling accepts("application/atom+xml;type=entry");)


acceptsNothing

boolean acceptsNothing()
Returns true if the collection accepts nothing (i.e. there is an empty accept element)


setAcceptsEntry

void setAcceptsEntry()
Sets the appropriate accept element to indicate that entries are accepted (equivalent to calling setAccept("application/atom+xml;type=entry");)


setAcceptsNothing

void setAcceptsNothing()
Sets the collection so that nothing is accepted (equivalent to calling setAccept(""); )


addAccepts

void addAccepts(java.lang.String mediaRange)
Adds a new accept element to the collection


addAccepts

void addAccepts(java.lang.String... mediaRanges)
Adds new accept elements to the collection


addAcceptsEntry

void addAcceptsEntry()
Same as setAcceptsEntry except the existing accepts are not discarded


accepts

boolean accepts(javax.activation.MimeType mediaType)
Returns true if the collection accepts the given media-type

Parameters:
mediaType - The media-type to check
Returns:
True if the media-type is acceptable

getCategories

java.util.List<Categories> getCategories()
Returns the app:categories element

Returns:
The app:categories element

addCategories

Categories addCategories()
Add an app:categories element

Returns:
The newly created app:categories element

addCategories

Categories addCategories(java.lang.String href)
Add an app:categories element that links to an external Category Document

Parameters:
href - The IRI of the external Category Document
Returns:
The newly created app:categories element
Throws:
IRISyntaxException - if the href value is malformed

addCategories

void addCategories(Categories categories)
Add the app:categories element to the collection

Parameters:
categories - The app:categories element

addCategories

Categories addCategories(java.util.List<Category> categories,
                         boolean fixed,
                         java.lang.String scheme)
Add a listing of categories to the collection

Parameters:
categories - The listing of categories to add
fixed - True if the listing of categories should be fixed
scheme - The default IRI scheme for the categories listing
Returns:
The newly created app:categories element
Throws:
IRISyntaxException - if the scheme value if malformed