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.
Modifier and Type | Method and Description |
---|---|
void |
aliasContact(Id contactId,
Id aliasId)
Adds an
Id to a Contact for the purpose
of creating compatibility. |
boolean |
canCreateContacts()
Tests if this user can create contacts.
|
boolean |
canCreateContactWithRecordTypes(Type[] contactRecordTypes)
Tests if this user can create a single
Contact using
the desired record types. |
boolean |
canDeleteContacts()
Tests if this user can delete contacts.
|
boolean |
canManageContactAliases()
Tests if this user can manage
Id aliases for
Contacts. |
boolean |
canUpdateContacts()
Tests if this user can update contacts.
|
Contact |
createContact(ContactForm contactForm)
Creates a new
Contact. |
void |
deleteContact(Id contactId)
Deletes a
Contact. |
AddressBook |
getAddressBook()
Gets the
AddressBook associated with this session. |
Id |
getAddressBookId()
Gets the
AddressBook Id associated with
this session. |
ContactForm |
getContactFormForCreate(Id addressId,
Id referenceId,
Type[] contactRecordTypes)
Gets the contact form for creating new contacts.
|
ContactForm |
getContactFormForUpdate(Id contactId)
Gets the contact form for updating an existing contact.
|
void |
updateContact(ContactForm contactForm)
Updates an existing contact.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getAddressBookId()
AddressBook
Id
associated with
this session. AddressBook Id
associated with this sessionmandatory
- This method must be implemented. AddressBook getAddressBook() throws OperationFailedException, PermissionDeniedException
AddressBook
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateContacts()
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. false
if Contact
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateContactWithRecordTypes(Type[] contactRecordTypes)
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.contactRecordTypes
- array of contact record types true
if Contact
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- contactRecordTypes
is null
mandatory
- This method must be implemented. ContactForm getContactFormForCreate(Id addressId, Id referenceId, Type[] contactRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
addressId
- the Id
for the addressreferenceId
- the Id
for the referencecontactRecordTypes
- array of contact record typesNotFoundException
- addressId
is not
foundNullArgumentException
- addressId, referenceId,
or contactRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Contact createContact(ContactForm contactForm) throws OperationFailedException, PermissionDeniedException
Contact.
contactForm
- the form for this Contact
Contact
IllegalStateException
- contactForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- contactForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- contactForm
did
not originate from getContactFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateContacts()
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. false
if Contact
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. ContactForm getContactFormForUpdate(Id contactId) throws NotFoundException, OperationFailedException, PermissionDeniedException
contactId
- the Id
of the Contact
NotFoundException
- contactId
is not
foundNullArgumentException
- contactId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateContact(ContactForm contactForm) throws OperationFailedException, PermissionDeniedException
contactForm
- the form containing the elements to be updatedIllegalStateException
- contactForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- contactForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- contactForm
did
not originate from getContactFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteContacts()
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. false
if Contact
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteContact(Id contactId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Contact.
contactId
- the Id
of the Contact
to removeNotFoundException
- contactId
not foundNullArgumentException
- contactId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageContactAliases()
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. false
if Contact
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasContact(Id contactId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
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.
contactId
- the Id
of a Contact
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- contactId
not foundNullArgumentException
- contactId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.