Interface MessageAdminSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
All Known Subinterfaces:
MessageBatchAdminSession

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.

  • Method Details

    • getMailboxId

      Id getMailboxId()
      Gets the Mailbox Id associated with this session.
      Returns:
      the Mailbox Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getMailbox

      Gets the Mailbox associated with this session.
      Returns:
      the Mailbox associated with this session
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canCreateMessages

      boolean canCreateMessages()
      Tests if this user can create 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.
      Returns:
      false if Message creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateMessageWithRecordTypes

      boolean canCreateMessageWithRecordTypes(Type[] messageRecordTypes)
      Tests if this user can create a single 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.
      Parameters:
      messageRecordTypes - array of message record types
      Returns:
      true if Message creation using the specified Types is supported, false otherwise
      Throws:
      NullArgumentException - messageRecordTypes is null
      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 - messageRecordTypes is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - unable to get form for requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createMessage

      Creates a new Message .
      Parameters:
      messageForm - the form for this Message
      Returns:
      the new Message
      Throws:
      IllegalStateException - messageForm already used in a create transaction
      InvalidArgumentException - one or more of the form elements is invalid
      NullArgumentException - messageForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - messageForm did not originate from getMessageFormForCreate()
      Compliance:
      mandatory - This method must be implemented.
    • canUpdateMessages

      boolean canUpdateMessages()
      Tests if this user can update 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.
      Returns:
      false if Message modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getMessageFormForUpdate

      Gets the message form for updating an existing message. A new message form should be requested for each update transaction.
      Parameters:
      messageId - the Id of the Message
      Returns:
      the message form
      Throws:
      NotFoundException - messageId is not found
      NullArgumentException - messageId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - 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 - messageForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - messageForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - messageForm did not originate from getMessageFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteMessages

      boolean canDeleteMessages()
      Tests if this user can delete 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.
      Returns:
      false if Message deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteMessage

      Deletes a Message .
      Parameters:
      messageId - the Id of the Message to remove
      Throws:
      NotFoundException - messageId not found
      NullArgumentException - messageId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageMessageAliases

      boolean canManageMessageAliases()
      Tests if this user can manage 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.
      Returns:
      false if Message aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasMessage

      Adds an 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 .
      Parameters:
      messageId - the Id of a Message
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is already assigned
      NotFoundException - messageId not found
      NullArgumentException - aliasId or messageId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.