blackboard.persist.content
Interface ContentDbLoader

All Superinterfaces:
Loader

public interface ContentDbLoader
extends Loader

This interface describes the set of methods that all database loaders for Content objects must implement. This loader is capable of loading all defined "types" of content (documents, folder, links, etc.).

Loading methods are named according to the criteria used for loading and the type of load that is performed. Loading operations can be either "lightweight" or "heavyweight". Lightweight loads load only those values directly associated with a data object (the immediate properties of an object). Heavyweight loads load those values directly associated with an object as well as the values of those objects directly contained by the object. Heavyweight loads are optimized to be as efficient as possible, but because more data is loaded performance will be slower than that of lightweight loads. As a result, lightweight load should be performed whenever possible.

Because of the tree structure of content (content and folders), some load operations can also be "deep". A "deep" load, loads an entire tree of content, while a "non-deep" load, loads only those content items at a specific level within the tree structure.

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

Nested Class Summary
static class ContentDbLoader.Default
          A utility class that provides quick access to the ContentDbLoader instance associated with the default instance of the database BbPersistenceManager.
 
Field Summary
static java.lang.String TYPE
          Type used to obtain an instance of the class configured to provide the implementation for this interface.
 
Method Summary
 java.util.List loadAvailableChildren(Id folderId, Id userId, boolean heavy, java.sql.Connection con)
          Loads all children of the specified folder, honoring availability settings as determined for the specified user.
 Content loadById(Id id)
          Load the Content with the given Id from the database in a lightweight fashion using a connection obtained through this object's database context.
 Content loadById(Id id, java.sql.Connection con)
          Load the Content with the given Id from the database in a lightweight fashion using the supplied connection.
 Content loadById(Id id, java.sql.Connection con, boolean bDeep, boolean bHeavy)
          Loads the Content with the given Id from the database in the specified fashion (lightweight or heavyweight) using the supplied connection.
 Content loadByTocId(Id tocId)
          Load the Content item that is the "Top" folder for the specified CourseToc (identified by Id) in a lightweight fashion using a connection obtained through this object's database context.
 Content loadByTocId(Id tocId, java.sql.Connection con)
          Load the Content item that is the "Top" folder for the specified CourseToc (identified by Id) in a lightweight fashion using the supplied connection.
 Content loadByTocId(Id tocId, java.sql.Connection con, boolean bDeep)
          Load the Content item that is the "Top" folder for the specified CourseToc (identified by Id) in a lightweight fashion using the supplied connection.
 BbList loadChildren(Id id)
          Loads a list containing the immediate children of the specified Content item (identified by Id) from the database in a lightweight fashion using a connection obtained through this object's database context.
 java.util.List loadChildren(Id id, boolean heavy, java.sql.Connection con)
          Loads a list containing the immediate children of the specified Content item (identified by Id) from the database using a connection obtained using the supplied Connection.
 BbList loadChildren(Id id, java.sql.Connection con)
          Loads a list containing the immediate children of the specified Content item (identified by Id) from the database in a lightweight fashion using a connection obtained using the supplied Connection.
 BbList loadContentPath(Id id)
          Loads a list of content items containing the specified Content item (identified by Id) along with all of its ancestors from the database in a lightweight fashion using a connection obtained through this object's database context.
 BbList loadContentPath(Id id, java.sql.Connection con)
          Loads a list of content items containing the specified Content item (identified by Id) along with all of its ancestors from the database in a lightweight fashion using a connection obtained using the supplied Connection.
 BbList loadListById(Id id)
          Loads a list of Content by performing a deep load rooted at the content item with the given Id.
 BbList loadListById(Id id, java.sql.Connection con)
          Loads a list of Content by performing a deep load rooted at the content item with the given Id.
 BbList loadListById(Id id, java.sql.Connection con, boolean bHeavy)
          Loads a list of Content by performing a deep load rooted at the content item with the given Id.
 java.util.List loadMapView(Id userId, Id courseId, java.sql.Connection con)
          Returns a list of items representing the top-level content items in the course.
 java.util.List loadPathAndStatus(Id id, Id userId, java.sql.Connection con)
          Method to return a path to a given item.
 java.util.List loadReviewableByCourseId(Id id)
          Loads a list containing the all the Content items in the given course which have reviewable flag set to true.
 java.util.List loadReviewableByCourseId(Id id, java.sql.Connection con)
          Loads a list containing the all the Content items in the given course which have reviewable flag set to true.
 
Methods inherited from interface blackboard.persist.Loader
getAppVersion, init
 

Field Detail

TYPE

static final java.lang.String TYPE
Type used to obtain an instance of the class configured to provide the implementation for this interface. Used when making a call to BbPersistenceManager.getLoader(String).

See Also:
Constant Field Values
Method Detail

loadById

Content loadById(Id id)
                 throws KeyNotFoundException,
                        PersistenceException
Load the Content with the given Id from the database in a lightweight fashion using a connection obtained through this object's database context.

If id references an aggregate type, and you want to load all of the contained items and/or related objects such as files, use loadById(Id,Connection,boolean,boolean).

Parameters:
id - the Id of the Content that should be loaded
Throws:
KeyNotFoundException - if there is no Content in the database with the given id
PersistenceException - if some other error occurs while loading the object

loadById

Content loadById(Id id,
                 java.sql.Connection con)
                 throws KeyNotFoundException,
                        PersistenceException
Load the Content with the given Id from the database in a lightweight fashion using the supplied connection.

If id references an aggregate type, and you want to load all of the contained items and/or related objects such as files, use loadById(Id,Connection,boolean,boolean).

Parameters:
id - the Id of the Content that should be loaded
con - the Connection to use to perform the load. Can be null.
Throws:
KeyNotFoundException - if there is no Content in the database with the given id
PersistenceException - if some other error occurs while loading the object

loadById

Content loadById(Id id,
                 java.sql.Connection con,
                 boolean bDeep,
                 boolean bHeavy)
                 throws KeyNotFoundException,
                        PersistenceException
Loads the Content with the given Id from the database in the specified fashion (lightweight or heavyweight) using the supplied connection.

If a deep load is requested, and the specified content item is an aggregate type, all descendants of the specified content item will also be loaded such that the returned content item will represent the root node in a content tree. If the requested load is not deep, only the specified content item will be loaded.

Parameters:
id - the Id of the Content that should be loaded
con - the Connection to use to perform the load. Can be null.
bDeep - a boolean value denoting whether a "deep" load should be performed.
bHeavy - a boolean value denoting whether a "heavy" load should be performed.
Throws:
KeyNotFoundException - if there is no Content in the database with the given id
PersistenceException - if some other error occurs while loading the object

loadListById

BbList loadListById(Id id)
                    throws KeyNotFoundException,
                           PersistenceException
Loads a list of Content by performing a deep load rooted at the content item with the given Id. The load is performed in a lightweight fashion using a connection obtained through this object's database context.

If the specified content item is not an aggregate type, it will have no descendants and the returned list will thus contain only one content item -- the content item with the provided Id.

The order of content items within the returned list is such that parent content items will always appear in the list before their children content items, and for content items within a particular folder, the order of content items is preserved. The first item in the list will always be the content item within the provided Id. Beyond these stipulations the ordering is not guaranteed.

Parameters:
id - the Id of the Content that should be treated as the root node for the load operation
Throws:
KeyNotFoundException - if the provided content Id is invalid
PersistenceException - if some other error occurs while loading the object

loadListById

BbList loadListById(Id id,
                    java.sql.Connection con)
                    throws KeyNotFoundException,
                           PersistenceException
Loads a list of Content by performing a deep load rooted at the content item with the given Id. The load is performed in a lightweight fashion using the supplied connection.

If the specified content item is not an aggregate type, it will have no descendants and the returned list will thus contain only one content item -- the content item with the provided Id.

The order of content items within the returned list is such that parent content items will always appear in the list before their children content items, and for content items within a particular folder, the order of content items is preserved. The first item in the list will always be the content item within the provided Id. Beyond these stipulations the ordering is not guaranteed.

Parameters:
id - the Id of the Content that should be treated as the root node for the load operation
con - the Connection to use to perform the load. Can be null.
Throws:
KeyNotFoundException - if the provided content Id is invalid
PersistenceException - if some other error occurs while loading the object

loadListById

BbList loadListById(Id id,
                    java.sql.Connection con,
                    boolean bHeavy)
                    throws KeyNotFoundException,
                           PersistenceException
Loads a list of Content by performing a deep load rooted at the content item with the given Id. The load is performed in the specified fashion (lightweight or heavyweight) using the supplied connection.

If the specified content item is not an aggregate type, it will have no descendants and the returned list will thus contain only one content item -- the content item with the provided Id.

The order of content items within the returned list is such that parent content items will always appear in the list before their children content items, and for content items within a particular folder, the order of content items is preserved. The first item in the list will always be the content item within the provided Id. Beyond these stipulations the ordering is not guaranteed.

Parameters:
id - the Id of the Content that should be treated as the root node for the load operation
con - the Connection to use to perform the load. Can be null.
bHeavy - a boolean value denoting whether a "heavy" load should be performed.
Throws:
KeyNotFoundException - if the provided content Id is invalid
PersistenceException - if some other error occurs while loading the object

loadByTocId

Content loadByTocId(Id tocId)
                    throws KeyNotFoundException,
                           PersistenceException
Load the Content item that is the "Top" folder for the specified CourseToc (identified by Id) in a lightweight fashion using a connection obtained through this object's database context.

The "Top" content object acts as an anchor for all of the Content within a course area (CourseToc) and is a ContentFolder which is the root parent of all other defined content items.

Parameters:
tocId - the Id of the CourseToc for which the "Top" folder should be loaded
Throws:
KeyNotFoundException - if there is no CourseToc in the database with the given id
PersistenceException - if some other error occurs while loading the object

loadByTocId

Content loadByTocId(Id tocId,
                    java.sql.Connection con)
                    throws KeyNotFoundException,
                           PersistenceException
Load the Content item that is the "Top" folder for the specified CourseToc (identified by Id) in a lightweight fashion using the supplied connection.

The "Top" content object acts as an anchor for all of the Content within a course area (CourseToc) and is a ContentFolder which is the root parent of all other defined content items.

Parameters:
tocId - the Id of the CourseToc for which the "Top" folder should be loaded
con - the Connection to use to perform the load. Can be null.
Throws:
KeyNotFoundException - if there is no CourseToc in the database with the given id
PersistenceException - if some other error occurs while loading the object

loadByTocId

Content loadByTocId(Id tocId,
                    java.sql.Connection con,
                    boolean bDeep)
                    throws KeyNotFoundException,
                           PersistenceException
Load the Content item that is the "Top" folder for the specified CourseToc (identified by Id) in a lightweight fashion using the supplied connection.

The "Top" content object acts as an anchor for all of the Content within a course area (CourseToc) and is a ContentFolder which is the root parent of all other defined content items.

If a deep load is requested, all descendants of the "Top" content item will also be loaded such that the returned content item will be the root node in a content tree. If the requested load is not deep, only the "Top" content item will be loaded.

Parameters:
tocId - the Id of the CourseToc for which the "Top" folder should be loaded
con - the Connection to use to perform the load. Can be null.
bDeep - a boolean value denoting whether a "deep" load should be performed.
Throws:
KeyNotFoundException - if there is no CourseToc in the database with the given id
PersistenceException - if some other error occurs while loading the object

loadContentPath

BbList loadContentPath(Id id)
                       throws KeyNotFoundException,
                              PersistenceException
Loads a list of content items containing the specified Content item (identified by Id) along with all of its ancestors from the database in a lightweight fashion using a connection obtained through this object's database context.

This method differs from other load methods in that it loads items up the tree of content instead of down. In other words, given the Id of a leaf node content item (leaf node within the "tree" of content) this method will load all of the ancestors of the leaf node back up tree, all the way to the root node.

The order of content items within the returned list is "top-down". This means that the "top" (root) content node will appear first in the list, with each subsequent item being from one level down in the tree.

Parameters:
id - the Id of the Content for which a content path should be loaded
Throws:
KeyNotFoundException - if the provided Content Id is invalid
PersistenceException - if some other error occurs while loading the object

loadContentPath

BbList loadContentPath(Id id,
                       java.sql.Connection con)
                       throws KeyNotFoundException,
                              PersistenceException
Loads a list of content items containing the specified Content item (identified by Id) along with all of its ancestors from the database in a lightweight fashion using a connection obtained using the supplied Connection.

This method differs from other load methods in that it loads items up the tree of content instead of down. In other words, given the Id of a leaf node content item (leaf node within the "tree" of content) this method will load all of the ancestors of the leaf node back up tree, all the way to the root node.

The order of content items within the returned list is "top-down". This means that the "top" (root) content node will appear first in the list, with each subsequent item being from one level down in the tree.

Parameters:
id - the Id of the Content for which a content path should be loaded
con - the Connection to use to perform the load. Can be null.
Throws:
KeyNotFoundException - if the provided Content Id is invalid
PersistenceException - if some other error occurs while loading the object

loadPathAndStatus

java.util.List loadPathAndStatus(Id id,
                                 Id userId,
                                 java.sql.Connection con)
                                 throws PersistenceException
Method to return a path to a given item. This method is identical to loadContentPath() except that it 1) uses a filtered map (loading only title, id, isAvailable, and contentHandler) and 2) attaches a status object each element in the path.

The principal use case for this method is loading a path to check whether an item is available based availability of parent objects (e.g., direct linking to a 4th level folder must be disallowed when the 1st level folder is unavailable).

Parameters:
id - Id of the leaf item
userId - Id of the user for evaluating release rules
con - Connection to query with
Returns:
List of Content objects, root first
Throws:
PersistenceException - thrown if an error occurs during load

loadChildren

BbList loadChildren(Id id)
                    throws KeyNotFoundException,
                           PersistenceException
Loads a list containing the immediate children of the specified Content item (identified by Id) from the database in a lightweight fashion using a connection obtained through this object's database context.

The order of content items is preserved in the returned list.

Parameters:
id - the Id of the Content for which the immediate children should be loaded
Throws:
KeyNotFoundException - if the provided Content Id is invalid
PersistenceException - if some other error occurs while loading the object

loadChildren

BbList loadChildren(Id id,
                    java.sql.Connection con)
                    throws KeyNotFoundException,
                           PersistenceException
Loads a list containing the immediate children of the specified Content item (identified by Id) from the database in a lightweight fashion using a connection obtained using the supplied Connection.

The order of content items is preserved in the returned list.

Parameters:
id - the Id of the Content for which the immediate children should be loaded
con - the Connection to use to perform the load. Can be null.
Returns:
List of Content objects. This may be an empty list.
Throws:
KeyNotFoundException - This exception is currently not thrown, but included for backwards-compatibility
PersistenceException - if some other error occurs while loading the object

loadChildren

java.util.List loadChildren(Id id,
                            boolean heavy,
                            java.sql.Connection con)
                            throws PersistenceException
Loads a list containing the immediate children of the specified Content item (identified by Id) from the database using a connection obtained using the supplied Connection. Attached files may optionally be loaded as well, depending on the heavy flag.

The order of content items is preserved in the returned list.

Parameters:
id - the Id of the Content for which the immediate children should be loaded
heavy - Flag indicating whether to load attached files.
con - the Connection to use to perform the load. Can be null.
Returns:
List of Content objects. This may be an empty list.
Throws:
KeyNotFoundException - This exception is currently not thrown, but included for backwards-compatibility
PersistenceException - if some other error occurs while loading the object

loadAvailableChildren

java.util.List loadAvailableChildren(Id folderId,
                                     Id userId,
                                     boolean heavy,
                                     java.sql.Connection con)
                                     throws PersistenceException
Loads all children of the specified folder, honoring availability settings as determined for the specified user.

Parameters:
folderId - Id of the parent item
userId - Id of the user to check
heavy - Flag whether to load associated files and attach them to the content list
con - Connection to perform query against. If null, a connection is retrieved from the current context
Returns:
List of Content items. This list may be empty if 1) the folder has no children, or 2) the parent folder is non-existent. If heavy is true, each item will have an attached collection of ContentFile objects.
Throws:
PersistenceException

loadMapView

java.util.List loadMapView(Id userId,
                           Id courseId,
                           java.sql.Connection con)
                           throws PersistenceException
Returns a list of items representing the top-level content items in the course. Each item in the list will be the root of the corresponding tree.

Note: loadMapView() loads a "filtered" view of the object, so not all attributes are going to be available. Implementations of this method, at a minimum must load the following attributes:

Parameters:
userId - User id used for evaluating adaptive release rules
courseId - Course to retrieve folders for
con - Connection to query against. If null, the default connection is used
Returns:
List of Content objects representing the top-level folders
Throws:
PersistenceException

loadReviewableByCourseId

java.util.List loadReviewableByCourseId(Id id)
                                        throws KeyNotFoundException,
                                               PersistenceException
Loads a list containing the all the Content items in the given course which have reviewable flag set to true. The items are loaded from the database in a lightweight fashion including all attributes other then Body.

Parameters:
id - the Id of the Course for which the reviewable items should be loaded
Returns:
List of Content objects. This may be an empty list.
Throws:
PersistenceException - if some other error occurs while loading the object
KeyNotFoundException

loadReviewableByCourseId

java.util.List loadReviewableByCourseId(Id id,
                                        java.sql.Connection con)
                                        throws PersistenceException
Loads a list containing the all the Content items in the given course which have reviewable flag set to true. The items are loaded from the database in a lightweight fashion including all attributes other then Body using a connection obtained using the supplied Connection.

Parameters:
id - the Id of the Course for which the reviewable items should be loaded
con - the Connection to use to perform the load. Can be null.
Returns:
List of Content objects. This may be an empty list.
Throws:
PersistenceException - if some other error occurs while loading the object


Copyright © 2003 Blackboard, Inc. All Rights Reserved.