Interface ItemBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, ItemAdminSession, OsidSession, OsidSession
This session creates, updates, and deletes Items in bulk. 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
getItemFormsForCreate() specifying the desired record Types or
none if no record Types are needed. Each of the returned
ItemForms 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 an
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.
The ItemForms returned from getItemFormsForCreate()
may be linked to the originating request through the peer Ids of
the ItemForm . In the case where there may be duplicates, any
ItemForm of the same peer Ids may be used for a create
operation.
Once a batch of ItemForms are submitted for create, a
CreateResponse is returned for each ItemForm , although the
ordering is not defined. Only errors that pertain to the entire create
operation are returned from createItems() , errors specific to an
individual ItemForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the originating
ItemForm through the ItemForm Id .
For updates, ItemForms are requested to the Item
Id that is to be updated using getItemFormsForUpdate()
where the reference Id in the ItemForm may be used to link
the request. 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.
Once a batch of ItemForms are submitted for update, an
UpdateResponse is returned for each ItemForm , although the
ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateItems() , errors specific to an
individual ItemForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the originating
ItemForm through the ItemForm Id .
The delete operations delete Items in bulk. To unmap an
Item 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. Bulk delete operations return the results in
DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasItems(AliasRequestList aliasRequests) Adds anIdto anItemfor the purpose of creating compatibility.createAnswers(AnswerBatchFormList answersForms) Creates a new set ofAnswers.createItems(ItemBatchFormList itemForms) Creates a new set ofItems.createQuestions(QuestionBatchFormList questionForms) Creates a new set ofQuestions.Deletes allAnswersin thisBank.Deletes allItemsin thisBank.Deletes allQuestionsin thisBank.deleteAnswers(IdList answersIds) Deletes answers for the givenIds.deleteItems(IdList itemIds) Deletes items for the givenIds.deleteQuestions(IdList questionIds) Deletes questions for the givenIds.getAnswerFormsForCreate(IdList itemIds, Type[] answerRecordTypes) Gets the answer forms for creating a bunch of new answers.getAnswerFormsForUpdate(IdList answersIds) Gets the answers forms for updating an existing set of answers.getItemFormsForCreate(long number, Type[] itemRecordTypes) Gets the item forms for creating a bunch of new items.getItemFormsForUpdate(IdList itemIds) Gets the item forms for updating an existing set of items.getQuestionFormsForCreate(IdList itemIds, Type[] questionRecordTypes) Gets the question forms for creating a bunch of new questions.getQuestionFormsForUpdate(IdList questionIds) Gets the question forms for updating an existing set of questions.updateAnswers(AnswerBatchFormList answersForms) Updates existing answers.updateItems(ItemBatchFormList itemForms) Updates existing items.updateQuestions(QuestionBatchFormList questionForms) Updates existing questions.Methods inherited from interface ItemAdminSession
aliasItem, canCreateAnswers, canCreateAnswersWithRecordTypes, canCreateItems, canCreateItemWithRecordTypes, canCreateQuestions, canCreateQuestionWithRecordTypes, canDeleteAnswers, canDeleteItems, canDeleteQuestions, canManageItemAliases, canUpdateAnswers, canUpdateItems, canUpdateQuestions, createAnswer, createItem, createQuestion, deleteAnswer, deleteItem, deleteQuestion, getAnswerFormForCreate, getAnswerFormForUpdate, getBank, getBankId, getItemFormForCreate, getItemFormForUpdate, getQuestionFormForCreate, getQuestionFormForUpdate, updateAnswer, updateItem, updateQuestionModifier 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
-
getItemFormsForCreate
ItemBatchFormList getItemFormsForCreate(long number, Type[] itemRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the item forms for creating a bunch of new items.- Parameters:
number- the number of forms to retrieveitemRecordTypes- array of item record types to be included in each create operation or an empty list if none- Returns:
- the item forms
- Throws:
NullArgumentException-itemRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createItems
CreateResponseList createItems(ItemBatchFormList itemForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofItems. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
itemForms- the item forms- Returns:
- the create responses
- Throws:
NullArgumentException-itemFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getItemFormsForUpdate
ItemBatchFormList getItemFormsForUpdate(IdList itemIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the item forms for updating an existing set of items. A new item form should be requested for each update transaction.- Parameters:
itemIds- theIdsof theItems- Returns:
- the item forms
- Throws:
NotFoundException- anitemIdis not foundNullArgumentException-itemIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateItems
UpdateResponseList updateItems(ItemBatchFormList itemForms) throws OperationFailedException, PermissionDeniedException Updates existing items. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
itemForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-itemFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllItems
Deletes allItemsin thisBank.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteItems
DeleteResponseList deleteItems(IdList itemIds) throws OperationFailedException, PermissionDeniedException Deletes items for the givenIds.- Parameters:
itemIds- theIdsof the items to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-itemIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasItems
AliasResponseList aliasItems(AliasRequestList aliasRequests) throws 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:
aliasRequests- the alias requests- Returns:
- the alias responses
- Throws:
NullArgumentException-aliasRequestsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getQuestionFormsForCreate
QuestionBatchFormList getQuestionFormsForCreate(IdList itemIds, Type[] questionRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the question forms for creating a bunch of new questions. A new form is retrieved for each supplied itemId.- Parameters:
itemIds- a list of itemIdsquestionRecordTypes- array of question record types to be included in each create operation or an empty list if none- Returns:
- the question forms
- Throws:
NotFoundException- anitemIdis not foundNullArgumentException-itemIdsorquestionRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createQuestions
CreateResponseList createQuestions(QuestionBatchFormList questionForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofQuestions. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
questionForms- the question forms- Returns:
- the create responses
- Throws:
NullArgumentException-questionFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getQuestionFormsForUpdate
QuestionBatchFormList getQuestionFormsForUpdate(IdList questionIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the question forms for updating an existing set of questions. A new question form should be requested for each update transaction.- Parameters:
questionIds- theIdsof theQuestions- Returns:
- the question forms
- Throws:
NotFoundException- aquestionIdis not foundNullArgumentException-questionIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateQuestions
UpdateResponseList updateQuestions(QuestionBatchFormList questionForms) throws OperationFailedException, PermissionDeniedException Updates existing questions. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
questionForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-questionFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllQuestions
Deletes allQuestionsin thisBank.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteQuestions
DeleteResponseList deleteQuestions(IdList questionIds) throws OperationFailedException, PermissionDeniedException Deletes questions for the givenIds.- Parameters:
questionIds- theIdsof the questions to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-questionIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getAnswerFormsForCreate
AnswerBatchFormList getAnswerFormsForCreate(IdList itemIds, Type[] answerRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the answer forms for creating a bunch of new answers. A new form is retrieved for each supplied itemId.- Parameters:
itemIds- a list of itemIdsanswerRecordTypes- array of answer record types to be included in each create operation or an empty list if none- Returns:
- the answer forms
- Throws:
NotFoundException- anitemIdis not foundNullArgumentException-itemIdsoranswerRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createAnswers
CreateResponseList createAnswers(AnswerBatchFormList answersForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofAnswers. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
answersForms- the answer forms- Returns:
- the create responses
- Throws:
NullArgumentException-answerFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getAnswerFormsForUpdate
AnswerBatchFormList getAnswerFormsForUpdate(IdList answersIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the answers forms for updating an existing set of answers. A new answer form should be requested for each update transaction.- Parameters:
answersIds- theIdsof theAnswers- Returns:
- the answer forms
- Throws:
NotFoundException- ananswerIdis not foundNullArgumentException-answerIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateAnswers
UpdateResponseList updateAnswers(AnswerBatchFormList answersForms) throws OperationFailedException, PermissionDeniedException Updates existing answers. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
answersForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-answerFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllAnswers
Deletes allAnswersin thisBank.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAnswers
DeleteResponseList deleteAnswers(IdList answersIds) throws OperationFailedException, PermissionDeniedException Deletes answers for the givenIds.- Parameters:
answersIds- theIdsof the answers to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-answerIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-