Interface ContactAdminSession

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

public interface ContactAdminSession extends OsidSession

This session creates, updates, and deletes Contacts . 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 a Contact , a ContactForm is requested using getContactFormForCreate() specifying the desired relationship peers and record Types or none if no record Types are needed. The returned ContactForm 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 ContactForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each ContactForm corresponds to an attempted transaction.

For updates, ContactForms are requested to the Contact Id that is to be updated using getContactFormForUpdate() . Similarly, the ContactForm has metadata about the data that can be updated and it can perform validation before submitting the update. The ContactForm can only be used once for a successful update and cannot be reused.

The delete operations delete Addresses . To unmap a Contact from the current AddressBook , the ContactAddressBookAssignmentSession should be used. These delete operations attempt to remove the Address itself thus removing it from all known ContactForm catalogs.

This session includes an Id aliasing mechanism to assign an external Id to an internally assigned Id.

  • Method Details

    • getAddressBookId

      Id getAddressBookId()
      Gets the AddressBook Id associated with this session.
      Returns:
      the AddressBook Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getAddressBook

      Gets the AddressBook associated with this session.
      Returns:
      the address book
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canCreateContacts

      boolean canCreateContacts()
      Tests if this user can create contacts. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a Contact 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 Contact creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateContactWithRecordTypes

      boolean canCreateContactWithRecordTypes(Type[] contactRecordTypes)
      Tests if this user can create a single Contact using the desired record types. While ContactManager.getContactRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Contact . Providing an empty array tests if a Contact can be created with no records.
      Parameters:
      contactRecordTypes - array of contact record types
      Returns:
      true if Contact creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - contactRecordTypes is null
      Compliance:
      mandatory - This method must be implemented.
    • getContactFormForCreate

      ContactForm getContactFormForCreate(Id addressId, Id referenceId, Type[] contactRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Gets the contact form for creating new contacts. A new form should be requested for each create transaction.
      Parameters:
      addressId - the Id for the address
      referenceId - the Id for the reference
      contactRecordTypes - array of contact record types
      Returns:
      the contact form
      Throws:
      NotFoundException - addressId is not found
      NullArgumentException - addressId, referenceId , or contactRecordTypes 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.
    • createContact

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

      boolean canUpdateContacts()
      Tests if this user can update contacts. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Contact 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 Contact modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getContactFormForUpdate

      Gets the contact form for updating an existing contact. A new contact form should be requested for each update transaction.
      Parameters:
      contactId - the Id of the Contact
      Returns:
      the contact form
      Throws:
      NotFoundException - contactId is not found
      NullArgumentException - contactId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • updateContact

      void updateContact(ContactForm contactForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing contact.
      Parameters:
      contactForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - contactForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - contactForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - contactForm did not originate from getContactFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteContacts

      boolean canDeleteContacts()
      Tests if this user can delete contacts. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an Contact 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 Contact deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteContact

      Deletes a Contact .
      Parameters:
      contactId - the Id of the Contact to remove
      Throws:
      NotFoundException - contactId not found
      NullArgumentException - contactId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageContactAliases

      boolean canManageContactAliases()
      Tests if this user can manage Id aliases for Contacts . 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 Contact aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasContact

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