Interface MessageAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
MessageBatchAdminSession
This session creates, updates, and deletes Messages . 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
Message , a MessageForm is requested using
getMessageFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned
MessageForm 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 MessageForm is submiited to a create operation, it cannot
be reused with another create operation unless the first operation was
unsuccessful. Each MessageForm corresponds to an attempted
transaction.
For updates, MessageForms are requested to the Message
Id that is to be updated using getMessageFormForUpdate() .
Similarly, the MessageForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
MessageForm can only be used once for a successful update and
cannot be reused.
The delete operations delete Messages . To unmap a
Message from the current Mailbox , the
MessageMailboxAssignmentSession should be used. These delete operations
attempt to remove the Message itself thus removing it from all
known Mailbox catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasMessage(Id messageId, Id aliasId) Adds anIdto aMessagefor the purpose of creating compatibility.booleanTests if this user can createMessages.booleancanCreateMessageWithRecordTypes(Type[] messageRecordTypes) Tests if this user can create a singleMessageusing the desired record types.booleanTests if this user can deleteMessages.booleanTests if this user can manageIdaliases forMessages.booleanTests if this user can updateMessages.createMessage(MessageForm messageForm) Creates a newMessage.voiddeleteMessage(Id messageId) Deletes aMessage.Gets theMailboxassociated with this session.Gets theMailboxIdassociated with this session.getMessageFormForCreate(Type[] messageRecordTypes) Gets the message form for creating new messages.getMessageFormForUpdate(Id messageId) Gets the message form for updating an existing message.voidupdateMessage(MessageForm messageForm) Updates an existing message.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
-
getMailboxId
Id getMailboxId()Gets theMailboxIdassociated with this session.- Returns:
- the
Mailbox Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getMailbox
Gets theMailboxassociated with this session.- Returns:
- the
Mailboxassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateMessages
boolean canCreateMessages()Tests if this user can createMessages. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aMessagewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifMessagecreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateMessageWithRecordTypes
Tests if this user can create a singleMessageusing the desired record types. WhileMessagingManager.getMessageRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificMessage. Providing an empty array tests if aMessagecan be created with no records.- Parameters:
messageRecordTypes- array of message record types- Returns:
trueifMessagecreation using the specifiedTypesis supported,falseotherwise- Throws:
NullArgumentException-messageRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getMessageFormForCreate
MessageForm getMessageFormForCreate(Type[] messageRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the message form for creating new messages. A new form should be requested for each create transaction.- Parameters:
messageRecordTypes- array of message record types- Returns:
- the message form
- Throws:
NullArgumentException-messageRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createMessage
Message createMessage(MessageForm messageForm) throws OperationFailedException, PermissionDeniedException Creates a newMessage.- Parameters:
messageForm- the form for thisMessage- Returns:
- the new
Message - Throws:
IllegalStateException-messageFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-messageFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-messageFormdid not originate fromgetMessageFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateMessages
boolean canUpdateMessages()Tests if this user can updateMessages. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aMessagewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifMessagemodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getMessageFormForUpdate
MessageForm getMessageFormForUpdate(Id messageId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the message form for updating an existing message. A new message form should be requested for each update transaction.- Parameters:
messageId- theIdof theMessage- Returns:
- the message form
- Throws:
NotFoundException-messageIdis not foundNullArgumentException-messageIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateMessage
void updateMessage(MessageForm messageForm) throws OperationFailedException, PermissionDeniedException Updates an existing message.- Parameters:
messageForm- the form containing the elements to be updated- Throws:
IllegalStateException-messageFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-messageFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-messageFormdid not originate fromgetMessageFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteMessages
boolean canDeleteMessages()Tests if this user can deleteMessages. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aMessagewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifMessagedeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteMessage
void deleteMessage(Id messageId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aMessage.- Parameters:
messageId- theIdof theMessageto remove- Throws:
NotFoundException-messageIdnot foundNullArgumentException-messageIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageMessageAliases
boolean canManageMessageAliases()Tests if this user can manageIdaliases forMessages. 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:
falseifMessagealiasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasMessage
void aliasMessage(Id messageId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aMessagefor the purpose of creating compatibility. The primaryIdof theMessageis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another message, it is reassigned to the given messageId.- Parameters:
messageId- theIdof aMessagealiasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-messageIdnot foundNullArgumentException-aliasIdormessageIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-