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 FormSwiftBlock2.MessagePriority
messagePriority, messageType
blockType, id, input, output, unparsedTexts
Constructor and Description |
---|
SwiftBlock2Output()
Default Constructor
|
SwiftBlock2Output(String value)
Creates the block with lenient false, meaning it expects a fixed length value.
|
SwiftBlock2Output(String value,
boolean lenient)
Creates a block 2 output object setting attributes by parsing the string argument containing the blocks value.
|
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 |
field(SwiftBlock2OutputField field)
Generic getter for block attributes based on qualified names from
SwiftBlock2OutputField |
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 |
setField(SwiftBlock2OutputField field,
String value)
Generic setter for block attributes based on qualified names from
SwiftBlock2OutputField |
void |
setMIR(String mir)
Sets the full MIR (Message Input Reference) from a fixed length (28 characters) string containing the complete MIR value.
|
void |
setMIR(String mir,
boolean lenient)
Sets the MIR (Message Input Reference) attributes by parsing the string argument containing the complete MIR value.
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 fixed length string argument.
|
void |
setValue(String value,
boolean lenient)
Sets the block's attributes by parsing the string argument containing the blocks value.
This value can be in different flavors because some fields are optional. Example of supported values: |
String |
toJson()
intended to be overwritten
|
clean, field, getMessagePriority, getMessagePriorityType, getMessageType, getName, getNumber, isInput, isOutput, setBlockName, setBlockNumber, setField, setMessagePriority, setMessageType, toString
getValuePart, getValuePart, size
getBlockType, getId, getInput, getOutput, getUnparsedTexts, getUnparsedTextsSize, isTagBlock, setBlockType, setId, setInput, setOutput, setUnparsedTexts, unparsedTextAddText, unparsedTextAddText, unparsedTextGetAsMessage, unparsedTextGetText, unparsedTextIsMessage, unparsedTextVerify
public 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 SwiftBlock2Output(String value)
value
- a fixed length string of 46 (starting with 'O') or 49 (starting with '2:O') characters containing the blocks valueIllegalArgumentException
- if parameter is not 47 or 49 charactersSwiftBlock2Output(String, boolean)
public SwiftBlock2Output(String value, boolean lenient)
value
- string containing the entire blocks valuelenient
- if true the value will be parsed with a best effort heuristic, if false it will throw a IllegalArgumentException if the value has an invalid total sizesetValue(String, boolean)
public SwiftBlock2Output()
public void setSenderInputTime(String senderInputTime)
senderInputTime
- 4 numbers HHMMpublic String getSenderInputTime()
public void setMIRDate(String MIRDate)
MIRDate
- 6 numbers with date in format YYMMDDpublic String getMIRDate()
public void setMIRLogicalTerminal(String MIRLogicalTerminal)
MIRLogicalTerminal
- 12 characters full LT addresspublic void setMIRLogicalTerminal(LogicalTerminalAddress MIRLogicalTerminal)
MIRLogicalTerminal
- 12 characters full LT addressLogicalTerminalAddress.getSenderLogicalTerminalAddress()
public void setSender(BIC bic)
bic
- setMIRLogicalTerminal(LogicalTerminalAddress)
public void setSender(String sender)
setMIRLogicalTerminal(LogicalTerminalAddress)
public String getMIRLogicalTerminal()
public BIC getSenderBIC()
BIC
public void setMIRSessionNumber(String MIRSessionNumber)
MIRSessionNumber
- 4 numberspublic String getMIRSessionNumber()
public void setMIRSequenceNumber(String MIRSequenceNumber)
MIRSequenceNumber
- 6 numberspublic String getMIRSequenceNumber()
public String getMIR()
null
if all MIR components are null
public void setMIR(String mir)
mir
- complete MIR string value, a fixed length (28 characters) string containing the MIR valueIllegalArgumentException
- if parameter has an invalid total size.setMIR(String, boolean)
public void setMIR(String mir, boolean lenient)
mir
- complete MIR stringlenient
- if true the value will be parsed with a best effort heuristic, if false it will throw a IllegalArgumentException if the value has an invalid total sizepublic void setReceiverOutputDate(String receiverOutputDate)
receiverOutputDate
- 6 characters in format YYMMDDpublic String getReceiverOutputDate()
public void setReceiverOutputTime(String receiverOutputTime)
receiverOutputTime
- String with 4 numberspublic String getReceiverOutputTime()
public boolean isEmpty()
null
.isEmpty
in class SwiftValueBlock
true
if all fields are null
and false in other casepublic String getValue()
getValue
in class SwiftValueBlock
public String getBlockValue()
SwiftValueBlock
java.lang.UnsupportedOperationException
getBlockValue
in class SwiftValueBlock
getValue()
public void setValue(String value)
setValue
in class SwiftValueBlock
value
- a fixed length (between 46 and 49) string containing the blocks' valueIllegalArgumentException
- if parameter has an invalid total size.setValue(String, boolean)
public void setValue(String value, boolean lenient)
"O1001200970103BANKBEBBAXXX22221234569701031201" (46) or "2:O1001200970103BANKBEBBAXXX22221234569701031201" (48) // used for service/system messages "O1001200970103BANKBEBBAXXX22221234569701031201N" (47) or "2:O1001200970103BANKBEBBAXXX22221234569701031201N" (49)
value
- string containing the entire blocks valuelenient
- if true the value will be parsed with a best effort heuristic, if false it will throw a IllegalArgumentException if the value has an invalid total sizepublic void setBlockValue(String value)
SwiftValueBlock
java.lang.UnsupportedOperationException
setBlockValue
in class SwiftValueBlock
value
- unusedsetValue(String)
public int hashCode()
hashCode
in class SwiftBlock2
public boolean equals(Object obj)
equals
in class SwiftBlock2
public String toJson()
SwiftBlock2
toJson
in class SwiftBlock2
public String field(SwiftBlock2OutputField field)
SwiftBlock2OutputField
field
- field to getnull
if attribute is not setpublic void setField(SwiftBlock2OutputField field, String value)
SwiftBlock2OutputField
field
- field to getvalue
- content to set