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

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

      @Nullable public static 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

      @Nonnull @Nonempty public static 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

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

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

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

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

      @Nonnull public static 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

      @Nonnull public static Ebms3MessageInfo createEbms3MessageInfo(@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

      @Nonnull public static Ebms3MessageInfo createEbms3MessageInfo(@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

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

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

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

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

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

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

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

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

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

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

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

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

      @Nullable public static 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

      @Nonnull @ReturnsMutableCopy public static 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

      @Nonnull @ReturnsMutableCopy public static 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.