blackboard.persist.content
Interface ContentDbPersister

All Superinterfaces:
Persister

public interface ContentDbPersister
extends Persister

This interface describes the set of methods that all database persisters for Content objects must implement.

A database persister allows an object to be stored (either inserted or updated) within the database or to be deleted from the database. Persisting methods are named according to the type of persistence that is performed.

Since:
Bb 5.5

Nested Class Summary
static class ContentDbPersister.Default
          A utility class that provides quick access to the ContentDbPersister 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
 void deleteById(Id id)
          Deletes the Content identified by the given Id value using a connection from the associated persistence manager's database container.
 void deleteById(Id id, java.sql.Connection con)
          Deletes the Content identified by the given Id value using the supplied connection.
 void handleContentNotification(Content content)
          Handles add, update and delete of notification for contents.
 void markReviewed(Id contentId, Id userId)
          Marks the Content identified by the given contentId value using a connection from the associated persistence manager's database container as status "Reviewed" by the user identified by userId.
 void markReviewed(Id contentId, Id userId, java.util.Calendar reviewDate)
          Marks the Content identified by the given contentId value using a connection from the associated persistence manager's database container as status "Reviewed" by the user identified by userId.
 void markReviewed(Id contentId, Id userId, java.util.Calendar reviewDate, java.sql.Connection con)
          Marks the Content identified by the given contentId value using a connection from the associated persistence manager's database container as status "Reviewed" by the user identified by userId.
 void markReviewed(Id contentId, Id userId, java.sql.Connection con)
          Marks the Content identified by the given contentId value using the supplied connection as status "Reviewed" by the user identified by userId.
 void markUnreviewed(Id contentId, Id userId)
          Marks the Content identified by the given contentId value using the supplied connection as status "Not Reviewed" by the user identified by userId.
 void markUnreviewed(Id contentId, Id userId, java.sql.Connection con)
          Marks the Content identified by the given contentId value using the supplied connection as status "Not Reviewed" by the user identified by userId.
 void persist(Content target)
          Inserts or updates the supplied Content using a connection from the associated persistence manager's database container.
 void persist(Content target, java.sql.Connection con)
          Inserts or updates the supplied Content using the supplied connection.
 void reposition(Id id, int newPosition)
          Used to dictate the new position that the Content item should have using a connection from the associated persistence manager's database container.
 void reposition(Id id, int newPosition, java.sql.Connection con)
          Used to dictate the new position that the Content item should have using the supplied connection.
 
Methods inherited from interface blackboard.persist.Persister
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.getPersister(String).

See Also:
Constant Field Values
Method Detail

persist

void persist(Content target)
             throws ValidationException,
                    PersistenceException
Inserts or updates the supplied Content using a connection from the associated persistence manager's database container. If the object's Id is set and is associated with the same container, then an update is done, otherwise a new object is inserted.

Parameters:
target - Object to store.
Throws:
ValidationException - if the object is not in a consistent state to be persisted.
PersistenceException - if some other exception happens while persisting the object.

persist

void persist(Content target,
             java.sql.Connection con)
             throws ValidationException,
                    PersistenceException
Inserts or updates the supplied Content using the supplied connection. The connection must be to the same database as is used by the associated persistence manager. If the object's Id is set and is associated with this persistence manager's same container, then an update is done, otherwise a new object is inserted.

Parameters:
target - Object to store.
con - Database connection to use. This may be null
Throws:
ValidationException - if the object is not in a consistent state to be persisted.
PersistenceException - if some other exception happens while persisting the object.

deleteById

void deleteById(Id id)
                throws KeyNotFoundException,
                       PersistenceException
Deletes the Content identified by the given Id value using a connection from the associated persistence manager's database container. Note that deletes are always "deep". That means that if the object specified by id is a folder or lesson, all contained objects will also be deleted.

Parameters:
id - Id of the object to delete.
Throws:
KeyNotFoundException - is not thrown. Depending on the database used, if a matching Content item does not exist a PersistenceException might be thrown or no exception will be thrown but no rows will be affected.
PersistenceException - if some other exception happens during the delete operation

deleteById

void deleteById(Id id,
                java.sql.Connection con)
                throws KeyNotFoundException,
                       PersistenceException
Deletes the Content identified by the given Id value using the supplied connection. Note that deletes are always "deep". That means that if the object specified by id is a folder or lesson, all contained objects will also be deleted.

Parameters:
id - id of the object to delete
con - Database connection to use. This may be null
Throws:
KeyNotFoundException - is not thrown. Depending on the database used, if a matching Content item does not exist a PersistenceException might be thrown or no exception will be thrown but no rows will be affected.
PersistenceException - if some other exception happens during the delete operation

reposition

void reposition(Id id,
                int newPosition)
                throws KeyNotFoundException,
                       PersistenceException
Used to dictate the new position that the Content item should have using a connection from the associated persistence manager's database container.

Parameters:
id - The Id of the Content Item to be repositioned
newPosition - An integer representing the new position
Throws:
KeyNotFoundException - is not thrown. Depending on the database used, if a matching Content item does not exist a PersistenceException might be thrown or no exception will be thrown but no rows will be affected.
PersistenceException

reposition

void reposition(Id id,
                int newPosition,
                java.sql.Connection con)
                throws KeyNotFoundException,
                       PersistenceException
Used to dictate the new position that the Content item should have using the supplied connection.

Parameters:
id - The Id of the Content Item to be repositioned
newPosition - An integer representing the new position
Throws:
KeyNotFoundException - is not thrown. Depending on the database used, if a matching Content item does not exist a PersistenceException might be thrown or no exception will be thrown but no rows will be affected.
PersistenceException

markReviewed

void markReviewed(Id contentId,
                  Id userId)
                  throws PersistenceException,
                         ValidationException
Marks the Content identified by the given contentId value using a connection from the associated persistence manager's database container as status "Reviewed" by the user identified by userId. Marking an item "Reviewed" represents whether the user has reviewed the Content Item.

Parameters:
contentId - Id of the object to mark Reviewed.
userId - The id of the user that has Reviewed the item
Throws:
PersistenceException - if some other exception happens during the operation
ValidationException - is declared, but can not be thrown because only the Ids are passed in and the objects are never loaded to be validated.
Since:
Bb 6.3

markReviewed

void markReviewed(Id contentId,
                  Id userId,
                  java.sql.Connection con)
                  throws PersistenceException,
                         ValidationException
Marks the Content identified by the given contentId value using the supplied connection as status "Reviewed" by the user identified by userId. Marking an item "Reviewed" represents whether the user has reviewed the Content Item.

Parameters:
contentId - Id of the object to mark Reviewed.
userId - The id of the user that has Reviewed the item
Throws:
PersistenceException - if some other exception happens during the operation
ValidationException - is declared, but can not be thrown because only the Ids are passed in and the objects are never loaded to be validated.
Since:
Bb 6.3

markReviewed

void markReviewed(Id contentId,
                  Id userId,
                  java.util.Calendar reviewDate)
                  throws PersistenceException,
                         ValidationException
Marks the Content identified by the given contentId value using a connection from the associated persistence manager's database container as status "Reviewed" by the user identified by userId. This method allows the date for this action to be programatically set by specifying reviewDate.

Parameters:
contentId - Id of the object to mark Reviewed.
userId - The id of the user that has Reviewed the item
reviewDate - the Date that should be recorded
Throws:
PersistenceException - if some other exception happens during the operation
ValidationException - is declared, but can not be thrown because only the Ids are passed in and the objects are never loaded to be validated.
Since:
Bb 6.3

markReviewed

void markReviewed(Id contentId,
                  Id userId,
                  java.util.Calendar reviewDate,
                  java.sql.Connection con)
                  throws PersistenceException,
                         ValidationException
Marks the Content identified by the given contentId value using a connection from the associated persistence manager's database container as status "Reviewed" by the user identified by userId.

Parameters:
contentId - Id of the object to mark UnReviewed.
userId - The id of the user that has Reviewed the item
reviewDate - the Date that should be recorded
Throws:
PersistenceException - if some other exception happens during the operation
ValidationException - is declared, but can not be thrown because only the Ids are passed in and the objects are never loaded to be validated.
Since:
Bb 6.3

markUnreviewed

void markUnreviewed(Id contentId,
                    Id userId)
                    throws PersistenceException,
                           ValidationException
Marks the Content identified by the given contentId value using the supplied connection as status "Not Reviewed" by the user identified by userId.

Parameters:
contentId - Id of the object to mark UnReviewed.
userId - The id of the user
Throws:
PersistenceException - if some other exception happens during the operation
ValidationException - is declared, but can not be thrown because only the Ids are passed in and the objects are never loaded to be validated.
Since:
Bb 6.3

markUnreviewed

void markUnreviewed(Id contentId,
                    Id userId,
                    java.sql.Connection con)
                    throws PersistenceException,
                           ValidationException
Marks the Content identified by the given contentId value using the supplied connection as status "Not Reviewed" by the user identified by userId.

Parameters:
contentId - Id of the object to mark Reviewed.
userId - The id of the user
Throws:
PersistenceException - if some other exception happens during the operation
ValidationException - is declared, but can not be thrown because only the Ids are passed in and the objects are never loaded to be validated.
Since:
Bb 6.3

handleContentNotification

void handleContentNotification(Content content)
                               throws PersistenceException,
                                      ValidationException
Handles add, update and delete of notification for contents.

Throws:
PersistenceException
ValidationException


Copyright © 2012 Blackboard, Inc. All Rights Reserved.