Interface GradebookAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
GradebookBatchAdminSession
This session creates, updates, and deletes Gradebooks . 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
Gradebook , a GradebookForm is requested using
getGradebookFormForCreate() specifying the desired record Types
or none if no record Types are needed. The returned
GradebookForm 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 GradebookForm is submiited to a create operation, it
cannot be reused with another create operation unless the first operation
was unsuccessful. Each GradebookForm corresponds to an attempted
transaction.
For updates, GradebookForms are requested to the
Gradebook Id that is to be updated using
getGradebookFormForUpdate() . Similarly, the GradebookForm has
metadata about the data that can be updated and it can perform validation
before submitting the update. The GradebookForm can only be used
once for a successful update and cannot be reused.
The delete operations delete Gradebooks .
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id .
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasGradebook(Id gradebookId, Id aliasId) Adds anIdto aGradebookfor the purpose of creating compatibility.booleanTests if this user can createGradebooks.booleancanCreateGradebookWithRecordTypes(Type[] gradebookRecordTypes) Tests if this user can create a singleGradebookusing the desired record types.booleanTests if this user can delete gradebooks.booleanTests if this user can manageIdaliases forGradebooks.booleanTests if this user can updateGradebooks.createGradebook(GradebookForm gradebookForm) Creates a newGradebook.voiddeleteGradebook(Id gradebookId) Deletes aGradebook.getGradebookFormForCreate(Type[] gradebookRecordTypes) Gets the gradebook form for creating new gradebooks.getGradebookFormForUpdate(Id gradebookId) Gets the gradebook form for updating an existing gradebook.voidupdateGradebook(GradebookForm gradebookForm) Updates an existing gradebook.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
-
canCreateGradebooks
boolean canCreateGradebooks()Tests if this user can createGradebooks. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aGradebookwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.- Returns:
falseifGradebookcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateGradebookWithRecordTypes
Tests if this user can create a singleGradebookusing the desired record types. WhileGradingManager.getGradebookRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificGradebook. Providing an empty array tests if aGradebookcan be created with no records.- Parameters:
gradebookRecordTypes- array of gradebook record types- Returns:
trueifGradebookcreation using the specifiedTypesis supported,falseotherwise- Throws:
NullArgumentException-gradebookRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getGradebookFormForCreate
GradebookForm getGradebookFormForCreate(Type[] gradebookRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the gradebook form for creating new gradebooks. A new form should be requested for each create transaction.- Parameters:
gradebookRecordTypes- array of gradebook record types- Returns:
- the gradebook form
- Throws:
NullArgumentException-gradebookRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createGradebook
Gradebook createGradebook(GradebookForm gradebookForm) throws OperationFailedException, PermissionDeniedException Creates a newGradebook.- Parameters:
gradebookForm- the form for thisGradebook- Returns:
- the new
Gradebook - Throws:
IllegalStateException-gradebookFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-gradebookFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-gradebookFormdid not originate fromgetGradebookFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateGradebooks
boolean canUpdateGradebooks()Tests if this user can updateGradebooks. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aGradebookwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Returns:
falseifGradebookmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getGradebookFormForUpdate
GradebookForm getGradebookFormForUpdate(Id gradebookId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the gradebook form for updating an existing gradebook. A new gradebook form should be requested for each update transaction.- Parameters:
gradebookId- theIdof theGradebook- Returns:
- the gradebook form
- Throws:
NotFoundException-gradebookIdis not foundNullArgumentException-gradebookIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateGradebook
void updateGradebook(GradebookForm gradebookForm) throws OperationFailedException, PermissionDeniedException Updates an existing gradebook.- Parameters:
gradebookForm- the form containing the elements to be updated- Throws:
IllegalStateException-gradebookFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-gradebookFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-gradebookForm did not originate from getGradebookFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteGradebooks
boolean canDeleteGradebooks()Tests if this user can delete gradebooks. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aGradebookwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Returns:
falseifGradebookdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteGradebook
void deleteGradebook(Id gradebookId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aGradebook.- Parameters:
gradebookId- theIdof theGradebookto remove- Throws:
NotFoundException-gradebookIdnot foundNullArgumentException-gradebookIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageGradebookAliases
boolean canManageGradebookAliases()Tests if this user can manageIdaliases forGradebooks. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifGradebookaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasGradebook
void aliasGradebook(Id gradebookId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aGradebookfor the purpose of creating compatibility. The primaryIdof theGradebookis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another gradebook, it is reassigned to the given gradebookId.- Parameters:
gradebookId- theIdof aGradebookaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-gradebookIdnot foundNullArgumentException-gradebookIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-