blackboard.data.content
Class ContentFolder

java.lang.Object
  extended by blackboard.data.BbObject
      extended by blackboard.data.content.Content
          extended by blackboard.data.content.ContentFolder
All Implemented Interfaces:
Available, Aggregate, Folder, IBbObject, Positionable, java.lang.Cloneable
Direct Known Subclasses:
Lesson

public class ContentFolder
extends Content
implements Aggregate

The ContentFolder class is a representation of a folder within the Bb Course Management System. A content folder provides a means of organizing documents, other folders, lessons, and links.

The children are maintained as an order list of Content objects.

Since:
Bb 6.0
Version:
$Revision: #1 $ $Date: 2005/06/27 $

Nested Class Summary
 
Nested classes/interfaces inherited from class blackboard.data.content.Content
Content.RenderType
 
Field Summary
static DataType DATA_TYPE
          Object data type constant
 
Fields inherited from class blackboard.data.content.Content
RESOURCE_BUNDLE
 
Fields inherited from class blackboard.data.BbObject
_bbAttributes
 
Fields inherited from interface blackboard.data.Positionable
POS_UNDEFINED
 
Constructor Summary
ContentFolder()
          Default constructor; ensures that the appropriate attributes in Content are over-ridden, including ContentHandler and IsFolder.
 
Method Summary
 boolean acceptsType(java.lang.String handler)
          A ContentFolder can accept any type of content except ContentFileRef objects ( "resource/x-bb-file" ).
 void addContent(Content content)
          Adds the given piece of Content (must not be of type ContentFile) to the list of children for this Folder.
 void addContent(Content content, int nPos)
          Adds the given piece of Content (must notbe of type ContentFile) to the list of children for this Folder at the provided position value.
 BbList getChildren()
          Returns the list of children that presently belong to (was assigned to) this CourseDocumentFolder.
 DataType getDataType()
          Returns the DataType identifier for this object.
 boolean getIsFolder()
          Overrides the method of the same name in Content.
 BbList getRemoved()
          Returns the ids that have been removed from this Folder.
 Sequence getSequence()
          Required method for Aggregate objects.
 void remove(Content content)
          Removes the specified Content object from the list of children.
 
Methods inherited from class blackboard.data.content.Content
addContentFile, getAllowGuests, getAllowObservers, getBody, getContentFiles, getContentHandler, getContentStatus, getCourseId, getEndDate, getIsAvailable, getIsDescribed, getIsFromCartridge, getIsLesson, getIsReviewable, getIsSequential, getIsTracked, getLaunchInNewWindow, getOfflineName, getOfflinePath, getParentId, getPersistentTitle, getPosition, getRemovedFiles, getRenderType, getStartDate, getTitle, getTitleColor, getUrl, printTree, removeContentFile, removeContentFile, setAllowGuests, setAllowObservers, setBody, setContentHandler, setCourseId, setEndDate, setIsAvailable, setIsDescribed, setIsFolder, setIsFromCartridge, setIsLesson, setIsReviewable, setIsSequential, setIsTracked, setLaunchInNewWindow, setOfflineName, setOfflinePath, setParentId, setPosition, setRenderType, setStartDate, setTitle, setTitleColor, setUrl, traverseContent, validate
 
Methods inherited from class blackboard.data.BbObject
clone, getBbAttributes, getCreatedDate, getId, getModifiedDate, persist, setCreatedDate, setId, setModifiedDate, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DATA_TYPE

public static final DataType DATA_TYPE
Object data type constant

Constructor Detail

ContentFolder

public ContentFolder()
Default constructor; ensures that the appropriate attributes in Content are over-ridden, including ContentHandler and IsFolder.

Method Detail

acceptsType

public boolean acceptsType(java.lang.String handler)
A ContentFolder can accept any type of content except ContentFileRef objects ( "resource/x-bb-file" ).

Specified by:
acceptsType in interface Aggregate
Parameters:
handler - content handler handle to test.
Returns:
true unless handler equals "resource/x-bb-file"

getIsFolder

public boolean getIsFolder()
Overrides the method of the same name in Content.

Overrides:
getIsFolder in class Content
Returns:
true (this object IS a folder)
See Also:
Content.getIsFolder()

addContent

public void addContent(Content content)
                throws java.lang.IllegalArgumentException
Adds the given piece of Content (must not be of type ContentFile) to the list of children for this Folder. The piece of content is added at the end of the list of content items.

This method enforces all constraints in the relationship of a folder and a child content item. First, the parent/child relationship between a folder and a piece of content is enforced by calling Content.setParentId(Id), passing in the local content Id value, on the provided Content object prior to adding it to the list of content items. Content items should also be part of the same course as their parent folder so Content.setCourseId(Id) is called passing in the local course Id value.

Specified by:
addContent in interface Folder
Parameters:
content - the piece of Content to be added to the list of content being maintained by this folder.
Throws:
java.lang.IllegalArgumentException - thrown if the provided content is of type ContentFile.

addContent

public void addContent(Content content,
                       int nPos)
                throws java.lang.IllegalArgumentException
Adds the given piece of Content (must notbe of type ContentFile) to the list of children for this Folder at the provided position value.

This method enforces all constraints in the relationship of a folder and a child content item. First, the parent/child relationship between a folder and a piece of content is enforced by calling Content.setParentId(Id), passing in the local content Id value, on the provided Content object prior to adding it to the list of content items. Content items should also be part of the same course as their parent folder so Content.setCourseId(Id) is called passing in the local course Id value.

Specified by:
addContent in interface Folder
Parameters:
content - the piece of Content to be added to the list of content being maintained by this folder.
nPos - the position in the child list at which the given content should be added.
Throws:
java.lang.IllegalArgumentException - thrown if the provided content is of type ContentFile.

remove

public void remove(Content content)
Removes the specified Content object from the list of children. The child is not immediately deleted from the database. Callers of this method must follow through by calling getRemoved() and calling blackbaord.persist.content.ContentDbPersister#delete(Id) for each entry in the the list of removed items.

Specified by:
remove in interface Aggregate
Parameters:
content - Content object to remove.

getRemoved

public BbList getRemoved()
Returns the ids that have been removed from this Folder. This is useful when attempting to reconcile the children in a heavy persistence operation. For example, if an object is removed from the folder, the folder will not require persisting, but the child removed must be deleted. This BbList tracks the ids of objects that have been removed.

Returns:
a BbList of Id objects. Each Id in the list represents the id of Content item that was removed from this content folder.

getSequence

public Sequence getSequence()
Required method for Aggregate objects. ContentFolder objects do not present a sequenced view of their content, so this method will return null.

Specified by:
getSequence in interface Aggregate
Returns:
null

getChildren

public BbList getChildren()
Returns the list of children that presently belong to (was assigned to) this CourseDocumentFolder.

Specified by:
getChildren in interface Folder
Returns:
a BbList of the children Content objects of this ContentFolder. The list will be empty if there are no children.

getDataType

public DataType getDataType()
Returns the DataType identifier for this object. Can be used to uniquely identify the "type" of this data object.

Specified by:
getDataType in interface IBbObject
Overrides:
getDataType in class Content
Returns:
the DataType for this object


Copyright © 2003 Blackboard, Inc. All Rights Reserved.