Interface ContactAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
ContactBatchAdminSession
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 Summary
Modifier and TypeMethodDescriptionvoidaliasContact(Id contactId, Id aliasId) Adds anIdto aContactfor the purpose of creating compatibility.booleanTests if this user can create contacts.booleancanCreateContactWithRecordTypes(Type[] contactRecordTypes) Tests if this user can create a singleContactusing the desired record types.booleanTests if this user can delete contacts.booleanTests if this user can manageIdaliases forContacts.booleanTests if this user can update contacts.createContact(ContactForm contactForm) Creates a newContact.voiddeleteContact(Id contactId) Deletes aContact.Gets theAddressBookassociated with this session.Gets theAddressBookIdassociated with this session.getContactFormForCreate(Id addressId, Id referenceId, Type[] contactRecordTypes) Gets the contact form for creating new contacts.getContactFormForUpdate(Id contactId) Gets the contact form for updating an existing contact.voidupdateContact(ContactForm contactForm) Updates an existing contact.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
-
getAddressBookId
Id getAddressBookId()Gets theAddressBookIdassociated with this session.- Returns:
- the
AddressBook Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getAddressBook
Gets theAddressBookassociated with this session.- Returns:
- the address book
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- 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 aContactwill 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:
falseifContactcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateContactWithRecordTypes
Tests if this user can create a singleContactusing the desired record types. WhileContactManager.getContactRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificContact. Providing an empty array tests if aContactcan be created with no records.- Parameters:
contactRecordTypes- array of contact record types- Returns:
trueifContactcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-contactRecordTypesisnull- 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- theIdfor the addressreferenceId- theIdfor the referencecontactRecordTypes- array of contact record types- Returns:
- the contact form
- Throws:
NotFoundException-addressIdis not foundNullArgumentException-addressId, referenceId, orcontactRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createContact
Contact createContact(ContactForm contactForm) throws OperationFailedException, PermissionDeniedException Creates a newContact.- Parameters:
contactForm- the form for thisContact- Returns:
- the new
Contact - Throws:
IllegalStateException-contactFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-contactFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-contactFormdid not originate fromgetContactFormForCreate()- 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 aContactwill 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:
falseifContactmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getContactFormForUpdate
ContactForm getContactFormForUpdate(Id contactId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the contact form for updating an existing contact. A new contact form should be requested for each update transaction.- Parameters:
contactId- theIdof theContact- Returns:
- the contact form
- Throws:
NotFoundException-contactIdis not foundNullArgumentException-contactIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- 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-contactFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-contactFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-contactFormdid not originate fromgetContactFormForUpdate()- 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 anContactwill 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:
falseifContactdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteContact
void deleteContact(Id contactId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aContact.- Parameters:
contactId- theIdof theContactto remove- Throws:
NotFoundException-contactIdnot foundNullArgumentException-contactIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageContactAliases
boolean canManageContactAliases()Tests if this user can manageIdaliases forContacts. 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:
falseifContactaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasContact
void aliasContact(Id contactId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aContactfor the purpose of creating compatibility. The primaryIdof theContactis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another contact, it is reassigned to the given contactId.- Parameters:
contactId- theIdof aContactaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-contactIdnot foundNullArgumentException-contactIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-