org.apache.abdera.model
Interface Categories

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

public interface Categories
extends ExtensibleElement

The Atom Publishing Protocol introduces the notion of a "Category Document" and the app:categories element. These are used to provide a listing of atom:category elements that may be used with the members of an Atom Publishing Protocol collection.


Method Summary
 void addCategory(Category category)
          Add an atom:category to the listing
 Category addCategory(java.lang.String term)
          Create and add an atom:category to the listing
 Category addCategory(java.lang.String scheme, java.lang.String term, java.lang.String label)
          Create an add an atom:category to the listing
 boolean contains(java.lang.String term)
          Returns true if this app:categories listing contains a category with the specified term
 boolean contains(java.lang.String term, java.lang.String scheme)
          Returns true if this app:categories listing contains a category with the specified term and scheme
 java.util.List<Category> getCategories()
          Lists the complete set of categories
 java.util.List<Category> getCategories(java.lang.String scheme)
          Lists the complete set of categories that use the specified scheme
 java.util.List<Category> getCategoriesWithScheme()
          Returns a copy of the complete set of categories with the scheme attribute set
 java.util.List<Category> getCategoriesWithScheme(java.lang.String scheme)
          Returns a copy of the complete set of categories with the scheme attribute set as specified in 7.2.1.
 org.apache.abdera.i18n.iri.IRI getHref()
          The app:categories element can have an href attribute whose value MUST point to an APP Category Document.
 org.apache.abdera.i18n.iri.IRI getResolvedHref()
          Returns the value of the href attribute resolved against the in-scope Base URI
 org.apache.abdera.i18n.iri.IRI getScheme()
          The app:categories element may specify a default scheme attribute for listed atom:category elements that do not have their own scheme attribute.
 boolean isFixed()
          If an app:categories element is marked as fixed, then the set of atom:category elements is considered to be a closed set.
 boolean isOutOfLine()
          Returns true if the href attribute is set
 void setFixed(boolean fixed)
          Sets whether or not this is a fixed listing of categories.
 void setHref(java.lang.String href)
          Sets the value of the href attribute.
 void setScheme(java.lang.String scheme)
          Sets the default scheme for this listing of categories
 
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

getHref

org.apache.abdera.i18n.iri.IRI getHref()
The app:categories element can have an href attribute whose value MUST point to an APP Category Document.

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

getResolvedHref

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

Returns:
The fully resolved href attribute value
Throws:
URISyntaxException - if the IRI in the underlying attribute value is malformed

setHref

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

Throws:
URISyntaxException - if the IRI specified is malformed

isFixed

boolean isFixed()
If an app:categories element is marked as fixed, then the set of atom:category elements is considered to be a closed set. That is, Atom Publishing Protocol clients SHOULD only use the atom:category elements listed. The default is false (fixed="no")

Returns:
True if the categories listing is fixed

setFixed

void setFixed(boolean fixed)
Sets whether or not this is a fixed listing of categories. If set to false, the fixed attribute will be removed from the app:categories element.

Parameters:
fixed - True if the app:categories listing is fixed

getScheme

org.apache.abdera.i18n.iri.IRI getScheme()
The app:categories element may specify a default scheme attribute for listed atom:category elements that do not have their own scheme attribute.

Returns:
The scheme IRI
Throws:
IRISyntaxException - if the IRI in the scheme attribute is malformed

setScheme

void setScheme(java.lang.String scheme)
Sets the default scheme for this listing of categories

Parameters:
scheme - The default scheme used for this listing of categories
Throws:
IRISyntaxException - if the IRI provided is malformed

getCategories

java.util.List<Category> getCategories()
Lists the complete set of categories

Returns:
This app:categories listing of atom:category elements

getCategories

java.util.List<Category> getCategories(java.lang.String scheme)
Lists the complete set of categories that use the specified scheme

Parameters:
scheme - The IRI of an atom:category scheme
Returns:
A listing of atom:category elements that use the specified scheme
Throws:
IRISyntaxException - if the scheme provided is malformed

getCategoriesWithScheme

java.util.List<Category> getCategoriesWithScheme()
Returns a copy of the complete set of categories with the scheme attribute set

Returns:
A listing of atom:category elements using the default scheme specified by the app:categories scheme attribute
Throws:
IRISyntaxException - if the values of the scheme attributes are malformed

getCategoriesWithScheme

java.util.List<Category> getCategoriesWithScheme(java.lang.String scheme)
Returns a copy of the complete set of categories with the scheme attribute set as specified in 7.2.1. (child categories that do not have a scheme attribute inherit the scheme attribute of the parent)

Parameters:
scheme - A scheme IRI
Returns:
A listing of atom:category elements
Throws:
IRISyntaxException - if the scheme provided is malformed

addCategory

void addCategory(Category category)
Add an atom:category to the listing

Parameters:
category - The atom:category to add to the listing

addCategory

Category addCategory(java.lang.String term)
Create and add an atom:category to the listing

Parameters:
term - The string term
Returns:
The newly created atom:category

addCategory

Category addCategory(java.lang.String scheme,
                     java.lang.String term,
                     java.lang.String label)
Create an add an atom:category to the listing

Parameters:
scheme - The scheme IRI for the newly created category
term - The string term
label - The human readable label for the category
Returns:
The newly created atom:category
Throws:
IRISyntaxException - if the scheme provided is malformed

contains

boolean contains(java.lang.String term)
Returns true if this app:categories listing contains a category with the specified term

Parameters:
term - The term to look for
Returns:
True if the term is found
Throws:
IRISyntaxException - if the Scheme IRI of any of the scheme attributes is malformed

contains

boolean contains(java.lang.String term,
                 java.lang.String scheme)
Returns true if this app:categories listing contains a category with the specified term and scheme

Parameters:
term - The term to look for
scheme - The IRI scheme
Returns:
True if the term and scheme are found
Throws:
IRISyntaxException - if the Scheme IRI of any of the scheme attributes is malformed

isOutOfLine

boolean isOutOfLine()
Returns true if the href attribute is set