Class ReceiveMsg

java.lang.Object
com.isode.x400api.MSMessage
com.isode.x400.highlevel.ReceiveMsg

public class ReceiveMsg extends MSMessage
Message read from a P7 Message Store or the MTA via P3
  • Constructor Details

    • ReceiveMsg

      public ReceiveMsg(P7BindSession session_obj, int seqn) throws X400APIException
      Constructs a new instance of this class given a P7BindSession and a sequence number. It connects to the P7 Message Store server specified in session_object and requests the message identified by seqn.
      Parameters:
      session_obj - : the session object to use for this message
      seqn - : Sequence number in the mailbox of the message to receive
      Throws:
      X400APIException
    • ReceiveMsg

      public ReceiveMsg(P3BindSession p3_session_obj) throws X400APIException
      Constructs a new instance of this class given a P3BindSession object
      Parameters:
      p3_session_obj - : the session object to use for this message
      Throws:
      X400APIException
    • ReceiveMsg

      public ReceiveMsg(P3BindSession p3_session_obj, int type, byte[] content) throws X400APIException
      Constructs a new instance of this class given a byte[] content
      Parameters:
      p3_session_obj -
      type -
      content -
      Throws:
      X400APIException
  • Method Details

    • delete

      public void delete(boolean retainInStore) throws X400APIException
      Delete message object
      Parameters:
      retainInStore - boolean : Retain in P7 Message Store (i.e. no P7 Delete) if true
      Throws:
      X400APIException
    • finalize

      protected void finalize() throws Throwable
      This routine will be called by the Garbage Collector at some point
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • getStringParam

      public String getStringParam(int param) throws X400APIException
      Get the specified string message parameter
      Parameters:
      param - int: One of the X400_att constants
      Returns:
      Returns the String value of the parameter, or "" if the parameter was not present in the message (i.e. it returned X400_E_NO_VALUE or X400_E_BADPARAM). Otherwise it throws an X400APIException
      Throws:
      X400APIException
    • getIntParam

      public int getIntParam(int param) throws X400APIException
      Get the specified integer message parameter
      Parameters:
      param - int: One of the X400_att constants
      Returns:
      Returns the integer value of the parameter, or -1 if the parameter was not present in the message (i.e. it returned X400_E_NO_VALUE or X400_E_BADPARAM). Otherwise it throws an X400APIException
      Throws:
      X400APIException
    • isIPN

      public boolean isIPN()
      Checks whether the message is an IPN (Inter Personal Notification)
    • isAllPositiveIPN

      public boolean isAllPositiveIPN()
      Checks whether the message is an IPN (Inter Personal Notification), and that all the reported recipients are read receipts (i.e. the message was read by all recipients).
    • getSubject

      public String getSubject() throws X400APIException
      Returns the subject of the message
      Throws:
      X400APIException
    • getTypeAsString

      public String getTypeAsString()
      Returns the type of the message as a string (message, report, probe or unknown)
    • getMessageType

      public X400Msg.X400_Message_Type getMessageType()
      Returns the type of the message as a X400_Message_Type
    • getX400Priority

      public X400Msg.X400_Priority getX400Priority() throws X400APIException
      Get the message X.400 priority
      Throws:
      X400APIException
    • getMilitaryPriority

      public X400Msg.Military_Priority getMilitaryPriority() throws X400APIException
      Returns:
      the military priority of this message. This method will return null if any of these conditions apply:
      - the message doesn't have the external content type set to P772 (1.3.26.0.4406.0.4.1)
      - the message is an IPN
      - the message is a Delivery Report

      Note that old implementations of this method used to return non-null values in the above cases.

      Throws:
      X400APIException
    • getPrimaryPrecedence

      public int getPrimaryPrecedence() throws X400APIException
      Obtain primary precedence value from message, if any.
      Returns:
      Primary Precedence value or -1 if not present
      Throws:
      X400APIException - if an internal error has occurred - this is almost certainly something fatal.
      Since:
      15.1
    • getCopyPrecedence

      public int getCopyPrecedence() throws X400APIException
      Obtain copy precedence value from message, if any.
      Returns:
      Copy Precedence value or -1 if not present
      Throws:
      X400APIException - if an internal error has occurred - this is almost certainly something fatal.
      Since:
      15.1
    • getFrom

      public String getFrom() throws X400APIException
      Returns the sender's String encoded O/R address
      Throws:
      X400APIException
    • getOriginatorFreeFormName

      public String getOriginatorFreeFormName() throws X400APIException
      Returns the sender's free form name, if available
      Throws:
      X400APIException
    • getOriginatorORAddress

      public String getOriginatorORAddress() throws X400APIException
      Returns the sender's O/R address
      Throws:
      X400APIException
    • getMessageIdentifier

      public String getMessageIdentifier() throws X400APIException
      Returns the message identifier
      Throws:
      X400APIException
    • getMessageIPMIdentifier

      public String getMessageIPMIdentifier() throws X400APIException
      Returns the message IPM identifier
      Throws:
      X400APIException
    • getMessageSubmissionTime

      public String getMessageSubmissionTime() throws X400APIException
      Returns the message submission time as a UTC string
      Throws:
      X400APIException
    • getMessageSubmissionTimeAsDate

      public Date getMessageSubmissionTimeAsDate() throws X400APIException
      Returns the message submission time as a Date
      Throws:
      X400APIException
    • getMessageDeliveryTime

      public String getMessageDeliveryTime() throws X400APIException
      Returns the message delivery time as a UTC string
      Throws:
      X400APIException
    • getMessageDeliveryTimeAsDate

      public Date getMessageDeliveryTimeAsDate() throws X400APIException
      Returns the message delivery time as a Date
      Throws:
      X400APIException
    • getTextContent

      public String getTextContent() throws X400APIException
      Returns the text content of the message as IA5 (if available)
      Throws:
      X400APIException
    • getReportContentAsText

      public String getReportContentAsText() throws X400APIException
      Returns a English text representation of the content of the report
      Throws:
      X400APIException
    • getIPNContentAsText

      public String getIPNContentAsText() throws X400APIException
      Returns a English text representation of the content of the IPN
      Throws:
      X400APIException
    • getImportance

      public int getImportance() throws X400APIException
      Returns the importance of the message
      Throws:
      X400APIException
    • getNumberOfBodyparts

      public int getNumberOfBodyparts() throws X400APIException
      Returns the number of bodyparts of the message
      Throws:
      X400APIException
    • getRecipients

      protected ArrayList<Recipient> getRecipients(int type) throws X400APIException
      Returns the message recipients, as an array list of Recipient objects This method is for internal use only.
      Parameters:
      type -
      Returns:
      Throws:
      X400APIException
    • getEnvelopeRecipients

      public ArrayList<Recipient> getEnvelopeRecipients() throws X400APIException
      Returns the message envelope recipients, as an array list of Recipient objects
      Throws:
      X400APIException
    • getIPMHeaderRecipients

      public ArrayList<Recipient> getIPMHeaderRecipients() throws X400APIException
      Returns the message IPM Header recipients, as an array list of Recipient objects
      Throws:
      X400APIException
    • getToRecipients

      public ArrayList<Recipient> getToRecipients() throws X400APIException
      Returns the message primary recipients (To:), as an array list of Recipient objects
      Throws:
      X400APIException
    • getCcRecipients

      public ArrayList<Recipient> getCcRecipients() throws X400APIException
      Returns the message copy recipients (Cc:), as an array list of Recipient objects
      Throws:
      X400APIException
    • getBccRecipients

      public ArrayList<Recipient> getBccRecipients() throws X400APIException
      Returns the message blind copy recipients (Bcc:), as an array list of Recipient objects
      Throws:
      X400APIException
    • getIntendedRecipient

      public Recip getIntendedRecipient() throws X400APIException
      Returns the IPN Intended Recipient, if one is set. Otherwise it returns null.
      Throws:
      X400APIException
    • getBodypart

      public Bodypart getBodypart(int bp_num) throws X400APIException
      Returns the specified bodypart of the message
      Parameters:
      bp_num - Bodypart number (starting from 1)
      Returns:
      An Bodypart object
      Throws:
      X400APIException
    • generateIPN

      public X400Msg generateIPN(P3BindSession p3bind_session, int reason, int ackMode) throws X400APIException
      Generates an IPN message so that it can be submitted later on
      Parameters:
      p3bind_session - the P3 or P7 session object to use for the IPN generation
      reason - Reason to use for the IPN
      ackMode - the Acknowledgement mode
      Returns:
      an IPN (X400Msg object) or null if it failed
      Throws:
      X400APIException
    • generateP22IPN

      public X400Msg generateP22IPN(P3BindSession p3bind_session, int reason, int ackMode) throws X400APIException
      Generates an IPN message so that it can be submitted later on. The content type is always P22 and the Acknowledgement Mode can be set
      Parameters:
      p3bind_session - the P3 or P7 session object to use for the IPN generation
      reason - Reason to use for the IPN
      ackMode - the Acknowledgement mode
      Returns:
      an IPN (X400Msg object) or null if it failed
      Throws:
      X400APIException
    • getMsgPrecedence

      public int getMsgPrecedence()
      Returns the message precedence, taken from one of the recipients.
    • getDLExpansionHistory

      public String getDLExpansionHistory()
      Returns the Distribution List Expansion History element of the message, if it exists, otherwise ""
    • finishWithMessage

      public int finishWithMessage(int errnum, int diag)
      After getting a message from the P3 channel, this method needs to be called to let the P3 channel know that the message was received and processed safely (i.e. by writing it to disk, a database or some other permanent storage)
      Parameters:
      errnum -
      diag -
    • getSecurityLabelAsBER

      public byte[] getSecurityLabelAsBER() throws X400APIException
      Read the X.411 security label from the message
      Returns:
      a byte array with the BER encoded security label
      Throws:
      X400APIException
    • getJRSecurityLabel

      public com.isode.rbac.swig.JRSecurityLabel getJRSecurityLabel() throws X400APIException
      Read the X.411 security label from the message
      Returns:
      a JRSecurityLabel object representing the X.411 security label of the message
      Throws:
      X400APIException
    • getPrintableStringParam

      public ArrayList<String> getPrintableStringParam(int param) throws X400APIException
      Get a message parameter that has a Printable String format.
      Parameters:
      param - int: One of the X400_att constants
      Throws:
      X400APIException
    • isMilitaryContentType

      public boolean isMilitaryContentType() throws X400APIException
      Returns true if the message's external content type is P772 (1.3.26.0.4406.0.4.1)
      Throws:
      X400APIException
    • getRedirectionHistory

      public String getRedirectionHistory()
      Returns a string representation of the Redirection History element
      Returns:
    • getTraceInformation

      public ArrayList<TraceInfoElementItem> getTraceInformation() throws X400APIException
      Returns a string representation of the Trace Information
      Returns:
      Throws:
      X400APIException
    • getInternalTraceInformation

      public ArrayList<TraceInfoElementItem> getInternalTraceInformation() throws X400APIException
      Returns a string representation of the Internal Trace Information
      Returns:
      Throws:
      X400APIException