public interface CommentAdminSession extends OsidSession
This session creates, updates, and deletes Comments.
The
data for create and update is provided by the consumer via the form
object. OsidForms
are requested for each create or update
and may not be reused.
Create and update operations differ in their usage. To create a
Comment,
a CommentForm
is requested using
getCommentFormForCreate()
specifying the desired relationship
peers and record Types
or none if no record Types
are needed. The returned CommentForm
will indicate
that it is to be used with a create operation and can be used to examine
metdata or validate data prior to creation. Once the CommentForm
is submiited to a create operation, it cannot be reused with
another create operation unless the first operation was unsuccessful. Each
CommentForm
corresponds to an attempted transaction.
For updates, CommentForms
are requested to the
Comment
Id
that is to be updated using
getCommentFormForUpdate().
Similarly, the CommentForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The CommentForm
can only be used once for a successful update and cannot be reused.
The delete operations delete Comments.
To unmap a
Comment
from the current Book,
the
CommentBookAssignmentSession
should be used. These delete
operations attempt to remove the Comment
itself thus
removing it from all known Book
catalogs.
This session includes an Id
aliasing mechanism to
assign an external Id
to an internally assigned Id.
Modifier and Type | Method and Description |
---|---|
void |
aliasComment(Id commentId,
Id aliasId)
Adds an
Id to a Comment for the purpose
of creating compatibility. |
boolean |
canCreateComments()
Tests if this user can create comments.
|
boolean |
canCreateCommentWithRecordTypes(Type[] commentRecordTypes)
Tests if this user can create a single
Comment using
the desired record types. |
boolean |
canDeleteComments()
Tests if this user can delete comments.
|
boolean |
canManageCommentAliases()
Tests if this user can manage
Id aliases for
Comnents. |
boolean |
canUpdateComments()
Tests if this user can update comments.
|
Comment |
createComment(CommentForm commentForm)
Creates a new
Comment. |
void |
deleteComment(Id commentId)
Deletes a
Comment. |
Book |
getBook()
Gets the
Book associated with this session. |
Id |
getBookId()
Gets the
Book Id associated with this
session. |
CommentForm |
getCommentFormForCreate(Id referenceId,
Type[] commentRecordTypes)
Gets the comment form for creating new comments.
|
CommentForm |
getCommentFormForUpdate(Id commentId)
Gets the comment form for updating an existing comment.
|
void |
updateComment(CommentForm commentForm)
Updates an existing comment.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getBookId()
Book
Id
associated with this
session. Book Id
associated with this sessionmandatory
- This method must be implemented. Book getBook() throws OperationFailedException, PermissionDeniedException
Book
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateComments()
Comment
will result in a
PERMISSION_DENIED.
This is intended as a hint to an
application that may not wish to offer create operations to
unauthorized users. false
if Comment
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateCommentWithRecordTypes(Type[] commentRecordTypes)
Comment
using
the desired record types. While
CommentingManager.getCommentRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Comment.
Providing
an empty array tests if a Comment
can be created with
no records.commentRecordTypes
- array of comment record types true
if Comment
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- commentRecordTypes
is null
mandatory
- This method must be implemented. CommentForm getCommentFormForCreate(Id referenceId, Type[] commentRecordTypes) throws OperationFailedException, PermissionDeniedException
referenceId
- the Id
for the reference objectcommentRecordTypes
- array of comment record typesNullArgumentException
- referenceId or
commentRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Comment createComment(CommentForm commentForm) throws OperationFailedException, PermissionDeniedException
Comment.
commentForm
- the form for this Comment
Comment
IllegalStateException
- commentForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- commentForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- commentForm
did
not originate from getCommentFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateComments()
Comment
will result in a
PERMISSION_DENIED.
This is intended as a hint to an
application that may not wish to offer update operations to
unauthorized users. false
if Comment
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. CommentForm getCommentFormForUpdate(Id commentId) throws NotFoundException, OperationFailedException, PermissionDeniedException
commentId
- the Id
of the Comment
NotFoundException
- commentId
is not
foundNullArgumentException
- commentId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateComment(CommentForm commentForm) throws OperationFailedException, PermissionDeniedException
commentForm
- the form containing the elements to be updatedIllegalStateException
- commentForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- commentForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- commentForm
did
not originate from getCommentFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteComments()
Comment
will result in a
PERMISSION_DENIED.
This is intended as a hint to an
application that may not wish to offer delete operations to
unauthorized users. false
if Comment
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteComment(Id commentId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Comment.
commentId
- the Id
of the Comment
to removeNotFoundException
- commentId
not foundNullArgumentException
- commentId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageCommentAliases()
Id
aliases for
Comnents.
A return of true does not guarantee successful
authorization. A return of false indicates that it is known changing
an alias will result in a PERMISSION_DENIED.
This is
intended as a hint to an application that may opt not to offer alias
operations to an unauthorized user. false
if Comment
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasComment(Id commentId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Comment
for the purpose
of creating compatibility. The primary Id
of the
Comment
is determined by the provider. The new Id
performs as an alias to the primary Id.
If the
alias is a pointer to another comment, it is reassigned to the given
comment Id.
commentId
- the Id
of a Comment
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- commentId
not foundNullArgumentException
- commentId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.