Interface ResultAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
ResultBatchAdminSession
This session creates, updates, and deletes Results . The data
for create and update is provided by the consumer via the form.
OsidForms are requested for each create or update and may not be reused.
Create and update operations differ in their usage. To create a
Result , a ResultForm is requested using
getResultFormForCreate() specifying the desired relationship peers and
record Types or none if no record Types are needed. The
returned ResultForm 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 ResultForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each ResultForm corresponds to
an attempted transaction.
For updates, ResultForms are requested to the Result
Id that is to be updated using getResultFormForUpdate() .
Similarly, the ResultForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
ResultForm can only be used once for a successful update and
cannot be reused.
The delete operations delete Results . To unmap a
Result from the current Catalogue , the
ResultCatalogueAssignmentSession should be used. These delete operations
attempt to remove the Result itself thus removing it from all
known Catalogue catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasResult(Id resultId, Id aliasId) Adds anIdto aResultfor the purpose of creating compatibility.booleanTests if this user can create results.booleancanCreateResultWithRecordTypes(Type[] resultRecordTypes) Tests if this user can create a singleResultusing the desired record types.booleanTests if this user can delete results.booleanTests if this user can manageIdaliases forResults.booleanTests if this user can update results.createResult(ResultForm resultForm) Creates a newResult.voiddeleteResult(Id resultId) Deletes aResult.Gets theCatalogueassociated with this session.Gets theCatalogueIdassociated with this session.getResultFormForCreate(Id canonicalUnitId, Id particpantId, Type[] resultRecordTypes) Gets the result form for creating new results.getResultFormForUpdate(Id resultId) Gets the result form for updating an existing result.voidupdateResult(ResultForm resultForm) Updates an existing result.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
-
getCatalogueId
Id getCatalogueId()Gets theCatalogueIdassociated with this session.- Returns:
- the
Catalogue Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getCatalogue
Gets theCatalogueassociated with this session.- Returns:
- the catalogue
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateResults
boolean canCreateResults()Tests if this user can create results. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aResultwill 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:
falseifResultcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateResultWithRecordTypes
Tests if this user can create a singleResultusing the desired record types. WhileOfferingManager.getResultRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificResult. Providing an empty array tests if aResultcan be created with no records.- Parameters:
resultRecordTypes- array of result record types- Returns:
trueifResultcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-resultRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getResultFormForCreate
ResultForm getResultFormForCreate(Id canonicalUnitId, Id particpantId, Type[] resultRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the result form for creating new results. A new form should be requested for each create transaction.- Parameters:
canonicalUnitId- the canonical unitIdparticpantId- the particpantIdresultRecordTypes- array of result record types to be included in the create operation or an empty list if none- Returns:
- the result form
- Throws:
NotFoundException-canonicalUnitIdorparticpantIdis not foundNullArgumentException-canonicalUnitId, particpantId, orresultRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- cannot get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createResult
Result createResult(ResultForm resultForm) throws OperationFailedException, PermissionDeniedException Creates a newResult.- Parameters:
resultForm- the form for thisResult- Returns:
- the new
Result - Throws:
IllegalStateException-resultFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-resultFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-resultFormdid not originate fromgetResultFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateResults
boolean canUpdateResults()Tests if this user can update results. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aResultwill 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:
falseifResultmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getResultFormForUpdate
ResultForm getResultFormForUpdate(Id resultId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the result form for updating an existing result. A new result form should be requested for each update transaction.- Parameters:
resultId- theIdof theResult- Returns:
- the result form
- Throws:
NotFoundException-resultIdis not foundNullArgumentException-resultIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateResult
Updates an existing result.- Parameters:
resultForm- the form containing the elements to be updated- Throws:
IllegalStateException-resultFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-resultFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-resultFormdid not originate fromgetResultFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteResults
boolean canDeleteResults()Tests if this user can delete results. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aResultwill 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:
falseifResultdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteResult
void deleteResult(Id resultId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aResult.- Parameters:
resultId- theIdof theResultto remove- Throws:
NotFoundException-resultIdnot foundNullArgumentException-resultIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageResultAliases
boolean canManageResultAliases()Tests if this user can manageIdaliases forResults. 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:
falseifResultaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasResult
void aliasResult(Id resultId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aResultfor the purpose of creating compatibility. The primaryIdof theResultis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another result, it is reassigned to the given resultId.- Parameters:
resultId- theIdof aResultaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-resultIdnot foundNullArgumentException-resultIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-