public abstract class AbstractSwiftMessage extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY_NAME |
Constructor and Description |
---|
AbstractSwiftMessage() |
Modifier and Type | Method and Description |
---|---|
void |
addNote(SwiftMessageNote n)
Adds a new note to the messages, initializing the notes list if necessary.
|
void |
addStatus(SwiftMessageStatusInfo status)
Adds a status to the message's status trail and current status attribute, initializing the statuses trail list if necessary.
|
boolean |
contains(Enum... statuses)
Tell if this message has any of the given statuses in his status trail
|
boolean |
contains(String... statuses)
Tell if this message has any of the given statuses in his status trail
|
boolean |
equals(Object obj) |
SwiftMessageStatusInfo |
findStatusInfo(String statusName)
Finds the first status info from the status trail, with the given name or returns
null if not found |
String |
getChecksum() |
Calendar |
getCreationDate() |
MessageIOType |
getDirection() |
String |
getFilename() |
Long |
getId() |
String |
getIdentifier() |
String |
getLastData() |
String |
getLastData(String... statuses)
Get the last saved status data of this message or empty string if not found
|
Calendar |
getLastModified() |
String |
getMessage() |
String |
getMessageName()
Get the value of the property under the
PROPERTY_NAME key or null if not found |
List<SwiftMessageNote> |
getNotes() |
String |
getPaddedId()
Returns the internal unique id as fixed length string, padded with zeros.
|
SwiftMessageStatusInfo |
getPreviousStatusInfo()
Retrieves from the status trail, the status info before the current one; or
null if none is found. |
Map<String,String> |
getProperties() |
String |
getProperty(Enum key) |
String |
getProperty(String key)
Get the value of the property under the given key or
null if the key is not found or its value is empty |
boolean |
getPropertyBoolean(Enum key) |
boolean |
getPropertyBoolean(String key)
Returns true if the message has a property with the given key name and value "true"
|
String |
getReceiver() |
String |
getSender() |
String |
getStatus()
Get the name of the last status set to this message, or
null if none is found. |
SwiftMessageStatusInfo |
getStatusInfo()
Retrieves from the status trail, the current status info; or
null if none is found. |
List<SwiftMessageStatusInfo> |
getStatusTrail() |
int |
hashCode() |
Boolean |
isIncoming() |
boolean |
isInput() |
boolean |
isOutgoing() |
Boolean |
isOutput() |
boolean |
isStatus(Enum... statuses)
Tell if this message has any of the given statuses as current status
|
boolean |
isStatus(Enum status)
Returns true if the current status is equals to the parameter status
|
boolean |
isStatus(String... statuses)
Tell if this message has any of the given statuses as current status
|
boolean |
isStatus(String status)
Returns true if the current status is equals to the parameter status
|
abstract AbstractSwiftMessage |
readFile(File file) |
void |
sanityCheckProperties()
Iterate message properties and truncate all needed values issuing a log entry for each truncated one
|
void |
setChecksum(String checksum) |
void |
setCreationDate(Calendar creationDate) |
void |
setDirection(MessageIOType direction) |
void |
setFilename(String filename) |
void |
setId(Long id) |
void |
setIdentifier(String identifier) |
void |
setLastModified(Calendar lastModified) |
void |
setMessage(String message)
Set the raw content of the message.
|
void |
setNotes(List<SwiftMessageNote> notes) |
void |
setProperties(Map<String,String> properties) |
void |
setProperty(Enum key,
String value) |
void |
setProperty(String key,
String value)
Sets a property using the given key and value, if the key exists the value is overwritten.
|
void |
setReceiver(String receiver) |
void |
setSender(String sender) |
void |
setStatus(String status)
Sets the status attribute.
|
void |
setStatus(SwiftMessageStatusInfo status) |
void |
setStatusTrail(List<SwiftMessageStatusInfo> statusTrail) |
public static final transient String PROPERTY_NAME
public void addNote(SwiftMessageNote n)
n
- note to addpublic void addStatus(SwiftMessageStatusInfo status)
status
- the status to addpublic boolean contains(Enum... statuses)
statuses
- a list of statuses to check in the status trailpublic boolean contains(String... statuses)
statuses
- a list of statuses to check in the status trailpublic SwiftMessageStatusInfo findStatusInfo(String statusName)
null
if not foundpublic String getChecksum()
public Calendar getCreationDate()
public MessageIOType getDirection()
public String getFilename()
public Long getId()
public String getIdentifier()
public String getLastData()
public String getLastData(String... statuses)
statuses
- an array of statuses to check data into, if null
all message statuses are checked for datapublic Calendar getLastModified()
public String getMessage()
public String getMessageName()
PROPERTY_NAME
key or null
if not foundpublic List<SwiftMessageNote> getNotes()
public String getPaddedId()
public SwiftMessageStatusInfo getPreviousStatusInfo()
null
if none is found.public String getProperty(Enum key)
getProperty(String)
public String getProperty(String key)
null
if the key is not found or its value is emptypublic boolean getPropertyBoolean(Enum key)
getPropertyBoolean(String)
public boolean getPropertyBoolean(String key)
public String getReceiver()
public String getSender()
public String getStatus()
null
if none is found.public SwiftMessageStatusInfo getStatusInfo()
null
if none is found.public List<SwiftMessageStatusInfo> getStatusTrail()
public Boolean isIncoming()
public boolean isInput()
isOutgoing()
public boolean isOutgoing()
public Boolean isOutput()
isIncoming()
public boolean isStatus(Enum... statuses)
statuses
- public boolean isStatus(Enum status)
status
- public boolean isStatus(String... statuses)
statuses
- public boolean isStatus(String status)
status
- public abstract AbstractSwiftMessage readFile(File file) throws IOException
IOException
public void sanityCheckProperties()
public void setChecksum(String checksum)
public void setCreationDate(Calendar creationDate)
public void setDirection(MessageIOType direction)
public void setFilename(String filename)
public void setId(Long id)
public void setIdentifier(String identifier)
public void setLastModified(Calendar lastModified)
public void setMessage(String message)
message
- raw content of the messagepublic void setNotes(List<SwiftMessageNote> notes)
public void setProperty(Enum key, String value)
setProperty(String, String)
public void setProperty(String key, String value)
public void setReceiver(String receiver)
public void setSender(String sender)
public void setStatus(String status)
status
- addStatus(SwiftMessageStatusInfo)
public void setStatus(SwiftMessageStatusInfo status)
addStatus(SwiftMessageStatusInfo)
public void setStatusTrail(List<SwiftMessageStatusInfo> statusTrail)