Interface RatingLookupSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session defines methods for retrieving ratings.
This lookup session defines several views:
- comparative view: elements may be silently omitted or re-ordered
- plenary view: provides a complete result set or is an error condition
- isolated book view: All comment methods in this session operate,
retrieve and pertain to comments defined explicitly in the current
book. Using an isolated view is useful for managing comments with the
CommentAdminSession. - federated book view: All comment lookup methods in this session operate, retrieve and pertain to all comments defined in this book and any other books implicitly available in this book through book inheritence.
The methods useFederatedBookView() and
useIsolatedBookView() behave as a radio group and one should be selected
before invoking any lookup methods.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if this user can examine this book.getBook()Gets theBookassociated with this session.Gets theBookIdassociated with this session.Gets the cumulative rating for all the references in this book.getCumulativeRatingForCommentor(Id resourceId) Gets the cumulative rating for a commentor.getCumulativeRatingForReference(Id referenceId) Gets the cumulative rating for a reference.getReferences(Id gradeId) Gets the references with ratings equal to or higher than the given grade.getTopReferences(long max) Gets the top rated references in this book.voidThe returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error.voidFederates the view for methods in this session.voidIsolates the view for methods in this session.voidA complete view of theCommentreturns is desired.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
-
getBookId
Id getBookId()Gets theBookIdassociated with this session.- Returns:
- the
Book Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getBook
Gets theBookassociated with this session.- Returns:
- the book
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canLookupRatings
boolean canLookupRatings()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 aPERMISSION_DENIED. 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,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
useComparativeCommentView
void useComparativeCommentView()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.
-
usePlenaryCommentView
void usePlenaryCommentView()A complete view of theCommentreturns 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.
-
useFederatedBookView
void useFederatedBookView()Federates the view for methods in this session. A federated view will include ratings in books which are children of this book in the book hierarchy.- Compliance:
mandatory- This method is must be implemented.
-
useIsolatedBookView
void useIsolatedBookView()Isolates the view for methods in this session. An isolated view restricts retrievals to this book only.- Compliance:
mandatory- This method is must be implemented.
-
getCumulativeRating
Gets the cumulative rating for all the references in this book.- Returns:
- the cumulative rating
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getCumulativeRatingForReference
Grade getCumulativeRatingForReference(Id referenceId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the cumulative rating for a reference.- Parameters:
referenceId- theIdof the reference- Returns:
- the cumulative rating
- Throws:
NotFoundException- no reference found with the givenIdNullArgumentException-referenceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getCumulativeRatingForCommentor
Grade getCumulativeRatingForCommentor(Id resourceId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the cumulative rating for a commentor.- Parameters:
resourceId- theIdof the resource- Returns:
- the cumulative rating
- Throws:
NotFoundException- no resource found with the givenIdNullArgumentException-resourceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getTopReferences
Gets the top rated references in this book.- Parameters:
max- the maximum number to return- Returns:
- the top references
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getReferences
Grade getReferences(Id gradeId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the references with ratings equal to or higher than the given grade.- Parameters:
gradeId- theIdof the grade- Returns:
- the cumulative rating
- Throws:
NotFoundException- no reference found with the givenIdNullArgumentException-referenceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-