OSID Logo
OSID Specifications
commenting package
Version 3.0.0
Release Candidate Preview
Interfaceosid.commenting.CommentAdminSession
Implementsosid.OsidSession
Description

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.

MethodgetBookId
Description

Gets the Book Id associated with this session.

Returnosid.id.Idthe Book Id associated with this session
CompliancemandatoryThis method must be implemented.
MethodgetBook
Description

Gets the Book associated with this session.

Returnosid.commenting.Bookthe book
ErrorsOPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodcanCreateComments
Description

Tests if this user can create comments. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a 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.

Returnboolean false if Comment creation is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodcanCreateCommentWithRecordTypes
Description

Tests if this user can create a single 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.

Parametersosid.type.Type[]commentRecordTypesarray of comment record types
Returnboolean true if Comment creation using the specified record Types is supported, false otherwise
ErrorsNULL_ARGUMENT commentRecordTypes is null
CompliancemandatoryThis method must be implemented.
MethodgetCommentFormForCreate
Description

Gets the comment form for creating new comments. A new form should be requested for each create transaction.

Parametersosid.id.IdreferenceIdthe Id for the reference object
osid.type.Type[]commentRecordTypesarray of comment record types
Returnosid.commenting.CommentFormthe comment form
ErrorsNULL_ARGUMENT referenceId or commentRecordTypes is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTEDunable to get form for requested record types
CompliancemandatoryThis method must be implemented.
MethodcreateComment
Description

Creates a new Comment.

Parametersosid.commenting.CommentFormcommentFormthe form for this Comment
Returnosid.commenting.Commentthe new Comment
ErrorsILLEGAL_STATE commentForm already used in a create transaction
INVALID_ARGUMENTone or more of the form elements is invalid
NULL_ARGUMENT commentForm is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED commentForm did not originate from getCommentFormForCreate()
CompliancemandatoryThis method must be implemented.
MethodcanUpdateComments
Description

Tests if this user can update comments. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a 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.

Returnboolean false if Comment modification is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodgetCommentFormForUpdate
Description

Gets the comment form for updating an existing comment. A new comment form should be requested for each update transaction.

Parametersosid.id.IdcommentIdthe Id of the Comment
Returnosid.commenting.CommentFormthe comment form
ErrorsNOT_FOUND commentId is not found
NULL_ARGUMENT commentId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodupdateComment
Description

Updates an existing comment.

Parametersosid.commenting.CommentFormcommentFormthe form containing the elements to be updated
ErrorsILLEGAL_STATE commentForm already used in an update transaction
INVALID_ARGUMENTthe form contains an invalid value
NULL_ARGUMENT commentForm is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED commentForm did not originate from getCommentFormForUpdate()
CompliancemandatoryThis method must be implemented.
MethodcanDeleteComments
Description

Tests if this user can delete comments. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an 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.

Returnboolean false if Comment deletion is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethoddeleteComment
Description

Deletes a Comment.

Parametersosid.id.IdcommentIdthe Id of the Comment to remove
ErrorsNOT_FOUND commentId not found
NULL_ARGUMENT commentId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodcanManageCommentAliases
Description

Tests if this user can manage 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.

Returnboolean false if Comment aliasing is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodaliasComment
Description

Adds an 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.

Parametersosid.id.IdcommentIdthe Id of a Comment
osid.id.IdaliasIdthe alias Id
ErrorsALREADY_EXISTS aliasId is already assigned
NOT_FOUND commentId not found
NULL_ARGUMENT commentId or aliasId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.