Interface ItemAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
ItemBatchAdminSession
This session creates, updates, and deletes Items . 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 an
Item , an ItemForm is requested using
getItemFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned ItemForm
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
ItemForm is submiited to a create operation, it cannot be reused
with another create operation unless the first operation was unsuccessful.
Each ItemForm corresponds to an attempted transaction.
For updates, ItemForms are requested to the ItemForm
Id that is to be updated using getItemFormForUpdate() .
Similarly, the ItemForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
ItemForm can only be used once for a successful update and cannot
be reused.
The delete operations delete ItemForm . To unmap an
ItemForm from the current Bank , the
ItemBankAssignmentSession should be used. These delete operations attempt
to remove the Item itself thus removing it from all known
Bank catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds anIdto anItemfor the purpose of creating compatibility.booleanTests if this user can createAnswers.booleancanCreateAnswersWithRecordTypes(Type[] answerRecordTypes) Tests if this user can create a singleAnswerusing the desired record types.booleanTests if this user can createItems.booleancanCreateItemWithRecordTypes(Type[] itemRecordTypes) Tests if this user can create a singleItemusing the desired record types.booleanTests if this user can createQuestions.booleancanCreateQuestionWithRecordTypes(Type[] questionRecordTypes) Tests if this user can create a singleQuestionusing the desired record types.booleanTests if this user can deleteAnswers.booleanTests if this user can deleteItems.booleanTests if this user can deleteQuestions.booleanTests if this user can manageIdaliases forItems.booleanTests if this user can updateAnswers.booleanTests if this user can updateItems.booleanTests if this user can updateQuestions.createAnswer(AnswerForm answerForm) Creates a newAnswer.createItem(ItemForm itemForm) Creates a newItem.createQuestion(QuestionForm questionForm) Creates a newQuestion.voiddeleteAnswer(Id answerId) Deletes theAnsweridentified by the givenId.voiddeleteItem(Id itemId) Deletes theItemidentified by the givenId.voiddeleteQuestion(Id questionId) Deletes theQuestionidentified by the givenId.getAnswerFormForCreate(Id itemId, Type[] answerRecordTypes) Gets the answer form for creating new answers.getAnswerFormForUpdate(Id answerId) Gets the answer form for updating an existing answer.getBank()Gets theBankassociated with this session.Gets theBankIdassociated with this session.getItemFormForCreate(Type[] itemRecordTypes) Gets the assessment item form for creating new assessment items.getItemFormForUpdate(Id itemId) Gets the assessment item form for updating an existing item.getQuestionFormForCreate(Id itemId, Type[] questionRecordTypes) Gets the question form for creating new questions.getQuestionFormForUpdate(Id questionId) Gets the question form for updating an existing question.voidupdateAnswer(AnswerForm answerForm) Updates an existing answer.voidupdateItem(ItemForm itemForm) Updates an existing item.voidupdateQuestion(QuestionForm questionForm) Updates an existing question.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
-
getBankId
Id getBankId()Gets theBankIdassociated with this session.- Returns:
- the
Bank Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getBank
Gets theBankassociated with this session.- Returns:
- the
Bankassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateItems
boolean canCreateItems()Tests if this user can createItems. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anItemwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifItemcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateItemWithRecordTypes
Tests if this user can create a singleItemusing the desired record types. WhileAssessmentManager.getItemRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificItem. Providing an empty array tests if anItemcan be created with no records.- Parameters:
itemRecordTypes- array of item record types- Returns:
trueifItemcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-itemRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getItemFormForCreate
ItemForm getItemFormForCreate(Type[] itemRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the assessment item form for creating new assessment items. A new form should be requested for each create transaction.- Parameters:
itemRecordTypes- array of item record types to be included in the create operation or an empty list if none- Returns:
- the assessment item form
- Throws:
NullArgumentException-itemRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurredUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createItem
Creates a newItem.- Parameters:
itemForm- the form for thisItem- Returns:
- the new
Item - Throws:
IllegalStateException-itemFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-itemFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurredUnsupportedException-itemFormdid not originate fromgetItemFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateItems
boolean canUpdateItems()Tests if this user can updateItems. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anItemwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseif assessment item modification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getItemFormForUpdate
ItemForm getItemFormForUpdate(Id itemId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the assessment item form for updating an existing item. A new item form should be requested for each update transaction.- Parameters:
itemId- theIdof theItem- Returns:
- the assessment item form
- Throws:
NotFoundException-itemIdis not foundNullArgumentException-itemIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurred- Compliance:
mandatory- This method must be implemented.
-
updateItem
Updates an existing item.- Parameters:
itemForm- the form containing the elements to be updated- Throws:
IllegalStateException-itemFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-itemFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurredUnsupportedException-itemFormdid not originate fromgetItemFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteItems
boolean canDeleteItems()Tests if this user can deleteItems. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anItemwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifItemdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteItem
void deleteItem(Id itemId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes theItemidentified by the givenId.- Parameters:
itemId- theIdof theItemto delete- Throws:
NotFoundException- anItemwas not found identified by the givenIdNullArgumentException-itemIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurred- Compliance:
mandatory- This method must be implemented.
-
canManageItemAliases
boolean canManageItemAliases()Tests if this user can manageIdaliases forItems. 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:
falseifItemaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasItem
void aliasItem(Id itemId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anItemfor the purpose of creating compatibility. The primaryIdof theItemis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another item, it is reassigned to the given itemId.- Parameters:
itemId- theIdof anItemaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-itemIdnot foundNullArgumentException-itemIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurred- Compliance:
mandatory- This method must be implemented.
-
canCreateQuestions
boolean canCreateQuestions()Tests if this user can createQuestions. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aQuestionwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifQuestioncreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateQuestionWithRecordTypes
Tests if this user can create a singleQuestionusing the desired record types. WhileAssessmentManager.getQuestionRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificQuestion. Providing an empty array tests if aQuestioncan be created with no records.- Parameters:
questionRecordTypes- array of question record types- Returns:
trueifQuestioncreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-questionRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getQuestionFormForCreate
QuestionForm getQuestionFormForCreate(Id itemId, Type[] questionRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the question form for creating new questions. A new form should be requested for each create transaction.- Parameters:
itemId- an assessment itemIdquestionRecordTypes- array of question record types to be included in the create operation or an empty list if none- Returns:
- the question form
- Throws:
NullArgumentException-questionRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurredUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createQuestion
Question createQuestion(QuestionForm questionForm) throws AlreadyExistsException, OperationFailedException, PermissionDeniedException Creates a newQuestion.- Parameters:
questionForm- the form for thisQuestion- Returns:
- the new
Question - Throws:
AlreadyExistsException- a question already exists for this itemIllegalStateException-questionFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-questionFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurredUnsupportedException-questionFormdid not originate fromgetQuestionFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateQuestions
boolean canUpdateQuestions()Tests if this user can updateQuestions. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aQuestionwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseif question modification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getQuestionFormForUpdate
QuestionForm getQuestionFormForUpdate(Id questionId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the question form for updating an existing question. A new question form should be requested for each update transaction.- Parameters:
questionId- theIdof theQuestion- Returns:
- the question form
- Throws:
NotFoundException-questionIdis not foundNullArgumentException-questionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurred- Compliance:
mandatory- This method must be implemented.
-
updateQuestion
void updateQuestion(QuestionForm questionForm) throws OperationFailedException, PermissionDeniedException Updates an existing question.- Parameters:
questionForm- the form containing the elements to be updated- Throws:
IllegalStateException-questionFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-questionFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurredUnsupportedException-questionFormdid not originate fromgetQuestionFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteQuestions
boolean canDeleteQuestions()Tests if this user can deleteQuestions. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aQuestionwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifQuestiondeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteQuestion
void deleteQuestion(Id questionId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes theQuestionidentified by the givenId.- Parameters:
questionId- theIdof theQuestionto delete- Throws:
NotFoundException- aQuestionwas not found identified by the givenIdNullArgumentException-questionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurred- Compliance:
mandatory- This method must be implemented.
-
canCreateAnswers
boolean canCreateAnswers()Tests if this user can createAnswers. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aAnswerwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifAnswercreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateAnswersWithRecordTypes
Tests if this user can create a singleAnswerusing the desired record types. WhileAssessmentManager.getAnswerRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificAnswer. Providing an empty array tests if anAnswercan be created with no records.- Parameters:
answerRecordTypes- array of answer record types- Returns:
trueifAnswercreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-answernRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getAnswerFormForCreate
AnswerForm getAnswerFormForCreate(Id itemId, Type[] answerRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the answer form for creating new answers. A new form should be requested for each create transaction.- Parameters:
itemId- an assessment itemIdanswerRecordTypes- array of answer record types to be included in the create operation or an empty list if none- Returns:
- the answer form
- Throws:
NullArgumentException-answerRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurredUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createAnswer
Answer createAnswer(AnswerForm answerForm) throws OperationFailedException, PermissionDeniedException Creates a newAnswer.- Parameters:
answerForm- the form for thisAnswer- Returns:
- the new
Answer - Throws:
IllegalStateException-answerFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-answerFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurredUnsupportedException-answerFormdid not originate fromgetAnswerFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateAnswers
boolean canUpdateAnswers()Tests if this user can updateAnswers. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anAnswerwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseif answer modification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getAnswerFormForUpdate
AnswerForm getAnswerFormForUpdate(Id answerId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the answer form for updating an existing answer. A new answer form should be requested for each update transaction.- Parameters:
answerId- theIdof theAnswer- Returns:
- the answer form
- Throws:
NotFoundException-answerIdis not foundNullArgumentException-answerIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurred- Compliance:
mandatory- This method must be implemented.
-
updateAnswer
Updates an existing answer.- Parameters:
answerForm- the form containing the elements to be updated- Throws:
IllegalStateException-answerFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-answerFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurredUnsupportedException-answerFormdid not originate fromgetAnswerFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteAnswers
boolean canDeleteAnswers()Tests if this user can deleteAnswers. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anAnswerwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifAnswerdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteAnswer
void deleteAnswer(Id answerId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes theAnsweridentified by the givenId.- Parameters:
answerId- theIdof theAnswerto delete- Throws:
NotFoundException- anAnswerwas not found identified by the givenIdNullArgumentException-answerIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurred- Compliance:
mandatory- This method must be implemented.
-