public interface MessageAdminSession extends OsidSession
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.
Modifier and Type | Method and Description |
---|---|
void |
aliasMessage(Id messageId,
Id aliasId)
Adds an
Id to a Message for the purpose
of creating compatibility. |
boolean |
canCreateMessages()
Tests if this user can create
Messages. |
boolean |
canCreateMessageWithRecordTypes(Type[] messageRecordTypes)
Tests if this user can create a single
Message using
the desired record types. |
boolean |
canDeleteMessages()
Tests if this user can delete
Messages. |
boolean |
canManageMessageAliases()
Tests if this user can manage
Id aliases for
Messages. |
boolean |
canUpdateMessages()
Tests if this user can update
Messages. |
Message |
createMessage(MessageForm messageForm)
Creates a new
Message. |
void |
deleteMessage(Id messageId)
Deletes a
Message. |
Mailbox |
getMailbox()
Gets the
Mailbox associated with this session. |
Id |
getMailboxId()
Gets the
Mailbox Id associated with this
session. |
MessageForm |
getMessageFormForCreate(Type[] messageRecordTypes)
Gets the message form for creating new messages.
|
MessageForm |
getMessageFormForUpdate(Id messageId)
Gets the message form for updating an existing message.
|
void |
updateMessage(MessageForm messageForm)
Updates an existing message.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getMailboxId()
Mailbox
Id
associated with this
session. Mailbox Id
associated with this sessionmandatory
- This method must be implemented. Mailbox getMailbox() throws OperationFailedException, PermissionDeniedException
Mailbox
associated with this session. Mailbox
associated with this sessionOperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateMessages()
Messages.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known creating a Message
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer create operations to
an unauthorized user. false
if Message
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateMessageWithRecordTypes(Type[] messageRecordTypes)
Message
using
the desired record types. While
MessagingManager.getMessageRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Message.
Providing
an empty array tests if a Message
can be created with
no records.messageRecordTypes
- array of message record types true
if Message
creation using
the specified Types
is supported, false
otherwiseNullArgumentException
- messageRecordTypes
is null
mandatory
- This method must be implemented. MessageForm getMessageFormForCreate(Type[] messageRecordTypes) throws OperationFailedException, PermissionDeniedException
messageRecordTypes
- array of message record typesNullArgumentException
- messageRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Message createMessage(MessageForm messageForm) throws OperationFailedException, PermissionDeniedException
Message.
messageForm
- the form for this Message
Message
IllegalStateException
- messageForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- messageForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- messageForm
did
not originate from getMessageFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateMessages()
Messages.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known updating a Message
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer update operations to
an unauthorized user. false
if Message
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. MessageForm getMessageFormForUpdate(Id messageId) throws NotFoundException, OperationFailedException, PermissionDeniedException
messageId
- the Id
of the Message
NotFoundException
- messageId
is not
foundNullArgumentException
- messageId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateMessage(MessageForm messageForm) throws OperationFailedException, PermissionDeniedException
messageForm
- the form containing the elements to be updatedIllegalStateException
- messageForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- messageForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- messageForm
did
not originate from getMessageFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteMessages()
Messages.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known deleting a Message
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer delete operations to
an unauthorized user. false
if Message
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteMessage(Id messageId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Message.
messageId
- the Id
of the Message
to removeNotFoundException
- messageId
not foundNullArgumentException
- messageId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageMessageAliases()
Id
aliases for
Messages.
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 Message
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasMessage(Id messageId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Message
for the purpose
of creating compatibility. The primary Id
of the
Message
is determined by the provider. The new Id
performs as an alias to the primary Id.
If the
alias is a pointer to another message, it is reassigned to the given
message Id.
messageId
- the Id
of a Message
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- messageId
not foundNullArgumentException
- aliasId
or
messageId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.