Interface CommentBookAssignmentSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session provides methods to re-assign Comments to
Books . A Comment may map to multiple Books and removing
the last reference to a Comment is the equivalent of deleting it.
Each Book may have its own authorizations governing who is allowed
to operate on it.
Adding a reference of a Comment to another Book is not
a copy operation (eg: does not change its Id ).
-
Method Summary
Modifier and TypeMethodDescriptionvoidassignCommentToBook(Id commentId, Id bookId) Adds an existingCommentto aBook.booleanTests if this user can alter comment/book mappings.booleancanAssignCommentsToBook(Id bookId) Tests if this user can alter comment/book mappings.getAssignableBookIds(Id bookId) Gets a list of books including and under the given book node in which any comment can be assigned.getAssignableBookIdsForComment(Id bookId, Id commentId) Gets a list of books including and under the given book node in which a specific comment can be assigned.voidreassignCommentToBook(Id commentId, Id fromBookId, Id toBookId) Moves aCreditfrom oneBookto another.voidunassignCommentFromBook(Id commentId, Id bookId) Removes aCommentfrom aBook.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
canAssignComments
boolean canAssignComments()Tests if this user can alter comment/book mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users.- Returns:
falseif mapping is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canAssignCommentsToBook
Tests if this user can alter comment/book mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users.- Parameters:
bookId- theIdof theBook- Returns:
falseif mapping is not authorized,trueotherwise- Throws:
NullArgumentException-bookIdisnull- Compliance:
mandatory- This method must be implemented.
-
getAssignableBookIds
Gets a list of books including and under the given book node in which any comment can be assigned.- Parameters:
bookId- theIdof theBook- Returns:
- list of assignable book
Ids - Throws:
NullArgumentException-bookIdisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
getAssignableBookIdsForComment
Gets a list of books including and under the given book node in which a specific comment can be assigned.- Parameters:
bookId- theIdof theBookcommentId- theIdof theComment- Returns:
- list of assignable book
Ids - Throws:
NullArgumentException-bookIdorcommentIdisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
assignCommentToBook
void assignCommentToBook(Id commentId, Id bookId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds an existingCommentto aBook.- Parameters:
commentId- theIdof theCommentbookId- theIdof theBook- Throws:
AlreadyExistsException-commentIdis already assigned tobookIdNotFoundException-commentIdorbookIdnot foundNullArgumentException-commentIdorbookIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
unassignCommentFromBook
void unassignCommentFromBook(Id commentId, Id bookId) throws NotFoundException, OperationFailedException, PermissionDeniedException Removes aCommentfrom aBook.- Parameters:
commentId- theIdof theCommentbookId- theIdof theBook- Throws:
NotFoundException-commentIdorbookIdnot found orcommentIdnot assigned tobookIdNullArgumentException-commentIdorbookIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
reassignCommentToBook
void reassignCommentToBook(Id commentId, Id fromBookId, Id toBookId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Moves aCreditfrom oneBookto another. Mappings to otherBooksare unaffected.- Parameters:
commentId- theIdof theCommentfromBookId- theIdof the currentBooktoBookId- theIdof the destinationBook- Throws:
AlreadyExistsException-commentIdalready assigned totoBookIdNotFoundException-commentId, fromBookId, ortoBookIdnot found orcommentnot mapped tofromBookIdNullArgumentException-commentId, bookIdId, ortoBookIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-