Book¶
Book¶
-
class
dlkit.services.commenting.Book(provider_manager, catalog, runtime, proxy, **kwargs)¶ Bases:
dlkit.osid.objects.OsidCatalog,dlkit.osid.sessions.OsidSessionA
Bookrepresents a collection of comments.Like all OSID objects, a
Bookis identified by itsIdand any persisted references should use theId.-
get_book_record(book_record_type)¶ Gets the book record corresponding to the given
BookrecordType.This method is used to retrieve an object implementing the requested record. The
book_record_typemay be theTypereturned inget_record_types()or any of its parents in aTypehierarchy wherehas_record_type(book_record_type)istrue.Parameters: book_record_type ( osid.type.Type) – the type of book record to retrieveReturns: the book record Return type: osid.commenting.records.BookRecordRaise: NullArgument–book_record_typeisnullRaise: OperationFailed– unable to complete requestRaise: Unsupported–has_record_type(book_record_type)isfalsecompliance: mandatory – This method must be implemented.
-
Comment Lookup Methods¶
Book.book_id¶Gets the
BookIdassociated with this session.
Returns: the Book Idassociated with this sessionReturn type: osid.id.Idcompliance: mandatory – This method must be implemented.
Book.book¶Gets the
Bookassociated with this session.
Returns: the book Return type: osid.commenting.BookRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.can_lookup_comments()¶Tests if this user can examine this book.
A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a
PermissionDenied. This is intended as a hint to an application that may opt not to offer these operations.
Returns: falseif book reading methods are not authorized,trueotherwiseReturn type: booleancompliance: mandatory – This method must be implemented.
Book.use_comparative_comment_view()¶The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error.
This view is used when greater interoperability is desired at the expense of precision.
compliance: mandatory – This method is must be implemented.
Book.use_plenary_comment_view()¶A complete view of the
Commentreturns is desired.Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability.
compliance: mandatory – This method is must be implemented.
Book.use_federated_book_view()¶Federates the view for methods in this session.
A federated view will include comments in books which are children of this book in the book hierarchy.
compliance: mandatory – This method is must be implemented.
Book.use_isolated_book_view()¶Isolates the view for methods in this session.
An isolated view restricts searches to this book only.
compliance: mandatory – This method is must be implemented.
Book.use_effective_comment_view()¶Only comments whose effective dates are current are returned by methods in this session.
compliance: mandatory – This method is must be implemented.
Book.use_any_effective_comment_view()¶All comments of any effective dates are returned by all methods in this session.
compliance: mandatory – This method is must be implemented.
Book.get_comment(comment_id)¶Gets the
Commentspecified by itsId.
Parameters: comment_id ( osid.id.Id) – theIdof theCommentto retrieveReturns: the returned CommentReturn type: osid.commenting.CommentRaise: NotFound– noCommentfound with the givenIdRaise: NullArgument–comment_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_by_ids(comment_ids)¶Gets a
CommentListcorresponding to the givenIdList.
Parameters: comment_ids ( osid.id.IdList) – the list ofIdsto retrieveReturns: the returned Comment listReturn type: osid.commenting.CommentListRaise: NotFound– anId wasnot foundRaise: NullArgument–comment_idsisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_by_genus_type(comment_genus_type)¶Gets a
CommentListcorresponding to the given comment genusTypewhich does not include comments of genus types derived from the specifiedType.
Parameters: comment_genus_type ( osid.type.Type) – a comment genus typeReturns: the returned CommentlistReturn type: osid.commenting.CommentListRaise: NullArgument–comment_genus_typeisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_by_parent_genus_type(comment_genus_type)¶Gets a
CommentListcorresponding to the given comment genusTypeand include any additional comments with genus types derived from the specifiedType.
Parameters: comment_genus_type ( osid.type.Type) – a comment genus typeReturns: the returned CommentlistReturn type: osid.commenting.CommentListRaise: NullArgument–comment_genus_typeisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_by_record_type(comment_record_type)¶Gets a
CommentListcontaining the given comment recordType.
Parameters: comment_record_type ( osid.type.Type) – a comment record typeReturns: the returned CommentlistReturn type: osid.commenting.CommentListRaise: NullArgument–comment_record_typeisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_on_date(from_, to)¶Gets a
CommentListeffective during the entire given date range inclusive but not confined to the date range.
Parameters:
- from (
osid.calendaring.DateTime) – starting date- to (
osid.calendaring.DateTime) – ending dateReturns: the returned
CommentlistReturn type:
osid.commenting.CommentListRaise:
InvalidArgument–fromis greater thantoRaise:
NullArgument–fromortoisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_by_genus_type_on_date(comment_genus_type, from_, to)¶Gets a
CommentListof a given genus type and effective during the entire given date range inclusive but not confined to the date range.
Parameters:
- comment_genus_type (
osid.type.Type) – a comment genus type- from (
osid.calendaring.DateTime) – starting date- to (
osid.calendaring.DateTime) – ending dateReturns: the returned
CommentlistReturn type:
osid.commenting.CommentListRaise:
InvalidArgument–fromis greater thantoRaise:
NullArgument–comment_genus_type, from,ortoisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_for_commentor(resource_id)¶Gets a list of comments corresponding to a resource
Id.
Parameters: resource_id ( osid.id.Id) – theIdof the resourceReturns: the returned CommentListReturn type: osid.commenting.CommentListRaise: NullArgument–resource_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_for_commentor_on_date(resource_id, from_, to)¶Gets a list of all comments corresponding to a resource
Idand effective during the entire given date range inclusive but not confined to the date range.
Parameters:
- resource_id (
osid.id.Id) – theIdof the resource- from (
osid.calendaring.DateTime) – from date- to (
osid.calendaring.DateTime) – to dateReturns: the returned
CommentListReturn type:
osid.commenting.CommentListRaise:
InvalidArgument–tois less thanfromRaise:
NullArgument–resource_id, from,ortoisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_by_genus_type_for_commentor(resource_id, comment_genus_type)¶Gets a list of comments of the given genus type corresponding to a resource
Id.
Parameters:
- resource_id (
osid.id.Id) – theIdof the resource- comment_genus_type (
osid.type.Type) – the comment genus typeReturns: the returned
CommentListReturn type:
osid.commenting.CommentListRaise:
NullArgument–resource_idorcomment_genus_typeisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_by_genus_type_for_commentor_on_date(resource_id, comment_genus_type, from_, to)¶Gets a list of all comments of the given genus type corresponding to a resource
Idand effective during the entire given date range inclusive but not confined to the date range.
Parameters:
- resource_id (
osid.id.Id) – theIdof the resource- comment_genus_type (
osid.type.Type) – the comment genus type- from (
osid.calendaring.DateTime) – from date- to (
osid.calendaring.DateTime) – to dateReturns: the returned
CommentListReturn type:
osid.commenting.CommentListRaise:
InvalidArgument–tois less thanfromRaise:
NullArgument–resource_id, comment_genus_type, from,ortoisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_for_reference(reference_id)¶Gets a list of comments corresponding to a reference
Id.
Parameters: reference_id ( osid.id.Id) – theIdof the referenceReturns: the returned CommentListReturn type: osid.commenting.CommentListRaise: NullArgument–reference_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_for_reference_on_date(reference_id, from_, to)¶Gets a list of all comments corresponding to a reference
Idand effective during the entire given date range inclusive but not confined to the date range.
Parameters:
- reference_id (
osid.id.Id) – a referenceId- from (
osid.calendaring.DateTime) – from date- to (
osid.calendaring.DateTime) – to dateReturns: the returned
CommentListReturn type:
osid.commenting.CommentListRaise:
InvalidArgument–tois less thanfromRaise:
NullArgument–reference_id, from,ortoisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_by_genus_type_for_reference(reference_id, comment_genus_type)¶Gets a list of comments of the given genus type corresponding to a reference
Id.
Parameters:
- reference_id (
osid.id.Id) – theIdof the reference- comment_genus_type (
osid.type.Type) – the comment genus typeReturns: the returned
CommentListReturn type:
osid.commenting.CommentListRaise:
NullArgument–reference_idorcomment_genus_typeisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_by_genus_type_for_reference_on_date(reference_id, comment_genus_type, from_, to)¶Gets a list of all comments of the given genus type corresponding to a reference
Idand effective during the entire given date range inclusive but not confined to the date range.
Parameters:
- reference_id (
osid.id.Id) – a referenceId- comment_genus_type (
osid.type.Type) – the comment genus type- from (
osid.calendaring.DateTime) – from date- to (
osid.calendaring.DateTime) – to dateReturns: the returned
CommentListReturn type:
osid.commenting.CommentListRaise:
InvalidArgument–tois less thanfromRaise:
NullArgument–reference_id, comment_genus_type, from,ortoisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_for_commentor_and_reference(resource_id, reference_id)¶Gets a list of comments corresponding to a resource and reference
Id.
Parameters:
- resource_id (
osid.id.Id) – theIdof the resource- reference_id (
osid.id.Id) – theIdof the referenceReturns: the returned
CommentListReturn type:
osid.commenting.CommentListRaise:
NullArgument–resource_idorreference_idisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_for_commentor_and_reference_on_date(resource_id, reference_id, from_, to)¶Gets a list of all comments corresponding to a resource and reference
Idand effective during the entire given date range inclusive but not confined to the date range.
Parameters:
- resource_id (
osid.id.Id) – theIdof the resource- reference_id (
osid.id.Id) – a referenceId- from (
osid.calendaring.DateTime) – from date- to (
osid.calendaring.DateTime) – to dateReturns: the returned
CommentListReturn type:
osid.commenting.CommentListRaise:
InvalidArgument–tois less thanfromRaise:
NullArgument–resource_id, reference_id, from,ortoisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_by_genus_type_for_commentor_and_reference(resource_id, reference_id, comment_genus_type)¶Gets a list of comments of the given genus type corresponding to a resource and reference
Id.
Parameters:
- resource_id (
osid.id.Id) – theIdof the resource- reference_id (
osid.id.Id) – theIdof the reference- comment_genus_type (
osid.type.Type) – the comment genus typeReturns: the returned
CommentListReturn type:
osid.commenting.CommentListRaise:
NullArgument–resource_id, reference_idorcomment_genus_typeisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.get_comments_by_genus_type_for_commentor_and_reference_on_date(resource_id, reference_id, comment_genus_type, from_, to)¶Gets a list of all comments corresponding to a resource and reference
Idand effective during the entire given date range inclusive but not confined to the date range.
Parameters:
- resource_id (
osid.id.Id) – theIdof the resource- reference_id (
osid.id.Id) – a referenceId- comment_genus_type (
osid.type.Type) – the comment genus type- from (
osid.calendaring.DateTime) – from date- to (
osid.calendaring.DateTime) – to dateReturns: the returned
CommentListReturn type:
osid.commenting.CommentListRaise:
InvalidArgument–tois less thanfromRaise:
NullArgument–resource_id, reference_id, comment_genus_type, from,ortoisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.comments¶Gets all comments.
Returns: a list of comments Return type: osid.commenting.CommentListRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Comment Query Methods¶
Book.book_idGets the
BookIdassociated with this session.
Returns: the Book Idassociated with this sessionReturn type: osid.id.Idcompliance: mandatory – This method must be implemented.
Book.bookGets the
Bookassociated with this session.
Returns: the book Return type: osid.commenting.BookRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.can_search_comments()¶Tests if this user can perform comment searches.
A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a
PermissionDenied. This is intended as a hint to an application that may not wish to offer search operations to unauthorized users.
Returns: falseif search methods are not authorized,trueotherwiseReturn type: booleancompliance: mandatory – This method must be implemented.
Book.use_federated_book_view()Federates the view for methods in this session.
A federated view will include comments in books which are children of this book in the book hierarchy.
compliance: mandatory – This method is must be implemented.
Book.use_isolated_book_view()Isolates the view for methods in this session.
An isolated view restricts searches to this book only.
compliance: mandatory – This method is must be implemented.
Book.comment_query¶Gets a comment query.
Returns: the comment query Return type: osid.commenting.CommentQuerycompliance: mandatory – This method must be implemented.
Book.get_comments_by_query(comment_query)¶Gets a list of comments matching the given search.
Parameters: comment_query ( osid.commenting.CommentQuery) – the search query arrayReturns: the returned CommentListReturn type: osid.commenting.CommentListRaise: NullArgument–comment_queryisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failureRaise: Unsupported–comment_queryis not of this servicecompliance: mandatory – This method must be implemented.
Comment Admin Methods¶
Book.book_idGets the
BookIdassociated with this session.
Returns: the Book Idassociated with this sessionReturn type: osid.id.Idcompliance: mandatory – This method must be implemented.
Book.bookGets the
Bookassociated with this session.
Returns: the book Return type: osid.commenting.BookRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.can_create_comments()¶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
Commentwill result in aPermissionDenied. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.
Returns: falseifCommentcreation is not authorized,trueotherwiseReturn type: booleancompliance: mandatory – This method must be implemented.
Book.can_create_comment_with_record_types(comment_record_types)¶Tests if this user can create a single
Commentusing 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 specificComment. Providing an empty array tests if aCommentcan be created with no records.
Parameters: comment_record_types ( osid.type.Type[]) – array of comment record typesReturns: trueifCommentcreation using the specified recordTypesis supported,falseotherwiseReturn type: booleanRaise: NullArgument–comment_record_typesisnullcompliance: mandatory – This method must be implemented.
Book.get_comment_form_for_create(reference_id, comment_record_types)¶Gets the comment form for creating new comments.
A new form should be requested for each create transaction.
Parameters:
- reference_id (
osid.id.Id) – theIdfor the reference object- comment_record_types (
osid.type.Type[]) – array of comment record typesReturns: the comment form
Return type:
osid.commenting.CommentFormRaise:
NullArgument–reference_id or comment_record_typesisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failureRaise:
Unsupported– unable to get form for requested record typescompliance: mandatory – This method must be implemented.
Book.create_comment(comment_form)¶Creates a new
Comment.
Parameters: comment_form ( osid.commenting.CommentForm) – the form for thisCommentReturns: the new CommentReturn type: osid.commenting.CommentRaise: IllegalState–comment_formalready used in a create transactionRaise: InvalidArgument– one or more of the form elements is invalidRaise: NullArgument–comment_formisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failureRaise: Unsupported–comment_formdid not originate fromget_comment_form_for_create()compliance: mandatory – This method must be implemented.
Book.can_update_comments()¶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
Commentwill result in aPermissionDenied. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.
Returns: falseifCommentmodification is not authorized,trueotherwiseReturn type: booleancompliance: mandatory – This method must be implemented.
Book.get_comment_form_for_update(comment_id)¶Gets the comment form for updating an existing comment.
A new comment form should be requested for each update transaction.
Parameters: comment_id ( osid.id.Id) – theIdof theCommentReturns: the comment form Return type: osid.commenting.CommentFormRaise: NotFound–comment_idis not foundRaise: NullArgument–comment_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.update_comment(comment_form)¶Updates an existing comment.
Parameters: comment_form ( osid.commenting.CommentForm) – the form containing the elements to be updatedRaise: IllegalState–comment_formalready used in an update transactionRaise: InvalidArgument– the form contains an invalid valueRaise: NullArgument–comment_formisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failureRaise: Unsupported–comment_formdid not originate fromget_comment_form_for_update()compliance: mandatory – This method must be implemented.
Book.can_delete_comments()¶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
Commentwill result in aPermissionDenied. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.
Returns: falseifCommentdeletion is not authorized,trueotherwiseReturn type: booleancompliance: mandatory – This method must be implemented.
Book.delete_comment(comment_id)¶Deletes a
Comment.
Parameters: comment_id ( osid.id.Id) – theIdof theCommentto removeRaise: NotFound–comment_idnot foundRaise: NullArgument–comment_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.
Book.can_manage_comment_aliases()¶Tests if this user can manage
Idaliases forComnents.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
PermissionDenied. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.
Returns: falseifCommentaliasing is not authorized,trueotherwiseReturn type: booleancompliance: mandatory – This method must be implemented.
Book.alias_comment(comment_id, alias_id)¶Adds an
Idto aCommentfor the purpose of creating compatibility.The primary
Idof theCommentis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another comment, it is reassigned to the given commentId.
Parameters:
- comment_id (
osid.id.Id) – theIdof aComment- alias_id (
osid.id.Id) – the aliasIdRaise:
AlreadyExists–alias_idis already assignedRaise:
NotFound–comment_idnot foundRaise:
NullArgument–comment_idoralias_idisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failurecompliance: mandatory – This method must be implemented.