public class BusinessHeader
extends java.lang.Object
BusinessApplicationHeaderV01
ApplicationHeader
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAMESPACE_AH |
static java.lang.String |
NAMESPACE_BAH |
Constructor and Description |
---|
BusinessHeader()
Creates an empty header
|
BusinessHeader(ApplicationHeader applicationHeader)
Creates a business header from the SWIFT Application Header
|
BusinessHeader(BusinessApplicationHeaderV01 businessApplicationHeader)
Creates a business header from the ISO Business Application Header
|
Modifier and Type | Method and Description |
---|---|
static BusinessHeader |
create(java.lang.String sender,
java.lang.String receiver,
java.lang.String reference,
MxId id)
Convenient method to create a new header, initialized from simple parameters.
|
org.w3c.dom.Element |
element()
Gets the header as an Element object.
|
java.lang.String |
from()
Gets the sender BIC code.
|
ApplicationHeader |
getApplicationHeader() |
BusinessApplicationHeaderV01 |
getBusinessApplicationHeader() |
java.lang.String |
reference()
Get the message reference.
|
void |
setApplicationHeader(ApplicationHeader applicationHeader) |
void |
setBusinessApplicationHeader(BusinessApplicationHeaderV01 businessApplicationHeader) |
void |
setCreationDate(boolean overwrite)
Sets the creation date in the inner header object with current moment in UTC time zone.
|
java.lang.String |
to()
Gets the receiver BIC code
If the header is a BAH, tries to gets the BIC code from this elements in the following order: BusinessApplicationHeaderV01/To/FIId/FinInstnId/BICFI BusinessApplicationHeaderV01/To/OrgId/Id/OrgId/Id/AnyBIC If the header is an AH, gets the same from ApplicationHeader/To/Type+Id where if Type is BIC the Id is returned as is, otherwise the domain name is parsed using MxParser.getBICFromDN(String) |
java.lang.String |
xml()
Get this header as an XML string.
|
java.lang.String |
xml(java.lang.String prefix,
boolean includeXMLDeclaration)
Get this header as an XML string.
|
public static final transient java.lang.String NAMESPACE_AH
public static final transient java.lang.String NAMESPACE_BAH
public BusinessHeader()
public BusinessHeader(ApplicationHeader applicationHeader)
applicationHeader
- public BusinessHeader(BusinessApplicationHeaderV01 businessApplicationHeader)
businessApplicationHeader
- public ApplicationHeader getApplicationHeader()
public void setApplicationHeader(ApplicationHeader applicationHeader)
public BusinessApplicationHeaderV01 getBusinessApplicationHeader()
public void setBusinessApplicationHeader(BusinessApplicationHeaderV01 businessApplicationHeader)
public java.lang.String from()
MxParser.getBICFromDN(String)
public java.lang.String to()
MxParser.getBICFromDN(String)
public java.lang.String reference()
BusinessApplicationHeaderV01.getBizMsgIdr()
,
ApplicationHeader.getMsgRef()
public java.lang.String xml()
xml(String, boolean)
public java.lang.String xml(java.lang.String prefix, boolean includeXMLDeclaration)
prefix
- optional prefix for namespace (empty by default)includeXMLDeclaration
- true to include the XML declaration (false by default)public org.w3c.dom.Element element()
public static BusinessHeader create(java.lang.String sender, java.lang.String receiver, java.lang.String reference, MxId id)
BusinessApplicationHeaderV01
.
Creation date will be set to current time.
sender
- optional sender BIC for the Fr element or null to leave not setreceiver
- optional receiver BIC for the To element or null to leave not setreference
- optional reference for the BizMsgIdr (business message identifier) or null to leave not setid
- optional MX identification for the MsgDefIdr (message definition identifier) element or null to leave not setpublic void setCreationDate(boolean overwrite)
overwrite
- if true, the creation date will always be set overwriting any previous value; if false it will be set only if it is not already set