Interface AccountAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
AccountBatchAdminSession
This session creates, updates, and deletes Accounts . 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
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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasAccount(Id accountId, Id aliasId) Adds anIdto anAccountfor the purpose of creating compatibility.booleanTests if this user can createAccounts.booleancanCreateAccountWithRecordTypes(Type[] accountRecordTypes) Tests if this user can create a singleAccountusing the desired record types.booleanTests if this user can deleteAccounts.booleanTests if this user can manageIdaliases forAccounts.booleanTests if this user can updateAccounts.createAccount(AccountForm accountForm) Creates a newAccount.voiddeleteAccount(Id accountId) Deletes anAccount.getAccountFormForCreate(Type[] accountRecordTypes) Gets the account form for creating new accounts.getAccountFormForUpdate(Id accountId) Gets the account form for updating an existing account.Gets theBusinessassociated with this session.Gets theBusinessIdassociated with this session.voidupdateAccount(AccountForm accountForm) Updates an existing account.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.
-
canCreateAccounts
boolean canCreateAccounts()Tests if this user can createAccounts. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anAccountwill 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:
falseifAccountcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateAccountWithRecordTypes
Tests if this user can create a singleAccountusing the desired record types. WhileFinancialsManager.getAccountRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificAccount. Providing an empty array tests if anAccountcan be created with no records.- Parameters:
accountRecordTypes- array of account record types- Returns:
trueifAccountcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-accountRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getAccountFormForCreate
AccountForm getAccountFormForCreate(Type[] accountRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the account form for creating new accounts. A new form should be requested for each create transaction.- Parameters:
accountRecordTypes- array of account record types- Returns:
- the account form
- Throws:
NullArgumentException-accountRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createAccount
Account createAccount(AccountForm accountForm) throws OperationFailedException, PermissionDeniedException Creates a newAccount.- Parameters:
accountForm- the form for thisAccount- Returns:
- the new
Account - Throws:
IllegalStateException-accountFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-accountFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-accountFormdid not originate fromgetAccountFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateAccounts
boolean canUpdateAccounts()Tests if this user can updateAccounts. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anAccountwill 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:
falseifAccountmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getAccountFormForUpdate
AccountForm getAccountFormForUpdate(Id accountId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the account form for updating an existing account. A new account form should be requested for each update transaction.- Parameters:
accountId- theIdof theAccount- Returns:
- the account form
- Throws:
NotFoundException-accountIdis not foundNullArgumentException-accountIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateAccount
void updateAccount(AccountForm accountForm) throws OperationFailedException, PermissionDeniedException Updates an existing account.- Parameters:
accountForm- the form containing the elements to be updated- Throws:
IllegalStateException-accountFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-accountFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-accountFormdid not originate fromgetAccountFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteAccounts
boolean canDeleteAccounts()Tests if this user can deleteAccounts. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anAccountwill 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:
falseifAccountdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteAccount
void deleteAccount(Id accountId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anAccount.- Parameters:
accountId- theIdof theAccountto remove- Throws:
NotFoundException-accountIdnot foundNullArgumentException-accountIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageAccountAliases
boolean canManageAccountAliases()Tests if this user can manageIdaliases forAccounts. 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:
falseifAccountaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasAccount
void aliasAccount(Id accountId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anAccountfor the purpose of creating compatibility. The primaryIdof theAccountis deactivityined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another account, it is reassigned to the given accountId.- Parameters:
accountId- theIdof anAccountaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-accountIdnot foundNullArgumentException-accountIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-