public interface ItemAdminSession extends OsidSession
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.
Modifier and Type | Method and Description |
---|---|
void |
aliasItem(Id itemId,
Id aliasId)
Adds an
Id to an Item for the purpose of
creating compatibility. |
boolean |
canCreateAnswers()
Tests if this user can create
Answers. |
boolean |
canCreateAnswersWithRecordTypes(Type[] answerRecordTypes)
Tests if this user can create a single
Answer using the
desired record types. |
boolean |
canCreateItems()
Tests if this user can create
Items. |
boolean |
canCreateItemWithRecordTypes(Type[] itemRecordTypes)
Tests if this user can create a single
Item using the
desired record types. |
boolean |
canCreateQuestions()
Tests if this user can create
Questions. |
boolean |
canCreateQuestionWithRecordTypes(Type[] questionRecordTypes)
Tests if this user can create a single
Question using
the desired record types. |
boolean |
canDeleteAnswers()
Tests if this user can delete
Answers. |
boolean |
canDeleteItems()
Tests if this user can delete
Items. |
boolean |
canDeleteQuestions()
Tests if this user can delete
Questions. |
boolean |
canManageItemAliases()
Tests if this user can manage
Id aliases for
Items. |
boolean |
canUpdateAnswers()
Tests if this user can update
Answers. |
boolean |
canUpdateItems()
Tests if this user can update
Items. |
boolean |
canUpdateQuestions()
Tests if this user can update
Questions. |
Answer |
createAnswer(AnswerForm answerForm)
Creates a new
Answer. |
Item |
createItem(ItemForm itemForm)
Creates a new
Item. |
Question |
createQuestion(QuestionForm questionForm)
Creates a new
Question. |
void |
deleteAnswer(Id answerId)
Deletes the
Answer identified by the given Id. |
void |
deleteItem(Id itemId)
Deletes the
Item identified by the given Id. |
void |
deleteQuestion(Id questionId)
Deletes the
Question identified by the given Id. |
AnswerForm |
getAnswerFormForCreate(Id itemId,
Type[] answerRecordTypes)
Gets the answer form for creating new answers.
|
AnswerForm |
getAnswerFormForUpdate(Id answerId)
Gets the answer form for updating an existing answer.
|
Bank |
getBank()
Gets the
Bank associated with this session. |
Id |
getBankId()
Gets the
Bank Id associated with this
session. |
ItemForm |
getItemFormForCreate(Type[] itemRecordTypes)
Gets the assessment item form for creating new assessment items.
|
ItemForm |
getItemFormForUpdate(Id itemId)
Gets the assessment item form for updating an existing item.
|
QuestionForm |
getQuestionFormForCreate(Id itemId,
Type[] questionRecordTypes)
Gets the question form for creating new questions.
|
QuestionForm |
getQuestionFormForUpdate(Id questionId)
Gets the question form for updating an existing question.
|
void |
updateAnswer(AnswerForm answerForm)
Updates an existing answer.
|
void |
updateItem(ItemForm itemForm)
Updates an existing item.
|
void |
updateQuestion(QuestionForm questionForm)
Updates an existing question.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getBankId()
Bank
Id
associated with this
session. Bank Id
associated with this sessionmandatory
- This method must be implemented. Bank getBank() throws OperationFailedException, PermissionDeniedException
Bank
associated with this session. Bank
associated with this sessionOperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateItems()
Items.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating an Item
will result
in a PERMISSION_DENIED.
This is intended as a hint to
an application that may opt not to offer create operations to an
unauthorized user. false
if Item
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateItemWithRecordTypes(Type[] itemRecordTypes)
Item
using the
desired record types. While
AssessmentManager.getItemRecordTypes()
can be used to examine
which records are supported, this method tests which record(s) are
required for creating a specific Item.
Providing an
empty array tests if an Item
can be created with no
records.itemRecordTypes
- array of item record types true
if Item
creation using the
specified record Types
is supported,
false
otherwiseNullArgumentException
- itemRecordTypes
is null
mandatory
- This method must be implemented. ItemForm getItemFormForCreate(Type[] itemRecordTypes) throws OperationFailedException, PermissionDeniedException
itemRecordTypes
- array of item record types to be included in
the create operation or an empty list if noneNullArgumentException
- itemRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Item createItem(ItemForm itemForm) throws OperationFailedException, PermissionDeniedException
Item.
itemForm
- the form for this Item
Item
IllegalStateException
- itemForm
already
used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- itemForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredUnsupportedException
- itemForm
did not
originate from getItemFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateItems()
Items.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating an Item
will result
in a PERMISSION_DENIED.
This is intended as a hint to
an application that may opt not to offer update operations to an
unauthorized user. false
if assessment item modification is not
authorized, true
otherwisemandatory
- This method must be implemented. ItemForm getItemFormForUpdate(Id itemId) throws NotFoundException, OperationFailedException, PermissionDeniedException
itemId
- the Id
of the Item
NotFoundException
- itemId
is not foundNullArgumentException
- itemId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredmandatory
- This method must be implemented. void updateItem(ItemForm itemForm) throws OperationFailedException, PermissionDeniedException
itemForm
- the form containing the elements to be updatedIllegalStateException
- itemForm
already
used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- itemForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredUnsupportedException
- itemForm
did not
originate from getItemFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteItems()
Items.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting an Item
will result
in a PERMISSION_DENIED.
This is intended as a hint to
an application that may opt not to offer delete operations to an
unauthorized user. false
if Item
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteItem(Id itemId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Item
identified by the given Id.
itemId
- the Id
of the Item
to
deleteNotFoundException
- an Item
was not
found identified by the given Id
NullArgumentException
- itemId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredmandatory
- This method must be implemented. boolean canManageItemAliases()
Id
aliases for
Items.
A return of true does not guarantee successful
authorization. A return of false indicates that it is known changing
an alias will result in a PERMISSION_DENIED.
This is
intended as a hint to an application that may opt not to offer alias
operations to an unauthorized user. false
if Item
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasItem(Id itemId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to an Item
for the purpose of
creating compatibility. The primary Id
of the
Item
is determined by the provider. The new Id
is an alias to the primary Id.
If the alias is a
pointer to another item, it is reassigned to the given item Id.
itemId
- the Id
of an Item
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- itemId
not foundNullArgumentException
- itemId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredmandatory
- This method must be implemented. boolean canCreateQuestions()
Questions.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known creating a Question
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer create operations to
an unauthorized user. false
if Question
creation is
not authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateQuestionWithRecordTypes(Type[] questionRecordTypes)
Question
using
the desired record types. While
AssessmentManager.getQuestionRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Question.
Providing an empty array tests if a Question
can be
created with no records.questionRecordTypes
- array of question record types true
if Question
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- questionRecordTypes
is null
mandatory
- This method must be implemented. QuestionForm getQuestionFormForCreate(Id itemId, Type[] questionRecordTypes) throws OperationFailedException, PermissionDeniedException
itemId
- an assessment item Id
questionRecordTypes
- array of question record types to be
included in the create operation or an empty list if noneNullArgumentException
- questionRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Question createQuestion(QuestionForm questionForm) throws AlreadyExistsException, OperationFailedException, PermissionDeniedException
Question.
questionForm
- the form for this Question
Question
AlreadyExistsException
- a question already exists for
this itemIllegalStateException
- questionForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- questionForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredUnsupportedException
- questionForm
did
not originate from getQuestionFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateQuestions()
Questions.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known updating a Question
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer update operations to
an unauthorized user. false
if question modification is not
authorized, true
otherwisemandatory
- This method must be implemented. QuestionForm getQuestionFormForUpdate(Id questionId) throws NotFoundException, OperationFailedException, PermissionDeniedException
questionId
- the Id
of the Question
NotFoundException
- questionId
is not
foundNullArgumentException
- questionId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredmandatory
- This method must be implemented. void updateQuestion(QuestionForm questionForm) throws OperationFailedException, PermissionDeniedException
questionForm
- the form containing the elements to be updatedIllegalStateException
- questionForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- questionForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredUnsupportedException
- questionForm
did
not originate from getQuestionFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteQuestions()
Questions.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known deleting a Question
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer delete operations to
an unauthorized user. false
if Question
deletion is
not authorized, true
otherwisemandatory
- This method must be implemented. void deleteQuestion(Id questionId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Question
identified by the given Id.
questionId
- the Id
of the Question
to deleteNotFoundException
- a Question
was not
found identified by the given Id
NullArgumentException
- questionId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredmandatory
- This method must be implemented. boolean canCreateAnswers()
Answers.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Answer
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer create operations to
an unauthorized user. false
if Answer
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateAnswersWithRecordTypes(Type[] answerRecordTypes)
Answer
using the
desired record types. While
AssessmentManager.getAnswerRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Answer.
Providing
an empty array tests if an Answer
can be created with
no records.answerRecordTypes
- array of answer record types true
if Answer
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- answernRecordTypes
is null
mandatory
- This method must be implemented. AnswerForm getAnswerFormForCreate(Id itemId, Type[] answerRecordTypes) throws OperationFailedException, PermissionDeniedException
itemId
- an assessment item Id
answerRecordTypes
- array of answer record types to be included
in the create operation or an empty list if noneNullArgumentException
- answerRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Answer createAnswer(AnswerForm answerForm) throws OperationFailedException, PermissionDeniedException
Answer.
answerForm
- the form for this Answer
Answer
IllegalStateException
- answerForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- answerForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredUnsupportedException
- answerForm
did
not originate from getAnswerFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateAnswers()
Answers.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating an Answer
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer update operations to
an unauthorized user. false
if answer modification is not authorized,
true
otherwisemandatory
- This method must be implemented. AnswerForm getAnswerFormForUpdate(Id answerId) throws NotFoundException, OperationFailedException, PermissionDeniedException
answerId
- the Id
of the Answer
NotFoundException
- answerId
is not
foundNullArgumentException
- answerId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredmandatory
- This method must be implemented. void updateAnswer(AnswerForm answerForm) throws OperationFailedException, PermissionDeniedException
answerForm
- the form containing the elements to be updatedIllegalStateException
- answerForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- answerForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredUnsupportedException
- answerForm
did
not originate from getAnswerFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteAnswers()
Answers.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting an Answer
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer delete operations to
an unauthorized user. false
if Answer
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteAnswer(Id answerId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Answer
identified by the given Id.
answerId
- the Id
of the Answer
to
deleteNotFoundException
- an Answer
was not
found identified by the given Id
NullArgumentException
- answerId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failure
occurredmandatory
- This method must be implemented.