Interface CommentBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, CommentAdminSession, OsidSession, OsidSession
This session creates, updates, and deletes Comments in bulk.
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
getCommentFormsForCreate() specifying the desired reference and and
record Types or none if no record Types are needed. Each
of the returned CommentForms 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 a 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.
The CommentForms returned from
getCommentFormsForCreate() may be linked to the originating request
through the peer Ids of the CommentForm . In the case
where there may be duplicates, any CommentForm of the same peer
Ids may be used for a create operation.
Once a batch of CommentForms are submitted for create, a
CreateResponse is returned for each CommentForm , although
the ordering is not defined. Only errors that pertain to the entire create
operation are returned from createComments() , errors specific to
an individual CommentForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the
originating CommentForm through the CommentForm Id
.
For updates, CommentForms are requested to the Comment
Id that is to be updated using getCommentFormsForUpdate()
where the reference Id in the CommentForm may be used to
link the request. 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.
Once a batch of CommentForms are submitted for update, an
UpdateResponse is returned for each CommentForm , although
the ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateComments() , errors specific to
an individual CommentForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the
originating CommentForm through the CommentForm Id
.
The delete operations delete Comments in bulk. 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. Bulk delete operations return the results in
DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasComments(AliasRequestList aliasRequests) Adds anIdto aCommentfor the purpose of creating compatibility.createComments(CommentBatchFormList commentForms) Creates a new set ofComments.Deletes allCommentsin thisBook.deleteComments(IdList commentIds) Deletes comments for the givenIds.deleteCommentsForCommentor(Id commentorId) Deletes comments for the given commentor.deleteCommentsForReference(Id referenceId) Deletes comments for the given reference.Deletes comments expired before the given date.getCommentFormsForCreate(IdList referenceIds, Type[] commentRecordTypes) Gets the comment forms for creating a bunch of new comments.getCommentFormsForUpdate(IdList commentIds) Gets the comment forms for updating an existing set of comments.updateComments(CommentBatchFormList commentForms) Updates existing comments.Methods inherited from interface CommentAdminSession
aliasComment, canCreateComments, canCreateCommentWithRecordTypes, canDeleteComments, canManageCommentAliases, canUpdateComments, createComment, deleteComment, getBook, getBookId, getCommentFormForCreate, getCommentFormForUpdate, updateCommentModifier and TypeMethodDescriptionvoidaliasComment(Id commentId, Id aliasId) Adds anIdto aCommentfor the purpose of creating compatibility.booleanTests if this user can create comments.booleancanCreateCommentWithRecordTypes(Type[] commentRecordTypes) Tests if this user can create a singleCommentusing the desired record types.booleanTests if this user can delete comments.booleanTests if this user can manageIdaliases forComnents.booleanTests if this user can update comments.createComment(CommentForm commentForm) Creates a newComment.voiddeleteComment(Id commentId) Deletes aComment.getBook()Gets theBookassociated with this session.Gets theBookIdassociated with this session.getCommentFormForCreate(Id referenceId, Type[] commentRecordTypes) Gets the comment form for creating new comments.getCommentFormForUpdate(Id commentId) Gets the comment form for updating an existing comment.voidupdateComment(CommentForm commentForm) Updates an existing comment.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
-
getCommentFormsForCreate
CommentBatchFormList getCommentFormsForCreate(IdList referenceIds, Type[] commentRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the comment forms for creating a bunch of new comments. A form is returned for each supplied reference.- Parameters:
referenceIds- the referenceIdscommentRecordTypes- array of comment record types to be included in each create operation or an empty list if none- Returns:
- the comment forms
- Throws:
NotFoundException- areferenceIdis not foundNullArgumentException-commentRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createComments
CreateResponseList createComments(CommentBatchFormList commentForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofComments. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
commentForms- the comment forms- Returns:
- the create responses
- Throws:
NullArgumentException-commentFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getCommentFormsForUpdate
CommentBatchFormList getCommentFormsForUpdate(IdList commentIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the comment forms for updating an existing set of comments. A new comment form should be requested for each update transaction.- Parameters:
commentIds- theIdsof theComment- Returns:
- the comment form
- Throws:
NotFoundException- acommentIdis not foundNullArgumentException-commentIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateComments
UpdateResponseList updateComments(CommentBatchFormList commentForms) throws OperationFailedException, PermissionDeniedException Updates existing comments. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
commentForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-commentFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllComments
Deletes allCommentsin thisBook.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteComments
DeleteResponseList deleteComments(IdList commentIds) throws OperationFailedException, PermissionDeniedException Deletes comments for the givenIds.- Parameters:
commentIds- theIdsof the comments to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-commentIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteCommentsForReference
DeleteResponseList deleteCommentsForReference(Id referenceId) throws OperationFailedException, PermissionDeniedException Deletes comments for the given reference.- Parameters:
referenceId- theIdof a reference- Returns:
- the delete responses
- Throws:
NullArgumentException-referenceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteCommentsForCommentor
DeleteResponseList deleteCommentsForCommentor(Id commentorId) throws OperationFailedException, PermissionDeniedException Deletes comments for the given commentor.- Parameters:
commentorId- theIdof a commentor- Returns:
- the delete responses
- Throws:
NullArgumentException-commentorIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteIneffectiveCommentsByDate
DeleteResponseList deleteIneffectiveCommentsByDate(DateTime date) throws OperationFailedException, PermissionDeniedException Deletes comments expired before the given date.- Parameters:
date- a date- Returns:
- the delete responses
- Throws:
NullArgumentException-dateisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasComments
AliasResponseList aliasComments(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aCommentfor the purpose of creating compatibility. The primaryIdof theCommentis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another comment, it is reassigned to the given entryId.- Parameters:
aliasRequests- the alias requests- Returns:
- the alias responses
- Throws:
NullArgumentException-aliasRequestsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-