public interface AccountAdminSession extends OsidSession
This session creates, updates, and deletes Accounts. 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
Account, an AccountForm is requested using
getAccountFormForCreate() specifying the desired record
Types or none if no record Types are needed.
The returned AccountForm 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 AccountForm is
submiited to a create operation, it cannot be reused with another create
operation unless the first operation was unsuccessful. Each
AccountForm corresponds to an attempted transaction.
For updates, AccountForms are requested to the
Account Id that is to be updated using
getAccountFormForUpdate(). Similarly, the AccountForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The AccountForm
can only be used once for a successful update and cannot be reused.
The delete operations delete Accounts. To unmap an
Account from the current Business, the
AccountBusinessAssignmentSession should be used. These
delete operations attempt to remove the Account 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 |
aliasAccount(Id accountId,
Id aliasId)
Adds an
Id to an Account for the purpose
of creating compatibility. |
boolean |
canCreateAccounts()
Tests if this user can create
Accounts. |
boolean |
canCreateAccountWithRecordTypes(Type[] accountRecordTypes)
Tests if this user can create a single
Account using
the desired record types. |
boolean |
canDeleteAccounts()
Tests if this user can delete
Accounts. |
boolean |
canManageAccountAliases()
Tests if this user can manage
Id aliases for
Accounts. |
boolean |
canUpdateAccounts()
Tests if this user can update
Accounts. |
Account |
createAccount(AccountForm accountForm)
Creates a new
Account. |
void |
deleteAccount(Id accountId)
Deletes an
Account. |
AccountForm |
getAccountFormForCreate(Type[] accountRecordTypes)
Gets the account form for creating new accounts.
|
AccountForm |
getAccountFormForUpdate(Id accountId)
Gets the account form for updating an existing account.
|
Business |
getBusiness()
Gets the
Business associated with this session. |
Id |
getBusinessId()
Gets the
Business Id associated with
this session. |
void |
updateAccount(AccountForm accountForm)
Updates an existing account.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionscloseId 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 canCreateAccounts()
Accounts. A return of
true does not guarantee successful authorization. A return of false
indicates that it is known creating an Account 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 Account creation is not
authorized, true otherwisemandatory - This method must be implemented. boolean canCreateAccountWithRecordTypes(Type[] accountRecordTypes)
Account using
the desired record types. While
FinancialsManager.getAccountRecordTypes() can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Account. Providing
an empty array tests if an Account can be created with
no records.accountRecordTypes - array of account record types true if Account creation using
the specified record Types is supported,
false otherwiseNullArgumentException - accountRecordTypes
is null mandatory - This method must be implemented. AccountForm getAccountFormForCreate(Type[] accountRecordTypes) throws OperationFailedException, PermissionDeniedException
accountRecordTypes - array of account record typesNullArgumentException - accountRecordTypes
is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - unable to get form for requested
record typesmandatory - This method must be implemented. Account createAccount(AccountForm accountForm) throws OperationFailedException, PermissionDeniedException
Account. accountForm - the form for this Account Account IllegalStateException - accountForm
already used in a create transactionInvalidArgumentException - one or more of the form
elements is invalidNullArgumentException - accountForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - accountForm did
not originate from getAccountFormForCreate() mandatory - This method must be implemented. boolean canUpdateAccounts()
Accounts. A return of
true does not guarantee successful authorization. A return of false
indicates that it is known updating an Account 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 Account modification is
not authorized, true otherwisemandatory - This method must be implemented. AccountForm getAccountFormForUpdate(Id accountId) throws NotFoundException, OperationFailedException, PermissionDeniedException
accountId - the Id of the Account NotFoundException - accountId is not
foundNullArgumentException - accountId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. void updateAccount(AccountForm accountForm) throws OperationFailedException, PermissionDeniedException
accountForm - the form containing the elements to be updatedIllegalStateException - accountForm
already used in an update transactionInvalidArgumentException - the form contains an invalid
valueNullArgumentException - accountForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - accountForm did
not originate from getAccountFormForUpdate() mandatory - This method must be implemented. boolean canDeleteAccounts()
Accounts. A return of
true does not guarantee successful authorization. A return of false
indicates that it is known deleting an Account 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 Account deletion is not
authorized, true otherwisemandatory - This method must be implemented. void deleteAccount(Id accountId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Account. accountId - the Id of the Account
to removeNotFoundException - accountId not foundNullArgumentException - accountId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canManageAccountAliases()
Id aliases for
Accounts. 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 Account aliasing is not
authorized, true otherwisemandatory - This method must be implemented. void aliasAccount(Id accountId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id to an Account for the purpose
of creating compatibility. The primary Id of the
Account is deactivityined by the provider. The new Id
performs as an alias to the primary Id. If the
alias is a pointer to another account, it is reassigned to the given
account Id. accountId - the Id of an Account aliasId - the alias Id AlreadyExistsException - aliasId is in
use as a primary Id NotFoundException - accountId not foundNullArgumentException - accountId or
aliasId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented.