Package com.helger.as2lib.partner
Class AbstractPartnershipFactory
java.lang.Object
com.helger.as2lib.AbstractDynamicComponent
com.helger.as2lib.partner.AbstractPartnershipFactory
- All Implemented Interfaces:
IDynamicComponent
,IPartnershipFactory
- Direct Known Subclasses:
AbstractPartnershipFactoryWithPartners
,SelfFillingPartnershipFactory
@ThreadSafe
public abstract class AbstractPartnershipFactory
extends AbstractDynamicComponent
implements IPartnershipFactory
Abstract
IPartnershipFactory
implementation using
PartnershipMap
as the underlying data storage object.- Author:
- Philip Helger
-
Field Summary
Fields inherited from class com.helger.as2lib.AbstractDynamicComponent
m_aRWLock
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal com.helger.commons.state.EChange
addPartnership
(Partnership aPartnership) Add a partnership.boolean
com.helger.commons.collection.impl.ICommonsSet<String>
com.helger.commons.collection.impl.ICommonsList<Partnership>
getPartnership
(Partnership aPartnership) Get the partnership identified by the provided stub partnership.getPartnershipByName
(String sName) Find an existing partnership by its name.int
hashCode()
protected void
Callback method that is invoked, when this object is modified.final com.helger.commons.state.EChange
removePartnership
(Partnership aPartnership) Remove the specified partnership.protected final void
setPartnerships
(PartnershipMap aPartnerships) toString()
final void
updatePartnership
(IMessageMDN aMdn, boolean bOverwrite) Looks up and fills in any header info for a specific MDN's partnershipvoid
updatePartnership
(IMessage aMsg, boolean bOverwrite) Looks up and fills in any header info for a specific msg's partnership.Methods inherited from class com.helger.as2lib.AbstractDynamicComponent
attrs, getAttributeAsIntRequired, getAttributeAsStringRequired, getName, getSession, initDynamicComponent
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.helger.as2lib.IDynamicComponent
attrs, getName, getSession, initDynamicComponent
-
Constructor Details
-
AbstractPartnershipFactory
public AbstractPartnershipFactory()
-
-
Method Details
-
markAsChanged
Callback method that is invoked, when this object is modified. This method must be overridden to do something useful. A use case scenario could e.g. be automatic storage of changes.- Throws:
AS2Exception
- In case anything goes wrong
-
getPartnership
@Nonnull @OverridingMethodsMustInvokeSuper public Partnership getPartnership(@Nonnull Partnership aPartnership) throws AS2Exception Description copied from interface:IPartnershipFactory
Get the partnership identified by the provided stub partnership.- Specified by:
getPartnership
in interfaceIPartnershipFactory
- Parameters:
aPartnership
- Stub partnership which must contain either a name or a set of sender and receiver IDs.- Returns:
- The Partnership as stored in this factory. Never
null
. - Throws:
AS2Exception
- If no partnership matching the provided stub partnership can be found.
-
getPartnershipByName
Description copied from interface:IPartnershipFactory
Find an existing partnership by its name.- Specified by:
getPartnershipByName
in interfaceIPartnershipFactory
- Parameters:
sName
- The partnership name to be looked up. May benull
.- Returns:
null
if no such partnership exists.
-
getAllPartnershipNames
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsSet<String> getAllPartnershipNames()- Specified by:
getAllPartnershipNames
in interfaceIPartnershipFactory
- Returns:
- A set with all contained partnership names. Never
null
but maybe empty.
-
getAllPartnerships
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<Partnership> getAllPartnerships()- Specified by:
getAllPartnerships
in interfaceIPartnershipFactory
- Returns:
- A list of all contained partnerships. Never
null
but maybe empty.
-
getPartnershipMap
-
setPartnerships
- Throws:
AS2Exception
-
addPartnership
@Nonnull public final com.helger.commons.state.EChange addPartnership(@Nonnull Partnership aPartnership) throws AS2Exception Description copied from interface:IPartnershipFactory
Add a partnership.- Specified by:
addPartnership
in interfaceIPartnershipFactory
- Parameters:
aPartnership
- The partnership to be added. May not benull
. The name of the partnership must be unique so that it gets added.- Returns:
EChange.CHANGED
if adding was successfully,EChange.UNCHANGED
if the name is already contained.- Throws:
AS2Exception
- Generic error
-
removePartnership
@Nonnull public final com.helger.commons.state.EChange removePartnership(@Nonnull Partnership aPartnership) throws AS2Exception Description copied from interface:IPartnershipFactory
Remove the specified partnership.- Specified by:
removePartnership
in interfaceIPartnershipFactory
- Parameters:
aPartnership
- The partnership to be removed.- Returns:
EChange.CHANGED
if removal was successful,EChange.UNCHANGED
if no such partnership to be removed is present.- Throws:
AS2Exception
- Generic error
-
updatePartnership
Description copied from interface:IPartnershipFactory
Looks up and fills in any header info for a specific msg's partnership.- Specified by:
updatePartnership
in interfaceIPartnershipFactory
- Parameters:
aMsg
- The message in which the partnership should be updated. May not benull
and must already contain a partnership with at least name or sender and receiver IDs.bOverwrite
-true
to also set the subject of the message with the subject stored in the partnership.- Throws:
AS2Exception
- In case of an error- See Also:
-
updatePartnership
public final void updatePartnership(@Nonnull IMessageMDN aMdn, boolean bOverwrite) throws AS2Exception Description copied from interface:IPartnershipFactory
Looks up and fills in any header info for a specific MDN's partnership- Specified by:
updatePartnership
in interfaceIPartnershipFactory
- Parameters:
aMdn
- The MDN of which the partnership information should be updated. May not benull
and must already contain a partnership with at least name or sender and receiver IDs.bOverwrite
- has no effect currently- Throws:
AS2Exception
- In case of an error- See Also:
-
equals
- Overrides:
equals
in classAbstractDynamicComponent
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractDynamicComponent
-
toString
- Overrides:
toString
in classAbstractDynamicComponent
-