@Entity(name="mx")
public class MxSwiftMessage
extends com.prowidesoftware.swift.model.AbstractSwiftMessage
The class holds the full xml content plus message identification metadata gathered from the application header.
Notice, the scope of Prowide MX model is the message payload (the actual message or body data) which is the fundamental purpose of the transmission. The transmission wrappers (overhead data) are excluded and intentionally ignored if found.
MX messages are uniquely identify by their business process, message functionality, variant and version.
Consider the following example: trea.001.001.02
businessProcess: Alphabetic code in four positions (fixed length) identifying the Business Process
functionality: Alphanumeric code in three positions (fixed length) identifying the Message Functionality
variant: Numeric code in three positions (fixed length) identifying a particular flavor (variant) of Message Functionality
version: Numeric code in two positions (fixed length) identifying the version.
Constructor and Description |
---|
MxSwiftMessage() |
MxSwiftMessage(AbstractMX mx)
|
MxSwiftMessage(AbstractMX mx,
com.prowidesoftware.swift.model.MessageMetadataStrategy metadataStrategy)
Creates a new message serializing to xml the parameter message object.
|
MxSwiftMessage(java.io.File file)
|
MxSwiftMessage(java.io.File file,
com.prowidesoftware.swift.model.MessageMetadataStrategy metadataStrategy)
Creates a new message reading the message the content from a file.
|
MxSwiftMessage(java.io.InputStream stream)
|
MxSwiftMessage(java.io.InputStream stream,
com.prowidesoftware.swift.model.MessageMetadataStrategy metadataStrategy)
Creates a new message reading the message the content from an input stream.
|
MxSwiftMessage(java.lang.String xml)
|
MxSwiftMessage(java.lang.String xml,
com.prowidesoftware.swift.model.MessageMetadataStrategy metadataStrategy)
Creates a new message reading the message the content from a string.
|
Modifier and Type | Method and Description |
---|---|
void |
copyTo(MxSwiftMessage msg)
Creates a full copy of the current message object into another message.
|
boolean |
equals(java.lang.Object o) |
static MxSwiftMessage |
fromJson(java.lang.String json)
This method deserializes the JSON data into an MX message object.
|
AppHdr |
getAppHdr()
If present in the message content, returns the business header (SWIFT or ISO version)
Notice this header is optional and may not be present.
|
com.prowidesoftware.swift.model.mx.dic.ApplicationHeader |
getApplicationHeader()
Deprecated.
use
getAppHdr() instead |
BusinessHeader |
getBusinessHeader()
Deprecated.
use
getAppHdr() instead |
MxBusinessProcess |
getBusinessProcess() |
java.lang.String |
getCategory()
For MT messages returns the category number and for MX messages return the business process.
|
java.lang.String |
getFunctionality() |
MxId |
getMxId()
Returns this message MX identification
|
java.lang.String |
getVariant() |
java.lang.String |
getVersion() |
int |
hashCode() |
static MxSwiftMessage |
parse(java.io.File file)
Creates a new message reading the message the content from a file.
|
static MxSwiftMessage |
parse(java.io.InputStream stream)
Creates a new message reading the message the content from an input stream.
|
static MxSwiftMessage |
parse(java.lang.String xml)
Creates a new message reading the message the content from a string.
|
void |
setApplicationHeader(com.prowidesoftware.swift.model.mx.dic.ApplicationHeader applicationHeader)
Deprecated.
@see #getApplicationHeader()
|
void |
setBusinessProcess(MxBusinessProcess businessProcess) |
void |
setFunctionality(java.lang.String functionality) |
void |
setVariant(java.lang.String variant) |
void |
setVersion(java.lang.String version) |
java.lang.String |
toString() |
protected void |
updateFromMessage()
|
protected void |
updateFromMessage(com.prowidesoftware.swift.model.MessageMetadataStrategy metadataStrategy)
Updates the object attributes with metadata parsed from the message raw content using the provided strategy
implementation for several of the metadata fields.
|
void |
updateFromModel(AbstractMX mx)
Updates the the attributes with the raw message and its metadata from the given raw (XML) message content.
|
void |
updateFromModel(AbstractMX mx,
com.prowidesoftware.swift.model.MessageMetadataStrategy metadataStrategy) |
void |
updateFromXML(java.lang.String xml)
|
void |
updateFromXML(java.lang.String xml,
MxId id)
|
void |
updateFromXML(java.lang.String xml,
MxId id,
com.prowidesoftware.swift.model.MessageMetadataStrategy metadataStrategy)
Updates the the attributes with the raw message and its metadata from the given raw (XML) message content.
|
void |
updateMetadata(com.prowidesoftware.swift.model.MessageMetadataStrategy strategy)
Enables injecting your own implementation for the entity metadata extraction, to set the generic properties
shared by all message types: main reference, main amount and currency, value date, trade date.
|
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, getMessageName, getMessageType, getNotes, getPaddedId, getPreviousStatusInfo, getProperties, getProperty, getProperty, getPropertyBoolean, getPropertyBoolean, getReceiver, getReference, getRevisions, getSender, getStatus, getStatusInfo, getStatusTrail, getTradeDate, getValueDate, identifiedAsACK, identifiedAsNAK, isIncoming, isInput, isMT, isMX, isOutgoing, isOutput, isStatus, isStatus, isStatus, isStatus, match, message, messageStandardType, propertyEquals, propertyEquals, propertyEquals, sanityCheckProperties, setAmount, setChecksum, setChecksumBody, setCreationDate, setCurrency, setDirection, setFileFormat, setFilename, setId, setIdentifier, setLastModified, setMessage, setNotes, setProperties, setProperty, setProperty, setReceiver, setReference, setRevisions, setSender, setStatus, setStatus, setStatusTrail, setTradeDate, setValueDate, toJson, toJsonImpl
public MxSwiftMessage()
public MxSwiftMessage(java.lang.String xml)
public MxSwiftMessage(java.lang.String xml, com.prowidesoftware.swift.model.MessageMetadataStrategy metadataStrategy)
Performs a fast parsing of the header to identify the message.
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.
xml
- the plain ISO 20022 XML content, with or without the optional headermetadataStrategy
- a strategy for metadata extractionpublic MxSwiftMessage(java.io.InputStream stream) throws java.io.IOException
java.io.IOException
public MxSwiftMessage(java.io.InputStream stream, com.prowidesoftware.swift.model.MessageMetadataStrategy metadataStrategy) throws java.io.IOException
stream
- a stream containing the XML messagemetadataStrategy
- a strategy for metadata extractionjava.io.IOException
public MxSwiftMessage(java.io.File file) throws java.io.IOException
java.io.IOException
public MxSwiftMessage(java.io.File file, com.prowidesoftware.swift.model.MessageMetadataStrategy metadataStrategy) throws java.io.IOException
file
- an existing file containing the XMLmetadataStrategy
- a strategy for metadata extractionjava.io.IOException
public MxSwiftMessage(AbstractMX mx)
mx
- a message objectpublic MxSwiftMessage(AbstractMX mx, com.prowidesoftware.swift.model.MessageMetadataStrategy metadataStrategy)
If the business header is present, the sender and receiver attributes will be set with content from the
header; also the internal raw XML will include both 'AppHdr' and 'Document' under a default root element tag
as returned by AbstractMX.message()
If the header is not present, sender and receiver will be left null and the raw internal XML will include
just the 'Document' element.
mx
- a message objectmetadataStrategy
- a strategy for metadata extractionpublic static MxSwiftMessage parse(java.lang.String xml)
MxSwiftMessage(String)
public static MxSwiftMessage parse(java.io.InputStream stream) throws java.io.IOException
MxSwiftMessage(InputStream)
java.io.IOException
public static MxSwiftMessage parse(java.io.File file) throws java.io.IOException
MxSwiftMessage(File)
java.io.IOException
public static MxSwiftMessage fromJson(java.lang.String json)
AbstractSwiftMessage.toJson()
protected void updateFromMessage()
updateFromMessage
in class com.prowidesoftware.swift.model.AbstractSwiftMessage
protected void updateFromMessage(com.prowidesoftware.swift.model.MessageMetadataStrategy metadataStrategy)
updateFromMessage
in class com.prowidesoftware.swift.model.AbstractSwiftMessage
public void updateFromModel(AbstractMX mx)
mx
- the new message contentupdateFromMessage()
public void updateFromModel(AbstractMX mx, com.prowidesoftware.swift.model.MessageMetadataStrategy metadataStrategy)
public void updateFromXML(java.lang.String xml)
public void updateFromXML(java.lang.String xml, MxId id)
public void updateFromXML(java.lang.String xml, MxId id, com.prowidesoftware.swift.model.MessageMetadataStrategy metadataStrategy)
xml
- the XML content of an MX message containing the Document and optional AppHdr elementsid
- the specific Mx type identification or null if message is unknownmetadataStrategy
- the strategy implementation to use for metadata extractionpublic MxBusinessProcess getBusinessProcess()
public void setBusinessProcess(MxBusinessProcess businessProcess)
public java.lang.String getFunctionality()
public void setFunctionality(java.lang.String functionality)
public java.lang.String getVariant()
public void setVariant(java.lang.String variant)
public java.lang.String getVersion()
public void setVersion(java.lang.String version)
public boolean equals(java.lang.Object o)
equals
in class com.prowidesoftware.swift.model.AbstractSwiftMessage
public int hashCode()
hashCode
in class com.prowidesoftware.swift.model.AbstractSwiftMessage
@Deprecated @ProwideDeprecated(phase2=SRU2021) public BusinessHeader getBusinessHeader()
getAppHdr()
insteadpublic AppHdr getAppHdr()
AppHdrParser.parse(String)
@Deprecated @ProwideDeprecated(phase4=SRU2021) public com.prowidesoftware.swift.model.mx.dic.ApplicationHeader getApplicationHeader()
getAppHdr()
instead@Deprecated @ProwideDeprecated(phase4=SRU2021) public void setApplicationHeader(com.prowidesoftware.swift.model.mx.dic.ApplicationHeader applicationHeader)
getApplicationHeader()
public void copyTo(MxSwiftMessage msg)
msg
- target messageAbstractSwiftMessage.copyTo(AbstractSwiftMessage)
public java.lang.String toString()
toString
in class java.lang.Object
public MxId getMxId()
public java.lang.String getCategory()
getCategory
in class com.prowidesoftware.swift.model.AbstractSwiftMessage
public void updateMetadata(com.prowidesoftware.swift.model.MessageMetadataStrategy strategy)