Interface ActivityAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
ActivityBatchAdminSession
This session creates, updates, and deletes Activities . The
data for create and update is provided by the consumer via the form.
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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasActivity(Id activityId, Id aliasId) Adds anIdto anActivityfor the purpose of creating compatibility.booleanTests if this user can createActivities.booleancanCreateActivityWithRecordTypes(Type[] activityRecordTypes) Tests if this user can create a singleActivityusing the desired record types.booleanTests if this user can deleteActivities.booleanTests if this user can manageIdaliases forActivities.booleanTests if this user can updateActivities.createActivity(ActivityForm activityForm) Creates a newActivity.voiddeleteActivity(Id activityId) Deletes anActivity.getActivityFormForCreate(Type[] activityRecordTypes) Gets the activity form for creating new activities.getActivityFormForUpdate(Id activityId) Gets the activity form for updating an existing activity.Gets theBusinessassociated with this session.Gets theBusinessIdassociated with this session.voidupdateActivity(ActivityForm activityForm) Updates an existing activity.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
getBusinessId
Id getBusinessId()Gets theBusinessIdassociated with this session.- Returns:
- the
Business Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getBusiness
Gets theBusinessassociated with this session.- Returns:
- the business
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateActivities
boolean canCreateActivities()Tests if this user can createActivities. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anActivitywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifActivitycreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateActivityWithRecordTypes
Tests if this user can create a singleActivityusing the desired record types. WhileFinancialsManager.getActivityRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificActivity. Providing an empty array tests if anActivitycan be created with no records.- Parameters:
activityRecordTypes- array of activity record types- Returns:
trueifActivitycreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-activityRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getActivityFormForCreate
ActivityForm getActivityFormForCreate(Type[] activityRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the activity form for creating new activities. A new form should be requested for each create transaction.- Parameters:
activityRecordTypes- array of activity record types- Returns:
- the activity form
- Throws:
NullArgumentException-activityRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createActivity
Activity createActivity(ActivityForm activityForm) throws OperationFailedException, PermissionDeniedException Creates a newActivity.- Parameters:
activityForm- the form for thisActivity- Returns:
- the new
Activity - Throws:
IllegalStateException-activityFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-activityFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-activityFormdid not originate fromgetActvityFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateActivities
boolean canUpdateActivities()Tests if this user can updateActivities. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anActivitywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifActivitymodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getActivityFormForUpdate
ActivityForm getActivityFormForUpdate(Id activityId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the activity form for updating an existing activity. A new activity form should be requested for each update transaction.- Parameters:
activityId- theIdof theActivity- Returns:
- the activity form
- Throws:
NotFoundException-activityIdis not foundNullArgumentException-activityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateActivity
void updateActivity(ActivityForm activityForm) throws OperationFailedException, PermissionDeniedException Updates an existing activity.- Parameters:
activityForm- the form containing the elements to be updated- Throws:
IllegalStateException-activityFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-activityFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-activityFormdid not originate fromgetActvityFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteActivities
boolean canDeleteActivities()Tests if this user can deleteActivities. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anActivitywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifActivitydeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteActivity
void deleteActivity(Id activityId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anActivity.- Parameters:
activityId- theIdof theActivityto remove- Throws:
NotFoundException-activityIdnot foundNullArgumentException-activityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageActivityAliases
boolean canManageActivityAliases()Tests if this user can manageIdaliases forActivities. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifActivityaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasActivity
void aliasActivity(Id activityId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anActivityfor the purpose of creating compatibility. The primaryIdof theActivityis deactivityined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another activity, it is reassigned to the given activityId.- Parameters:
activityId- theIdof anActivityaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-activityIdnot foundNullArgumentException-activityIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-