blackboard.data.content
Class Content

java.lang.Object
  extended by blackboard.data.BbObject
      extended by blackboard.data.content.Content
All Implemented Interfaces:
Available, IBbObject, Positionable, java.lang.Cloneable
Direct Known Subclasses:
ContentFileRef, ContentFolder, CourseDocument, CourseLink, ExternalLink

public class Content
extends BbObject
implements Available, Positionable

The Content class is the root of the content class hierarchy. All content objects have Content as a superclass. This object contains the attributes shared by all pieces of content.

Programmatically, Content is the data object that is stored in specific areas of the course. It does not include "tool" data, such as Announcements, Calendar Entries, or Discussion Board postings.

The built-in content types supported by the system (as identified in the user interface) include Documents, Folders, Lessons, and Files.

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

Nested Class Summary
static class Content.RenderType
          Class to encapsulate the hints used by the renderers.
 
Field Summary
static DataType DATA_TYPE
           
static java.lang.String RESOURCE_BUNDLE
          Resource bundle for this data object
 
Fields inherited from class blackboard.data.BbObject
_bbAttributes
 
Fields inherited from interface blackboard.data.Positionable
POS_UNDEFINED
 
Constructor Summary
Content()
          Default constructor.
 
Method Summary
 void addContentFile(ContentFile cf)
          Adds a the specified ContentFile as an attachment to this object.
 boolean getAllowGuests()
          Returns the allow guests flag for this piece of Content.
 boolean getAllowObservers()
          Returns the allow observers flag for this piece of Content.
 FormattedText getBody()
          Returns the body of this object as a FormattedText object.
 BbList getContentFiles()
          Returns the list of ContentFile objects associated with the content item.
 java.lang.String getContentHandler()
          Returns the Content Handler handle associated with this content object.
 ContentStatus getContentStatus()
          Returns the ContentStatus for this content item.
 Id getCourseId()
          Returns the course Id associated with this piece of Content.
 DataType getDataType()
          Returns the DataType identifier for this object.
 java.util.Calendar getEndDate()
          Returns the last date this content object will be available to students.
 boolean getIsAvailable()
          Returns whether the piece of Content is available.
 boolean getIsDescribed()
          Returns whether this Content contains meta-data.
 boolean getIsFolder()
          Returns whether this piece of Content should be treated as a folder of content, or as an actual content piece itself.
 boolean getIsFromCartridge()
          Returns whether this piece of TrackedContent came from a course cartridge.
 boolean getIsLesson()
          Returns whether the underlying content represents a lesson.
 boolean getIsReviewable()
          Returns whether this piece of Content is presently set for review.
 boolean getIsSequential()
          Indicates whether the object is a Lesson that requires its contents to be displayed in a sequential fashion.
 boolean getIsTracked()
          Returns whether this piece of TrackedContent is presently set for access tracking.
 boolean getLaunchInNewWindow()
          Indicates whether a link for this object should be launched in a new window.
 java.lang.String getOfflineName()
          Returns the offline name associated with this Content.
 java.lang.String getOfflinePath()
          Returns the offline path associated with this Content.
 Id getParentId()
          Returns the parent Id associated with this piece of Content.
 java.lang.String getPersistentTitle()
          Returns the persistent title associated with this piece of Content.
 int getPosition()
          Returns the position of this piece of Content within its parent content item (folder).
 BbList getRemovedFiles()
          Returns a list of the Ids of the files that have been removed from this content object.
 Content.RenderType getRenderType()
          Returns the RenderType for this piece of content.
 java.util.Calendar getStartDate()
          Returns the Calendar that indicates the first date this object is to be made available in the student view of a course.
 java.lang.String getTitle()
          Returns the title associated with this piece of Content.
 java.lang.String getTitleColor()
          Returns the title color associated with this piece of Content.
 java.lang.String getUrl()
          Returns the URL associated with this ExternalLink.
 void printTree()
          printTree
 void removeContentFile(ContentFile cf)
          Removes the specified ContentFile object from this content object.
 void removeContentFile(Id id)
          Removes the specified ContentFile object from this object.
 void setAllowGuests(boolean bAllowGuests)
          Sets the allow guests flag for this piece of Content.
 void setAllowObservers(boolean bAllowObservers)
          Sets the allow observers flag for this piece of Content.
 void setBody(FormattedText text)
          Sets the body of this object as a FormattedText object.
 void setContentHandler(java.lang.String handler)
          Sets the content handler for this content object.
 void setCourseId(Id iCourseId)
          Sets the course Id value for this piece of Content.
 void setEndDate(java.util.Calendar cal)
          Sets the last date this object will be available to students.
 void setIsAvailable(boolean bIsAvailable)
          Sets whether this piece of Content is available.
 void setIsDescribed(boolean bIsDescribed)
          Sets whether this Content contains meta-data.
 void setIsFolder(boolean isFolder)
          Sets whether this piece of Content should be treated as a folder of content, or as an actual content piece itself.
 void setIsFromCartridge(boolean bIsFromCartridge)
          Sets whether this piece of TrackedContent came from a course cartridge.
 void setIsLesson(boolean isLesson)
          Sets whether the underlying content represents a lesson.
 void setIsReviewable(boolean bIsReviewable)
          Sets whether this piece of Content should be set for review.
 void setIsSequential(boolean sequential)
          Sets whether the object is a Lesson that requires its contents to be displayed in a sequential fashion.
 void setIsTracked(boolean bIsTracked)
          Sets whether this piece of TrackedContent should be set for access tracking.
 void setLaunchInNewWindow(boolean newWindow)
          Sets whether a link for this object should be launched in a new window.
 void setOfflineName(java.lang.String strOfflineName)
          Sets the offline name associated with this Content.
 void setOfflinePath(java.lang.String strOfflinePath)
          Sets the offline path associated with this Content.
 void setParentId(Id iParentId)
          Sets the parent Id value for this piece of Content.
 void setPosition(int nPos)
          Sets the position of this piece of Content within its parent content item (folder).
 void setRenderType(Content.RenderType eRenderType)
          Sets the RenderType for this piece of content.
 void setStartDate(java.util.Calendar cal)
          Sets the first date that this content object will be available to students.
 void setTitle(java.lang.String strTitle)
          Sets the title associated with this piece of Content.
 void setTitleColor(java.lang.String strTitleColor)
          Sets the title color associated with this piece of Content.
 void setUrl(java.lang.String strUrl)
          Sets the URL associated with this ExternalLink.
static void traverseContent(ContentVisitor visitor, Content item)
          Recursively traverses folders and content according to the visitor pattern.
 void validate()
          Validates the contents of this Content.
 
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 DataType DATA_TYPE

RESOURCE_BUNDLE

public static final java.lang.String RESOURCE_BUNDLE
Resource bundle for this data object

See Also:
Constant Field Values
Constructor Detail

Content

public Content()
Default constructor. Creates an empty Content. Various sub-classes of this object will over-ride the default attributes in this object.

An object returned from this constructor cannot be persisted without calling setCourseId(Id). However, most of the other attributes should be set in order for the object to be properly used in a course.

To make a Content object appear in a specific location, you must either explicitly add it to an already existing Aggregate (such as ContentFolder or Lesson), or you must persist the object and associate it with a CourseToc object.

Method Detail

getCourseId

public Id getCourseId()
Returns the course Id associated with this piece of Content.

Returns:
course Id value for this piece of content

setCourseId

public void setCourseId(Id iCourseId)
Sets the course Id value for this piece of Content. This id must come from a course that already exists, otherwise any attempt to persist this object will fail.

Parameters:
iCourseId - the course Id value to use for this piece of content

getParentId

public Id getParentId()
Returns the parent Id associated with this piece of Content. If the Id returned is not set (see Id.isSet() then this piece of content has no parent.

Returns:
course Id value for this piece of content

setParentId

public void setParentId(Id iParentId)
Sets the parent Id value for this piece of Content. This is typically called when this object is added to an Aggregate object, such as ContentFolder.

The object referenced by iParentId must already exist, otherwise problems may occur when attempting to persist this object.

Parameters:
iParentId - the parent Id value to use for this piece of content

getPersistentTitle

public java.lang.String getPersistentTitle()
Returns the persistent title associated with this piece of Content.

Returns:
the title value of this piece of content as a String

getTitle

public java.lang.String getTitle()
Returns the title associated with this piece of Content.

Returns:
the title value of this piece of content as a String

setTitle

public void setTitle(java.lang.String strTitle)
Sets the title associated with this piece of Content. This attribute can not exceed 255 characters.

Parameters:
strTitle - a String containing the title for this piec of content

getBody

public FormattedText getBody()
Returns the body of this object as a FormattedText object.

Returns:
body of this object as a FormattedText object.

setBody

public void setBody(FormattedText text)
Sets the body of this object as a FormattedText object. There is no limit for the text component's size.

Parameters:
text - the text to set.

getTitleColor

public java.lang.String getTitleColor()
Returns the title color associated with this piece of Content. Color values should by a RGB color value as used in HTML pages (#RRGGBB -- for example, #000000 will display black).

Returns:
the title color value for this piece of content as a String

setTitleColor

public void setTitleColor(java.lang.String strTitleColor)
Sets the title color associated with this piece of Content. This value can not exceed 10 characters.

Parameters:
strTitleColor - a String containing the title color for this piece of content. The color value should by a RGB color value as used in HTML pages (#RRGGBB -- for example, #000000 will display black).

getIsAvailable

public boolean getIsAvailable()
Returns whether the piece of Content is available.

Specified by:
getIsAvailable in interface Available
Returns:
true if this piece of content is available, false otherwise

setIsAvailable

public void setIsAvailable(boolean bIsAvailable)
Sets whether this piece of Content is available.

Specified by:
setIsAvailable in interface Available
Parameters:
bIsAvailable - true if this piece of content is available, false otherwise

getIsFromCartridge

public boolean getIsFromCartridge()
Returns whether this piece of TrackedContent came from a course cartridge.

Returns:
true if this piece of content came from a cartridge, false otherwise

setIsFromCartridge

public void setIsFromCartridge(boolean bIsFromCartridge)
Sets whether this piece of TrackedContent came from a course cartridge.

Parameters:
bIsFromCartridge - true if this piece of content came from a cartridge, false otherwise

getIsTracked

public boolean getIsTracked()
Returns whether this piece of TrackedContent is presently set for access tracking.

Returns:
true if this piece of content is setting for tracking, false otherwise

setIsTracked

public void setIsTracked(boolean bIsTracked)
Sets whether this piece of TrackedContent should be set for access tracking.

Parameters:
bIsTracked - true if access to this piece of content should be tracked, false otherwise

getIsReviewable

public boolean getIsReviewable()
Returns whether this piece of Content is presently set for review.

Returns:
true if this piece of content can be reviewed, false otherwise

setIsReviewable

public void setIsReviewable(boolean bIsReviewable)
Sets whether this piece of Content should be set for review.

Parameters:
bIsReviewable - true if this piece of content can be reviewed, false otherwise

getIsDescribed

public boolean getIsDescribed()
Returns whether this Content contains meta-data.

Returns:
true if this course document has metadata, false otherwise

setIsDescribed

public void setIsDescribed(boolean bIsDescribed)
Sets whether this Content contains meta-data.

Parameters:
bIsDescribed - true if this course document has associated meta-data, false otherwise

getOfflineName

public java.lang.String getOfflineName()
Returns the offline name associated with this Content.

Returns:
the offline name of this course document as a String

setOfflineName

public void setOfflineName(java.lang.String strOfflineName)
Sets the offline name associated with this Content.

Parameters:
strOfflineName - a String containing the offline name value for this course document

getOfflinePath

public java.lang.String getOfflinePath()
Returns the offline path associated with this Content.

Returns:
the offline path of this course document as a String

setOfflinePath

public void setOfflinePath(java.lang.String strOfflinePath)
Sets the offline path associated with this Content.

Parameters:
strOfflinePath - a String containing the offline path value for this course document

getPosition

public int getPosition()
Returns the position of this piece of Content within its parent content item (folder). This position should be used when displaying content at the same level (parent-child wise) relative to each other. Position values are zero-based (the first element has a position value of zero, not one).

A value of -1 indicates the new content item will be appended to the end of the list of items in the current folder.

Specified by:
getPosition in interface Positionable
Returns:
the position of this piece of content within its current context. If this value has not been set or is unknown its value will be Positionable.POS_UNDEFINED.

setPosition

public void setPosition(int nPos)
Sets the position of this piece of Content within its parent content item (folder). Position values are zero-based (the first element has a position value of zero, not one).

The default value is -1, which indicates the new content item will be appended to the end of the list of items in the current folder.

Specified by:
setPosition in interface Positionable
Parameters:
nPos - the new position value of this piece of content. This value should be a positive value.

getIsFolder

public boolean getIsFolder()
Returns whether this piece of Content should be treated as a folder of content, or as an actual content piece itself.

Returns:
true if this piece of content should be treated as a folder, false otherwise

setIsFolder

public void setIsFolder(boolean isFolder)
Sets whether this piece of Content should be treated as a folder of content, or as an actual content piece itself. Most content sub- classes willset this attribute automatically. Manually setting this attribute should only be done when the final type of the content object is not known when the object is instantiated.

Parameters:
isFolder - indicate whether to treat this object as a folder.

getIsLesson

public boolean getIsLesson()
Returns whether the underlying content represents a lesson. This attribute should only set by set by sub-classes of Content.

Returns:
true if the object is a Lesson

setIsLesson

public void setIsLesson(boolean isLesson)
Sets whether the underlying content represents a lesson. This attribute should only be set by sub-classes of Content.

Parameters:
true - if the object is a Lesson

getIsSequential

public boolean getIsSequential()
Indicates whether the object is a Lesson that requires its contents to be displayed in a sequential fashion.

Returns:
true if the object requires its contents displayed in linear order.

setIsSequential

public void setIsSequential(boolean sequential)
Sets whether the object is a Lesson that requires its contents to be displayed in a sequential fashion. This property is typically set by specific sub-classes.

Parameters:
sequential - if true, the contents should be displayed in a linear order.

getLaunchInNewWindow

public boolean getLaunchInNewWindow()
Indicates whether a link for this object should be launched in a new window. This is typically only used by specific sub-classes of content.

Returns:
true if the object is meant to be displayed in a new rendering context (window)

setLaunchInNewWindow

public void setLaunchInNewWindow(boolean newWindow)
Sets whether a link for this object should be launched in a new window. This is typically only used by specific sub-classes of content.

Parameters:
newWindow - true if the object is meant to be displayed in a new rendering context (window)

getUrl

public java.lang.String getUrl()
Returns the URL associated with this ExternalLink.

Returns:
the URL value of this external link as a String

setUrl

public void setUrl(java.lang.String strUrl)
Sets the URL associated with this ExternalLink. This field cannot exceed 1024 characters. Additionally, it is not required to conform to URL syntax, and is not double checked for "live" links.

Parameters:
strUrl - a String containing the url for this external link

getAllowGuests

public boolean getAllowGuests()
Returns the allow guests flag for this piece of Content. This flag determines whether or not "guests" (users with the role guest) are allowed access to this piece of content.

Returns:
a boolean denoting whether guests should be allowed access to this piece of content

setAllowGuests

public void setAllowGuests(boolean bAllowGuests)
Sets the allow guests flag for this piece of Content. This flag determines whether or not "guests" (users with the role guest) are allowed access to this piece of content.

Parameters:
bAllowGuests - true if guests should be allowed to this piece of content, false otherwise

getAllowObservers

public boolean getAllowObservers()
Returns the allow observers flag for this piece of Content. This flag determines whether or not "observers" (parents of a student in a course for example) are allowed access to this piece of content.

Returns:
a boolean denoting whether observers should be allowed access to this piece of content

setAllowObservers

public void setAllowObservers(boolean bAllowObservers)
Sets the allow observers flag for this piece of Content. This flag determines whether or not "observers" (parents of a student in a course for example) are allowed access to this piece of content.

Parameters:
bAllowObservers - true if observers should be allowed access to the this piece of content, false otherwise

getStartDate

public java.util.Calendar getStartDate()
Returns the Calendar that indicates the first date this object is to be made available in the student view of a course.

Note: the database's precision may affect the value retrieved from the database. Some databases store date/time values with precision only to the second, others store it to the millisecond.

Returns:
Calendar object. If this is a new object, or the value was never set, null will be returned.

setStartDate

public void setStartDate(java.util.Calendar cal)
Sets the first date that this content object will be available to students. No constraint checking is performed against the start date or end date, so care should be taken when setting this parameter.

Note: the database's precision may affect the value stored in the database. Some databases store date/time values with precision only to the second, others store it to the millisecond.

Parameters:
cal - Calendar object.

getEndDate

public java.util.Calendar getEndDate()
Returns the last date this content object will be available to students.

Note: the database's precision may affect the value retrieved from the database. Some databases store date/time values with precision only to the second, others store it to the millisecond.

Returns:
Calendar entry. If this attribute was never set, null will be returned.

setEndDate

public void setEndDate(java.util.Calendar cal)
Sets the last date this object will be available to students. No constraint checking is performed against the start date or end date, so care should be taken when setting this parameter.

Note: the database's precision may affect the value stored in the database. Some databases store date/time values with precision only to the second, others store it to the millisecond.

Parameters:
cal - final date

getRenderType

public Content.RenderType getRenderType()
Returns the RenderType for this piece of content. This property should be treated as a readonly property - it is typically determined by the actual content type.

Returns:
a render type value as defined in Content.RenderType

setRenderType

public void setRenderType(Content.RenderType eRenderType)
Sets the RenderType for this piece of content. Since the value of this property is determined by the actual content type, it should be treated as a read only property as changing it value to an improper one could cause rendering issues.

Parameters:
eRenderType - a valid type value as defined in Course.RenderType

getContentHandler

public java.lang.String getContentHandler()
Returns the Content Handler handle associated with this content object. These handles are used to determine the underlying object class when the object is loaded from the database. There are several built-in handles, in addition to handles that may be installed by a system extension.

Note that a particular content handler does not have to exist on a system for the handle to be associated with content. This is to allow content that was authored with a system extension to be moved to another system that may not have that extension. If the extension is loaded at a later date, it will automatically be associated any content with it's handle.

Content in 6.0 will always contain rendering data for an object, so that any content objects that require a custom content handler may be displayed on the target system (in the instructor view) but not edited. However, because of potential run-time requirements, the content will not be visible for student view, however. For example, if the content's display data references a Java applet that is part of the system extension.

Returns:
String-based handle. Note that the handles look like MIME types, but have Blackboard-specific meanings.

setContentHandler

public void setContentHandler(java.lang.String handler)
Sets the content handler for this content object. This property should typically be set either by Content subclasses or by business logic (such as import/export) that needs to ensure the content data is associated with a specific handler. System extensions, however, will set this to ensure that content is handled (created, modified) by the code installed with the system extension.

This does not have to reference a handler that exists on the system. This field cannot exceed 64 characters. By convention, the string conforms to a syntax similar to MIME types. Blackboard has the following content handlers built-in:

Note that these strings are available in the ContentHandlerStrings interface.

Parameters:
handler - handle string. The corresponding content handler does not have to exist on the system. This parameter should not exceed 64 characters.

getContentStatus

public ContentStatus getContentStatus()
Returns the ContentStatus for this content item. Note: This field is read-only, and is only accessible if the Content object was loaded with one of the methods accepting a userId parameter.

Returns:
ContentStatus object, null if Content was not retrieved with an appropriate load method.

addContentFile

public void addContentFile(ContentFile cf)
Adds a the specified ContentFile as an attachment to this object. Note that in the UI, only Content objects and ContentFileRef objects require attachments.

The attachments are used solely for rendering. If a Content object has associated files for storing data, etc., but do not require those files to be rendered in the default folder view, ContentFile objects should not be use. Instead, the files should simply be manipulated directly.

Parameters:
cf - the ContentFile to attach

getRemovedFiles

public BbList getRemovedFiles()
Returns a list of the Ids of the files that have been removed from this content object.

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

removeContentFile

public void removeContentFile(ContentFile cf)
Removes the specified ContentFile object from this content object.

Parameters:
cf - the ContentFile to remove.

removeContentFile

public void removeContentFile(Id id)
Removes the specified ContentFile object from this object.

Parameters:
id - the Id of the file to remove.

getContentFiles

public BbList getContentFiles()
Returns the list of ContentFile objects associated with the content item.

Returns:
a BbList of the associated ContentFile objects. The list will be empty if there are no attachments.

traverseContent

public static final void traverseContent(ContentVisitor visitor,
                                         Content item)
Recursively traverses folders and content according to the visitor pattern.


printTree

public final void printTree()
printTree


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
Specified by:
getDataType in class BbObject
Returns:
the DataType for this object

validate

public void validate()
              throws ValidationException
Validates the contents of this Content. Internal consistency checks are also performed.

Specified by:
validate in interface IBbObject
Overrides:
validate in class BbObject
Throws:
ValidationException - if validation of this object fails


Copyright © 2003 Blackboard, Inc. All Rights Reserved.