public interface ActivityAdminSession extends OsidSession
This session creates, updates, and deletes Activities.
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
Activity,
an ActivityForm
is requested using
getActivityFormForCreate()
specifying the desired objective
and record Types
or none if no record Types
are needed. The returned ActivityForm
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 ActivityForm
is submiited to a create operation, it cannot be reused with another
create operation unless the first operation was unsuccessful. Each
ActivityForm
corresponds to an attempted transaction.
For updates, ActivityForms
are requested to the
Activity
Id
that is to be updated using
getActivityFormForUpdate().
Similarly, the ActivityForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The ActivityForm
can only be used once for a successful update and cannot be reused.
The delete operations delete Activities.
To unmap an
Activity
from the current ObjectiveBank,
the
ActivityObjectiveBankAssignmentSession
should be used.
These delete operations attempt to remove the Activity
itself thus removing it from all known ObjectiveBank
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 |
aliasActivity(Id activityId,
Id aliasId)
Adds an
Id to an Activity for the
purpose of creating compatibility. |
boolean |
canCreateActivities()
Tests if this user can create
Activities. |
boolean |
canCreateActivityWithRecordTypes(Type[] activityRecordTypes)
Tests if this user can create a single
Activity using
the desired record types. |
boolean |
canDeleteActivities()
Tests if this user can delete
Activities. |
boolean |
canManageActivityAliases()
Tests if this user can manage
Id aliases for
activities. |
boolean |
canUpdateActivities()
Tests if this user can update
Activities. |
Activity |
createActivity(ActivityForm activityForm)
Creates a new
Activity. |
void |
deleteActivity(Id activityId)
Deletes the
Activity identified by the given Id. |
ActivityForm |
getActivityFormForCreate(Id objectiveId,
Type[] activityRecordTypes)
Gets the activity form for creating new activities.
|
ActivityForm |
getActivityFormForUpdate(Id activityId)
Gets the activity form for updating an existing activity.
|
ObjectiveBank |
getObjectiveBank()
Gets the
ObjectiveBank associated with this session. |
Id |
getObjectiveBankId()
Gets the
ObjectiveBank Id associated
with this session. |
void |
updateActivity(ActivityForm activityForm)
Updates an existing activity,
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getObjectiveBankId()
ObjectiveBank
Id
associated
with this session. ObjectiveBank Id
associated with this
sessionmandatory
- This method must be implemented. ObjectiveBank getObjectiveBank() throws OperationFailedException, PermissionDeniedException
ObjectiveBank
associated with this session. ObjectiveBank
associated with this sessionOperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateActivities()
Activities.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known creating an Activity
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 Activity
creation is
not authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateActivityWithRecordTypes(Type[] activityRecordTypes)
Activity
using
the desired record types. While
LearningManager.getActivityRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Activity.
Providing an empty array tests if an Activity
can be
created with no records.activityRecordTypes
- array of activity record types true
if Activity
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- activityRecordTypes
is null
mandatory
- This method must be implemented. ActivityForm getActivityFormForCreate(Id objectiveId, Type[] activityRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
objectiveId
- the Id
of the Objective
activityRecordTypes
- array of activity record typesNotFoundException
- objectiveId
is not
foundNullArgumentException
- objectiveId
or
activityRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Activity createActivity(ActivityForm activityForm) throws OperationFailedException, PermissionDeniedException
Activity.
activityForm
- the form for this Activity
Activity
IllegalStateException
- activityForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- activityForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- activityForm
did
not originate from getActivityFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateActivities()
Activities.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known updating an Activity
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 activity modification is not
authorized, true
otherwisemandatory
- This method must be implemented. ActivityForm getActivityFormForUpdate(Id activityId) throws NotFoundException, OperationFailedException, PermissionDeniedException
activityId
- the Id
of the Activity
NotFoundException
- activityId
is not
foundNullArgumentException
- activityId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateActivity(ActivityForm activityForm) throws OperationFailedException, PermissionDeniedException
activityForm
- the form containing the elements to be updatedIllegalStateException
- activityForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- activityForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- activityForm
did
not originate from getActivityFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteActivities()
Activities.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known deleting an Activity
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 Activity
deletion is
not authorized, true
otherwisemandatory
- This method must be implemented. void deleteActivity(Id activityId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Activity
identified by the given Id.
activityId
- the Id
of the Activity
to deleteNotFoundException
- an Activity
was not
found identified by the given Id
NullArgumentException
- activityId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageActivityAliases()
Id
aliases for
activities. 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 Activity
aliasing is
not authorized, true
otherwisemandatory
- This method must be implemented. void aliasActivity(Id activityId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to an Activity
for the
purpose of creating compatibility. The primary Id
of
the Activity
is determined by the provider. The new
Id
performs as an alias to the primary Id.
If the alias is a pointer to another activity, it is
reassigned to the given activity Id.
activityId
- the Id
of an Activity
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- activityId
not foundNullArgumentException
- activityId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.