Class AddressAddressRelationMergeHandler
java.lang.Object
ch.tocco.nice2.entityoperation.spi.merge.ToManyRelationMergeHandler
ch.tocco.nice2.optional.address.impl.merge.AbstractAddressAddressAndUserUserRelationMergeHandler
ch.tocco.nice2.optional.address.impl.merge.AddressAddressRelationMergeHandler
- All Implemented Interfaces:
RelationMergeHandler
@Component
public class AddressAddressRelationMergeHandler
extends AbstractAddressAddressAndUserUserRelationMergeHandler
Custom
RelationMergeHandler
for Address→Address_address relations.
This handler removes potential duplicates if multiple source addresses have a relation
to the same address.
This is necessary to avoid a validation error (see EqualAddressAddressEntityExistsValidator
).
If there are duplicates it is important to remove the 'new' value and keep the existing one,
because the validator uses a query to compare uniqueness.-
Constructor Summary
ConstructorDescriptionAddressAddressRelationMergeHandler
(TextResources textResources, SecurityManager securityManager, BusinessUnitManager businessUnitManager, DeleteService deleteService, PersistenceService persistenceService) -
Method Summary
Modifier and TypeMethodDescriptionprotected Entity
getCodeEntity
(Entity entity) protected String
protected Entity
getRelatedEntity
(Entity entity, RelationModel relationModel) boolean
supports
(RelationModel relationModel) Methods inherited from class ch.tocco.nice2.optional.address.impl.merge.AbstractAddressAddressAndUserUserRelationMergeHandler
mergeRelation, priority
-
Constructor Details
-
AddressAddressRelationMergeHandler
public AddressAddressRelationMergeHandler(TextResources textResources, SecurityManager securityManager, BusinessUnitManager businessUnitManager, DeleteService deleteService, PersistenceService persistenceService)
-
-
Method Details
-
supports
- Specified by:
supports
in interfaceRelationMergeHandler
- Overrides:
supports
in classToManyRelationMergeHandler
- Returns:
- true if this handler supports merging the given relation model
-
getRelatedEntity
- Specified by:
getRelatedEntity
in classAbstractAddressAddressAndUserUserRelationMergeHandler
-
getEntityName
- Specified by:
getEntityName
in classAbstractAddressAddressAndUserUserRelationMergeHandler
-
getCodeEntity
- Specified by:
getCodeEntity
in classAbstractAddressAddressAndUserUserRelationMergeHandler
-