Interface AppHdr

  • All Known Implementing Classes:
    BusinessAppHdrV01, BusinessAppHdrV02, BusinessAppHdrV03, LegacyAppHdr

    public interface AppHdr
    The business header is an optional part of the payload of an ISO 20022 message, and contains general information that is relevant to the business applications that process the message.

    When the header is used, its AppHdr element is a sibling of the Document element containing the specific message type content. The parent wrapper structure that holds the AppHdr and Document is implementation/network specific and not part of the scope of this model and parser.

    As for the AppHdr there are at the moment two main specifications:

    • The ISO 20022 business application header such as the head.001.001.01.
    • The legacy application header originally defined by SWIFT: $ahV10

    This interface exports shared information applicable to all header implementations (legacy and ISO based).

    Since:
    9.0.1
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String HEADER_LOCALNAME  
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods 
      Modifier and Type Method Description
      java.time.OffsetDateTime creationDate()
      Gets the message creation date from the "CreDate" (BAH) or "CrDate" (AH) element.
      boolean duplicate()
      Gets the duplicate flag from the "PssblDplct" (BAH) or "Dup" (AH) element
      org.w3c.dom.Element element()
      Gets the header as an Element object.
      java.lang.String from()
      Gets the header sender form the "Fr" element.
      java.lang.String messageName()
      Gets the message name from the "MsgDefIdr" (BAH) or "MsgName" (AH) element.
      default java.lang.String namespace()
      Gets the specific namespace of the header
      java.lang.String reference()
      Gets the message reference from the "BizMsgIdr" (BAH) or "MsgRef" (AH) element.
      java.lang.String serviceName()
      Gets the service name from the "BizSvc" (BAH) or "SvcName" (AH) element.
      void setCreationDate​(boolean overwrite)
      Sets the creation date in the header object with current moment in UTC time zone.
      java.lang.String to()
      Gets the header receiver form the "To" element.
      default java.lang.String xml()
      Get this header as an XML string.
      default java.lang.String xml​(MxWriteParams params)
      Get this header as an XML string.
      java.lang.String xml​(java.lang.String prefix, boolean includeXMLDeclaration)
      Deprecated.
      use xml(MxWriteParams) instead
      default java.lang.String xml​(java.lang.String prefix, boolean includeXMLDeclaration, EscapeHandler escapeHandler)
      Deprecated.
      use xml(MxWriteParams) instead
    • Method Detail

      • from

        java.lang.String from()
        Gets the header sender form the "Fr" element.

        The From element is used for the identification of the sender, whether as a BIC, a name and address, a proprietary identification or a Uniform Resource Identifier (URI).

        Returns:
        the sender BIC code or null if the element is not found
      • to

        java.lang.String to()
        Gets the header receiver form the "To" element.

        The To element is used for identification of the receiver, whether as a BIC, a name and address, a proprietary identification or a Uniform Resource Identifier (URI).

        Returns:
        the receiver BIC code or null if the element is not found
      • reference

        java.lang.String reference()
        Gets the message reference from the "BizMsgIdr" (BAH) or "MsgRef" (AH) element.
        Returns:
        the message reference from the header or null if the element is not found
      • messageName

        java.lang.String messageName()
        Gets the message name from the "MsgDefIdr" (BAH) or "MsgName" (AH) element.
        Returns:
        the message name from the header or null if the element is not found
      • serviceName

        java.lang.String serviceName()
        Gets the service name from the "BizSvc" (BAH) or "SvcName" (AH) element.
        Returns:
        the service name from the header or null if the element is not found
      • duplicate

        boolean duplicate()
        Gets the duplicate flag from the "PssblDplct" (BAH) or "Dup" (AH) element
        Returns:
        true if the element is present, false otherwise
      • creationDate

        java.time.OffsetDateTime creationDate()
        Gets the message creation date from the "CreDate" (BAH) or "CrDate" (AH) element.
        Returns:
        found date or null if the element is not found
      • setCreationDate

        void setCreationDate​(boolean overwrite)
        Sets the creation date in the header object with current moment in UTC time zone.
        Parameters:
        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
      • xml

        default java.lang.String xml()
        Get this header as an XML string.

        The implementation uses xml(MxWriteParams) with no prefix and no XML declaration.

        Returns:
        header serialized into XML string or null in case of unexpected error
      • xml

        @Deprecated
        @ProwideDeprecated(phase3=SRU2024)
        java.lang.String xml​(java.lang.String prefix,
                             boolean includeXMLDeclaration)
        Deprecated.
        use xml(MxWriteParams) instead
      • xml

        @Deprecated
        @ProwideDeprecated(phase3=SRU2024)
        default java.lang.String xml​(java.lang.String prefix,
                                     boolean includeXMLDeclaration,
                                     EscapeHandler escapeHandler)
        Deprecated.
        use xml(MxWriteParams) instead
      • xml

        default java.lang.String xml​(MxWriteParams params)
        Get this header as an XML string.
        Parameters:
        params - not null marshalling parameters
        Returns:
        header serialized into XML string or null in case of unexpected error
        Since:
        9.2.6
      • element

        org.w3c.dom.Element element()
        Gets the header as an Element object.
      • namespace

        default java.lang.String namespace()
        Gets the specific namespace of the header
        Returns:
        default implementation returns null
        Since:
        9.1.7