Package com.helger.phase4.servlet
Class AS4MessageState
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<KEYTYPE,VALUETYPE>
- All Implemented Interfaces:
com.helger.commons.collection.attr.IAttributeContainer<String,,Object> com.helger.commons.collection.attr.IAttributeContainerAny<String>,com.helger.commons.collection.impl.ICommonsMap<String,,Object> com.helger.commons.collection.impl.ICommonsOrderedMap<String,,Object> com.helger.commons.lang.ICloneable<com.helger.commons.collection.impl.ICommonsMap<String,,Object>> com.helger.commons.traits.IGetterByKeyTrait<String>,IAS4MessageState,Serializable,Cloneable,Map<String,Object>
@NotThreadSafe
public final class AS4MessageState
extends com.helger.commons.collection.attr.AttributeContainerAny<String>
implements IAS4MessageState
This class keeps track of the status of an incoming message. It is basically
a String to any map.
Keys starting with
Instances of this object are only modified in the SOAP header handlers.
Keys starting with
phase4. are reserved for internal use.Instances of this object are only modified in the SOAP header handlers.
- Author:
- Philip Helger
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> Nested classes/interfaces inherited from interface com.helger.commons.collection.attr.IAttributeContainer
com.helger.commons.collection.attr.IAttributeContainer.IAfterSetValueCallback<KEYTYPE extends Object,VALUETYPE extends Object>, com.helger.commons.collection.attr.IAttributeContainer.IBeforeSetValueCallback<KEYTYPE extends Object, VALUETYPE extends Object> -
Constructor Summary
ConstructorsConstructorDescriptionAS4MessageState(ESoapVersion eSoapVersion, AS4ResourceHelper aResHelper, Locale aLocale) -
Method Summary
Modifier and TypeMethodDescriptionbooleancom.helger.commons.collection.impl.ICommonsMap<String,EAS4CompressionMode> com.helger.commons.collection.impl.ICommonsList<WSS4JAttachment>intcom.helger.commons.datetime.XMLOffsetDateTimegetMPC()com.helger.commons.collection.impl.ICommonsList<WSS4JAttachment>getPMode()intinthashCode()booleanbooleanbooleanbooleanbooleanvoidsetAS4Profile(IAS4Profile aProfile) Set the AS4 profile of the message.voidsetCompressedAttachmentIDs(com.helger.commons.collection.impl.ICommonsMap<String, EAS4CompressionMode> aIDs) voidsetDecryptedAttachments(com.helger.commons.collection.impl.ICommonsList<WSS4JAttachment> aAttachments) voidsetDecryptedSoapDocument(Document aDocument) voidsetEffectivePModeLeg(int nLegNumber, PModeLeg aEffectiveLeg) voidsetInitiatorID(String sInitiatorID) voidsetMessageID(String sMessageID) Set the AS4 message ID of the current message.voidsetMessageTimestamp(com.helger.commons.datetime.XMLOffsetDateTime aMessageTimestamp) Set the AS4 message timestamp of the current message.voidsetMessaging(Ebms3Messaging aMessaging) voidvoidsetOriginalAttachments(com.helger.commons.collection.impl.ICommonsList<WSS4JAttachment> aAttachments) voidsetOriginalSoapDocument(Document aDocument) voidsetPingMessage(boolean bIsPingMessage) voidSet the PMode to be used.voidsetRefToMessageID(String sRefMessageID) Set the AS4 "reference to message ID" from the current message.voidsetResponderID(String sResponderID) voidsetSoapBodyPayloadNode(Node aPayloadNode) voidsetSoapBodyPayloadPresent(boolean bHasSoapBodyPayload) voidsetSoapHeaderElementProcessingSuccessful(boolean bSuccess) voidsetSoapWSS4JException(Exception aException) voidsetSoapWSS4JSecurityActions(int nSecurityActions) voidMethods inherited from class com.helger.commons.collection.attr.AttributeContainerAny
getCloneMethods inherited from class com.helger.commons.collection.attr.AttributeContainer
afterSetValueCallbacks, beforeSetValueCallbacks, toStringMethods inherited from class com.helger.commons.collection.impl.CommonsLinkedHashMap
createInstanceMethods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.phase4.servlet.IAS4MessageState
containsCompressedAttachmentID, getAttachmentCompressionMode, getEbmsError, getEbmsPullRequest, getEbmsReceipt, getEbmsSignalMessage, getEbmsUserMessage, getProfileID, hasCompressedAttachmentIDs, hasDecryptedAttachments, hasDecryptedSoapDocument, hasInitiatorID, hasMPC, hasOriginalAttachments, hasOriginalSoapDocument, hasResponderID, hasSoapWSS4JException, hasUsedCertificateMethods inherited from interface com.helger.commons.collection.attr.IAttributeContainer
afterSetValueCallbacks, beforeSetValueCallbacks, getAsBoolean, getAsDouble, getAsFloat, getAsInt, getAsLong, getValue, putAllIn, putInMethods inherited from interface com.helger.commons.collection.attr.IAttributeContainerAny
getAndSetFlag, putIn, putIn, putIn, putIn, putIn, putInMethods inherited from interface com.helger.commons.collection.impl.ICommonsMap
addAll, containsAnyEntry, containsAnyKey, containsAnyValue, copyOfValues, copyOfValues, copyOfValuesMapped, copyOfValuesMapped, findFirstEntry, findFirstKey, findFirstValue, forEach, forEachKey, forEachKey, forEachValue, forEachValue, getAsUnmodifiable, getFirstEntry, getFirstEntry, getFirstKey, getFirstKey, getFirstValue, getFirstValue, getSortedByKey, getSortedByValue, getSwappedKeyValues, isNotEmpty, put, putAll, putAll, putAllMapped, putAllMapped, putAllMapped, putIf, putIfNotNull, removeAll, removeIf, removeIfKey, removeIfValue, removeObject, setAllMethods inherited from interface com.helger.commons.collection.impl.ICommonsOrderedMap
copyOfEntrySet, copyOfKeySet, copyOfKeySet, getLastKey, getLastKey, getLastValue, getLastValueMethods inherited from interface com.helger.commons.traits.IGetterByKeyTrait
containsNonNullValue, containsNullValue, getAsBigDecimal, getAsBigDecimal, getAsBigInteger, getAsBigInteger, getAsBoolean, getAsBooleanObj, getAsByte, getAsByte, getAsByteArray, getAsByteObj, getAsChar, getAsChar, getAsCharArray, getAsCharArray, getAsCharObj, getAsDouble, getAsDoubleObj, getAsFloat, getAsFloatObj, getAsInt, getAsIntObj, getAsLocalDate, getAsLocalDate, getAsLocalDate, getAsLocalDateTime, getAsLocalDateTime, getAsLocalDateTime, getAsLocalTime, getAsLocalTime, getAsLocalTime, getAsLong, getAsLongObj, getAsShort, getAsShort, getAsShortObj, getAsSqlBlob, getAsSqlClob, getAsSqlDate, getAsSqlNClob, getAsSqlRowId, getAsSqlTime, getAsSqlTimestamp, getAsString, getAsString, getAsStringList, getAsStringList, getAsStringSet, getAsStringSet, getCastedValue, getCastedValue, getCastedValue, getCastedValue, getConvertedValue, getConvertedValue, getSafeCastedValue, getSafeCastedValue, getValueClass, hasStringValue, hasStringValue, onSafeCastErrorMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Constructor Details
-
AS4MessageState
public AS4MessageState(@Nonnull ESoapVersion eSoapVersion, @Nonnull @WillNotClose AS4ResourceHelper aResHelper, @Nonnull Locale aLocale)
-
-
Method Details
-
getReceiptDT
- Specified by:
getReceiptDTin interfaceIAS4MessageState- Returns:
- Date and time when the receipt started. This must be set in the
implementation and never
null.
-
getSoapVersion
- Specified by:
getSoapVersionin interfaceIAS4MessageState- Returns:
- The SOAP version of the current request as specified in the
constructor. Never
null.
-
getResourceHelper
- Specified by:
getResourceHelperin interfaceIAS4MessageState- Returns:
- The resource manager as specified in the constructor. Never
null.
-
getLocale
- Specified by:
getLocalein interfaceIAS4MessageState- Returns:
- The request locale to use. Never
null.
-
getMessaging
- Specified by:
getMessagingin interfaceIAS4MessageState- Returns:
- The parent of the user message/signal message for further evaluation.
-
setMessaging
-
getPMode
- Specified by:
getPModein interfaceIAS4MessageState- Returns:
- the PMode that is used with the current message. May be
nullif none was found.
-
setPMode
Set the PMode to be used. Called only from Ebms3 header processor- Parameters:
aPMode- PMode Config. May benull.
-
getOriginalSoapDocument
- Specified by:
getOriginalSoapDocumentin interfaceIAS4MessageState- Returns:
- get the original SOAP document, only the entire document no attachment. This might by encrypted.
- See Also:
-
setOriginalSoapDocument
-
getOriginalAttachments
@Nullable public com.helger.commons.collection.impl.ICommonsList<WSS4JAttachment> getOriginalAttachments()- Specified by:
getOriginalAttachmentsin interfaceIAS4MessageState- Returns:
- has saved the original attachment, can be encrypted or not depends if encryption is used or not.
- See Also:
-
setOriginalAttachments
public void setOriginalAttachments(@Nullable com.helger.commons.collection.impl.ICommonsList<WSS4JAttachment> aAttachments) -
getDecryptedSoapDocument
- Specified by:
getDecryptedSoapDocumentin interfaceIAS4MessageState- Returns:
- get the decrypted SOAP document, only the entire document no attachment
- See Also:
-
setDecryptedSoapDocument
-
getDecryptedAttachments
@Nullable public com.helger.commons.collection.impl.ICommonsList<WSS4JAttachment> getDecryptedAttachments()- Specified by:
getDecryptedAttachmentsin interfaceIAS4MessageState- Returns:
- Getting decrypted attachment, if there were encrypted attachments
to begin with. May be
null. - See Also:
-
setDecryptedAttachments
public void setDecryptedAttachments(@Nullable com.helger.commons.collection.impl.ICommonsList<WSS4JAttachment> aAttachments) -
getCompressedAttachmentIDs
@Nullable public com.helger.commons.collection.impl.ICommonsMap<String,EAS4CompressionMode> getCompressedAttachmentIDs()- Specified by:
getCompressedAttachmentIDsin interfaceIAS4MessageState- Returns:
- IDs from all compressed attachments and/or payload. May be
null.
-
setCompressedAttachmentIDs
public void setCompressedAttachmentIDs(@Nullable com.helger.commons.collection.impl.ICommonsMap<String, EAS4CompressionMode> aIDs) -
getMPC
- Specified by:
getMPCin interfaceIAS4MessageState- Returns:
- the MPC that is used in the current message exchange. May be
null.
-
setMPC
-
isSoapBodyPayloadPresent
public boolean isSoapBodyPayloadPresent()- Specified by:
isSoapBodyPayloadPresentin interfaceIAS4MessageState- Returns:
trueif a payload in the soap body is present, elsefalse- See Also:
-
setSoapBodyPayloadPresent
public void setSoapBodyPayloadPresent(boolean bHasSoapBodyPayload) -
getInitiatorID
- Specified by:
getInitiatorIDin interfaceIAS4MessageState- Returns:
- initiator set in the usermessage if the incoming message is a
UserMessage. This is the content of the FromParty/PartyId element
and in Peppol reflects the C2. May be
null.
-
setInitiatorID
-
getResponderID
- Specified by:
getResponderIDin interfaceIAS4MessageState- Returns:
- responder set in the usermessage if the incoming message is a
UserMessage. This is the content of the ToParty/PartyId element and
in Peppol reflects the C3. May be
null.
-
setResponderID
-
getUsedCertificate
- Specified by:
getUsedCertificatein interfaceIAS4MessageState- Returns:
- The first provided certificate in the incoming message. Usually the
certificate that was used for signing. May be
null. - See Also:
-
setUsedCertificate
-
getEffectivePModeLeg
- Specified by:
getEffectivePModeLegin interfaceIAS4MessageState- Returns:
- The effective leg to use. May be leg 1 or leg 2 of the PMode. If no PMode was found, no PModeLeg is present.
- See Also:
-
getEffectivePModeLegNumber
- Specified by:
getEffectivePModeLegNumberin interfaceIAS4MessageState- Returns:
- 1 or 2, depending on the used leg. Any other value indicates "undefined". If no PMode was found, no PModeLeg is present.
- See Also:
-
setEffectivePModeLeg
-
getSoapWSS4JSecurityActions
public int getSoapWSS4JSecurityActions()- Specified by:
getSoapWSS4JSecurityActionsin interfaceIAS4MessageState- Returns:
- A bit set of the WSS4J security action tags found. 0 for nothing. See class org.apache.wss4j.dom.WSContants line 326ff for the constants.
-
setSoapWSS4JSecurityActions
public void setSoapWSS4JSecurityActions(int nSecurityActions) -
isSoapSignatureChecked
public boolean isSoapSignatureChecked()- Specified by:
isSoapSignatureCheckedin interfaceIAS4MessageState- Returns:
trueif the incoming message was signed and the signature was verified,falseotherwise.
-
isSoapDecrypted
public boolean isSoapDecrypted()- Specified by:
isSoapDecryptedin interfaceIAS4MessageState- Returns:
trueif the incoming message was decrypted,falseotherwise.
-
getSoapWSS4JException
- Specified by:
getSoapWSS4JExceptionin interfaceIAS4MessageState- Returns:
- An Exception that occurred during processing the incoming SOAP
WS-Security handler. If this is a
org.apache.wss4j.common.ext.WSSecurityExceptionexception something happened on the security level.
-
setSoapWSS4JException
-
getAS4Profile
- Specified by:
getAS4Profilein interfaceIAS4MessageState- Returns:
- The phase4 profile to be used. May be
nullin case it could not be determined.
-
setAS4Profile
Set the AS4 profile of the message.- Parameters:
aProfile- The internal AS4 profile. May benull.
-
getMessageID
- Specified by:
getMessageIDin interfaceIAS4MessageState- Returns:
- The AS4 message ID. Source is the
MessageInfoelement. May benull.
-
setMessageID
Set the AS4 message ID of the current message.- Parameters:
sMessageID- The ID to be set. May benull.
-
getRefToMessageID
- Specified by:
getRefToMessageIDin interfaceIAS4MessageState- Returns:
- The AS4 "reference to message ID". This value is optional in the
headers. Source is the
MessageInfoelement. May benull.
-
setRefToMessageID
Set the AS4 "reference to message ID" from the current message.- Parameters:
sRefMessageID- The ID to be set. May benull.- Since:
- 1.2.0
-
getMessageTimestamp
- Specified by:
getMessageTimestampin interfaceIAS4MessageState- Returns:
- The AS4 provided message timestamp. This value is mandatory in the
source
MessageInfoelement. May benull.
-
setMessageTimestamp
public void setMessageTimestamp(@Nullable com.helger.commons.datetime.XMLOffsetDateTime aMessageTimestamp) Set the AS4 message timestamp of the current message.- Parameters:
aMessageTimestamp- The timestamp to be set. May benull.- Since:
- 1.2.0
-
isPingMessage
public boolean isPingMessage()- Specified by:
isPingMessagein interfaceIAS4MessageState- Returns:
trueif the incoming message is an AS4 ping message,falseotherwise.
-
setPingMessage
public void setPingMessage(boolean bIsPingMessage) -
getSoapBodyPayloadNode
- Specified by:
getSoapBodyPayloadNodein interfaceIAS4MessageState- Returns:
- The child of the SOAP Body node or
null. That is always decrypted.
-
setSoapBodyPayloadNode
-
isSoapHeaderElementProcessingSuccessful
public boolean isSoapHeaderElementProcessingSuccessful()- Specified by:
isSoapHeaderElementProcessingSuccessfulin interfaceIAS4MessageState- Returns:
trueif SOAP header element processing was successful,falseif not. If not, than many other values are also not set and at least one error is in the error list.
-
setSoapHeaderElementProcessingSuccessful
public void setSoapHeaderElementProcessingSuccessful(boolean bSuccess) -
equals
-
hashCode
public int hashCode()
-