public abstract class AbstractMT extends AbstractMessage
Modifier and Type | Field and Description |
---|---|
protected SwiftMessage |
m |
Constructor and Description |
---|
AbstractMT()
Creates a particular MT initialized with a new SwiftMessage.
|
AbstractMT(int messageType)
Create an input message for the given type setting TEST BICS as sender and receiver.
All mandatory header attributes are completed with default values. |
AbstractMT(int messageType,
String sender,
String receiver)
Creates a new input message for the given type setting the given sender and receiver.
All mandatory header attributes are completed with default values. |
AbstractMT(MtSwiftMessage m)
Deprecated.
use constructor from subclasses instead
|
AbstractMT(SwiftMessage m) |
Modifier and Type | Method and Description |
---|---|
void |
addField(Field f)
Adds the given field to the body block.
|
AbstractMT |
append(Field... fields)
Add all the fields to the end of the block4
|
AbstractMT |
append(SwiftTagListBlock block)
Add all tags from block to the end of the block4
|
AbstractMT |
append(Tag... tags)
Add all tags to the end of the block4
|
boolean |
containsSequence(String name)
Test if the MT class contains a getSequenceX method
|
boolean |
containsSequenceList(String name)
Test if the MT class contains a getSequenceXList method
|
static AbstractMT |
create(int messageType)
Create a blank message for the given category setting TEST bics as sender and receiver
|
static AbstractMT |
create(int messageType,
String sender,
String receiver)
Create a blank message for the given category setting the given sender and receiver BICs
|
String |
FIN()
Deprecated.
use
message() instead of this |
String |
getApplicationId() |
String |
getLogicalTerminal() |
String |
getMessagePriority() |
abstract String |
getMessageType()
Returns this message type according to the specific class.
|
MtId |
getMtId()
Returns the MT message identification.
Composed by the business process, message type and variant. |
String |
getReceiver()
Gets the message receiver BIC from the message headers.
|
String |
getSender()
Gets the message sender BIC from the message headers.
|
SwiftTagListBlock |
getSequence(String name)
Convenience method to get a sequence named
name from this message without creating the MTXXX class. |
SwiftTagListBlock |
getSequence(String name,
SwiftTagListBlock block)
Get the sequence with the given name from the tags in block invoking the proper static method in the mt class
|
static SwiftTagListBlock |
getSequence(SwiftMessage msg,
String sequence)
Deprecated.
use
msg.toMT().getSequence(sequence) instead of this method |
List<SwiftTagListBlock> |
getSequenceList(String name)
Convenience method to get the list of sequences named
name from this message without creating the MTXXX class. |
List<SwiftTagListBlock> |
getSequenceList(String name,
SwiftTagListBlock block)
Get the sequence with a given name from the given subblock
|
String |
getSequenceNumber() |
String |
getServiceId() |
String |
getSessionNumber() |
SwiftMessage |
getSwiftMessage() |
protected SwiftMessage |
getSwiftMessageNotNullOrException()
Get the swift message guaranteeing a non null return.
|
MTVariant |
getVariant() |
boolean |
isIncoming() |
boolean |
isInput() |
boolean |
isOutgoing() |
boolean |
isOutput() |
boolean |
isType(Integer type) |
String |
json()
Returns the JSON representation of the SwiftMessage attribute
|
String |
message()
Get this message as string containing the FIN message (SWIFT MT message).
|
String |
nameFromClass() |
static AbstractMT |
parse(File file)
Parses a the file content into the MTxxx that corresponds to the found message type.
|
static AbstractMT |
parse(InputStream stream)
Parses a the stream content into the MTxxx that corresponds to the found message type.
|
static AbstractMT |
parse(String fin)
Parses a the string content into the MTxxx that corresponds to the found message type.
|
protected static SwiftMessage |
read(String fin)
Base implementation for subclasses static parse.
|
void |
setReceiver(BIC bic)
Sets the logical terminal field of the application header block 2.
Notice this method only makes sense when building input messages (messages that are going to be sent to swift). |
void |
setReceiver(String receiver)
Sets the logical terminal field of the application header block 2.
|
void |
setSender(BIC bic)
Sets the logical terminal field of the header block 1 with the parameter BIC code and default LT identifier
(the message is assumed to be of type input).
Notice this method only makes sense when building input messages (messages that are going to be sent to swift). |
void |
setSender(String sender)
Sets the logical terminal field of the header block 1 (the message is assumed to be of type input).
|
void |
setSwiftMessage(SwiftMessage m) |
String |
toString() |
void |
write(File file)
Writes the message into a file with its message content in the FIN format.
|
void |
write(OutputStream stream)
Writes the message into a given output stream with its message content in the FIN format,
encoding content in UTF-8.
|
String |
xml()
Returns the message content in XML format.
The XML created is the internal format defined and used by Prowide Core. Notice: it is neither a standard nor the MX version of this MT. |
getMessageStandardType, isMT, isMX
protected SwiftMessage m
public AbstractMT(SwiftMessage m)
m
- swift message to model as a particular MTpublic AbstractMT(MtSwiftMessage m)
m
- swift message to model as a particular MTpublic AbstractMT()
public AbstractMT(int messageType)
messageType
- AbstractMT(int, String, String)
public AbstractMT(int messageType, String sender, String receiver)
messageType
- message type to createsender
- the sender address as a bic8, bic11 or full logical terminal consisting of 12 charactersreceiver
- the receiver address as a bic8, bic11 or full logical terminal consisting of 12 characterspublic static AbstractMT parse(String fin) throws IOException
fin
- string a string containing a swift MT messageIOException
public static AbstractMT parse(InputStream stream) throws IOException
stream
- a stream containing a swift MT messageIOException
parse(String)
public static AbstractMT parse(File file) throws IOException
file
- a file containing a swift MT messageIOException
parse(String)
public SwiftMessage getSwiftMessage()
protected SwiftMessage getSwiftMessageNotNullOrException()
public void setSwiftMessage(SwiftMessage m)
m
- swift message to model as a particular MTpublic String getApplicationId()
SwiftBlock1.getApplicationId()
public String getServiceId()
SwiftBlock1.getServiceId()
public String getLogicalTerminal()
SwiftBlock1.getLogicalTerminal()
public String getSessionNumber()
SwiftBlock1.getSessionNumber()
public String getSequenceNumber()
SwiftBlock1.getSequenceNumber()
public String getMessagePriority()
SwiftBlock2.getMessagePriority()
public boolean isInput()
SwiftMessage.isOutgoing()
public boolean isOutgoing()
SwiftMessage.isOutgoing()
public boolean isOutput()
SwiftMessage.isIncoming()
public boolean isIncoming()
SwiftMessage.isIncoming()
public void setSender(String sender)
sender
- the sender address as a bic8, bic11 or full logical terminal consisting of 12 charactersSwiftBlock1.setSender(String)
public void setSender(BIC bic)
bic
- a BIC codeSwiftBlock1.setLogicalTerminal(BIC)
public String getSender()
public void setReceiver(String receiver)
receiver
- the sender address as a bic8, bic11 or full logical terminal consisting of 12 charactersSwiftBlock2Input.setReceiver(String)
public void setReceiver(BIC bic)
bic
- a BIC codeSwiftBlock2Input.setReceiver(String)
public String getReceiver()
public void addField(Field f)
f
- @Deprecated public String FIN()
message()
instead of thismessage()
So the same method can be used for both MT and MX
This method may be deleted in 2016message()
public String message()
public abstract String getMessageType()
public List<SwiftTagListBlock> getSequenceList(String name)
name
from this message without creating the MTXXX class.
getSequenceList("A")
is the same as
((CastToSpecificMT)getMT()).getSequenceAList()
The requested sequence must be repetitive for non repetitive sequences use getSequence(name)name
- getSequence(String)
public List<SwiftTagListBlock> getSequenceList(String name, SwiftTagListBlock block)
name
- the name of the sequence to get. Must not be null
block
- the block from where to get the sequence
This method invokes the static version of getSequenceList(String)
getSequenceList(String)
public boolean containsSequenceList(String name)
getSequenceList(String)
public boolean containsSequence(String name)
getSequence(String)
public SwiftTagListBlock getSequence(String name)
name
from this message without creating the MTXXX class.
getSequence("A")
is the same as
((CastToSpecificMT)getMT()).getSequenceA()
The requested sequence must NOT be repetitive for repetitive sequences use getSequenceList(name)name
- getSequenceList(String)
public SwiftTagListBlock getSequence(String name, SwiftTagListBlock block)
name
- the name of the sequence to getblock
- the block where to extract the sequence frompublic static AbstractMT create(int messageType)
messageType
- create(int, String, String)
public static AbstractMT create(int messageType, String sender, String receiver)
messageType
- sender
- receiver
- public AbstractMT append(SwiftTagListBlock block)
block
- public AbstractMT append(Tag... tags)
tags
- public AbstractMT append(Field... fields)
fields
- protected static SwiftMessage read(String fin)
public void write(File file) throws IOException
file
- a non null file to write, if it does not exists, it will be createdIOException
public void write(OutputStream stream) throws IOException
stream
- a non null stream to writeIOException
public String json()
SwiftMessage.toJson()
public String xml()
public boolean isType(Integer type)
public static SwiftTagListBlock getSequence(SwiftMessage msg, String sequence)
msg.toMT().getSequence(sequence)
instead of this methodmsg
- the message to extract the sequence fromsequence
- the sequence nameSwiftMessage.toMT()
public MTVariant getVariant()
public String nameFromClass()
public MtId getMtId()