Interface AddressBookAdminSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
All Known Subinterfaces:
AddressBookBatchAdminSession

public interface AddressBookAdminSession extends OsidSession

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 Details

    • canCreateAddressBooks

      boolean canCreateAddressBooks()
      Tests if this user can create AddressBooks . A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an AddressBook will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.
      Returns:
      false if AddressBook creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateAddressBookWithRecordTypes

      boolean canCreateAddressBookWithRecordTypes(Type[] addressBookRecordTypes)
      Tests if this user can create a single AddressBook using the desired record types. While ContactManager.getAddressBookRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific AddressBook . Providing an empty array tests if an AddressBook can be created with no records.
      Parameters:
      addressBookRecordTypes - array of address book types
      Returns:
      true if AddressBook creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - addressBookRecordTypes is null
      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 - addressBookRecordTypes is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - unable to get form for requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createAddressBook

      Creates a new AddressBook .
      Parameters:
      addressBookForm - the form for this AddressBook
      Returns:
      the new AddressBook
      Throws:
      IllegalStateException - addressBookForm already used in a create transaction
      InvalidArgumentException - one or more of the form elements is invalid
      NullArgumentException - addressBookForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - addressBookForm did not originate from getAddressBookFormForCreate()
      Compliance:
      mandatory - This method must be implemented.
    • canUpdateAddressBooks

      boolean canUpdateAddressBooks()
      Tests if this user can update AddressBooks . A return of true does not guarantee successful authorization. A return of false indicates that it is known updating an AddressBook will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.
      Returns:
      false if AddressBook modification is not authorized, true otherwise
      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 - the Id of the AddressBook
      Returns:
      the address book form
      Throws:
      NotFoundException - addressBookId is not found
      NullArgumentException - addressBookId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - 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 - addressBookForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - addressBookId or addressBookForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - addressBookForm did not originate from getAddressBookFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteAddressBooks

      boolean canDeleteAddressBooks()
      Tests if this user can delete AddressBooks A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an AddressBook will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.
      Returns:
      false if AddressBook deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteAddressBook

      void deleteAddressBook(Id addressBookId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Deletes an AddressBook .
      Parameters:
      addressBookId - the Id of the AddressBook to remove
      Throws:
      NotFoundException - addressBookId not found
      NullArgumentException - addressBookId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageAddressBookAliases

      boolean canManageAddressBookAliases()
      Tests if this user can manage Id aliases for AddressBooks . 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.
      Returns:
      false if AddressBook aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasAddressBook

      void aliasAddressBook(Id addressBookId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
      Adds an Id to an AddressBook for the purpose of creating compatibility. The primary Id of the AddressBook is determined by the provider. The new Id performs as an alias to the primary Id . If the alias is a pointer to another addressBook, it is reassigned to the given address book Id .
      Parameters:
      addressBookId - the Id of an AddressBook
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is already assigned
      NotFoundException - addressBookId not found
      NullArgumentException - addressBookId or aliasId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.