Interface AddressBookAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
AddressBookBatchAdminSession
This session creates, updates, and deletes AddressBooks . 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
AddressBook , an AddressBookForm is requested using
getAddressBookFormForCreate() specifying the desired record Types
or none if no record Types are needed. The returned
AddressBookForm 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 AddressBookForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each AddressBookForm corresponds
to an attempted transaction.
For updates, AddressBookForms are requested to the
AddressBook Id that is to be updated using
getAddressBookFormForUpdate() . Similarly, the AddressBookForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The AddressBookForm can
only be used once for a successful update and cannot be reused.
The delete operations delete AddressBooks .
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasAddressBook(Id addressBookId, Id aliasId) Adds anIdto anAddressBookfor the purpose of creating compatibility.booleanTests if this user can createAddressBooks.booleancanCreateAddressBookWithRecordTypes(Type[] addressBookRecordTypes) Tests if this user can create a singleAddressBookusing the desired record types.booleanTests if this user can deleteAddressBooksA return of true does not guarantee successful authorization.booleanTests if this user can manageIdaliases forAddressBooks.booleanTests if this user can updateAddressBooks.createAddressBook(AddressBookForm addressBookForm) Creates a newAddressBook.voiddeleteAddressBook(Id addressBookId) Deletes anAddressBook.getAddressBookFormForCreate(Type[] addressBookRecordTypes) Gets the address book form for creating new address books.getAddressBookFormForUpdate(Id addressBookId) Gets the address book form for updating an existing address book.voidupdateAddressBook(AddressBookForm addressBookForm) Updates an existing address book.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
-
canCreateAddressBooks
boolean canCreateAddressBooks()Tests if this user can createAddressBooks. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anAddressBookwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.- Returns:
falseifAddressBookcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateAddressBookWithRecordTypes
Tests if this user can create a singleAddressBookusing the desired record types. WhileContactManager.getAddressBookRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificAddressBook. Providing an empty array tests if anAddressBookcan be created with no records.- Parameters:
addressBookRecordTypes- array of address book types- Returns:
trueifAddressBookcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-addressBookRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getAddressBookFormForCreate
AddressBookForm getAddressBookFormForCreate(Type[] addressBookRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the address book form for creating new address books. A new form should be requested for each create transaction.- Parameters:
addressBookRecordTypes- array of address book types- Returns:
- the address book form
- Throws:
NullArgumentException-addressBookRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createAddressBook
AddressBook createAddressBook(AddressBookForm addressBookForm) throws OperationFailedException, PermissionDeniedException Creates a newAddressBook.- Parameters:
addressBookForm- the form for thisAddressBook- Returns:
- the new
AddressBook - Throws:
IllegalStateException-addressBookFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-addressBookFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-addressBookFormdid not originate fromgetAddressBookFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateAddressBooks
boolean canUpdateAddressBooks()Tests if this user can updateAddressBooks. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anAddressBookwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Returns:
falseifAddressBookmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getAddressBookFormForUpdate
AddressBookForm getAddressBookFormForUpdate(Id addressBookId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the address book form for updating an existing address book. A new address book form should be requested for each update transaction.- Parameters:
addressBookId- theIdof theAddressBook- Returns:
- the address book form
- Throws:
NotFoundException-addressBookIdis not foundNullArgumentException-addressBookIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateAddressBook
void updateAddressBook(AddressBookForm addressBookForm) throws OperationFailedException, PermissionDeniedException Updates an existing address book.- Parameters:
addressBookForm- the form containing the elements to be updated- Throws:
IllegalStateException-addressBookFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-addressBookIdoraddressBookFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-addressBookFormdid not originate fromgetAddressBookFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteAddressBooks
boolean canDeleteAddressBooks()Tests if this user can deleteAddressBooksA return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anAddressBookwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Returns:
falseifAddressBookdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteAddressBook
void deleteAddressBook(Id addressBookId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anAddressBook.- Parameters:
addressBookId- theIdof theAddressBookto remove- Throws:
NotFoundException-addressBookIdnot foundNullArgumentException-addressBookIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageAddressBookAliases
boolean canManageAddressBookAliases()Tests if this user can manageIdaliases forAddressBooks. 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:
falseifAddressBookaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasAddressBook
void aliasAddressBook(Id addressBookId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anAddressBookfor the purpose of creating compatibility. The primaryIdof theAddressBookis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another addressBook, it is reassigned to the given address bookId.- Parameters:
addressBookId- theIdof anAddressBookaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-addressBookIdnot foundNullArgumentException-addressBookIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-