Package com.helger.as2lib.partner
Class Partnership
java.lang.Object
com.helger.as2lib.partner.Partnership
- All Implemented Interfaces:
Serializable
This class represents a single partnership. It has a unique name, a set of
sender and receiver specific attributes (like AS2 ID, Email and key alias)
and a set of generic attributes that are interpreted depending on the
context.
- Author:
- Philip Helger
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAllAttributes
(Map<String, String> aAttributes) Add all provided attributes. existing attributes are not altered.void
addReceiverIDs
(Map<String, String> aMap) Add all receiver IDs provided in the passed map.void
addSenderIDs
(Map<String, String> aMap) Add all sender IDs provided in the passed map.protected boolean
compareIDs
(com.helger.commons.collection.attr.IStringMap aIDs, com.helger.commons.collection.attr.IStringMap aCompareTo) Check if all values from the left side are also present on the right side.boolean
boolean
boolean
containsReceiverID
(String sKey) Check if an arbitrary receiver ID is present.boolean
boolean
boolean
boolean
containsSenderID
(String sKey) Check if an arbitrary sender ID is present.boolean
void
copyFrom
(Partnership aPartnership) Set all fields of this partnership with the data from the provided partnership.static Partnership
com.helger.commons.collection.attr.IStringMap
com.helger.commons.collection.attr.IStringMap
com.helger.commons.collection.attr.IStringMap
getAttribute
(String sKey) Get the value associated with the given attribute name.getAttribute
(String sKey, String sDefault) Get the value associated with the given attribute name or the default values.getContentTransferEncodingReceive
(String sDefault) Get the Content-Transfer-Encoding for receiving messages.getContentTransferEncodingSend
(String sDefault) Get the Content-Transfer-Encoding for sending messages.getDateFormat
(String sDefault) com.helger.commons.state.ETriState
getMessageIDFormat
(String sDefault) final String
getName()
getReceiverID
(String sKey) Get the value of an arbitrary receiver IDgetSenderID
(String sKey) Get the value of an arbitrary sender IDcom.helger.commons.state.ETriState
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
matches
(Partnership aPartnership) Check if sender and receiver IDs of this partnership match the ones of the provided partnership.com.helger.commons.state.EChange
setAS2MDNOptions
(String sValue) Set the MDN options corresponding to theDisposition-Notification-Options
header.com.helger.commons.state.EChange
setAS2MDNTo
(String sValue) Set the URL to send the MDN to.com.helger.commons.state.EChange
setAS2ReceiptDeliveryOption
(String sValue) Set the return URL for async MDNs when sending messages.com.helger.commons.state.EChange
com.helger.commons.state.EChange
setAttribute
(String sKey, String sValue) Set an arbitrary partnership attribute.com.helger.commons.state.EChange
setBlockErrorMDN
(boolean bBlock) com.helger.commons.state.EChange
setCompressionMode
(String sValue) com.helger.commons.state.EChange
com.helger.commons.state.EChange
com.helger.commons.state.EChange
setCompressionType
(ECompressionType eValue) com.helger.commons.state.EChange
setCompressionType
(String sValue) com.helger.commons.state.EChange
setContentTransferEncodingReceive
(com.helger.mail.cte.EContentTransferEncoding eCTE) Set the Content-Transfer-Encoding for receiving messages.com.helger.commons.state.EChange
Set the Content-Transfer-Encoding for receiving messages.com.helger.commons.state.EChange
setContentTransferEncodingSend
(com.helger.mail.cte.EContentTransferEncoding eCTE) Set the Content-Transfer-Encoding for sending messages.com.helger.commons.state.EChange
setContentTransferEncodingSend
(String sValue) Set the Content-Transfer-Encoding for sending messages.com.helger.commons.state.EChange
setDateFormat
(String sValue) com.helger.commons.state.EChange
setDisableDecompress
(boolean bValue) com.helger.commons.state.EChange
setDisableDecrypt
(boolean bValue) com.helger.commons.state.EChange
setDisableVerify
(boolean bValue) com.helger.commons.state.EChange
com.helger.commons.state.EChange
setEncryptAlgorithm
(String sValue) com.helger.commons.state.EChange
setForceDecrypt
(boolean bValue) com.helger.commons.state.EChange
setForceVerify
(boolean bValue) com.helger.commons.state.EChange
setIncludeCertificateInSignedContent
(com.helger.commons.state.ETriState eValue) com.helger.commons.state.EChange
setMDNSubject
(String sValue) com.helger.commons.state.EChange
setMessageIDFormat
(String sValue) final void
com.helger.commons.state.EChange
setProtocol
(String sValue) void
setReceiverAS2ID
(String sValue) Set the receivers AS2 ID.void
setReceiverEmail
(String sValue) Set the receivers email address.void
setReceiverID
(String sKey, String sValue) Set an arbitrary receiver ID.void
setReceiverX509Alias
(String sValue) Set the receivers X509 alias.com.helger.commons.state.EChange
setRemoveCmsAlgorithmProtect
(boolean bValue) Enable or disable the removal of the CMS attribute "AlgorithmProtect".com.helger.commons.state.EChange
setRFC3851MICAlgs
(boolean bValue) Enable or disable the usage of the old RFC 3851 MIC algorithm names.void
setSenderAS2ID
(String sValue) Set the senders AS2 ID.void
setSenderEmail
(String sValue) Set the senders email address.void
setSenderID
(String sKey, String sValue) Set an arbitrary sender ID.void
setSenderX509Alias
(String sValue) Set the senders X509 alias.com.helger.commons.state.EChange
com.helger.commons.state.EChange
setSigningAlgorithm
(String sValue) com.helger.commons.state.EChange
setSubject
(String sValue) com.helger.commons.state.EChange
setVerifyUseCertificateInBodyPart
(com.helger.commons.state.ETriState eValue) toString()
-
Field Details
-
DEFAULT_NAME
- See Also:
-
-
Constructor Details
-
Partnership
-
-
Method Details
-
getName
- Returns:
- The partnership name. Never
null
.
-
setName
-
setSenderID
Set an arbitrary sender ID.- Parameters:
sKey
- The name of the ID. May not benull
.sValue
- The value to be set. It may benull
in which case the attribute is removed.
-
setSenderAS2ID
Set the senders AS2 ID.- Parameters:
sValue
- The value to be set. May benull
.- See Also:
-
setSenderX509Alias
Set the senders X509 alias.- Parameters:
sValue
- The value to be set. May benull
.- See Also:
-
setSenderEmail
Set the senders email address.- Parameters:
sValue
- The value to be set. May benull
.- See Also:
-
addSenderIDs
Add all sender IDs provided in the passed map. Existing sender IDs are not altered.- Parameters:
aMap
- The map to use. May benull
.
-
getSenderID
Get the value of an arbitrary sender ID- Parameters:
sKey
- The name of the ID to query. May benull
.- Returns:
- The contained value if the name is not
null
and contained in the sender IDs.
-
getSenderAS2ID
- Returns:
- the sender's AS2 ID or
null
if it is not set - See Also:
-
getSenderX509Alias
- Returns:
- the sender's X509 alias or
null
if it is not set - See Also:
-
getSenderEmail
- Returns:
- the sender's email address or
null
if it is not set. - See Also:
-
containsSenderID
Check if an arbitrary sender ID is present.- Parameters:
sKey
- The name of the ID to query. May benull
.- Returns:
true
if the name is notnull
and contained in the sender IDs.
-
containsSenderAS2ID
public boolean containsSenderAS2ID()- Returns:
true
if the sender's AS2 ID is present,false
otherwise.- See Also:
-
containsSenderX509Alias
public boolean containsSenderX509Alias()- Returns:
true
if the sender's X509 alias is present,false
otherwise.- See Also:
-
containsSenderEmail
public boolean containsSenderEmail()- Returns:
true
if the sender's email address is present,false
otherwise.- See Also:
-
getAllSenderIDs
- Returns:
- All sender IDs. Never
null
.
-
setReceiverID
Set an arbitrary receiver ID.- Parameters:
sKey
- The name of the ID. May not benull
.sValue
- The value to be set. It may benull
in which case the attribute is removed.
-
setReceiverAS2ID
Set the receivers AS2 ID.- Parameters:
sValue
- The value to be set. May benull
.- See Also:
-
setReceiverX509Alias
Set the receivers X509 alias.- Parameters:
sValue
- The value to be set. May benull
.- See Also:
-
setReceiverEmail
Set the receivers email address.- Parameters:
sValue
- The value to be set. May benull
.- See Also:
-
addReceiverIDs
Add all receiver IDs provided in the passed map. Existing receiver IDs are not altered.- Parameters:
aMap
- The map to use. May benull
.
-
getReceiverID
Get the value of an arbitrary receiver ID- Parameters:
sKey
- The name of the ID to query. May benull
.- Returns:
- The contained value if the name is not
null
and contained in the receiver IDs.
-
getReceiverAS2ID
- Returns:
- the receiver's AS2 ID or
null
if it is not set - See Also:
-
getReceiverX509Alias
- Returns:
- the receiver's X509 alias or
null
if it is not set - See Also:
-
getReceiverEmail
- Returns:
- the receiver's email address or
null
if it is not set. - See Also:
-
containsReceiverID
Check if an arbitrary receiver ID is present.- Parameters:
sKey
- The name of the ID to query. May benull
.- Returns:
true
if the name is notnull
and contained in the receiver IDs.
-
containsReceiverAS2ID
public boolean containsReceiverAS2ID()- Returns:
true
if the receiver's AS2 ID is present,false
otherwise.- See Also:
-
containsReceiverX509Alias
public boolean containsReceiverX509Alias()- Returns:
true
if the receiver's X509 alias is present,false
otherwise.- See Also:
-
containsReceiverEmail
public boolean containsReceiverEmail()- Returns:
true
if the receiver's email address is present,false
otherwise.- See Also:
-
getAllReceiverIDs
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.attr.IStringMap getAllReceiverIDs()- Returns:
- All receiver IDs. Never
null
.
-
setAttribute
@Nonnull public com.helger.commons.state.EChange setAttribute(@Nonnull String sKey, @Nullable String sValue) Set an arbitrary partnership attribute.- Parameters:
sKey
- The key to be used. May not benull
.sValue
- The value to be used. Ifnull
an existing attribute with the provided name will be removed.- Returns:
EChange.CHANGED
if something changed. Nevernull
.
-
getAttribute
Get the value associated with the given attribute name.- Parameters:
sKey
- Attribute name to search. May benull
.- Returns:
null
if the attribute name wasnull
or if no such attribute is contained.- See Also:
-
getAttribute
Get the value associated with the given attribute name or the default values.- Parameters:
sKey
- Attribute name to search. May benull
.sDefault
- Default value to be returned if no such attribute is present.- Returns:
- The provided default value if the attribute name was
null
or if no such attribute is contained. - See Also:
-
getAS2URL
-
setAS2URL
-
getAS2MDNTo
- Returns:
- The URL to send the MDN to. May be
null
. - See Also:
-
setAS2MDNTo
Set the URL to send the MDN to. For async MDN also callsetAS2ReceiptDeliveryOption(String)
.- Parameters:
sValue
- The async MDN URL. May benull
.- Returns:
EChange
.- See Also:
-
getAS2MDNOptions
- Returns:
- The MDN options corresponding to the
Disposition-Notification-Options
header. May benull
.
-
setAS2MDNOptions
Set the MDN options corresponding to theDisposition-Notification-Options
header.- Parameters:
sValue
- The value to be set. May benull
.- Returns:
EChange
-
getAS2ReceiptDeliveryOption
- Returns:
- The return URL for async MDN when sending messages. May be
null
. - Since:
- 3.0.4
- See Also:
-
setAS2ReceiptDeliveryOption
@Nonnull public com.helger.commons.state.EChange setAS2ReceiptDeliveryOption(@Nullable String sValue) Set the return URL for async MDNs when sending messages. When setting it, also setsetAS2MDNTo(String)
.- Parameters:
sValue
- The async MDN url. May benull
.- Returns:
EChange
- Since:
- 3.0.4
- See Also:
-
getMessageIDFormat
-
setMessageIDFormat
-
getMDNSubject
-
setMDNSubject
-
isBlockErrorMDN
public boolean isBlockErrorMDN() -
setBlockErrorMDN
-
getDateFormat
-
setDateFormat
-
getEncryptAlgorithm
-
setEncryptAlgorithm
-
setEncryptAlgorithm
@Nonnull public com.helger.commons.state.EChange setEncryptAlgorithm(@Nullable ECryptoAlgorithmCrypt eValue) -
getSigningAlgorithm
-
setSigningAlgorithm
-
setSigningAlgorithm
@Nonnull public com.helger.commons.state.EChange setSigningAlgorithm(@Nullable ECryptoAlgorithmSign eValue) -
getProtocol
-
setProtocol
-
getSubject
-
setSubject
-
getContentTransferEncodingSend
Get the Content-Transfer-Encoding for sending messages.- Parameters:
sDefault
- Default to be returned if none is present. May benull
.- Returns:
- The partnership Content-Transfer-Encoding or the provided default value.
-
setContentTransferEncodingSend
@Nonnull public com.helger.commons.state.EChange setContentTransferEncodingSend(@Nullable String sValue) Set the Content-Transfer-Encoding for sending messages.- Parameters:
sValue
- The value for this partnership. May benull
.- Returns:
EChange
-
setContentTransferEncodingSend
@Nonnull public com.helger.commons.state.EChange setContentTransferEncodingSend(@Nullable com.helger.mail.cte.EContentTransferEncoding eCTE) Set the Content-Transfer-Encoding for sending messages.- Parameters:
eCTE
- The value for this partnership. May benull
.- Returns:
EChange
-
getContentTransferEncodingReceive
Get the Content-Transfer-Encoding for receiving messages.- Parameters:
sDefault
- Default to be returned if none is present. May benull
.- Returns:
- The partnership Content-Transfer-Encoding or the provided default value.
-
setContentTransferEncodingReceive
@Nonnull public com.helger.commons.state.EChange setContentTransferEncodingReceive(@Nullable String sValue) Set the Content-Transfer-Encoding for receiving messages.- Parameters:
sValue
- The value for this partnership. May benull
.- Returns:
EChange
-
setContentTransferEncodingReceive
@Nonnull public com.helger.commons.state.EChange setContentTransferEncodingReceive(@Nullable com.helger.mail.cte.EContentTransferEncoding eCTE) Set the Content-Transfer-Encoding for receiving messages.- Parameters:
eCTE
- The value for this partnership. May benull
.- Returns:
EChange
-
getCompressionType
-
setCompressionType
-
setCompressionType
@Nonnull public com.helger.commons.state.EChange setCompressionType(@Nullable ECompressionType eValue) -
getCompressionMode
-
setCompressionMode
-
isCompressBeforeSign
public boolean isCompressBeforeSign() -
setCompressionModeCompressAfterSigning
-
setCompressionModeCompressBeforeSigning
-
isForceDecrypt
public boolean isForceDecrypt() -
setForceDecrypt
-
isDisableDecrypt
public boolean isDisableDecrypt() -
setDisableDecrypt
-
isForceVerify
public boolean isForceVerify() -
setForceVerify
-
isDisableVerify
public boolean isDisableVerify() -
setDisableVerify
-
getIncludeCertificateInSignedContent
-
setIncludeCertificateInSignedContent
-
getVerifyUseCertificateInBodyPart
-
setVerifyUseCertificateInBodyPart
-
isDisableDecompress
public boolean isDisableDecompress() -
setDisableDecompress
-
isRFC3851MICAlgs
public boolean isRFC3851MICAlgs()- Returns:
true
if the "old" RFC 3851 MIC algorithm names (e.g.sha1
) should be used,false
if the new RFC 5751 MIC algorithm names (e.g.sha-1
) should be used. Default isfalse
.- Since:
- 2.2.7
-
setRFC3851MICAlgs
Enable or disable the usage of the old RFC 3851 MIC algorithm names. By default this isfalse
.- Parameters:
bValue
-true
if the "old" RFC 3851 MIC algorithm names (e.g.sha1
) should be used,false
if the new RFC 5751 MIC algorithm names (e.g.sha-1
) should be used. Default isfalse
.- Returns:
EChange
.- Since:
- 2.2.7
-
isRemoveCmsAlgorithmProtect
public boolean isRemoveCmsAlgorithmProtect()- Returns:
- if
true
, the CMS attribute "AlgorithmProtect" will be removed. This is needed in compatibility with e.g. IBM Sterling. Default value isfalse
. See Issue #137. - Since:
- 4.10.1
-
setRemoveCmsAlgorithmProtect
Enable or disable the removal of the CMS attribute "AlgorithmProtect". By default this isfalse
. This is needed in compatibility with e.g. IBM Sterling. Default value isfalse
. See Issue #137.- Parameters:
bValue
-true
to remove the attribute,false
to keep it.- Returns:
EChange
.- Since:
- 4.10.1
-
getAllAttributes
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.attr.IStringMap getAllAttributes()- Returns:
- A copy of all contained attributes. Never
null
.
-
addAllAttributes
Add all provided attributes. existing attributes are not altered.- Parameters:
aAttributes
- The attributes to be added. May benull
. If anull
value is contained in the map, the respective attribute will be removed.
-
matches
Check if sender and receiver IDs of this partnership match the ones of the provided partnership.- Parameters:
aPartnership
- The partnership to compare to. May not benull
.- Returns:
true
if sender and receiver IDs of this partnership are present in the sender and receiver IDs of the provided partnership.
-
compareIDs
protected boolean compareIDs(@Nonnull com.helger.commons.collection.attr.IStringMap aIDs, @Nonnull com.helger.commons.collection.attr.IStringMap aCompareTo) Check if all values from the left side are also present on the right side.- Parameters:
aIDs
- The source map which must be fully contained in the aCompareTo mapaCompareTo
- The map to compare to. May not benull
. It may contain more attributes than aIDs but must at least contain the same ones.- Returns:
true
if aIDs is not empty and all values from aIDs are also present in aCompareTo,false
otherwise.
-
copyFrom
Set all fields of this partnership with the data from the provided partnership. Name, sender IDs, receiver IDs and attributes are fully overwritten!- Parameters:
aPartnership
- The partnership to copy the data from. May not benull
.
-
toString
-
createPlaceholderPartnership
-