Class MIR

  • Direct Known Subclasses:
    MOR

    public class MIR
    extends java.lang.Object
    This class models and parses the Message Input Reference (MIR), String of 28 characters, always local to the sender of the message. It includes the date the sender sent the message to SWIFT, followed by the full LT address of the sender of the message, and the sender's session and sequence to SWIFT. YYMMDD BANKBEBBAXXX 2222 123456

    MIR and MOR are messages unique identifiers containing the date, logical terminal (including branch code), session and sequence numbers. Nevertheless this identifiers can be confusing sometimes because they must be thought from SWIFT perspective.

    A message created by the sender user/application is considered an INPUT message, because it gets into the SWIFT network. When the message is delivered and gets out of the network it is considered an OUTPUT message. Therefore the headers of a sent message are not exactly the same as the headers of the received message at the destination party. Analogous the headers of a message that the receiving user/application gets from SWIFT are not exactly the same as the headers when the message was created and sent by the sending party.

    The usage of MIR and MOR are clear when analyzing system messages. A non delivery warning for example, includes the original MIR of the sent message, but not the MOR because the message was not delivered yet. But a delivery confirmation on the other hand, includes both, the sender’s MIR and the receiver’s MOR.
    System messages provide MIR/MOR information using fields 106 and 107 respectively.

    Since:
    6.0
    • Constructor Summary

      Constructors 
      Constructor Description
      MIR()
      Default constructor
      MIR​(java.lang.String value)
      Creates a MIR object parsing the literal string value.
      MIR​(java.lang.String date, java.lang.String logicalTerminal, java.lang.String sessionNumber, java.lang.String sequenceNumber)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.lang.String getDate()  
      java.util.Calendar getDateAsCalendar()
      Returns this MIR date as Calendar.
      java.lang.String getLogicalTerminal()  
      java.lang.String getMIR()
      Gets the full MIR (Message Input Reference) string of 28 characters containing the sender's date, LT address, session and sequence:
      for example YYMMDDBANKBEBBAXXX2222123456
      java.lang.String getSequenceNumber()  
      java.lang.String getSessionNumber()  
      int hashCode()  
      void setDate​(java.lang.String date)  
      void setDate​(java.util.Calendar date)
      Sets a date from a calendar, formatting it as YYMMDD
      void setLogicalTerminal​(java.lang.String logicalTerminal)  
      void setSequenceNumber​(java.lang.String sequenceNumber)  
      void setSessionNumber​(java.lang.String sessionNumber)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MIR

        public MIR​(java.lang.String date,
                   java.lang.String logicalTerminal,
                   java.lang.String sessionNumber,
                   java.lang.String sequenceNumber)
      • MIR

        public MIR​(java.lang.String value)
        Creates a MIR object parsing the literal string value. If the value is incorrect (cannot be parsed) the object will not be initialized.
        Parameters:
        value - the MIR value, it is expected to 28 characters length
      • MIR

        public MIR()
        Default constructor
    • Method Detail

      • getDate

        public java.lang.String getDate()
        Returns:
        the date
      • setDate

        public void setDate​(java.lang.String date)
        Parameters:
        date - a date formatted as YYMMDD
      • setDate

        public void setDate​(java.util.Calendar date)
        Sets a date from a calendar, formatting it as YYMMDD
        Parameters:
        date - a date
        Since:
        7.10.4
      • getLogicalTerminal

        public java.lang.String getLogicalTerminal()
        Returns:
        the logical terminal
      • setLogicalTerminal

        public void setLogicalTerminal​(java.lang.String logicalTerminal)
      • getSessionNumber

        public java.lang.String getSessionNumber()
        Returns:
        the session number
      • setSessionNumber

        public void setSessionNumber​(java.lang.String sessionNumber)
      • getSequenceNumber

        public java.lang.String getSequenceNumber()
        Returns:
        the sequence number
      • setSequenceNumber

        public void setSequenceNumber​(java.lang.String sequenceNumber)
      • getMIR

        public java.lang.String getMIR()
        Gets the full MIR (Message Input Reference) string of 28 characters containing the sender's date, LT address, session and sequence:
        for example YYMMDDBANKBEBBAXXX2222123456
        Returns:
        a String with MIR, returns null if all MIR components are null
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getDateAsCalendar

        public final java.util.Calendar getDateAsCalendar()
        Returns this MIR date as Calendar. This implementation uses SwiftFormatUtils.getDate2(String)
        Returns:
        the parsed date or null if MIR date is invalid or not set
        Since:
        7.8.8