Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.model
Interface DocumentContainer

All Known Subinterfaces:
Document, DocumentProxy, SQLDocument
All Known Implementing Classes:
AbstractDocument, MockDocument, SQLDocumentLive, SQLDocumentProxy, SQLDocumentVersion

public interface DocumentContainer

Author:
Bogdan Stefanescu

Method Summary
 Document addChild(String name, String typeName)
          Creates a new child document given its typename.
 Document getChild(String name)
          Gets a child document given its name.
 Iterator<Document> getChildren()
          Gets an iterator over the children of the document.
 DocumentIterator getChildren(int start)
           
 List<String> getChildrenIds()
          Gets a list of the children ids.
 boolean hasChild(String name)
          Tests if the document has the named child.
 boolean hasChildren()
          Tests if the document has any children.
 void orderBefore(String src, String dest)
          Orders the given source child before the destination child.
 void removeChild(String name)
          Removes the child having the given name
 Document resolvePath(String relPath)
          Resolves a document given its relative path to the current document.
 

Method Detail

resolvePath

Document resolvePath(String relPath)
                     throws DocumentException
Resolves a document given its relative path to the current document.

If the path is absolute then it will be transformed in a relative path (i.e. the leading '/' removed).

Parameters:
relPath - the path relative to this document
Returns:
the resolved document
Throws:
DocumentException

getChild

Document getChild(String name)
                  throws DocumentException
Gets a child document given its name.

Throws an exception if the document could not be found.

If the supplied name is null, returns the default child of the document if any, otherwise raises an exception.

Parameters:
name - the name of the child to retrieve
Returns:
the named child if exists, raises a NoSuchDocumentException otherwise
Throws:
UnsupportedOperationException - if this is not a folder document
DocumentException

getChildren

Iterator<Document> getChildren()
                               throws DocumentException
Gets an iterator over the children of the document.

This operation silently ignores non-folder documents: if the document is not a folder then it returns an empty iterator.

Returns:
the children iterator
Throws:
DocumentException

getChildren

DocumentIterator getChildren(int start)
                             throws DocumentException
Throws:
DocumentException

getChildrenIds

List<String> getChildrenIds()
                            throws DocumentException
Gets a list of the children ids.

Returns:
a list of children ids.
Throws:
DocumentException
Since:
1.4.1

hasChild

boolean hasChild(String name)
                 throws DocumentException
Tests if the document has the named child.

This operation silently ignores non-folder documents: If the document is not a folder then return false.

Parameters:
name - the name of the child to test
Returns:
true if the named child exists, false otherwise
Throws:
DocumentException

hasChildren

boolean hasChildren()
                    throws DocumentException
Tests if the document has any children.

This operation silently ignores non-folder documents: If the document is not a folder then returns false.

Returns:
true if document has children, false otherwise
Throws:
DocumentException

addChild

Document addChild(String name,
                  String typeName)
                  throws DocumentException
Creates a new child document given its typename.

This operation throws an error if the current document is not a folder.

Parameters:
name - the name of the new child to create
typeName - the type of the child to create
Returns:
the newly created document
Throws:
DocumentException

removeChild

void removeChild(String name)
                 throws DocumentException
Removes the child having the given name

If this is not a folder does nothing.

If this is a folder and no child exists with the given name then throws an exception

Parameters:
name - the child name
Throws:
DocumentException

orderBefore

void orderBefore(String src,
                 String dest)
                 throws DocumentException
Orders the given source child before the destination child. Both source and destination must be names that point to child documents of the current document. The source document will be placed before the destination one. If destination is null the source document will be appended at the end of the children list.

Parameters:
src - the document to move
dest - the document before which to place the source document
Throws:
DocumentException - if this document is not an orderable folder or any other exception occurs

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.