blackboard.data.content
Class ContentFile

java.lang.Object
  extended by blackboard.data.BbObject
      extended by blackboard.data.content.ContentFile
All Implemented Interfaces:
IBbObject, java.lang.Cloneable

public class ContentFile
extends BbObject

The ContentFile class wraps a reference to a file that has been uploaded to a content area in a course. This object only represents the information in the database used to track the file reference. References to the actual file system objects must be obtained separately.

Note that ContentFile objects are only meant to deal with files associated with content. It does not deal with files in other contexts, such as user or group uploads.

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

Nested Class Summary
static class ContentFile.Action
          Type-safe enumeration of possible values for the Action attribute of a file.
static class ContentFile.StorageType
          Type-safe enumeration of possible values for the StorageType attribute of a file.
 
Field Summary
static DataType DATA_TYPE
           
 
Fields inherited from class blackboard.data.BbObject
_bbAttributes
 
Constructor Summary
ContentFile()
          Default constructor.
ContentFile(BbFile bbFile)
          Constructor that builds some defaults based on the given BbFile argument.
 
Method Summary
 void addChildFile(ChildFile file)
          Appends the given ChildFile to the current list of child files defined for this ContentFile.
 ContentFile.Action getAction()
          Returns the action specified for this ContentFile.
 BbList getChildFiles()
          Returns the list of child files for this ContentFile.
 Id getContentId()
          Returns the content Id to which this ContentFile "belongs" (is part of).
 DataType getDataType()
          Returns the DataType identifier for this object.
 java.lang.String getLinkName()
          Returns the name of the link to display with this file object.
 java.lang.String getName()
          Returns the file name of this file object.
 Registry getRegistry()
          Returns the Registry associated with this ContentFile .
 long getSize()
          Returns the size of the file wrapped by this object.
 ContentFile.StorageType getStorageType()
          Returns the storageType specified for this ContentFile.
 void setAction(ContentFile.Action action)
          Sets the display action for this ContentFile.
 void setChildFiles(BbList files)
          Sets the list of child files for this ContentFile.
 void setContentId(Id iContentId)
          Sets the content Id value for this ContentFile.
 void setLinkName(java.lang.String strLinkName)
          Sets the text of the link displayed for this object.
 void setName(java.lang.String strName)
          Sets the file name of this object
 void setRegistry(Registry reg)
          Sets the Registry associated with this ContentFile.
 void setSize(long size)
          Records the size of the file wrapped by this object.
 void setStorageType(ContentFile.StorageType storageType)
          Sets the display storageType for this ContentFile.
 
Methods inherited from class blackboard.data.BbObject
clone, getBbAttributes, getCreatedDate, getId, getModifiedDate, persist, setCreatedDate, setId, setModifiedDate, toString, validate
 
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
Constructor Detail

ContentFile

public ContentFile()
Default constructor. Creates an instance of ContentFile with default property values.


ContentFile

public ContentFile(BbFile bbFile)
Constructor that builds some defaults based on the given BbFile argument.

Parameters:
bbFile - BbFile used to prepopulate some values.
Method Detail

getAction

public ContentFile.Action getAction()
Returns the action specified for this ContentFile. The action is used to determine how the file should display in the UI.

Returns:
One of the values enumerated in ContentFile.Action

setAction

public void setAction(ContentFile.Action action)
Sets the display action for this ContentFile.

Parameters:
action - Action to set.

getStorageType

public ContentFile.StorageType getStorageType()
Returns the storageType specified for this ContentFile. The storageType is used to determine how the file should display in the UI.

Returns:
One of the values enumerated in ContentFile.StorageType

setStorageType

public void setStorageType(ContentFile.StorageType storageType)
Sets the display storageType for this ContentFile.

Parameters:
storageType - StorageType to set.

getSize

public long getSize()
Returns the size of the file wrapped by this object.

Returns:
the size of this content file

setSize

public void setSize(long size)
Records the size of the file wrapped by this object.

Parameters:
size - size to record.

getName

public java.lang.String getName()
Returns the file name of this file object. The name should not contain any path information.

Returns:
file name of the object

setName

public void setName(java.lang.String strName)
Sets the file name of this object

Parameters:
strName - file name to set. This value should not exceed 500 characters.

getLinkName

public java.lang.String getLinkName()
Returns the name of the link to display with this file object.

Returns:
Name of display link.

setLinkName

public void setLinkName(java.lang.String strLinkName)
Sets the text of the link displayed for this object.

Parameters:
strLinkName - name to display. This field cannot exceed 255 characters.

getContentId

public Id getContentId()
Returns the content Id to which this ContentFile "belongs" (is part of).

Returns:
content Id value for this content file

setContentId

public void setContentId(Id iContentId)
Sets the content Id value for this ContentFile.

Parameters:
iContentId - the content Id value to use for this content file

getRegistry

public Registry getRegistry()
Returns the Registry associated with this ContentFile .

This attribute is a "heavy" attribute and only contains a value if this ContentFile was loaded using a "heavy" load method. Accessing this value when it has not been loaded is an error.

Returns:
Registry value for this content file

setRegistry

public void setRegistry(Registry reg)
Sets the Registry associated with this ContentFile. The Registry provided should only contain FileRegistryEntry values.

Parameters:
reg - a Registry value to use for this content file

getChildFiles

public BbList getChildFiles()
Returns the list of child files for this ContentFile.

Returns:
a BbList with the child files for this content file

setChildFiles

public void setChildFiles(BbList files)
Sets the list of child files for this ContentFile.

When child files are added to a content file in this manner, no enforcement of the relationship between a content file and its child files is performed. It is therefore the responsibility of the caller to have properly enforced these constraints. If enforcement of the elements of the relationship is desired, use #addContentFile(ChildFile) instead.

Parameters:
files - a BbList containing the set of child files to use for this content file

addChildFile

public void addChildFile(ChildFile file)
Appends the given ChildFile to the current list of child files defined for this ContentFile.

This method enforces all constraints in the relationship of a child file and a content file. The parent/child relationship between a content file and a child file is enforced by calling ChildFile.setParentId(Id), passing in the local id value, on the provided ChildFile prior to adding it to the list of child files.

Presently, child files are only used in a special case of file content uploaded through the user interface, in which image references in an uploaded HTML file are stored as "children" of the HTML content file record.

Parameters:
file - the ChildFile to append to the current list of child files

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


Copyright © 2003 Blackboard, Inc. All Rights Reserved.