public interface ActivityUnitAdminSession extends OsidSession
This session creates, updates, and deletes ActivityUnit.
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
ActivityUnit,
an ActivityUnitForm
is
requested using getActivityUnitFormForCreate()
specifying
the desired course and record Types
or none if no record
Types
are needed. The returned ActivityUnitForm
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 ActivityUnitForm
is submiited to a create operation, it
cannot be reused with another create operation unless the first operation
was unsuccessful. Each ActivityUnitForm
corresponds to an
attempted transaction.
For updates, ActivityUnitForms
are requested to the
ActivityUnit
Id
that is to be updated using
getActivityUnitFormForUpdate().
Similarly, the
ActivityUnitForm
has metadata about the data that can be updated
and it can perform validation before submitting the update. The
ActivityUnitForm
can only be used once for a successful update and
cannot be reused.
The delete operations delete ActivityUnits.
To unmap an
ActivityUnit
from the current CourseCatalog,
the ActivityUnitCourseCatalogAssignmentSession
should be
used. These delete operations attempt to remove the ActivityUnit
itself thus removing it from all known CourseCatalog
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 |
aliasActivityUnit(Id activityUnitId,
Id aliasId)
Adds an
Id to an ActivityUnit for the
purpose of creating compatibility. |
boolean |
canCreateActivityUnits()
Tests if this user can create
ActivityUnits. |
boolean |
canCreateActivityUnitWithRecordTypes(Type[] activityUnitRecordTypes)
Tests if this user can create a single
ActivityUnit
using the desired record types. |
boolean |
canDeleteActivityUnits()
Tests if this user can delete
ActivityUnits. |
boolean |
canManageActivityUnitAliases()
Tests if this user can manage
Id aliases for
ActivityUnits. |
boolean |
canUpdateActivityUnits()
Tests if this user can update
ActivityUnits. |
ActivityUnit |
createActivityUnit(CourseForm activityUnitForm)
Creates a new
ActivityUnit. |
void |
deleteActivityUnit(Id activityUnitId)
Deletes an
ActivityUnit. |
ActivityUnitForm |
getActivityUnitFormForCreate(Id courseId,
Type[] activityUnitRecordTypes)
Gets the activity unit form for creating new activity units.
|
ActivityUnitForm |
getActivityUnitFormForUpdate(Id activityUnitId)
Gets the activity unit form for updating an existing activity unit.
|
CourseCatalog |
getCourseCatalog()
Gets the
CourseCatalog associated with this session. |
Id |
getCourseCatalogId()
Gets the
CourseCatalog Id associated
with this session. |
void |
updateActivityUnit(ActivityUnitForm activityUnitForm)
Updates an existing activity unit.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getCourseCatalogId()
CourseCatalog
Id
associated
with this session. CourseCatalog Id
associated with this
sessionmandatory
- This method must be implemented. CourseCatalog getCourseCatalog() throws OperationFailedException, PermissionDeniedException
CourseCatalog
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateActivityUnits()
ActivityUnits.
A return
of true does not guarantee successful authorization. A return of false
indicates that it is known creating an ActivityUnit
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 ActivityUnit
creation
is not authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateActivityUnitWithRecordTypes(Type[] activityUnitRecordTypes)
ActivityUnit
using the desired record types. While
CourseManager.getActivityUnitRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific ActivityUnit.
Providing an empty array tests if an ActivityUnit
can
be created with no records.activityUnitRecordTypes
- array of activity unit record types true
if ActivityUnit
creation
using the specified record Types
is supported,
false
otherwiseNullArgumentException
- activityUnitRecordTypes
is null
mandatory
- This method must be implemented. ActivityUnitForm getActivityUnitFormForCreate(Id courseId, Type[] activityUnitRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
courseId
- the course Id
activityUnitRecordTypes
- array of activity unit record typesNotFoundException
- courseId
is not
foundNullArgumentException
- courseId
or
activityUnitRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. ActivityUnit createActivityUnit(CourseForm activityUnitForm) throws OperationFailedException, PermissionDeniedException
ActivityUnit.
activityUnitForm
- the form for this ActivityUnit
ActivityUnit
IllegalStateException
- activityForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- activityUnitForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- activityUnitForm did not
originate from getActivityUnitFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateActivityUnits()
ActivityUnits.
A return
of true does not guarantee successful authorization. A return of false
indicates that it is known updating an ActivityUnit
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 ActivityUnit
modification is not authorized, true
otherwisemandatory
- This method must be implemented. ActivityUnitForm getActivityUnitFormForUpdate(Id activityUnitId) throws NotFoundException, OperationFailedException, PermissionDeniedException
activityUnitId
- the Id
of the
ActivityUnit
NotFoundException
- activityUnitId
is
not foundNullArgumentException
- activityUnitId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateActivityUnit(ActivityUnitForm activityUnitForm) throws OperationFailedException, PermissionDeniedException
activityUnitForm
- the form containing the elements to be
updatedIllegalStateException
- activityForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- courseForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- activityUnitForm did not
originate from getActivityUnitFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteActivityUnits()
ActivityUnits.
A return
of true does not guarantee successful authorization. A return of false
indicates that it is known deleting an ActivityUnit
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 ActivityUnit
deletion
is not authorized, true
otherwisemandatory
- This method must be implemented. void deleteActivityUnit(Id activityUnitId) throws NotFoundException, OperationFailedException, PermissionDeniedException
ActivityUnit.
activityUnitId
- the Id
of the
ActivityUnit
to removeNotFoundException
- activityUnitId
not
foundNullArgumentException
- activityUnitId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageActivityUnitAliases()
Id
aliases for
ActivityUnits.
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 ActivityUnit
aliasing
is not authorized, true
otherwisemandatory
- This method must be implemented. void aliasActivityUnit(Id activityUnitId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to an ActivityUnit
for the
purpose of creating compatibility. The primary Id
of
the ActivityUnit
is deactivityined by the provider. The
new Id
performs as an alias to the primary Id.
If the alias is a pointer to another activity unit, it is
reassigned to the given activity unit Id.
activityUnitId
- the Id
of an ActivityUnit
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- activityUnitId
not
foundNullArgumentException
- activityUnitId
or aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.