Class EffectiveRecipientImpl
java.lang.Object
ch.tocco.nice2.optional.address.impl.recipient.EffectiveRecipientImpl
- All Implemented Interfaces:
EffectiveRecipient
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.tocco.nice2.optional.address.api.recipient.EffectiveRecipient
EffectiveRecipient.ClientRepresentation -
Constructor Summary
ConstructorsConstructorDescriptionEffectiveRecipientImpl(ConcernedRecipientImpl concernedRecipient, @Nullable Entity person, @Nullable Entity address, AddressService addressService, DefaultDisplayService defaultDisplayService) Creates a new instance ofEffectiveRecipientImpl. -
Method Summary
Modifier and TypeMethodDescriptionboolean@Nullable StringReturns theDefaultDisplayof the address if available.@Nullable StringReturns theAddressas used when generating output if available.Returns a simple representation of theEffectiveRecipientto be used in client UI.@Nullable StringReturns theDefaultDisplayof the person if available.@Nullable StringReturns theSaluationas used when generating output if available.inthashCode()booleanisValid()Checks if thisEffectiveRecipientis valid for the givenCommunicationTypeby checking the presence ofaddressDataoremailData, which is gathered from the underlying entity.voidsetAddressForOutput(String addressForOutput) voidsetSalutationForOutput(String salutationForOutput)
-
Constructor Details
-
EffectiveRecipientImpl
public EffectiveRecipientImpl(ConcernedRecipientImpl concernedRecipient, @Nullable @Nullable Entity person, @Nullable @Nullable Entity address, AddressService addressService, DefaultDisplayService defaultDisplayService) throws NoEntityToLoadException Creates a new instance ofEffectiveRecipientImpl. It can be instantiated in different ways described as follows to cover three different scenarios: Providing only the parameter for thePersonentity: TheEffectiveRecipientImplwill be built based on theUserentity, gathering all information from it, Providing aUserentity and anAddressentity: TheEffectiveRecipientImplwill be built based on theUserentity, but using theaddressentity as alternative address to gather address specific information from it. Providing only aAddressentity: TheEffectiveRecipientImplwill be built based on theAddressentity, gathering all information from it. Providing neitherUser, norAddressentity.: TheEffectiveRecipientImplwill be built based on the selected entity, gathering all information directly from it. This is used when communication has to be created for a selection of entities without direct connection to aUserorAddressentity. E.g.Applicationentity model.- Parameters:
concernedRecipient- theConcernedRecipientImplthisEffectiveRecipientImplbelongs to.person- thePersonentity ornullif thisEffectiveRecipientImplis only a simpleAddressaddress- theAddressentity if theEffectiveRecipientImplis not aPersonor thePerson'sAddressshould be overridden.defaultDisplayService- theDefaultDisplayService- Throws:
NoEntityToLoadException
-
-
Method Details
-
isValid
public boolean isValid()Description copied from interface:EffectiveRecipientChecks if thisEffectiveRecipientis valid for the givenCommunicationTypeby checking the presence ofaddressDataoremailData, which is gathered from the underlying entity.- Specified by:
isValidin interfaceEffectiveRecipient- Returns:
trueif valid,falseotherwise- See Also:
-
getPerson
- Specified by:
getPersonin interfaceEffectiveRecipient
-
getAddress
- Specified by:
getAddressin interfaceEffectiveRecipient
-
getEffectiveEntity
- Specified by:
getEffectiveEntityin interfaceEffectiveRecipient
-
getEmailAddress
- Specified by:
getEmailAddressin interfaceEffectiveRecipient
-
getPersonDisplay
Description copied from interface:EffectiveRecipientReturns theDefaultDisplayof the person if available. Otherwisenull.- Specified by:
getPersonDisplayin interfaceEffectiveRecipient
-
getAddressDisplay
Description copied from interface:EffectiveRecipientReturns theDefaultDisplayof the address if available. Otherwisenull.- Specified by:
getAddressDisplayin interfaceEffectiveRecipient
-
getSalutationForOutput
Description copied from interface:EffectiveRecipientReturns theSaluationas used when generating output if available. Otherwisenull.- Specified by:
getSalutationForOutputin interfaceEffectiveRecipient
-
setSalutationForOutput
- Specified by:
setSalutationForOutputin interfaceEffectiveRecipient
-
getAddressForOutput
Description copied from interface:EffectiveRecipientReturns theAddressas used when generating output if available. Otherwisenull.- Specified by:
getAddressForOutputin interfaceEffectiveRecipient
-
setAddressForOutput
- Specified by:
setAddressForOutputin interfaceEffectiveRecipient
-
equals
-
hashCode
public int hashCode() -
getClientRepresentation
Description copied from interface:EffectiveRecipientReturns a simple representation of theEffectiveRecipientto be used in client UI.- Specified by:
getClientRepresentationin interfaceEffectiveRecipient- Returns:
- the simple
EffectiveRecipientrepresentation
-
getConcernedRecipient
- Specified by:
getConcernedRecipientin interfaceEffectiveRecipient
-