Interface MessageBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, MessageAdminSession, OsidSession, OsidSession
This session creates, updates, and deletes Messages in bulk.
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
getMessageFormsForCreate() specifying the desired record Types or
none if no record Types are needed. Each of the returned
MessageForms 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 a 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.
The MessageForms returned from
getMessageFormsForCreate() may be linked to the originating request
through the peer Ids of the MessageForm . In the case
where there may be duplicates, any MessageForm of the same peer
Ids may be used for a create operation.
Once a batch of MessageForms are submitted for create, a
CreateResponse is returned for each MessageForm , although
the ordering is not defined. Only errors that pertain to the entire create
operation are returned from createMessages() , errors specific to
an individual MessageForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the
originating MessageForm through the MessageForm Id
.
For updates, MessageForms are requested to the Message
Id that is to be updated using getMessageFormsForUpdate()
where the reference Id in the MessageForm may be used to
link the request. 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.
Once a batch of MessageForms are submitted for update, an
UpdateResponse is returned for each MessageForm , although
the ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateMessages() , errors specific to
an individual MessageForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the
originating MessageForm through the MessageForm Id
.
The delete operations delete Messages in bulk. 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. Bulk delete operations return the results
in DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasMessages(AliasRequestList aliasRequests) Adds anIdto aMessagefor the purpose of creating compatibility.createMessages(MessageBatchFormList messageForms) Creates a new set ofMessages.Deletes allMessagesin thisMailbox.deleteMessagesByDate(DateTime from, DateTime to) Deletes messages received between the given date range inclusive.deleteMessagesBySender(Id resourceId) Deletes messages for the given sender resource.getMessageFormsForCreate(long number, Type[] messageRecordTypes) Gets the message forms for creating a bunch of new messages.getMessageFormsForUpdate(IdList messageIds) Gets the message forms for updating an existing set of messages.updateMessages(MessageBatchFormList messageForms) Updates existing messages.Methods inherited from interface MessageAdminSession
aliasMessage, canCreateMessages, canCreateMessageWithRecordTypes, canDeleteMessages, canManageMessageAliases, canUpdateMessages, createMessage, deleteMessage, getMailbox, getMailboxId, getMessageFormForCreate, getMessageFormForUpdate, updateMessageModifier 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
-
getMessageFormsForCreate
MessageBatchFormList getMessageFormsForCreate(long number, Type[] messageRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the message forms for creating a bunch of new messages.- Parameters:
number- the number of forms to retrievemessageRecordTypes- array of message record types to be included in each create operation or an empty list if none- Returns:
- the message forms
- Throws:
NullArgumentException-messageRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createMessages
CreateResponseList createMessages(MessageBatchFormList messageForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofMessages. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
messageForms- the message forms- Returns:
- the create responses
- Throws:
NullArgumentException-messageFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getMessageFormsForUpdate
MessageBatchFormList getMessageFormsForUpdate(IdList messageIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the message forms for updating an existing set of messages. A new message form should be requested for each update transaction.- Parameters:
messageIds- theIdsof theMessage- Returns:
- the message form
- Throws:
NotFoundException- amessageIdis not foundNullArgumentException-messageIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateMessages
UpdateResponseList updateMessages(MessageBatchFormList messageForms) throws OperationFailedException, PermissionDeniedException Updates existing messages. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
messageForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-messageFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllMessages
Deletes allMessagesin thisMailbox.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteMessagesBySender
DeleteResponseList deleteMessagesBySender(Id resourceId) throws OperationFailedException, PermissionDeniedException Deletes messages for the given sender resource.- Parameters:
resourceId- theIdof a resource- Returns:
- the delete responses
- Throws:
NullArgumentException-resourceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteMessagesByDate
DeleteResponseList deleteMessagesByDate(DateTime from, DateTime to) throws OperationFailedException, PermissionDeniedException Deletes messages received between the given date range inclusive.- Parameters:
from- start of date rangeto- end of date range- Returns:
- the delete responses
- Throws:
InvalidArgumentException-fromis greater thantoNullArgumentException-fromortoisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasMessages
AliasResponseList aliasMessages(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aMessagefor the purpose of creating compatibility. The primaryIdof theMessageis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another message, it is reassigned to the given messageId.- Parameters:
aliasRequests- the alias requests- Returns:
- the alias responses
- Throws:
NullArgumentException-aliasRequestsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-