Package com.isode.x400.highlevel
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 Summary
Constructors Constructor Description ReceiveMsg(P3BindSession p3_session_obj)
Constructs a new instance of this class given a P3BindSession objectReceiveMsg(P3BindSession p3_session_obj, int type, byte[] content)
Constructs a new instance of this class given a byte[] contentReceiveMsg(P7BindSession session_obj, int seqn)
Constructs a new instance of this class given a P7BindSession and a sequence number.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete(boolean retainInStore)
Delete message objectprotected void
finalize()
This routine will be called by the Garbage Collector at some pointint
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.X400Msg
generateIPN(P3BindSession p3bind_session, int reason, int ackMode)
Generates an IPN message so that it can be submitted later onX400Msg
generateP22IPN(P3BindSession p3bind_session, int reason, int ackMode)
Generates an IPN message so that it can be submitted later on.java.util.ArrayList<Recipient>
getBccRecipients()
Returns the message blind copy recipients (Bcc:), as an array list of Recipient objectsBodypart
getBodypart(int bp_num)
Returns the specified bodypart of the messagejava.util.ArrayList<Recipient>
getCcRecipients()
Returns the message copy recipients (Cc:), as an array list of Recipient objectsint
getCopyPrecedence()
Obtain copy precedence value from message, if any.java.lang.String
getDLExpansionHistory()
Returns the Distribution List Expansion History element of the message, if it exists, otherwise ""java.util.ArrayList<Recipient>
getEnvelopeRecipients()
Returns the message envelope recipients, as an array list of Recipient objectsjava.lang.String
getFrom()
Returns the sender's String encoded O/R addressint
getImportance()
Returns the importance of the messageRecip
getIntendedRecipient()
Returns the IPN Intended Recipient, if one is set.java.util.ArrayList<TraceInfoElementItem>
getInternalTraceInformation()
Returns a string representation of the Internal Trace Informationint
getIntParam(int param)
Get the specified integer message parameterjava.util.ArrayList<Recipient>
getIPMHeaderRecipients()
Returns the message IPM Header recipients, as an array list of Recipient objectsjava.lang.String
getIPNContentAsText()
Returns a English text representation of the content of the IPNcom.isode.rbac.swig.JRSecurityLabel
getJRSecurityLabel()
Read the X.411 security label from the messagejava.lang.String
getMessageDeliveryTime()
Returns the message delivery time as a UTC stringjava.util.Date
getMessageDeliveryTimeAsDate()
Returns the message delivery time as a Datejava.lang.String
getMessageIdentifier()
Returns the message identifierjava.lang.String
getMessageSubmissionTime()
Returns the message submission time as a UTC stringjava.util.Date
getMessageSubmissionTimeAsDate()
Returns the message submission time as a DateX400Msg.X400_Message_Type
getMessageType()
Returns the type of the message as a X400_Message_TypeX400Msg.Military_Priority
getMilitaryPriority()
int
getMsgPrecedence()
Returns the message precedence, taken from one of the recipients.int
getNumberOfBodyparts()
Returns the number of bodyparts of the messagejava.lang.String
getOriginatorFreeFormName()
Returns the sender's free form name, if availablejava.lang.String
getOriginatorORAddress()
Returns the sender's O/R addressint
getPrimaryPrecedence()
Obtain primary precedence value from message, if any.java.util.ArrayList<java.lang.String>
getPrintableStringParam(int param)
Get a message parameter that has a Printable String format.protected java.util.ArrayList<Recipient>
getRecipients(int type)
Returns the message recipients, as an array list of Recipient objects This method is for internal use only.java.lang.String
getRedirectionHistory()
Returns a string representation of the Redirection History elementjava.lang.String
getReportContentAsText()
Returns a English text representation of the content of the reportbyte[]
getSecurityLabelAsBER()
Read the X.411 security label from the messagejava.lang.String
getStringParam(int param)
Get the specified string message parameterjava.lang.String
getSubject()
Returns the subject of the messagejava.lang.String
getTextContent()
Returns the text content of the message as IA5 (if available)java.util.ArrayList<Recipient>
getToRecipients()
Returns the message primary recipients (To:), as an array list of Recipient objectsjava.util.ArrayList<TraceInfoElementItem>
getTraceInformation()
Returns a string representation of the Trace Informationjava.lang.String
getTypeAsString()
Returns the type of the message as a string (message, report, probe or unknown)X400Msg.X400_Priority
getX400Priority()
Get the message X.400 priorityboolean
isAllPositiveIPN()
Checks whether the message is an IPN (Inter Personal Notification), and that all the reported recipients are read receipts (i.e.boolean
isIPN()
Checks whether the message is an IPN (Inter Personal Notification)boolean
isMilitaryContentType()
Returns true if the message's external content type is P772 (1.3.26.0.4406.0.4.1)-
Methods inherited from class com.isode.x400api.MSMessage
GetAttLen, GetAttType, GetIntValue, GetNumRecips, GetType
-
-
-
-
Constructor Detail
-
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 messageseqn
- : 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 Detail
-
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 java.lang.Throwable
This routine will be called by the Garbage Collector at some point- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
getStringParam
public java.lang.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 java.lang.String getSubject() throws X400APIException
Returns the subject of the message- Throws:
X400APIException
-
getTypeAsString
public java.lang.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 ReportNote 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 java.lang.String getFrom() throws X400APIException
Returns the sender's String encoded O/R address- Throws:
X400APIException
-
getOriginatorFreeFormName
public java.lang.String getOriginatorFreeFormName() throws X400APIException
Returns the sender's free form name, if available- Throws:
X400APIException
-
getOriginatorORAddress
public java.lang.String getOriginatorORAddress() throws X400APIException
Returns the sender's O/R address- Throws:
X400APIException
-
getMessageIdentifier
public java.lang.String getMessageIdentifier() throws X400APIException
Returns the message identifier- Throws:
X400APIException
-
getMessageSubmissionTime
public java.lang.String getMessageSubmissionTime() throws X400APIException
Returns the message submission time as a UTC string- Throws:
X400APIException
-
getMessageSubmissionTimeAsDate
public java.util.Date getMessageSubmissionTimeAsDate() throws X400APIException
Returns the message submission time as a Date- Throws:
X400APIException
-
getMessageDeliveryTime
public java.lang.String getMessageDeliveryTime() throws X400APIException
Returns the message delivery time as a UTC string- Throws:
X400APIException
-
getMessageDeliveryTimeAsDate
public java.util.Date getMessageDeliveryTimeAsDate() throws X400APIException
Returns the message delivery time as a Date- Throws:
X400APIException
-
getTextContent
public java.lang.String getTextContent() throws X400APIException
Returns the text content of the message as IA5 (if available)- Throws:
X400APIException
-
getReportContentAsText
public java.lang.String getReportContentAsText() throws X400APIException
Returns a English text representation of the content of the report- Throws:
X400APIException
-
getIPNContentAsText
public java.lang.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 java.util.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 java.util.ArrayList<Recipient> getEnvelopeRecipients() throws X400APIException
Returns the message envelope recipients, as an array list of Recipient objects- Throws:
X400APIException
-
getIPMHeaderRecipients
public java.util.ArrayList<Recipient> getIPMHeaderRecipients() throws X400APIException
Returns the message IPM Header recipients, as an array list of Recipient objects- Throws:
X400APIException
-
getToRecipients
public java.util.ArrayList<Recipient> getToRecipients() throws X400APIException
Returns the message primary recipients (To:), as an array list of Recipient objects- Throws:
X400APIException
-
getCcRecipients
public java.util.ArrayList<Recipient> getCcRecipients() throws X400APIException
Returns the message copy recipients (Cc:), as an array list of Recipient objects- Throws:
X400APIException
-
getBccRecipients
public java.util.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 generationreason
- Reason to use for the IPNackMode
- 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 generationreason
- Reason to use for the IPNackMode
- 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 java.lang.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 java.util.ArrayList<java.lang.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 java.lang.String getRedirectionHistory()
Returns a string representation of the Redirection History element- Returns:
-
getTraceInformation
public java.util.ArrayList<TraceInfoElementItem> getTraceInformation() throws X400APIException
Returns a string representation of the Trace Information- Returns:
- Throws:
X400APIException
-
getInternalTraceInformation
public java.util.ArrayList<TraceInfoElementItem> getInternalTraceInformation() throws X400APIException
Returns a string representation of the Internal Trace Information- Returns:
- Throws:
X400APIException
-
-