Class MessageHelperMethods
java.lang.Object
com.helger.phase4.messaging.domain.MessageHelperMethods
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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Ebms3CollaborationInfocreateEbms3CollaborationInfo(String sAgreementRefPMode, String sAgreementRefValue, String sServiceType, String sServiceValue, String sAction, String sConversationID) static Ebms3DescriptioncreateEbms3Description(Locale aLocale, String sText) static Ebms3MessageInfoCreate a new message info with a UUID as message ID.static Ebms3MessageInfocreateEbms3MessageInfo(String sRefToMessageID) Create a new message info with a UUID as message ID and a reference to the previous message.static Ebms3MessageInfocreateEbms3MessageInfo(String sMessageID, String sRefToMessageID) Create a new message info.static Ebms3MessageInfocreateEbms3MessageInfo(String sMessageID, String sRefToMessageID, OffsetDateTime aDateTime) Create a new message info.static Ebms3MessagePropertiescreateEbms3MessageProperties(List<Ebms3Property> aEbms3Properties) static Ebms3PartInfocreateEbms3PartInfo(IAS4Attachment aAttachment) static Ebms3PartyIdcreateEbms3PartyId(String sValue) static Ebms3PartyIdcreateEbms3PartyId(String sType, String sValue) static Ebms3PartyInfocreateEbms3PartyInfo(String sFromRole, String sFromPartyID, String sToRole, String sToPartyID) static Ebms3PartyInfocreateEbms3PartyInfo(String sFromRole, String sFromPartyIDType, String sFromPartyID, String sToRole, String sToPartyIDType, String sToPartyID) static Ebms3PayloadInfocreateEbms3PayloadInfo(boolean bHasSoapPayload, com.helger.commons.collection.impl.ICommonsList<? extends IAS4Attachment> aAttachments) Add payload info if attachments are present.static Ebms3PropertycreateEbms3Property(String sName, String sValue) static Ebms3PropertycreateEbms3Property(String sName, String sType, String sValue) static Ebms3PartyInfocreateEbms3ReversePartyInfo(Ebms3PartyInfo aOrigPartyInfo) static Stringstatic Stringstatic StringCreate a new random AS4 Message ID.static Stringstatic Stringstatic voidforEachHeaderAndRemoveAfterwards(jakarta.mail.internet.MimeMessage aMimeMsg, BiConsumer<String, String> aConsumer, boolean bUnifyValues) Take all headers from the MIME message and pass them to the provided consumer.static com.helger.commons.http.HttpHeaderMapgetAndRemoveAllHeaders(jakarta.mail.internet.MimeMessage aMimeMsg) static Stringstatic voidsetCustomMessageIDSuffix(String sSuffix) Set a custom message ID suffix to be used increateRandomMessageID().
-
Field Details
-
PART_PROPERTY_MIME_TYPE
- See Also:
-
PART_PROPERTY_CHARACTER_SET
- See Also:
-
PART_PROPERTY_COMPRESSION_TYPE
- See Also:
-
PREFIX_CID
-
MESSAGE_ID_SUFFIX_REGEX
The regular expression that any custom message ID suffix must follow.- See Also:
-
-
Method Details
-
createRandomConversationID
-
getCustomMessageIDSuffix
- Returns:
- The custom message ID suffix to be used. May be
null. - Since:
- 1.1.1
-
setCustomMessageIDSuffix
Set a custom message ID suffix to be used increateRandomMessageID(). If a string is provided, any eventually present leading dot is cut. This- Parameters:
sSuffix- The suffix to be used. May benull. If present it must match theMESSAGE_ID_SUFFIX_REGEXregular expression.- Since:
- 1.1.1
-
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]whereUUIDis a random UID, "@phase4" is a constant, non-changeable value andcustomSuffixis the optional suffix to be set viasetCustomMessageIDSuffix(String).- Returns:
- A new random AS4 Message ID. Neither
nullnor empty.
-
createRandomContentID
- Returns:
- A random Content-ID that adheres to RFC 822. Neither
nullnor empty.
-
createRandomMessagingID
-
createRandomWSUID
-
createEbms3MessageInfo
Create a new message info with a UUID as message ID.- Returns:
- Never
null.
-
createEbms3MessageInfo
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 benull.- 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 benullnor 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 benullnor empty.sRefToMessageID- to set the reference to the previous message needed for two way exchangesaDateTime- Date and time. May not benull.- Returns:
- Never
null. - Since:
- 0.12.0
-
createEbms3Description
-
createEbms3Property
-
createEbms3Property
-
createEbms3PartyId
-
createEbms3PartyId
-
createEbms3ReversePartyInfo
@Nonnull public static Ebms3PartyInfo createEbms3ReversePartyInfo(@Nonnull Ebms3PartyInfo aOrigPartyInfo) -
createEbms3PartyInfo
-
createEbms3PartyInfo
-
createEbms3MessageProperties
@Nullable public static Ebms3MessageProperties createEbms3MessageProperties(@Nullable List<Ebms3Property> aEbms3Properties) -
createEbms3CollaborationInfo
-
createEbms3PartInfo
-
createEbms3PayloadInfo
@Nullable public static Ebms3PayloadInfo createEbms3PayloadInfo(boolean bHasSoapPayload, @Nullable com.helger.commons.collection.impl.ICommonsList<? extends IAS4Attachment> aAttachments) Add payload info if attachments are present.- Parameters:
bHasSoapPayload-trueif SOAP payload is present. This must befalsewhen using MIME message layout!aAttachments- Used attachments- Returns:
nullif no attachments are present.
-
forEachHeaderAndRemoveAfterwards
public static void forEachHeaderAndRemoveAfterwards(@Nonnull jakarta.mail.internet.MimeMessage aMimeMsg, @Nonnull BiConsumer<String, String> aConsumer, boolean bUnifyValues) throws jakarta.mail.MessagingExceptionTake all headers from the MIME message and pass them to the provided consumer. Afterwards remove all headers from the MIME message itself.- Parameters:
aMimeMsg- The message to use. May not benull.aConsumer- The consumer to be invoked. May not benull.bUnifyValues-trueto unify the HTTP header values before passing them to the consumer.- Throws:
jakarta.mail.MessagingException- In case of MIME message processing problems
-
getAndRemoveAllHeaders
@Nonnull @ReturnsMutableCopy public static com.helger.commons.http.HttpHeaderMap getAndRemoveAllHeaders(@Nonnull jakarta.mail.internet.MimeMessage aMimeMsg) throws jakarta.mail.MessagingException - Throws:
jakarta.mail.MessagingException
-