Interface AddressAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
AddressBatchAdminSession
This session creates, updates, and deletes Addresses . 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
Address , an AddressForm is requested using
getAddressFormForCreate() specifying the desired relationship peers and
record Types or none if no record Types are needed. The
returned AddressForm 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 AddressForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each AddressForm corresponds to
an attempted transaction.
For updates, AddressForms are requested to the Address
Id that is to be updated using getAddressFormForUpdate() .
Similarly, the AddressForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
AddressForm can only be used once for a successful update and
cannot be reused.
The delete operations delete Addresses . To unmap an
Address from the current AddressBook , the
AddressAddressBookAssignmentSession should be used. These delete
operations attempt to remove the Address itself thus removing it
from all known AddressBook catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasAddress(Id addressId, Id aliasId) Adds anIdto anAddressfor the purpose of creating compatibility.booleanTests if this user can createAddresses.booleancanCreateAddressWithRecordTypes(Type[] addressRecordTypes) Tests if this user can create a singleAddressusing the desired record types.booleanTests if this user can deleteAddressesA return of true does not guarantee successful authorization.booleanTests if this user can manageIdaliases forAddresses.booleanTests if this user can updateAddresses.createAddress(AddressForm addressForm) Creates a newAddress.voiddeleteAddress(Id addressId) Deletes anAddress.Gets theAddressBookassociated with this session.Gets theAddressBookIdassociated with this session.getAddressFormForCreate(Type[] addressRecordTypes) Gets the address form for creating new addresses.getAddressFormForUpdate(Id addressId) Gets the address form for updating an existing address.voidupdateAddress(AddressForm addressForm) Updates an existing address.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.
-
canCreateAddresses
boolean canCreateAddresses()Tests if this user can createAddresses. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anAddresswill 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:
falseifAddresscreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateAddressWithRecordTypes
Tests if this user can create a singleAddressusing the desired record types. WhileContactManager.getAddressRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificAddress. Providing an empty array tests if anAddresscan be created with no records.- Parameters:
addressRecordTypes- array of address record types- Returns:
trueifAddresscreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-addressRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getAddressFormForCreate
AddressForm getAddressFormForCreate(Type[] addressRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the address form for creating new addresses. A new form should be requested for each create transaction.- Parameters:
addressRecordTypes- array of address record types- Returns:
- the address form
- Throws:
NullArgumentException-addressRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createAddress
Address createAddress(AddressForm addressForm) throws OperationFailedException, PermissionDeniedException Creates a newAddress.- Parameters:
addressForm- the form for thisAddress- Returns:
- the new
Address - Throws:
IllegalStateException-addressFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-addressFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-addressFormdid not originate fromgetAddressFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateAddresses
boolean canUpdateAddresses()Tests if this user can updateAddresses. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anAddresswill 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:
falseifAddressmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getAddressFormForUpdate
AddressForm getAddressFormForUpdate(Id addressId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the address form for updating an existing address. A new address form should be requested for each update transaction.- Parameters:
addressId- theIdof theAddress- Returns:
- the address form
- Throws:
NotFoundException-addressIdis not foundNullArgumentException-addressIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateAddress
void updateAddress(AddressForm addressForm) throws OperationFailedException, PermissionDeniedException Updates an existing address.- Parameters:
addressForm- the form containing the elements to be updated- Throws:
IllegalStateException-addressFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-addressIdoraddressFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-addressFormdid not originate fromgetAddressFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteAddresses
boolean canDeleteAddresses()Tests if this user can deleteAddressesA return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anAddresswill 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:
falseifAddressdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteAddress
void deleteAddress(Id addressId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anAddress.- Parameters:
addressId- theIdof theAddressto remove- Throws:
NotFoundException-addressIdnot foundNullArgumentException-addressIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageAddressAliases
boolean canManageAddressAliases()Tests if this user can manageIdaliases forAddresses. 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:
falseifAddressaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasAddress
void aliasAddress(Id addressId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anAddressfor the purpose of creating compatibility. The primaryIdof theAddressis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another address, it is reassigned to the given addressId.- Parameters:
addressId- theIdof anAddressaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-addressIdnot foundNullArgumentException-addressIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-