public class SwiftBlock1 extends SwiftValueBlock implements Serializable
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_ID_FIN
Constant for FIN messages in application id
|
static String |
APPLICATION_ID_GPA
Constant for GPA (General Purpose Application) messages in application id
|
static String |
APPLICATION_ID_LOGINS
Constant for Logins and so messages in application id
|
blockType, id, input, output, unparsedTexts
Constructor and Description |
---|
SwiftBlock1()
Default constructor
|
SwiftBlock1(String value)
Creates a block 1 object setting attributes by parsing the fixed string argument;
for example "F01BANKBEBBAXXX2222123456" or "1:F01BANKBEBBAXXX2222123456" |
SwiftBlock1(String applicationId,
String serviceId,
String logicalTerminal,
String sessionNumber,
String sequenceNumber)
Constructor for specific values
|
Modifier and Type | Method and Description |
---|---|
void |
clean()
Sets all attributes to null
|
boolean |
equals(Object obj) |
String |
getApplicationId()
Gets the application ID field in block 1
|
BIC |
getBIC()
Gets the BIC code from the LT address.
|
String |
getBlockValue()
This method should be overwritten by subclasses, calling
this method will throw a
java.lang.UnsupportedOperationException |
String |
getLogicalTerminal()
Gets the The Logical Terminal address of the sender for messages
sent or the receiver for messages received from the SWIFT network.
|
String |
getName()
Returns the block name (the value 1 as a string)
|
Integer |
getNumber()
Returns the block number (the value 1 as an integer)
|
String |
getSequenceNumber()
Gets the sequence number field in block 1
|
String |
getServiceId()
Gets the service ID field in block 1
|
String |
getSessionNumber()
Gets the session number in block 1
|
String |
getValue()
Gets the fixed length block 1 value, as a result of
concatenating its individual elements as follow:
Application ID Service ID + Logical terminal (LT) address + Session number + Sequence number. Notice that this method does not return the "1:" string. |
int |
hashCode() |
boolean |
isEmpty()
Tell if this block is empty or not.
|
void |
setApplicationId(String applicationId)
Sets the applicationId
|
protected void |
setBlockName(String blockName)
Sets the block name.
|
protected void |
setBlockNumber(Integer blockNumber)
Sets the block number.
|
void |
setBlockValue(String value)
This method should be overwritten by subclasses, calling
this method will throw a
java.lang.UnsupportedOperationException |
void |
setLogicalTerminal(BIC bic)
Creates and sets a full LT address using the parameter BIC code and a default LT identifier.
|
void |
setLogicalTerminal(LogicalTerminalAddress logicalTerminal)
Sets the LT address.
|
void |
setLogicalTerminal(String logicalTerminal)
Sets the The Logical Terminal address with the parameter as it is given.
|
void |
setSender(String sender)
Completes if necessary and sets the LT address.
The sender addresses will be filled with proper default LT identifier and branch codes if not provided. |
void |
setSequenceNumber(String sequenceNumber)
Sets the Sequence number that is generated by the
user's computer.
For all FIN messages with a Service Identifier of 01 or 05, this number is the next expected sequence number appropriate to the direction of the transmission. For FIN messages with a Service Identifier of 21 or 25, the sequence number is that of the acknowledged service message. It is padded with zeros. |
void |
setServiceId(String serviceId)
Sets the Service ID
|
void |
setSessionNumber(String sessionNumber)
Sets the Session number.
|
void |
setValue(String value)
Sets the block's attributes by parsing the fixed string argument;
For example "F01BANKBEBBAXXX2222123456" or "1:F01BANKBEBBAXXX2222123456". |
String |
toJson() |
getValuePart, size
getBlockType, getId, getUnparsedTexts, getUnparsedTextsSize, isTagBlock, setBlockType, setId, setInput, setOutput, setUnparsedTexts, toString, unparsedTextAddText, unparsedTextAddText, unparsedTextGetAsMessage, unparsedTextGetText, unparsedTextIsMessage, unparsedTextVerify
public static final transient String APPLICATION_ID_FIN
public static final transient String APPLICATION_ID_GPA
public static final transient String APPLICATION_ID_LOGINS
public SwiftBlock1()
public SwiftBlock1(String value)
value
- a fixed length string of 25 or 27 (which must start with '1:') characters containing the blocks valuepublic SwiftBlock1(String applicationId, String serviceId, String logicalTerminal, String sessionNumber, String sequenceNumber)
applicationId
- the application idserviceId
- the service idlogicalTerminal
- the logical terminal namesessionNumber
- the session numbersequenceNumber
- the message sequence numberpublic void clean()
public boolean equals(Object obj)
equals
in class SwiftBlock
public String getApplicationId()
public BIC getBIC()
public String getBlockValue()
SwiftValueBlock
java.lang.UnsupportedOperationException
getBlockValue
in class SwiftValueBlock
getValue()
public String getLogicalTerminal()
public String getName()
getName
in class SwiftBlock
public Integer getNumber()
getNumber
in class SwiftBlock
public String getSequenceNumber()
public String getServiceId()
public String getSessionNumber()
public String getValue()
getValue
in class SwiftValueBlock
public int hashCode()
hashCode
in class SwiftBlock
public boolean isEmpty()
null
.isEmpty
in class SwiftValueBlock
true
if all fields are null
and false in other casepublic void setApplicationId(String applicationId)
applicationId
- String of 1 character containing the Application ID (F, A or L)protected void setBlockName(String blockName)
setBlockName
in class SwiftBlock
blockName
- the block name to setIllegalArgumentException
- if parameter blockName is not the string "1"protected void setBlockNumber(Integer blockNumber)
setBlockNumber
in class SwiftBlock
blockNumber
- the block number to setIllegalArgumentException
- if parameter blockName is not the integer 1public void setBlockValue(String value)
SwiftValueBlock
java.lang.UnsupportedOperationException
setBlockValue
in class SwiftValueBlock
value
- unusedsetValue(String)
public void setLogicalTerminal(BIC bic)
bic
- setLogicalTerminal(LogicalTerminalAddress)
public void setLogicalTerminal(LogicalTerminalAddress logicalTerminal)
logicalTerminal
- LogicalTerminalAddress.getSenderLogicalTerminalAddress()
public void setLogicalTerminal(String logicalTerminal)
logicalTerminal
- it is fixed at 12 characters; it must not have X in position 9 (padded with "X" if no branch is required).public void setSender(String sender)
setLogicalTerminal(LogicalTerminalAddress)
public void setSequenceNumber(String sequenceNumber)
sequenceNumber
- 6 numberspublic void setServiceId(String serviceId)
serviceId
- string of 2 characters containing Service ID (01, 02, 03, etc...)public void setSessionNumber(String sessionNumber)
sessionNumber
- 4 numbers.public void setValue(String value)
setValue
in class SwiftValueBlock
value
- a fixed length string containing the blocks' value (25 or 24 characters when '1:' is not indicated; 26 or 27 characters when starting string '1:' is included)public String toJson()