public class SwiftBlock2Input 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.
This class does not provide explicit API to get the MIR of an
outgoing message because it should be created using the session and
sequence numbers at header block 1, and this information is not usually
generated by the application creating the message but by the SWIFT
Alliance interface. Therefore neither SwiftBLock1 or SwiftBlock2Input
provide a getter for the MIR.
It also does not provide any API to get the MOR of a sent message
because that information will be available only when the message
is delivered at destination.
MIR
,
Serialized FormmessagePriority, messageType
blockType, id, input, output, unparsedTexts
Constructor and Description |
---|
SwiftBlock2Input()
Default constructor
|
SwiftBlock2Input(String value)
Creates a block 2 output object setting attributes by parsing the
string argument containing the blocks value.
|
SwiftBlock2Input(String messageType,
String receiverAddress,
String messagePriority,
String deliveryMonitoring,
String obsolescencePeriod)
Constructor for specific values
|
Modifier and Type | Method and Description |
---|---|
void |
clean()
Sets all attributes to null
|
boolean |
equals(Object obj) |
String |
getBlockValue()
Returns the block value
|
String |
getDeliveryMonitoring()
Gets the Delivery Monitoring field in block 2 input
|
String |
getMessagePriority()
Gets the the message priority field in block 2 input
|
String |
getMessageType()
Gets the Message Type (MT) as classified and numbered by SWIFT.
|
String |
getObsolescencePeriod()
Gets the obsolescence period field in block 2 input
|
String |
getReceiverAddress()
Gets the LT receiver's address field in block 2 input
|
BIC |
getReceiverBIC()
Gets the receiver's BIC code from the receiver LT address.
|
String |
getValue()
Gets the fixed length block 2 value, as a result of
concatenating its individual elements as follow:
Message Type + Receivers address + Message Priority + Delivery Monitoring + Obsolescence Period. |
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 |
setDeliveryMonitoring(String deliveryMonitoring)
Sets the Delivery Monitoring field is as follows:
1 = Non-Delivery Warning 2 = Delivery Notification 3 = Both valid, Non-Delivery Warning and Delivery Notification This value is optional. If the priority is U, delivery monitoring must be: 1 or 3. If the priority is N, delivery monitoring must be: 2 or not included. |
void |
setMessagePriority(String messagePriority)
Sets the message priority as follows:
S = System N = Normal U = Urgent |
void |
setMessageType(String messageType)
Sets the Message Type (MT) as classified and numbered by SWIFT.
|
void |
setObsolescencePeriod(String obsolescencePeriod)
Sets the Obsolescence Period.
It specifies when a non-delivery notification is generated as follows: Valid for U = 003 (15 minutes) Valid for N = 020 (100 minutes) This value is optional. |
void |
setReceiver(BIC bic)
Creates a full LT address using the parameter BIC code and a default LT identifier.
|
void |
setReceiver(String receiver)
Completes if necessary and sets the LT address of the receiver.
The receiver addresses will be filled with proper default LT identifier and branch codes if not provided. |
void |
setReceiverAddress(LogicalTerminalAddress logicalTerminal)
Sets the receiver's address.
|
void |
setReceiverAddress(String receiverAddress)
Sets the receiver's address.
It is fixed at 12 characters; it must have X in position 9 (padded with "X" if no branch is required). |
void |
setValue(String value)
Sets the block's attributes by parsing the string argument
containing the blocks value.
|
String |
toJson()
intended to be overwritten
|
getName, getNumber, isInput, isOutput, setBlockName, setBlockNumber, toString
getValuePart, size
getBlockType, getId, getUnparsedTexts, getUnparsedTextsSize, isTagBlock, setBlockType, setId, setInput, setOutput, setUnparsedTexts, unparsedTextAddText, unparsedTextAddText, unparsedTextGetAsMessage, unparsedTextGetText, unparsedTextIsMessage, unparsedTextVerify
public SwiftBlock2Input()
public SwiftBlock2Input(String value)
value
- a string with length between 17 and 23 containing the blocks valuepublic SwiftBlock2Input(String messageType, String receiverAddress, String messagePriority, String deliveryMonitoring, String obsolescencePeriod)
messageType
- the message typereceiverAddress
- the receiver addressmessagePriority
- the message priority (S=system, U=urgent, N=normal)deliveryMonitoring
- the delivery monitoring option (1 or 3 for U priority, 2 for N priority)obsolescencePeriod
- the obsolescence period, measured in 5 minutes units (3 for priority U, 20 for priority N).public void clean()
clean
in class SwiftBlock2
public boolean equals(Object obj)
equals
in class SwiftBlock2
public String getBlockValue()
getBlockValue
in class SwiftValueBlock
getValue()
public String getDeliveryMonitoring()
public String getMessagePriority()
getMessagePriority
in class SwiftBlock2
public String getMessageType()
SwiftBlock2
getMessageType
in class SwiftBlock2
public String getObsolescencePeriod()
public String getReceiverAddress()
public BIC getReceiverBIC()
BIC
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 setDeliveryMonitoring(String deliveryMonitoring)
deliveryMonitoring
- String of 1 character containing the Delivery Monitoring fieldpublic void setMessagePriority(String messagePriority)
setMessagePriority
in class SwiftBlock2
messagePriority
- String of 1 characterpublic void setMessageType(String messageType)
setMessageType
in class SwiftBlock2
messageType
- String of 3 characterpublic void setObsolescencePeriod(String obsolescencePeriod)
obsolescencePeriod
- String of 3 characters containing the Obsolescence Periodpublic void setReceiver(BIC bic)
bic
- setReceiverAddress(LogicalTerminalAddress)
public void setReceiver(String receiver)
setReceiverAddress(LogicalTerminalAddress)
public void setReceiverAddress(LogicalTerminalAddress logicalTerminal)
logicalTerminal
- LogicalTerminalAddress.getReceiverLogicalTerminalAddress()
public void setReceiverAddress(String receiverAddress)
receiverAddress
- 12 characters Stringpublic void setValue(String value)
"I100BANKDEFFXXXX" (16) or "2:I100BANKDEFFXXXX" (18) // used for service/system messages "I100BANKDEFFXXXXU" (17) or "2:I100BANKDEFFXXXXU" (19) "I100BANKDEFFXXXXU3" (18) or "2:I100BANKDEFFXXXXU3" (20) "I100BANKDEFFXXXXU3003" (21) or "2:I100BANKDEFFXXXXU3003" (23)
setValue
in class SwiftValueBlock
value
- a string with length between 17 and 23 containing the blocks valuepublic String toJson()
SwiftBlock2
toJson
in class SwiftBlock2