Class MessageHelperMethods

java.lang.Object
com.helger.phase4.model.message.MessageHelperMethods

@Immutable public final class MessageHelperMethods extends Object
This class contains every method, static variables which are used by more than one message creating classes in this package.
Author:
bayerlma, Philip Helger
  • Field Details

    • PART_PROPERTY_MIME_TYPE

      public static final String PART_PROPERTY_MIME_TYPE
      See Also:
    • PART_PROPERTY_CHARACTER_SET

      public static final String PART_PROPERTY_CHARACTER_SET
      See Also:
    • PART_PROPERTY_COMPRESSION_TYPE

      public static final String PART_PROPERTY_COMPRESSION_TYPE
      See Also:
    • PREFIX_CID

      public static final String PREFIX_CID
    • MESSAGE_ID_SUFFIX_REGEX

      @RegEx public static final String MESSAGE_ID_SUFFIX_REGEX
      The regular expression that any custom message ID suffix must follow.
      See Also:
  • Method Details

    • createRandomConversationID

      @Nonempty public static @NonNull @Nonempty String createRandomConversationID()
    • getCustomMessageIDSuffix

      public static @Nullable String getCustomMessageIDSuffix()
      Returns:
      The custom message ID suffix to be used. May be null.
      Since:
      1.1.1
    • setCustomMessageIDSuffix

      public static void setCustomMessageIDSuffix(@Nullable String sSuffix)
      Set a custom message ID suffix to be used in createRandomMessageID(). If a string is provided, any eventually present leading dot is cut. This
      Parameters:
      sSuffix - The suffix to be used. May be null. If present it must match the MESSAGE_ID_SUFFIX_REGEX regular expression.
      Since:
      1.1.1
    • createRandomMessageID

      @Nonempty public static @NonNull @Nonempty String createRandomMessageID()
      Create a new random AS4 Message ID. Every call results in a new unique message ID. The layout of a created message ID is like this: UUID@phase4[.customSuffix] where UUID is a random UID, "@phase4" is a constant, non-changeable value and customSuffix is the optional suffix to be set via setCustomMessageIDSuffix(String).
      Returns:
      A new random AS4 Message ID. Neither null nor empty.
    • createRandomContentID

      @Nonempty public static @NonNull @Nonempty String createRandomContentID()
      Returns:
      A random Content-ID that adheres to RFC 822. Neither null nor empty.
    • createRandomMessagingID

      @Nonempty public static @NonNull @Nonempty String createRandomMessagingID()
    • createRandomWSUID

      @Nonempty public static @NonNull @Nonempty String createRandomWSUID()
    • createEbms3MessageInfo

      public static @NonNull Ebms3MessageInfo createEbms3MessageInfo()
      Create a new message info with a UUID as message ID.
      Returns:
      Never null.
    • createEbms3MessageInfo

      public static @NonNull Ebms3MessageInfo createEbms3MessageInfo(@Nullable String sRefToMessageID)
      Create a new message info with a UUID as message ID and a reference to the previous message.
      Parameters:
      sRefToMessageID - The message ID of the referenced message. May be null.
      Returns:
      Never null.
    • createEbms3MessageInfo

      public static @NonNull Ebms3MessageInfo createEbms3MessageInfo(@Nonempty @NonNull @Nonempty String sMessageID, @Nullable String sRefToMessageID)
      Create a new message info.
      Parameters:
      sMessageID - The message ID. May neither be null nor empty.
      sRefToMessageID - to set the reference to the previous message needed for two way exchanges
      Returns:
      Never null.
    • createEbms3MessageInfo

      public static @NonNull Ebms3MessageInfo createEbms3MessageInfo(@Nonempty @NonNull @Nonempty String sMessageID, @Nullable String sRefToMessageID, @NonNull OffsetDateTime aDateTime)
      Create a new message info.
      Parameters:
      sMessageID - The message ID. May neither be null nor empty.
      sRefToMessageID - to set the reference to the previous message needed for two way exchanges
      aDateTime - Date and time. May not be null.
      Returns:
      Never null.
      Since:
      0.12.0
    • createEbms3Description

      @ReturnsMutableCopy public static @NonNull Ebms3Description createEbms3Description(@NonNull Locale aLocale, @NonNull String sText)
    • createEbms3Property

      public static @NonNull Ebms3Property createEbms3Property(@Nonempty @NonNull @Nonempty String sName, @NonNull String sValue)
    • createEbms3Property

      public static @NonNull Ebms3Property createEbms3Property(@Nonempty @NonNull @Nonempty String sName, @Nullable String sType, @NonNull String sValue)
    • createEbms3PartyId

      public static @NonNull Ebms3PartyId createEbms3PartyId(@Nonempty @NonNull @Nonempty String sValue)
    • createEbms3PartyId

      public static @NonNull Ebms3PartyId createEbms3PartyId(@Nullable String sType, @Nonempty @NonNull @Nonempty String sValue)
    • createEbms3ReversePartyInfo

      public static @NonNull Ebms3PartyInfo createEbms3ReversePartyInfo(@NonNull Ebms3PartyInfo aOrigPartyInfo)
    • createEbms3PartyInfo

      public static @NonNull Ebms3PartyInfo createEbms3PartyInfo(@Nonempty @NonNull @Nonempty String sFromRole, @Nonempty @NonNull @Nonempty String sFromPartyID, @Nonempty @NonNull @Nonempty String sToRole, @Nonempty @NonNull @Nonempty String sToPartyID)
    • createEbms3PartyInfo

      public static @NonNull Ebms3PartyInfo createEbms3PartyInfo(@Nonempty @NonNull @Nonempty String sFromRole, @Nullable String sFromPartyIDType, @Nonempty @NonNull @Nonempty String sFromPartyID, @Nonempty @NonNull @Nonempty String sToRole, @Nullable String sToPartyIDType, @Nonempty @NonNull @Nonempty String sToPartyID)
    • createEbms3MessageProperties

      public static @Nullable Ebms3MessageProperties createEbms3MessageProperties(@Nullable Ebms3Property... aEbms3Properties)
    • createEbms3MessageProperties

      public static @Nullable Ebms3MessageProperties createEbms3MessageProperties(@Nullable List<Ebms3Property> aEbms3Properties)
    • createEbms3CollaborationInfo

      public static @NonNull Ebms3CollaborationInfo createEbms3CollaborationInfo(@Nullable String sAgreementRefPMode, @Nullable String sAgreementRefValue, @Nullable String sAgreementTypeValue, @Nullable String sServiceType, @Nonempty @NonNull @Nonempty String sServiceValue, @Nonempty @NonNull @Nonempty String sAction, @NonNull String sConversationID)
    • createEbms3PartInfo

      public static @Nullable Ebms3PartInfo createEbms3PartInfo(@Nullable IAS4Attachment aAttachment)
    • createEbms3PayloadInfo

      public static @Nullable Ebms3PayloadInfo createEbms3PayloadInfo(boolean bHasSoapPayload, @Nullable com.helger.collection.commons.ICommonsList<? extends IAS4Attachment> aAttachments)
      Add payload info if attachments are present.
      Parameters:
      bHasSoapPayload - true if SOAP payload is present. This must be false when using MIME message layout!
      aAttachments - Used attachments
      Returns:
      null if no attachments are present.
    • getAllDSigReferenceNodes

      @ReturnsMutableCopy public static @NonNull com.helger.collection.commons.ICommonsList<Node> getAllDSigReferenceNodes(@Nullable Node aSoapDocument)
      Extract all "ds:Reference" nodes from the passed SOAP document. This method search ins "{soapDocument}/Envelop/Header/Security/Signature/SignedInfo".
      Note: use new DSigReferenceMarshaller ().read (aRef) to read the content.
      Parameters:
      aSoapDocument - The SOAP document to search in. May be null.
      Returns:
      A non-null but maybe empty list of Reference nodes.
      See Also:
    • getAllDSigReferences

      @ReturnsMutableCopy public static @NonNull com.helger.collection.commons.ICommonsList<com.helger.xsds.xmldsig.ReferenceType> getAllDSigReferences(@Nullable Node aSoapDocument)
      This is the typed version of getAllDSigReferenceNodes(Node)
      Parameters:
      aSoapDocument - The SOAP document to search in. May be null.
      Returns:
      A non-null but maybe empty list of ReferenceType object.