org.apache.lenya.modules.collection
Interface Collection

All Known Implementing Classes:
CollectionWrapper

public interface Collection

A document representing a collection of documents. This class is in prototyping stage.


Field Summary
static java.lang.String ATTRIBUTE_HREF
          Name of the href attribute.
static java.lang.String ATTRIBUTE_TYPE
          Name of the type attribute.
static java.lang.String ATTRIBUTE_UUID
          attribute for document IDs
static java.lang.String DEFAULT_PREFIX
          default namespace prefix
static java.lang.String ELEMENT_COLLECTION
          document element
static java.lang.String ELEMENT_DOCUMENT
          element for single document references
static java.lang.String NAMESPACE
          collection namespace
static java.lang.String TYPE_CHILDREN
          Type for automatic inclusion of child documents.
static java.lang.String TYPE_LINK
          Type for manual addition of documents.
static java.lang.String TYPE_MANUAL
          Type for manual addition of documents.
 
Method Summary
 void add(org.apache.lenya.cms.publication.Document document)
          Adds a document to the collection.
 void add(int position, org.apache.lenya.cms.publication.Document document)
          Inserts a document into the collection at a specific position.
 void clear()
          Removes all documents from this collection.
 boolean contains(org.apache.lenya.cms.publication.Document document)
          Checks if this collection contains a specific document.
 org.apache.lenya.cms.publication.Document getDelegate()
           
 org.apache.lenya.cms.publication.Document[] getDocuments()
          Returns the documents in this collection.
 int getFirstPosition(org.apache.lenya.cms.publication.Document document)
          Returns the first position of this document in the collection.
 java.lang.String getHref()
           
 java.lang.String getType()
           
 void remove(org.apache.lenya.cms.publication.Document document)
          Removes a document from the collection.
 void setHref(java.lang.String href)
           
 void setType(java.lang.String type)
           
 int size()
          Returns the number of documents in this collection.
 

Field Detail

NAMESPACE

static final java.lang.String NAMESPACE
collection namespace

See Also:
Constant Field Values

DEFAULT_PREFIX

static final java.lang.String DEFAULT_PREFIX
default namespace prefix

See Also:
Constant Field Values

ELEMENT_COLLECTION

static final java.lang.String ELEMENT_COLLECTION
document element

See Also:
Constant Field Values

ELEMENT_DOCUMENT

static final java.lang.String ELEMENT_DOCUMENT
element for single document references

See Also:
Constant Field Values

ATTRIBUTE_UUID

static final java.lang.String ATTRIBUTE_UUID
attribute for document IDs

See Also:
Constant Field Values

ATTRIBUTE_TYPE

static final java.lang.String ATTRIBUTE_TYPE
Name of the type attribute.

See Also:
Constant Field Values

ATTRIBUTE_HREF

static final java.lang.String ATTRIBUTE_HREF
Name of the href attribute.

See Also:
Constant Field Values

TYPE_CHILDREN

static final java.lang.String TYPE_CHILDREN
Type for automatic inclusion of child documents.

See Also:
Constant Field Values

TYPE_MANUAL

static final java.lang.String TYPE_MANUAL
Type for manual addition of documents.

See Also:
Constant Field Values

TYPE_LINK

static final java.lang.String TYPE_LINK
Type for manual addition of documents.

See Also:
Constant Field Values
Method Detail

getDocuments

org.apache.lenya.cms.publication.Document[] getDocuments()
                                                         throws org.apache.lenya.cms.publication.DocumentException
Returns the documents in this collection.

Returns:
An array of documents.
Throws:
org.apache.lenya.cms.publication.DocumentException - when something went wrong.

add

void add(org.apache.lenya.cms.publication.Document document)
         throws org.apache.lenya.cms.publication.DocumentException
Adds a document to the collection.

Parameters:
document - A document.
Throws:
org.apache.lenya.cms.publication.DocumentException - when an error occurs.

add

void add(int position,
         org.apache.lenya.cms.publication.Document document)
         throws org.apache.lenya.cms.publication.DocumentException
Inserts a document into the collection at a specific position.

Parameters:
document - A document.
position - The position of the document after insertion, starting with 0.
Throws:
org.apache.lenya.cms.publication.DocumentException - when something went wrong.

remove

void remove(org.apache.lenya.cms.publication.Document document)
            throws org.apache.lenya.cms.publication.DocumentException
Removes a document from the collection.

Parameters:
document - A document.
Throws:
org.apache.lenya.cms.publication.DocumentException - when the document is not contained or another error occurs.

clear

void clear()
           throws org.apache.lenya.cms.publication.DocumentException
Removes all documents from this collection.

Throws:
org.apache.lenya.cms.publication.DocumentException - when something went wrong.

contains

boolean contains(org.apache.lenya.cms.publication.Document document)
                 throws org.apache.lenya.cms.publication.DocumentException
Checks if this collection contains a specific document.

Parameters:
document - The document to check.
Returns:
A boolean value.
Throws:
org.apache.lenya.cms.publication.DocumentException - when something went wrong.

getFirstPosition

int getFirstPosition(org.apache.lenya.cms.publication.Document document)
                     throws org.apache.lenya.cms.publication.DocumentException
Returns the first position of this document in the collection.

Parameters:
document - The document.
Returns:
An integer.
Throws:
org.apache.lenya.cms.publication.DocumentException - when the document is not contained.

size

int size()
         throws org.apache.lenya.cms.publication.DocumentException
Returns the number of documents in this collection.

Returns:
An integer value.
Throws:
org.apache.lenya.cms.publication.DocumentException - when something went wrong.

getDelegate

org.apache.lenya.cms.publication.Document getDelegate()
Returns:
The document which the collection is stored in.

setType

void setType(java.lang.String type)
Parameters:
type - One of TYPE_CHILDREN, TYPE_MANUAL, TYPE_LINK.

getType

java.lang.String getType()
Returns:
One of TYPE_CHILDREN, TYPE_MANUAL, TYPE_LINK.

getHref

java.lang.String getHref()
Returns:
The link target.

setHref

void setHref(java.lang.String href)
Parameters:
href - The link target. If the type is not TYPE_LINK, calling this method has no effect.


Copyright © $ Apache Software Foundation. All Rights Reserved.