public class SwiftBlock2Output extends SwiftBlock2 implements Serializable
It's value is fixed-length and continuous with no field delimiters. This class contains its elements as individual attributes for easier management of the block value.
For a received message, a message being output from SWIFT, the SwiftBlock2Output includes explicit information regarding the MIR. This is sometimes confusing because it is an output block with an input reference. The important thing to understand here is that the MIR information is related to the original sender of the message that has been received. The attributes of this header (block 2 output) are explicitly documented as MIR information by SWIFT.
The MOR itself could be created combining information from block 1 and 2 but it usually does not make sense.
MIR
,
Serialized FormmessagePriority, messageType
blockType, id, input, output, unparsedTexts
Constructor and Description |
---|
SwiftBlock2Output()
Default Constructor
|
SwiftBlock2Output(String value)
Creates a block 2 output object setting attributes by parsing the fixed string argument;
for example "O1001200970103BANKBEBBAXXX22221234569701031201N" or "2:O1001200970103BANKBEBBAXXX22221234569701031201N" |
SwiftBlock2Output(String messageType,
String senderInputTime,
String MIRDate,
String MIRLogicalTerminal,
String MIRSessionNumber,
String MIRSequenceNumber,
String receiverOutputDate,
String receiverOutputTime,
String messagePriority)
Constructor for specific values
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getBlockValue()
This method should be overwritten by subclasses, calling
this method will throw a
java.lang.UnsupportedOperationException |
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 |
String |
getMIRDate()
Gets the date the sender sent the message to SWIFT,
from the MIR field, in the format YYMMDD
|
String |
getMIRLogicalTerminal()
Gets the the full LT address of the sender of the
message, from the MIR field, for example: BANKBEBBAXXX
|
String |
getMIRSequenceNumber()
Gets the date the sender sequence number,
from the MIR field, in the format NNNNNN
|
String |
getMIRSessionNumber()
Gets the date the sender session number,
from the MIR field, in the format NNNN
|
String |
getReceiverOutputDate()
Gets the Output date local to the receiver
|
String |
getReceiverOutputTime()
Gets the Output time local to the receiver, written in the following format: HHMM
|
BIC |
getSenderBIC()
Gets the sender's BIC code.
For output message the sender address is contained in this block2 and not in the header block 1 as for input messages. |
String |
getSenderInputTime()
Returns the input time with respect to the sender
|
String |
getValue()
Gets the fixed length block 2 value, as a result of
concatenating its individual elements as follow:
Message Type + Sender Input Time + MIR + Receiver Output Date + Receiver Output Time + Message Priority. |
int |
hashCode() |
boolean |
isEmpty()
Tell if this block is empty or not.
|
void |
setBlockValue(String value)
This method should be overwritten by subclasses, calling
this method will throw a
java.lang.UnsupportedOperationException |
void |
setMIR(String mir)
Sets the full MIR (Message Input Reference) string of 28
characters containing the sender's date, LT address,
session and sequence:
for example YYMMDDBANKBEBBAXXX2222123456 |
void |
setMIRDate(String MIRDate)
Sets the date the sender sent the message to SWIFT,
from the MIR field
|
void |
setMIRLogicalTerminal(LogicalTerminalAddress MIRLogicalTerminal)
Sets the the full LT address of the sender of the message.
|
void |
setMIRLogicalTerminal(String MIRLogicalTerminal)
Sets the the full LT address of the sender of the message.
|
void |
setMIRSequenceNumber(String MIRSequenceNumber)
Sets the sequence number field of the MIR
|
void |
setMIRSessionNumber(String MIRSessionNumber)
Sets the session number field of the MIR
|
void |
setReceiverOutputDate(String receiverOutputDate)
Sets the Output date local to the receiver, written in the following format: YYMMDD
|
void |
setReceiverOutputTime(String receiverOutputTime)
Sets the Output time local to the receiver, written in the following format: HHMM
|
void |
setSender(BIC bic)
Creates a full LT address using the parameter BIC code and a default LT identifier,
and sets the resulting address as MIR logical terminal address.
|
void |
setSender(String sender)
Completes if necessary and sets the LT address of the sender
as MIR logical terminal address.
The sender addresses will be filled with proper default LT identifier and branch codes if not provided. |
void |
setSenderInputTime(String senderInputTime)
Sets the input time with respect to the sender
|
void |
setValue(String value)
Sets the block's attributes by parsing the string argument
containing the blocks value.
|
String |
toJson()
intended to be overwritten
|
clean, getMessagePriority, getMessageType, getName, getNumber, isInput, isOutput, setBlockName, setBlockNumber, setMessagePriority, setMessageType, toString
getValuePart, size
getBlockType, getId, getUnparsedTexts, getUnparsedTextsSize, isTagBlock, setBlockType, setId, setInput, setOutput, setUnparsedTexts, unparsedTextAddText, unparsedTextAddText, unparsedTextGetAsMessage, unparsedTextGetText, unparsedTextIsMessage, unparsedTextVerify
public SwiftBlock2Output()
public SwiftBlock2Output(String value)
value
- a fixed length string of 47 (starting with 'O') or 49 (starting with '2:O') characters containing the blocks valuepublic SwiftBlock2Output(String messageType, String senderInputTime, String MIRDate, String MIRLogicalTerminal, String MIRSessionNumber, String MIRSequenceNumber, String receiverOutputDate, String receiverOutputTime, String messagePriority)
messageType
- the message typesenderInputTime
- the input timeMIRDate
- dateMIRLogicalTerminal
- logical terminalMIRSessionNumber
- session numberMIRSequenceNumber
- message sequence numberreceiverOutputDate
- receiver datereceiverOutputTime
- receiver timemessagePriority
- the message priority (S=system, U=urgent, N=normal)public boolean equals(Object obj)
equals
in class SwiftBlock2
public String getBlockValue()
SwiftValueBlock
java.lang.UnsupportedOperationException
getBlockValue
in class SwiftValueBlock
getValue()
public String getMIR()
null
if all MIR components are null
public String getMIRDate()
public String getMIRLogicalTerminal()
public String getMIRSequenceNumber()
public String getMIRSessionNumber()
public String getReceiverOutputDate()
public String getReceiverOutputTime()
public BIC getSenderBIC()
BIC
public String getSenderInputTime()
public String getValue()
getValue
in class SwiftValueBlock
public int hashCode()
hashCode
in class SwiftBlock2
public boolean isEmpty()
null
.isEmpty
in class SwiftValueBlock
true
if all fields are null
and false in other casepublic void setBlockValue(String value)
SwiftValueBlock
java.lang.UnsupportedOperationException
setBlockValue
in class SwiftValueBlock
value
- unusedsetValue(String)
public void setMIR(String mir)
mir
- complete MIR stringpublic void setMIRDate(String MIRDate)
MIRDate
- 6 numbers with date in format YYMMDDpublic void setMIRLogicalTerminal(LogicalTerminalAddress MIRLogicalTerminal)
MIRLogicalTerminal
- 12 characters full LT addressLogicalTerminalAddress.getSenderLogicalTerminalAddress()
public void setMIRLogicalTerminal(String MIRLogicalTerminal)
MIRLogicalTerminal
- 12 characters full LT addresspublic void setMIRSequenceNumber(String MIRSequenceNumber)
MIRSequenceNumber
- 6 numberspublic void setMIRSessionNumber(String MIRSessionNumber)
MIRSessionNumber
- 4 numberspublic void setReceiverOutputDate(String receiverOutputDate)
receiverOutputDate
- 6 characters in format YYMMDDpublic void setReceiverOutputTime(String receiverOutputTime)
receiverOutputTime
- String with 4 numberspublic void setSender(BIC bic)
bic
- setMIRLogicalTerminal(LogicalTerminalAddress)
public void setSender(String sender)
setMIRLogicalTerminal(LogicalTerminalAddress)
public void setSenderInputTime(String senderInputTime)
senderInputTime
- 4 numbers HHMMpublic void setValue(String value)
"O1001200970103BANKBEBBAXXX22221234569701031201" (46) or "2:O1001200970103BANKBEBBAXXX22221234569701031201" (48) // used for service/system messages "O1001200970103BANKBEBBAXXX22221234569701031201N" (47) or "2:O1001200970103BANKBEBBAXXX22221234569701031201N" (49)
setValue
in class SwiftValueBlock
value
- a string with the value to splitpublic String toJson()
SwiftBlock2
toJson
in class SwiftBlock2