Class ServiceMessage21
- java.lang.Object
-
- com.prowidesoftware.swift.model.AbstractMessage
-
- com.prowidesoftware.swift.model.mt.AbstractMT
-
- com.prowidesoftware.swift.model.mt.ServiceMessage21
-
- All Implemented Interfaces:
JsonSerializable
public class ServiceMessage21 extends AbstractMT
Generic MT representation for service messages with service id 21 = GPA/FIN Message (ACK/NAK/UAK/UNK). It can hold both a positive or negative acknowledge.
For system messages, category 0, see the MT0xx classes.- Since:
- 7.10.4
-
-
Field Summary
-
Fields inherited from class com.prowidesoftware.swift.model.mt.AbstractMT
m
-
-
Constructor Summary
Constructors Constructor Description ServiceMessage21(SwiftMessage aMessage)
ServiceMessage21(java.io.File file)
Creates a new ServiceMessage21 by parsing a file with the message content in its swift FIN format.
If the file content is null or cannot be parsed as a message, the internal message object will be initialized (blocks will be created) but empty.
If the file contains multiple messages, only the first one will be parsed.ServiceMessage21(java.io.InputStream stream)
Creates a new ServiceMessage21 by parsing a input stream with the message content in its swift FIN format, using "UTF-8" as encoding.
If the message content is null or cannot be parsed, the internal message object will be initialized (blocks will be created) but empty.
If the stream contains multiple messages, only the first one will be parsed.ServiceMessage21(java.lang.String fin)
Creates a new ServiceMessage21 by parsing a String with the message content in its swift FIN format.
If the fin parameter is null or the message cannot be parsed, the internal message object will be initialized (blocks will be created) but empty.
If the string contains multiple messages, only the first one will be parsed.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getErrorCode()
Returns the error code present in NAK messages in field 405java.lang.String
getErrorLine()
Returns the error line present in NAK messages in field 405Field108
getField108()
gets the MUR fieldField177
getField177()
Local date time of the submitting user message on to the SWIFT networkField405
getField405()
The error code and error line in case of NAKField451
getField451()
The ACK/NAK flag fieldjava.lang.String
getMessageType()
Will always return null because service messages do not contain a message type.MtId
getMtId()
Returns the MT message identification.
Composed by the business process, message type and variant.boolean
isAck()
Returns true if this message is an ACK (positive acknowledge).boolean
isNack()
Returns true if this message is an NACK (negative acknowledge).static MtId
mtId()
The identifier for system messages will always be gpa.021static AbstractMT
newInstance(SwiftMessage swiftMessage)
static ServiceMessage21
parse(MtSwiftMessage m)
Creates an ServiceMessage21 initialized with the parameter MtSwiftMessage.static ServiceMessage21
parse(java.io.File file)
Creates a new ServiceMessage21 by parsing a file with the message content in its swift FIN format.
If the file contains multiple messages, only the first one will be parsed.static ServiceMessage21
parse(java.io.InputStream stream)
Creates a new ServiceMessage21 by parsing a input stream with the message content in its swift FIN format, using "UTF-8" as encoding.
If the stream contains multiple messages, only the first one will be parsed.static ServiceMessage21
parse(java.lang.String fin)
Creates a new ServiceMessage21 by parsing a String with the message content in its swift FIN format.
If the file contains multiple messages, only the first one will be parsed.-
Methods inherited from class com.prowidesoftware.swift.model.mt.AbstractMT
addField, append, append, append, containsSequence, containsSequenceList, create, create, fromJson, getApplicationId, getFields, getLogicalTerminal, getMessagePriority, getReceiver, getSender, getSequence, getSequence, getSequence, getSequenceList, getSequenceList, getSequenceNumber, getServiceId, getSessionNumber, getSignature, getSwiftMessage, getSwiftMessageNotNullOrException, getVariant, isIncoming, isInput, isOutgoing, isOutput, isType, message, nameFromClass, read, setReceiver, setReceiver, setSender, setSender, setSignature, setSwiftMessage, tag, tags, toJson, toString, write, write, xml
-
Methods inherited from class com.prowidesoftware.swift.model.AbstractMessage
getMessageStandardType, isMT, isMX
-
-
-
-
Constructor Detail
-
ServiceMessage21
public ServiceMessage21(SwiftMessage aMessage)
- Throws:
java.lang.RuntimeException
- if the message is not a service message with service id 21 (meaning positive or negative acknowledge)
-
ServiceMessage21
public ServiceMessage21(java.io.InputStream stream) throws java.io.IOException
Creates a new ServiceMessage21 by parsing a input stream with the message content in its swift FIN format, using "UTF-8" as encoding.
If the message content is null or cannot be parsed, the internal message object will be initialized (blocks will be created) but empty.
If the stream contains multiple messages, only the first one will be parsed.- Parameters:
stream
- an input stream in UTF-8 encoding with the MT message in its FIN swift format.- Throws:
java.io.IOException
-
ServiceMessage21
public ServiceMessage21(java.io.File file) throws java.io.IOException
Creates a new ServiceMessage21 by parsing a file with the message content in its swift FIN format.
If the file content is null or cannot be parsed as a message, the internal message object will be initialized (blocks will be created) but empty.
If the file contains multiple messages, only the first one will be parsed.- Parameters:
file
- a file with the MT message in its FIN swift format.- Throws:
java.io.IOException
-
ServiceMessage21
public ServiceMessage21(java.lang.String fin)
Creates a new ServiceMessage21 by parsing a String with the message content in its swift FIN format.
If the fin parameter is null or the message cannot be parsed, the internal message object will be initialized (blocks will be created) but empty.
If the string contains multiple messages, only the first one will be parsed.- Parameters:
fin
- a string with the MT message in its FIN swift format- Throws:
java.lang.RuntimeException
- if the message is not a service message with service id 21 (meaning positive or negative acknowledge)
-
-
Method Detail
-
newInstance
public static AbstractMT newInstance(SwiftMessage swiftMessage)
- Throws:
java.lang.RuntimeException
- if the message is not a service message with service id 21 (meaning positive or negative acknowledge)
-
parse
public static ServiceMessage21 parse(MtSwiftMessage m)
Creates an ServiceMessage21 initialized with the parameter MtSwiftMessage.- Parameters:
m
- swift message with the ServiceMessage21 content- Returns:
- the created object or null if the parameter is null
- See Also:
ServiceMessage21(String)
-
parse
public static ServiceMessage21 parse(java.io.InputStream stream) throws java.io.IOException
Creates a new ServiceMessage21 by parsing a input stream with the message content in its swift FIN format, using "UTF-8" as encoding.
If the stream contains multiple messages, only the first one will be parsed.- Parameters:
stream
- an input stream in UTF-8 encoding with the MT message in its FIN swift format.- Returns:
- a new instance of ServiceMessage21 or null if stream is null or the message cannot be parsed
- Throws:
java.io.IOException
-
parse
public static ServiceMessage21 parse(java.io.File file) throws java.io.IOException
Creates a new ServiceMessage21 by parsing a file with the message content in its swift FIN format.
If the file contains multiple messages, only the first one will be parsed.- Parameters:
file
- a file with the MT message in its FIN swift format.- Returns:
- a new instance of ServiceMessage21 or null if; file is null, does not exist, can't be read, is not a file or the message cannot be parsed
- Throws:
java.io.IOException
-
parse
public static ServiceMessage21 parse(java.lang.String fin)
Creates a new ServiceMessage21 by parsing a String with the message content in its swift FIN format.
If the file contains multiple messages, only the first one will be parsed.- Parameters:
fin
- a string with the MT message in its FIN swift format- Returns:
- a new instance of ServiceMessage21 or null if; fin is null or the message cannot be parsed
- Throws:
java.lang.RuntimeException
- if the message is not a service message with service id 21 (meaning positive or negative acknowledge)
-
mtId
public static MtId mtId()
The identifier for system messages will always be gpa.021- Returns:
- gpa.021
- Since:
- 8.0.3
-
getMessageType
public java.lang.String getMessageType()
Will always return null because service messages do not contain a message type.- Specified by:
getMessageType
in classAbstractMT
- Returns:
- the message type number of this MT
-
isAck
public final boolean isAck()
Returns true if this message is an ACK (positive acknowledge). This is determined by testing if the value of field 451 is 0. If Field 451 is not present, returns false.
-
isNack
public final boolean isNack()
Returns true if this message is an NACK (negative acknowledge). This is determined by testing if the value of field 451 is 1. If Field 451 is not present, returns false.
-
getErrorCode
public java.lang.String getErrorCode()
Returns the error code present in NAK messages in field 405- Returns:
- error code found or null if the error code field is not present
-
getErrorLine
public java.lang.String getErrorLine()
Returns the error line present in NAK messages in field 405- Returns:
- error code found or null if the error code field is not present
-
getField177
public Field177 getField177()
Local date time of the submitting user message on to the SWIFT network- Since:
- 8.0.3
-
getField451
public Field451 getField451()
The ACK/NAK flag field- Since:
- 8.0.3
-
getField405
public Field405 getField405()
The error code and error line in case of NAK- Since:
- 8.0.3
- See Also:
getErrorCode()
,getErrorLine()
-
getField108
public Field108 getField108()
gets the MUR field- Since:
- 8.0.3
-
getMtId
public MtId getMtId()
Description copied from class:AbstractMT
Returns the MT message identification.
Composed by the business process, message type and variant. Example: fin.103.STP- Overrides:
getMtId
in classAbstractMT
- Returns:
- gpa.021
- Since:
- 8.0.3
-
-