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
ConstructorDescriptionEffectiveRecipientImpl
(ConcernedRecipientImpl concernedRecipient, @Nullable Entity person, @Nullable Entity address, AddressService addressService, DefaultDisplayService defaultDisplayService) Creates a new instance ofEffectiveRecipientImpl
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
@Nullable String
Returns theDefaultDisplay
of the address if available.@Nullable String
Returns theAddress
as used when generating output if available.Returns a simple representation of theEffectiveRecipient
to be used in client UI.@Nullable String
Returns theDefaultDisplay
of the person if available.@Nullable String
Returns theSaluation
as used when generating output if available.int
hashCode()
boolean
isValid()
Checks if thisEffectiveRecipient
is valid for the givenCommunicationType
by checking the presence ofaddressData
oremailData
, which is gathered from the underlying entity.void
setAddressForOutput
(String addressForOutput) void
setSalutationForOutput
(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 thePerson
entity: TheEffectiveRecipientImpl
will be built based on theUser
entity, gathering all information from it, Providing aUser
entity and anAddress
entity: TheEffectiveRecipientImpl
will be built based on theUser
entity, but using theaddress
entity as alternative address to gather address specific information from it. Providing only aAddress
entity: TheEffectiveRecipientImpl
will be built based on theAddress
entity, gathering all information from it. Providing neitherUser
, norAddress
entity.: TheEffectiveRecipientImpl
will 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 aUser
orAddress
entity. E.g.Application
entity model.- Parameters:
concernedRecipient
- theConcernedRecipientImpl
thisEffectiveRecipientImpl
belongs to.person
- thePerson
entity ornull
if thisEffectiveRecipientImpl
is only a simpleAddress
address
- theAddress
entity if theEffectiveRecipientImpl
is not aPerson
or thePerson
'sAddress
should be overridden.defaultDisplayService
- theDefaultDisplayService
- Throws:
NoEntityToLoadException
-
-
Method Details
-
isValid
public boolean isValid()Description copied from interface:EffectiveRecipient
Checks if thisEffectiveRecipient
is valid for the givenCommunicationType
by checking the presence ofaddressData
oremailData
, which is gathered from the underlying entity.- Specified by:
isValid
in interfaceEffectiveRecipient
- Returns:
true
if valid,false
otherwise- See Also:
-
getPerson
- Specified by:
getPerson
in interfaceEffectiveRecipient
-
getAddress
- Specified by:
getAddress
in interfaceEffectiveRecipient
-
getEffectiveEntity
- Specified by:
getEffectiveEntity
in interfaceEffectiveRecipient
-
getEmailAddress
- Specified by:
getEmailAddress
in interfaceEffectiveRecipient
-
getPersonDisplay
Description copied from interface:EffectiveRecipient
Returns theDefaultDisplay
of the person if available. Otherwisenull
.- Specified by:
getPersonDisplay
in interfaceEffectiveRecipient
-
getAddressDisplay
Description copied from interface:EffectiveRecipient
Returns theDefaultDisplay
of the address if available. Otherwisenull
.- Specified by:
getAddressDisplay
in interfaceEffectiveRecipient
-
getSalutationForOutput
Description copied from interface:EffectiveRecipient
Returns theSaluation
as used when generating output if available. Otherwisenull
.- Specified by:
getSalutationForOutput
in interfaceEffectiveRecipient
-
setSalutationForOutput
- Specified by:
setSalutationForOutput
in interfaceEffectiveRecipient
-
getAddressForOutput
Description copied from interface:EffectiveRecipient
Returns theAddress
as used when generating output if available. Otherwisenull
.- Specified by:
getAddressForOutput
in interfaceEffectiveRecipient
-
setAddressForOutput
- Specified by:
setAddressForOutput
in interfaceEffectiveRecipient
-
equals
-
hashCode
public int hashCode() -
getClientRepresentation
Description copied from interface:EffectiveRecipient
Returns a simple representation of theEffectiveRecipient
to be used in client UI.- Specified by:
getClientRepresentation
in interfaceEffectiveRecipient
- Returns:
- the simple
EffectiveRecipient
representation
-
getConcernedRecipient
- Specified by:
getConcernedRecipient
in interfaceEffectiveRecipient
-