Search in sources :

Example 1 with MessageProperty

use of com.helger.phase4.model.MessageProperty in project phase4 by phax.

the class AbstractAS4UserMessageBuilder method applyToUserMessage.

/**
 * This method applies all builder parameters onto the user message, except
 * the attachments.
 *
 * @param aUserMsg
 *        The user message the parameters should be applied to. May not be
 *        <code>null</code>.
 */
@OverridingMethodsMustInvokeSuper
protected void applyToUserMessage(@Nonnull final AS4ClientUserMessage aUserMsg) {
    if (m_aHttpRetrySettings != null)
        aUserMsg.httpRetrySettings().assignFrom(m_aHttpRetrySettings);
    aUserMsg.getHttpPoster().setHttpClientFactory(m_aHttpClientFactory);
    // Otherwise Oxalis dies
    aUserMsg.getHttpPoster().setQuoteHttpHeaders(false);
    aUserMsg.setSoapVersion(m_eSoapVersion);
    aUserMsg.setSendingDateTimeOrNow(m_aSendingDateTime);
    // Set the keystore/truststore parameters
    aUserMsg.setAS4CryptoFactory(m_aCryptoFactory);
    aUserMsg.setPMode(m_aPMode, true);
    // Set after PMode
    if (m_aReceiverCertificate != null)
        aUserMsg.cryptParams().setCertificate(m_aReceiverCertificate);
    aUserMsg.setAgreementRefValue(m_sAgreementRef);
    if (StringHelper.hasText(m_sPModeID))
        aUserMsg.setPModeID(m_sPModeID);
    else
        aUserMsg.setPModeIDFactory(x -> null);
    aUserMsg.setServiceType(m_sServiceType);
    aUserMsg.setServiceValue(m_sService);
    aUserMsg.setAction(m_sAction);
    if (StringHelper.hasText(m_sMessageID))
        aUserMsg.setMessageID(m_sMessageID);
    if (StringHelper.hasText(m_sRefToMessageID))
        aUserMsg.setRefToMessageID(m_sRefToMessageID);
    // Empty conversation ID is okay
    aUserMsg.setConversationID(m_sConversationID != null ? m_sConversationID : MessageHelperMethods.createRandomConversationID());
    aUserMsg.setFromPartyIDType(m_sFromPartyIDType);
    aUserMsg.setFromPartyID(m_sFromPartyID);
    aUserMsg.setFromRole(m_sFromRole);
    aUserMsg.setToPartyIDType(m_sToPartyIDType);
    aUserMsg.setToPartyID(m_sToPartyID);
    aUserMsg.setToRole(m_sToRole);
    for (final MessageProperty aItem : m_aMessageProperties) aUserMsg.ebms3Properties().add(aItem.getAsEbms3Property());
}
Also used : X509Certificate(java.security.cert.X509Certificate) Ebms3SignalMessage(com.helger.phase4.ebms3header.Ebms3SignalMessage) MessageHelperMethods(com.helger.phase4.messaging.domain.MessageHelperMethods) IAS4SignalMessageConsumer(com.helger.phase4.client.IAS4SignalMessageConsumer) LoggerFactory(org.slf4j.LoggerFactory) Nonempty(com.helger.commons.annotation.Nonempty) IHasID(com.helger.commons.id.IHasID) EnumHelper(com.helger.commons.lang.EnumHelper) Nonnull(javax.annotation.Nonnull) Phase4Exception(com.helger.phase4.util.Phase4Exception) Nullable(javax.annotation.Nullable) Ebms3Property(com.helger.phase4.ebms3header.Ebms3Property) OverridingMethodsMustInvokeSuper(javax.annotation.OverridingMethodsMustInvokeSuper) Logger(org.slf4j.Logger) CommonsArrayList(com.helger.commons.collection.impl.CommonsArrayList) IPMode(com.helger.phase4.model.pmode.IPMode) StringHelper(com.helger.commons.string.StringHelper) ISuccessIndicator(com.helger.commons.state.ISuccessIndicator) Consumer(java.util.function.Consumer) MessageProperty(com.helger.phase4.model.MessageProperty) ICommonsList(com.helger.commons.collection.impl.ICommonsList) Wrapper(com.helger.commons.wrapper.Wrapper) Phase4OutgoingAttachment(com.helger.phase4.attachment.Phase4OutgoingAttachment) AS4ClientUserMessage(com.helger.phase4.client.AS4ClientUserMessage) NotThreadSafe(javax.annotation.concurrent.NotThreadSafe) MessageProperty(com.helger.phase4.model.MessageProperty) OverridingMethodsMustInvokeSuper(javax.annotation.OverridingMethodsMustInvokeSuper)

Aggregations

Nonempty (com.helger.commons.annotation.Nonempty)1 CommonsArrayList (com.helger.commons.collection.impl.CommonsArrayList)1 ICommonsList (com.helger.commons.collection.impl.ICommonsList)1 IHasID (com.helger.commons.id.IHasID)1 EnumHelper (com.helger.commons.lang.EnumHelper)1 ISuccessIndicator (com.helger.commons.state.ISuccessIndicator)1 StringHelper (com.helger.commons.string.StringHelper)1 Wrapper (com.helger.commons.wrapper.Wrapper)1 Phase4OutgoingAttachment (com.helger.phase4.attachment.Phase4OutgoingAttachment)1 AS4ClientUserMessage (com.helger.phase4.client.AS4ClientUserMessage)1 IAS4SignalMessageConsumer (com.helger.phase4.client.IAS4SignalMessageConsumer)1 Ebms3Property (com.helger.phase4.ebms3header.Ebms3Property)1 Ebms3SignalMessage (com.helger.phase4.ebms3header.Ebms3SignalMessage)1 MessageHelperMethods (com.helger.phase4.messaging.domain.MessageHelperMethods)1 MessageProperty (com.helger.phase4.model.MessageProperty)1 IPMode (com.helger.phase4.model.pmode.IPMode)1 Phase4Exception (com.helger.phase4.util.Phase4Exception)1 X509Certificate (java.security.cert.X509Certificate)1 Consumer (java.util.function.Consumer)1 Nonnull (javax.annotation.Nonnull)1