blackboard.data.content
Class ContentFile

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

public class ContentFile
extends blackboard.data.content.AbstractContentFile

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
See Also:
Serialized Form

Nested Class Summary
static class ContentFile.Action
          Type-safe enumeration of possible values for the Action attribute of a file.
 
Nested classes/interfaces inherited from class blackboard.data.content.AbstractContentFile
blackboard.data.content.AbstractContentFile.StorageType
 
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.
ContentFile(java.io.File file)
          Constructs a ContentFile object from the specified java.io.File object.
 
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<ChildFile> getChildFiles()
           
 Id getContentId()
          Returns the content Id to which this ContentFile "belongs" (is part of).
 DataType getDataType()
          Returns the DataType identifier for this object.
 blackboard.data.registry.Registry getRegistry()
          Returns the Registry associated with this ContentFile .
 void setAction(ContentFile.Action action)
          Sets the display action for this ContentFile.
 void setChildFiles(BbList<ChildFile> files)
           
 void setContentId(Id iContentId)
          Sets the content Id value for this ContentFile.
 void setRegistry(blackboard.data.registry.Registry reg)
          Sets the Registry associated with this ContentFile.
 void validate()
          Validates the contents of this ContentFile.
 
Methods inherited from class blackboard.data.content.AbstractContentFile
getLinkName, getName, getSize, getStorageType, setLinkName, setName, setSize, setStorageType
 
Methods inherited from class blackboard.data.BbObject
clone, getBbAttributes, getCreatedDate, getId, getModifiedDate, matches, 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
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.

ContentFile

public ContentFile(java.io.File file)
Constructs a ContentFile object from the specified java.io.File object. The file is assumed to be in the proper file system location.

Parameters:
file - File object used to initialize the ContentFile. The provided file must exist.
Throws:
java.lang.IllegalArgumentException - if the provided file does not exist
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.

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 blackboard.data.registry.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(blackboard.data.registry.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<ChildFile> getChildFiles()

setChildFiles

public void setChildFiles(BbList<ChildFile> files)

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

validate

public void validate()
              throws ValidationException
Validates the contents of this ContentFile. 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 © 2012 Blackboard, Inc. All Rights Reserved.