org.olat.ims.cp.objects
Class CPOrganization

java.lang.Object
  extended by org.dom4j.tree.AbstractNode
      extended by org.dom4j.tree.AbstractBranch
          extended by org.dom4j.tree.AbstractElement
              extended by org.dom4j.tree.DefaultElement
                  extended by org.olat.ims.cp.objects.CPOrganization
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, org.dom4j.Branch, org.dom4j.Element, org.dom4j.Node, CPNode

public class CPOrganization
extends org.dom4j.tree.DefaultElement
implements CPNode

Description:
This class represents a organization-element of a IMS-manifest-file

Initial Date: 26.06.2008

Author:
Sergio Trentini
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.dom4j.Node
ANY_NODE, ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, MAX_NODE_TYPE, NAMESPACE_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE, UNKNOWN_NODE
 
Method Summary
 void addItem(CPItem newItem)
          adds a new CPItem to the end of the items-vector
 void addItemAt(CPItem newItem, int index)
           
 void buildChildren()
          traverses XML-nodes and builds children-objects this function is invoked while the CP is instantiating (parsing-process of the manifest-file)
 void buildDocument(org.dom4j.tree.DefaultElement parent)
          generates a DefaultElement with all its Attributes and children, and adds it to parent This Function is needed to build the DefaultDocument of the ContentPackage
 java.util.Vector<CPItem> getAllItems()
          returns a vector that holds all items in this organization-element (recursively, all ! )
 org.dom4j.tree.DefaultElement getElementByIdentifier(java.lang.String id)
           
 CPItem getFirstItem()
          Returns the first Item.
 java.lang.String getIdentifier()
           
 CPItem getItemByID(java.lang.String id)
          Returns the Item with the specified identifier Returns null if Item is not found
 java.util.Iterator<CPItem> getItemIterator()
           
 java.util.Vector<CPItem> getItems()
           
 int getPosition()
           
 java.lang.String getTitle()
           
 void removeChild(java.lang.String id)
          removes a child from this elements children-collection
 void removeFromManifest(boolean resourceFlag)
          removes this element from the manifest
 void setIdentifier(java.lang.String identifier)
           
 void setMetadata(CPMetadata md)
           
 void setParentElement(CPOrganizations parent)
           
 void setPosition(int pos)
           
 void setTitle(java.lang.String title)
           
 boolean validateElement()
          checks whether required attributes are set, and whether required child-elements are present
 
Methods inherited from class org.dom4j.tree.DefaultElement
add, additionalNamespaces, additionalNamespaces, attribute, attribute, attribute, attribute, attributeCount, attributeIterator, attributes, clearContent, clone, declaredNamespaces, element, element, element, getDocument, getNamespaceForPrefix, getNamespaceForURI, getParent, getQName, getStringValue, getText, indexOf, node, nodeCount, nodeIterator, processingInstruction, processingInstructions, processingInstructions, remove, removeProcessingInstruction, setAttributes, setContent, setDocument, setParent, setQName, supportsParent
 
Methods inherited from class org.dom4j.tree.AbstractElement
accept, add, add, add, add, add, add, add, add, addAttribute, addAttribute, addCDATA, addComment, addElement, addEntity, addNamespace, addProcessingInstruction, addProcessingInstruction, addText, appendAttributes, asXML, attributeValue, attributeValue, attributeValue, attributeValue, createCopy, createCopy, createCopy, elementIterator, elementIterator, elementIterator, elementIterator, elements, elements, elements, elements, elementText, elementText, elementTextTrim, elementTextTrim, ensureAttributesCapacity, getData, getName, getNamespace, getNamespacePrefix, getNamespacesForURI, getNamespaceURI, getNodeType, getPath, getQName, getQualifiedName, getUniquePath, getXPathNameStep, getXPathResult, hasMixedContent, isRootElement, isTextOnly, normalize, remove, remove, remove, remove, remove, remove, remove, remove, setAttributes, setAttributeValue, setAttributeValue, setData, setName, setNamespace, setText, toString, write
 
Methods inherited from class org.dom4j.tree.AbstractBranch
addElement, addElement, addElement, appendContent, content, elementByID, getTextTrim, hasContent, isReadOnly, setProcessingInstructions
 
Methods inherited from class org.dom4j.tree.AbstractNode
asXPathResult, createPattern, createXPath, createXPathFilter, detach, getNodeTypeName, getPath, getUniquePath, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOf
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.dom4j.Element
getTextTrim
 
Methods inherited from interface org.dom4j.Branch
addElement, addElement, appendContent, content, elementByID, setProcessingInstructions
 
Methods inherited from interface org.dom4j.Node
asXPathResult, createXPath, detach, getNodeTypeName, getPath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOf
 

Method Detail

buildChildren

public void buildChildren()
Description copied from interface: CPNode
traverses XML-nodes and builds children-objects this function is invoked while the CP is instantiating (parsing-process of the manifest-file)

Specified by:
buildChildren in interface CPNode
See Also:
CPNode.buildChildren()

validateElement

public boolean validateElement()
Description copied from interface: CPNode
checks whether required attributes are set, and whether required child-elements are present

Specified by:
validateElement in interface CPNode
See Also:
CPNode.validateElement()

buildDocument

public void buildDocument(org.dom4j.tree.DefaultElement parent)
Description copied from interface: CPNode
generates a DefaultElement with all its Attributes and children, and adds it to parent This Function is needed to build the DefaultDocument of the ContentPackage

Specified by:
buildDocument in interface CPNode
See Also:
org.olat.ims.cp.objects.CPNode#getXML(java.lang.StringBuilder)

addItem

public void addItem(CPItem newItem)
adds a new CPItem to the end of the items-vector


addItemAt

public void addItemAt(CPItem newItem,
                      int index)

removeFromManifest

public void removeFromManifest(boolean resourceFlag)
removes this element from the manifest

Parameters:
resourceFlag - indicates whether linked resources should be deleted as well (true-->delete resources too)

removeChild

public void removeChild(java.lang.String id)
removes a child from this elements children-collection

Parameters:
id - the identifier of the child to remove

getItemByID

public CPItem getItemByID(java.lang.String id)
Returns the Item with the specified identifier Returns null if Item is not found

Parameters:
identifier - id
Returns:
CPItem or null

getItems

public java.util.Vector<CPItem> getItems()

getItemIterator

public java.util.Iterator<CPItem> getItemIterator()

getIdentifier

public java.lang.String getIdentifier()

setIdentifier

public void setIdentifier(java.lang.String identifier)

getTitle

public java.lang.String getTitle()

setTitle

public void setTitle(java.lang.String title)

getElementByIdentifier

public org.dom4j.tree.DefaultElement getElementByIdentifier(java.lang.String id)
Specified by:
getElementByIdentifier in interface CPNode
Returns:
See Also:
CPNode.getElementByIdentifier(java.lang.String)

getPosition

public int getPosition()
Specified by:
getPosition in interface CPNode
Returns:
Returns the position of this Element

getAllItems

public java.util.Vector<CPItem> getAllItems()
returns a vector that holds all items in this organization-element (recursively, all ! )

Returns:
vector

getFirstItem

public CPItem getFirstItem()
Returns the first Item. If this organization has no child-items, null is returned.

Returns:

setPosition

public void setPosition(int pos)
Specified by:
setPosition in interface CPNode

setParentElement

public void setParentElement(CPOrganizations parent)

setMetadata

public void setMetadata(CPMetadata md)