Interface ContactAddressBookAssignmentSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session provides methods to re-assign Contacts to
AddressBooks . A Contact may map to multiple AddressBooks
and removing the last reference to a Contact is the equivalent of
deleting it. Each AddressBook may have its own authorizations
governing who is allowed to operate on it.
Adding a reference of a Contact to another AddressBook
is not a copy operation (eg: does not change its Id ).
-
Method Summary
Modifier and TypeMethodDescriptionvoidassignContactToAddressBook(Id contactId, Id addressBookId) Adds an existingContactto anAddressBook.booleanTests if this user can alter contact/address book mappings.booleancanAssignContactsToAddressBook(Id addressBookId) Tests if this user can alter contact/address book mappings.getAssignableAddressBookIds(Id addressBookId) Gets a list of address books including and under the given address book node in which any contact can be assigned.getAssignableAddressBookIdsForContact(Id addressBookId, Id contactId) Gets a list of address books including and under the given address book node in which a specific contact can be assigned.voidreassignContactToAddressBook(Id contactId, Id fromAddressBookId, Id toAddressBookId) Moves aContactfrom oneAddressBookto another.voidunassignContactFromAddressBook(Id contactId, Id addressBookId) Removes aContactfrom anAddressBook.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
-
canAssignContacts
boolean canAssignContacts()Tests if this user can alter contact/address book mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users.- Returns:
falseif mapping is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canAssignContactsToAddressBook
Tests if this user can alter contact/address book mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users.- Parameters:
addressBookId- theIdof theAddressBook- Returns:
falseif mapping is not authorized,trueotherwise- Throws:
NullArgumentException-addressBookIdisnull- Compliance:
mandatory- This method must be implemented.
-
getAssignableAddressBookIds
Gets a list of address books including and under the given address book node in which any contact can be assigned.- Parameters:
addressBookId- theIdof theAddressBook- Returns:
- list of assignable address book
Ids - Throws:
NullArgumentException-addressBookIdisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
getAssignableAddressBookIdsForContact
IdList getAssignableAddressBookIdsForContact(Id addressBookId, Id contactId) throws OperationFailedException Gets a list of address books including and under the given address book node in which a specific contact can be assigned.- Parameters:
addressBookId- theIdof theAddressBookcontactId- theIdof theContact- Returns:
- list of assignable address book
Ids - Throws:
NullArgumentException-addressBookIdorcontactIdisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
assignContactToAddressBook
void assignContactToAddressBook(Id contactId, Id addressBookId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds an existingContactto anAddressBook.- Parameters:
contactId- theIdof theContactaddressBookId- theIdof theAddressBook- Throws:
AlreadyExistsException-contactIdis already assigned toaddressBookIdNotFoundException-contactIdoraddressBookIdnot foundNullArgumentException-contactIdoraddressBookIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
unassignContactFromAddressBook
void unassignContactFromAddressBook(Id contactId, Id addressBookId) throws NotFoundException, OperationFailedException, PermissionDeniedException Removes aContactfrom anAddressBook.- Parameters:
contactId- theIdof theContactaddressBookId- theIdof theAddressBook- Throws:
NotFoundException-contactIdoraddressBookIdnot found orcontactIdnot assigned toaddressBookIdNullArgumentException-contactIdoraddressBookIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
reassignContactToAddressBook
void reassignContactToAddressBook(Id contactId, Id fromAddressBookId, Id toAddressBookId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Moves aContactfrom oneAddressBookto another. Mappings to otherAddressBooksare unaffected.- Parameters:
contactId- theIdof theContactfromAddressBookId- theIdof the currentAddressBooktoAddressBookId- theIdof the destinationAddressBook- Throws:
AlreadyExistsException-contactIdalready assigned totoAddressBookIdNotFoundException-contactId, fromAddressBookId, ortoAddressBookIdnot found orcontactIdnot mapped tofromAddressBookIdNullArgumentException-contactId, fromAddressBookId, ortoAddressBookIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-