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 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 Business,
the
ActivityBusinessAssignmentSession
should be used. These
delete operations attempt to remove the Activity
itself
thus removing it from all known Business
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 an
Activity. |
ActivityForm |
getActivityFormForCreate(Type[] activityRecordTypes)
Gets the activity form for creating new activities.
|
ActivityForm |
getActivityFormForUpdate(Id activityId)
Gets the activity form for updating an existing activity.
|
Business |
getBusiness()
Gets the
Business associated with this session. |
Id |
getBusinessId()
Gets the
Business 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 getBusinessId()
Business
Id
associated with
this session. Business Id
associated with this sessionmandatory
- This method must be implemented. Business getBusiness() throws OperationFailedException, PermissionDeniedException
Business
associated with this session.OperationFailedException
- 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
FinancialsManager.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(Type[] activityRecordTypes) throws OperationFailedException, PermissionDeniedException
activityRecordTypes
- array of activity record typesNullArgumentException
- 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 getActvityFormForCreate()
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 getActvityFormForUpdate()
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.
activityId
- the Id
of the Activity
to removeNotFoundException
- activityId
not foundNullArgumentException
- 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 deactivityined 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 in
use as a primary Id
NotFoundException
- activityId
not foundNullArgumentException
- activityId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.