@Entity(name="mt") public class MtSwiftMessage extends AbstractSwiftMessage
identifier, IDENTIFIER_ACK, IDENTIFIER_NAK, PROPERTY_NAME, receiver, sender
Constructor and Description |
---|
MtSwiftMessage() |
MtSwiftMessage(java.io.File file)
Creates a new message reading the message the content from a file.
|
MtSwiftMessage(java.io.InputStream stream)
Creates a new message reading the message the content from an input stream.
|
MtSwiftMessage(java.lang.String fin)
Creates a new message reading the message the content from a string.
|
MtSwiftMessage(SwiftMessage model)
Creates an MtSwiftMessage from a SwiftMessage.
|
Modifier and Type | Method and Description |
---|---|
void |
copyTo(MtSwiftMessage msg)
Creates a full copy of the current message object into another message.
|
boolean |
equals(java.lang.Object o) |
static MtSwiftMessage |
fromJson(java.lang.String json)
This method deserializes the JSON data into an MT message object.
|
java.lang.String |
getMessageName()
Get the value of the property under the
AbstractSwiftMessage.PROPERTY_NAME key or the result of getMessageType() |
java.lang.String |
getMessageType()
Get the message type.
For MTs this is the MT type number present in the identifier attribute. |
java.lang.Integer |
getMessageTypeInt()
Get the integer value of the
getMessageType()
or null if the identifier attribute is not set or not a number |
java.lang.String |
getMir()
Gets the MIR (Message Input Reference)
|
SwiftMessage |
getModelMessage()
Deprecated.
The internal model message is no longer kept as class attribute to avoid
inconsistencies between the raw format and the parsed data. To parse the internal raw
format into a model object use
modelMessage() instead of this getter. |
java.lang.String |
getMur()
Gets the MUR (Message User Reference) from block 3
|
java.lang.String |
getPde()
Gets PDE (Possible Duplicate Emission) flag from the trailer block or null if the trailer or the PDE field is not present
|
java.lang.String |
getPdm()
Gets PDM from the trailer block or null if the trailer or the PDM field is not present
|
java.lang.String |
getUuid()
Gets a UUID (User Unique Identifier)
|
int |
hashCode() |
boolean |
isType(int type)
Test if this message is a given specific type.
|
boolean |
isType(java.lang.Integer... type)
Tell if this message is any of the given types.
|
SwiftMessage |
modelMessage()
Parses the raw message content into a
SwiftMessage object. |
static MtSwiftMessage |
parse(java.io.File file)
Creates a new message reading the message the content from a file.
|
static MtSwiftMessage |
parse(java.io.InputStream stream)
Creates a new message reading the message the content from an input stream.
|
static MtSwiftMessage |
parse(java.lang.String fin)
Creates a new message reading the message the content from a string.
|
void |
setMir(java.lang.String mir)
Sets the MIR attribute.
|
void |
setModelMessage(SwiftMessage modelMessage)
Deprecated.
The internal model message is no longer kept as class attribute to avoid
inconsistencies between the raw format and the parsed data. To update the internal raw
format from a model object use
updateFromModel(SwiftMessage) instead of this setter. |
void |
setMur(java.lang.String mur)
Sets the MUR attribute.
|
void |
setPde(java.lang.String pde)
Sets the PDE attribute.
|
void |
setPdm(java.lang.String pdm)
Sets the PDM attribute.
|
void |
setUuid(java.lang.String uuid)
Sets a UUID
This field is automatically updated on message update from FIN or model
|
java.lang.String |
toString() |
void |
updateFromFIN()
Updates the derived attributes from the current raw (FIN) message attribute.
|
void |
updateFromFIN(java.lang.String fin)
Updates the the attributes with the raw message and its metadata from the given raw (FIN) message content.
|
protected void |
updateFromMessage()
Updates the object attributes with metadata parsed from the message raw content:
identifier, sender, receiver, direction and specific data for the implementing subclass.
|
void |
updateFromModel(AbstractMT mt)
The AbstractMT is serialized to its FIN raw format to set the internal raw message attribute.
|
void |
updateFromModel(SwiftMessage model)
The SwiftMessage is serialized to its FIN raw format to set the internal raw message attribute.
|
addNote, addRevision, addStatus, bic11, contains, contains, copyTo, createRevision, findStatusInfo, findStatusInfo, findStatusInfoLast, findStatusInfoLast, formattedAmount, formattedAmount, getAmount, getChecksum, getChecksumBody, getCorrespondentBIC, getCreationDate, getCreationDayOfMonth, getCreationMonth, getCreationYear, getCurrency, getDirection, getFileFormat, getFilename, getId, getIdentifier, getLastData, getLastData, getLastModified, getMessage, getNotes, getPaddedId, getPreviousStatusInfo, getProperties, getProperty, getProperty, getPropertyBoolean, getPropertyBoolean, getReceiver, getReference, getRevisions, getSender, getStatus, getStatusInfo, getStatusTrail, identifiedAsACK, identifiedAsNAK, isIncoming, isInput, isMT, isMX, isOutgoing, isOutput, isStatus, isStatus, isStatus, isStatus, match, message, messageStandardType, sanityCheckProperties, setAmount, setChecksum, setChecksumBody, setCreationDate, setCurrency, setDirection, setFileFormat, setFilename, setId, setIdentifier, setLastModified, setMessage, setNotes, setProperties, setProperty, setProperty, setReceiver, setReference, setRevisions, setSender, setStatus, setStatus, setStatusTrail, toJson
public MtSwiftMessage()
public MtSwiftMessage(java.lang.String fin)
If the string contains several messages, the whole passed content will be save in the message attribute but identification and metadata will be parser from the first one found only.
Notice that if an ACK/NAK followed by the original message is passed, this object will represent the ACK/NAK.
File format is set to FileFormat.FIN
public MtSwiftMessage(java.io.InputStream stream) throws java.io.IOException
FileFormat.FIN
java.io.IOException
MtSwiftMessage(String)
,
AbstractSwiftMessage.AbstractSwiftMessage(InputStream)
public MtSwiftMessage(java.io.File file) throws java.io.IOException
FileFormat.FIN
java.io.IOException
MtSwiftMessage(String)
,
AbstractSwiftMessage.AbstractSwiftMessage(File)
public MtSwiftMessage(SwiftMessage model)
updateFromModel(SwiftMessage)
public static MtSwiftMessage parse(java.lang.String fin)
MtSwiftMessage(String)
public static MtSwiftMessage parse(java.io.InputStream stream) throws java.io.IOException
MtSwiftMessage(InputStream)
java.io.IOException
public static MtSwiftMessage parse(java.io.File file) throws java.io.IOException
MtSwiftMessage(File)
java.io.IOException
protected void updateFromMessage() throws java.lang.IllegalArgumentException
AbstractSwiftMessage
updateFromMessage
in class AbstractSwiftMessage
java.lang.IllegalArgumentException
- if the source format is not FileFormat.FIN
or if the message cannot be parsed into a MtSwiftMessage
objectAbstractSwiftMessage.updateFromMessage()
public void updateFromFIN(java.lang.String fin)
fin
- the new message contentupdateFromMessage()
public void updateFromFIN()
public void updateFromModel(SwiftMessage model)
public void updateFromModel(AbstractMT mt)
@Deprecated @ProwideDeprecated(phase4=_2019) public SwiftMessage getModelMessage()
modelMessage()
instead of this getter.public SwiftMessage modelMessage()
SwiftMessage
object.@Deprecated @ProwideDeprecated(phase4=_2019) public void setModelMessage(SwiftMessage modelMessage)
updateFromModel(SwiftMessage)
instead of this setter.public java.lang.String getMessageType()
public java.lang.Integer getMessageTypeInt()
getMessageType()
or null if the identifier attribute is not set or not a numberpublic java.lang.String getMessageName()
AbstractSwiftMessage.PROPERTY_NAME
key or the result of getMessageType()
getMessageName
in class AbstractSwiftMessage
public boolean isType(java.lang.Integer... type)
type
- a variable list of integers for testing to match as the current message typetrue
if the current message type is any of the integers given as parameters, and false
in any other casepublic boolean isType(int type)
type
- the message type given as int, to testtrue
if this message type is the type
given, or false
in any other casepublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getPde()
public void setPde(java.lang.String pde)
pde
- the PDE flag to setupdateFromFIN(String)
,
updateFromModel(AbstractMT)
,
updateFromModel(SwiftMessage)
public java.lang.String getPdm()
public void setPdm(java.lang.String pdm)
pdm
- the PDM flag to setupdateFromFIN(String)
,
updateFromModel(AbstractMT)
,
updateFromModel(SwiftMessage)
public java.lang.String getMir()
SwiftMessage.getMIR()
public void setMir(java.lang.String mir)
mir
- the MIR to setupdateFromFIN(String)
,
updateFromModel(AbstractMT)
,
updateFromModel(SwiftMessage)
public java.lang.String getMur()
SwiftMessage.getMUR()
public void setMur(java.lang.String mur)
mur
- the MUR to setupdateFromFIN(String)
,
updateFromModel(AbstractMT)
,
updateFromModel(SwiftMessage)
public java.lang.String getUuid()
SwiftMessage.getUUID()
public void setUuid(java.lang.String uuid)
uuid
- updateFromFIN(String)
,
updateFromModel(AbstractMT)
,
updateFromModel(SwiftMessage)
public boolean equals(java.lang.Object o)
equals
in class AbstractSwiftMessage
public int hashCode()
hashCode
in class AbstractSwiftMessage
public void copyTo(MtSwiftMessage msg)
msg
- target messageAbstractSwiftMessage.copyTo(AbstractSwiftMessage)
public static MtSwiftMessage fromJson(java.lang.String json)