com.prowidesoftware.swift.model
Class SwiftBlock2Input

java.lang.Object
  extended by com.prowidesoftware.swift.model.SwiftBlock
      extended by com.prowidesoftware.swift.model.SwiftValueBlock
          extended by com.prowidesoftware.swift.model.SwiftBlock2
              extended by com.prowidesoftware.swift.model.SwiftBlock2Input
All Implemented Interfaces:
java.io.Serializable

public class SwiftBlock2Input
extends SwiftBlock2
implements java.io.Serializable

Base class for SWIFT Application Header Block (block 2) for INPUT (to SWIFT).
This block is used to construct messages that are going to be input to the SWIFT network. From the application point of view, it correspond to the SENT messages.

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 is an optional block.

Since:
4.0
Version:
$Id: SwiftBlock2Input.java,v 1.1.1.1 2013/04/10 17:04:50 mgriffa Exp $
Author:
www.prowidesoftware.com
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.prowidesoftware.swift.model.SwiftBlock2
messagePriority, messageType
 
Fields inherited from class com.prowidesoftware.swift.model.SwiftBlock
blockType, id, input, output, unparsedTexts
 
Constructor Summary
SwiftBlock2Input()
          Default constructor
SwiftBlock2Input(java.lang.String value)
          Creates a block 2 output object setting attributes by parsing the string argument containing the blocks value.
SwiftBlock2Input(java.lang.String messageType, java.lang.String receiverAddress, java.lang.String messagePriority, java.lang.String deliveryMonitoring, java.lang.String obsolescencePeriod)
          Constructor for specific values
 
Method Summary
 void clean()
          Sets all attributes to null
 boolean equals(java.lang.Object obj)
           
 java.lang.String getBlockValue()
          Returns the block value
 java.lang.String getDeliveryMonitoring()
          Gets the Delivery Monitoring field in block 2 input
 java.lang.String getMessagePriority()
          Gets the the message priority field in block 2 input
 java.lang.String getMessageType()
          Gets the Message Type (MT) as classified and numbered by SWIFT.
 java.lang.String getObsolescencePeriod()
          Gets the obsolescence period field in block 2 input
 java.lang.String getReceiverAddress()
          Gets the receiver's address field in block 2 input
 java.lang.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(java.lang.String value)
          This method should be overwritten by subclasses, calling this method will throw a java.lang.UnsupportedOperationException
 void setDeliveryMonitoring(java.lang.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(java.lang.String messagePriority)
          Sets the message priority as follows:
S = System
N = Normal
U = Urgent
 void setMessageType(java.lang.String messageType)
          Sets the Message Type (MT) as classified and numbered by SWIFT.
 void setObsolescencePeriod(java.lang.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 setReceiverAddress(java.lang.String receiverAddress)
          Receiver's address with X in position 9.
It is fixed at 12 characters; it must have X in position 9 (padded with "X" if no branch is required).
 void setValue(java.lang.String value)
          Sets the block's attributes by parsing the string argument containing the blocks value.
 
Methods inherited from class com.prowidesoftware.swift.model.SwiftBlock2
getName, getNumber, isInput, isOutput, setBlockName, setBlockNumber, toString
 
Methods inherited from class com.prowidesoftware.swift.model.SwiftValueBlock
getValuePart, size
 
Methods inherited from class com.prowidesoftware.swift.model.SwiftBlock
getBlockType, getId, getInput, getOutput, getUnparsedTexts, getUnparsedTextsSize, isTagBlock, setBlockType, setId, setInput, setOutput, setUnparsedTexts, unparsedTextAddText, unparsedTextAddText, unparsedTextGetAsMessage, unparsedTextGetText, unparsedTextIsMessage, unparsedTextVerify
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SwiftBlock2Input

public SwiftBlock2Input(java.lang.String messageType,
                        java.lang.String receiverAddress,
                        java.lang.String messagePriority,
                        java.lang.String deliveryMonitoring,
                        java.lang.String obsolescencePeriod)
Constructor for specific values

Parameters:
messageType - the message type
receiverAddress - the receiver address
messagePriority - 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).
According to SWIFT documentation, this value is ignored by the system

SwiftBlock2Input

public SwiftBlock2Input(java.lang.String value)
Creates a block 2 output object setting 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:
"I100BANKDEFFXXXXU3003" (21) or "2:I100BANKDEFFXXXXU3003" (23) "I100BANKDEFFXXXXU3" (18) or "2:I100BANKDEFFXXXXU3" (20) "I100BANKDEFFXXXXU" (17) or "2:I100BANKDEFFXXXXU" (19)

Parameters:
value - a string with length between 17 and 23 containing the blocks value

SwiftBlock2Input

public SwiftBlock2Input()
Default constructor

Method Detail

setMessageType

public void setMessageType(java.lang.String messageType)
Sets the Message Type (MT) as classified and numbered by SWIFT. Three-digit FIN message type, 000 � 999.

Overrides:
setMessageType in class SwiftBlock2
Parameters:
messageType - String of 3 character

getMessageType

public java.lang.String getMessageType()
Description copied from class: SwiftBlock2
Gets the Message Type (MT) as classified and numbered by SWIFT.

Overrides:
getMessageType in class SwiftBlock2
Returns:
messageType String of 3 character

setReceiverAddress

public void setReceiverAddress(java.lang.String receiverAddress)
Receiver's address with X in position 9.
It is fixed at 12 characters; it must have X in position 9 (padded with "X" if no branch is required).

Parameters:
receiverAddress - 12 characters String

getReceiverAddress

public java.lang.String getReceiverAddress()
Gets the receiver's address field in block 2 input

Returns:
receiver address

setMessagePriority

public void setMessagePriority(java.lang.String messagePriority)
Sets the message priority as follows:
S = System
N = Normal
U = Urgent

Overrides:
setMessagePriority in class SwiftBlock2
Parameters:
messagePriority - String of 1 character

getMessagePriority

public java.lang.String getMessagePriority()
Gets the the message priority field in block 2 input

Overrides:
getMessagePriority in class SwiftBlock2
Returns:
message priority

setDeliveryMonitoring

public void setDeliveryMonitoring(java.lang.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.

Parameters:
deliveryMonitoring - String of 1 character containing the Delivery Monitoring field

getDeliveryMonitoring

public java.lang.String getDeliveryMonitoring()
Gets the Delivery Monitoring field in block 2 input

Returns:
the delivery monitoring

setObsolescencePeriod

public void setObsolescencePeriod(java.lang.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.

Parameters:
obsolescencePeriod - String of 3 characters containing the Obsolescence Period

getObsolescencePeriod

public java.lang.String getObsolescencePeriod()
Gets the obsolescence period field in block 2 input

Returns:
the obsolescence period

isEmpty

public boolean isEmpty()
Tell if this block is empty or not. This block is considered to be empty if all its attributes are set to null.

Overrides:
isEmpty in class SwiftValueBlock
Returns:
true if all fields are null and false in other case

getValue

public java.lang.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.

Overrides:
getValue in class SwiftValueBlock
Returns:
the blocks value as a single string

getBlockValue

public java.lang.String getBlockValue()
Returns the block value

Overrides:
getBlockValue in class SwiftValueBlock
Returns:
N/A
See Also:
getValue()

setValue

public void setValue(java.lang.String value)
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:
 "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)
 

Overrides:
setValue in class SwiftValueBlock
Parameters:
value - a string with length between 17 and 23 containing the blocks value

setBlockValue

public void setBlockValue(java.lang.String value)
Description copied from class: SwiftValueBlock
This method should be overwritten by subclasses, calling this method will throw a java.lang.UnsupportedOperationException

Overrides:
setBlockValue in class SwiftValueBlock
Parameters:
value - unused
See Also:
setValue(String)

clean

public void clean()
Sets all attributes to null

Overrides:
clean in class SwiftBlock2
Since:
6.4

hashCode

public int hashCode()
Overrides:
hashCode in class SwiftBlock2

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class SwiftBlock2