public interface AwardAdminSession extends OsidSession
This session creates, updates, and deletes Awards.
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
Award,
an AwardForm
is requested using
getAwardFormForCreate()
specifying the desired record
Types
or none if no record Types
are needed.
The returned AwardForm
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 AwardForm
is submiited to
a create operation, it cannot be reused with another create operation
unless the first operation was unsuccessful. Each AwardForm
corresponds to an attempted transaction.
For updates, AwardForms
are requested to the
Award
Id
that is to be updated using
getAwardFormForUpdate().
Similarly, the AwardForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The AwardForm
can
only be used once for a successful update and cannot be reused.
The delete operations delete Awards.
To unmap an
Award
from the current Academy,
the
AwardAcademyAssignmentSession
should be used. These delete
operations attempt to remove the Award
itself thus removing
it from all known Academy
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 |
aliasAward(Id awardId,
Id aliasId)
Adds an
Id to an Award for the purpose
of creating compatibility. |
boolean |
canCreateAwards()
Tests if this user can create
Awards. |
boolean |
canCreateAwardWithRecordTypes(Type[] awardRecordTypes)
Tests if this user can create a single
Award using the
desired record types. |
boolean |
canDeleteAwards()
Tests if this user can delete
Awards A return of true
does not guarantee successful authorization. |
boolean |
canManageAwardAliases()
Tests if this user can manage
Id aliases for
Awards. |
boolean |
canUpdateAwards()
Tests if this user can update
Awards. |
Award |
createAward(AwardForm awardForm)
Creates a new
Award. |
void |
deleteAward(Id awardId)
Deletes an
Award. |
Academy |
getAcademy()
Gets the
Academy associated with this session. |
Id |
getAcademyId()
Gets the
Academy Id associated with this
session. |
AwardForm |
getAwardFormForCreate(Type[] awardRecordTypes)
Gets the award form for creating new awards.
|
AwardForm |
getAwardFormForUpdate(Id awardId)
Gets the award form for updating an existing award.
|
void |
updateAward(AwardForm awardForm)
Updates an existing award.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getAcademyId()
Academy
Id
associated with this
session. Academy Id
associated with this sessionmandatory
- This method must be implemented. Academy getAcademy() throws OperationFailedException, PermissionDeniedException
Academy
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateAwards()
Awards.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating an Award
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may not wish to offer create operations to
unauthorized users. false
if Award
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateAwardWithRecordTypes(Type[] awardRecordTypes)
Award
using the
desired record types. While
RecognitionManager.getAwardRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Award.
Providing
an empty array tests if an Award
can be created with no
records.awardRecordTypes
- array of award record types true
if Award
creation using the
specified record Types
is supported,
false
otherwiseNullArgumentException
- awardRecordTypes
is null
mandatory
- This method must be implemented. AwardForm getAwardFormForCreate(Type[] awardRecordTypes) throws OperationFailedException, PermissionDeniedException
awardRecordTypes
- array of award record typesNullArgumentException
- awardRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Award createAward(AwardForm awardForm) throws OperationFailedException, PermissionDeniedException
Award.
awardForm
- the form for this Award
Award
IllegalStateException
- awardForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- awardForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- awardForm
did not
originate from getAwardFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateAwards()
Awards.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating an Award
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may not wish to offer update operations to
unauthorized users. false
if Award
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. AwardForm getAwardFormForUpdate(Id awardId) throws NotFoundException, OperationFailedException, PermissionDeniedException
awardId
- the Id
of the Award
NotFoundException
- awardId
is not foundNullArgumentException
- awardId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateAward(AwardForm awardForm) throws OperationFailedException, PermissionDeniedException
awardForm
- the form containing the elements to be updatedIllegalStateException
- awardForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- awardForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- awardForm
did not
originate from getAwardFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteAwards()
Awards
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting an Award
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may not wish to offer delete operations to
unauthorized users. false
if Award
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteAward(Id awardId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Award.
awardId
- the Id
of the Award
to
removeNotFoundException
- awardId
not foundNullArgumentException
- awardId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageAwardAliases()
Id
aliases for
Awards.
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 Award
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasAward(Id awardId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to an Award
for the purpose
of creating compatibility. The primary Id
of the
Award
is determined by the provider. The new Id
performs as an alias to the primary Id.
If the alias is
a pointer to another award, it is reassigned to the given award
Id.
awardId
- the Id
of an Award
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- awardId
not foundNullArgumentException
- awardId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.