/*
* If we find a matching explicit promotion try to resolve using the matched composite relation
*/
if (matching != null) {
RelationDefinition compositeRelation = client.getComposite().getRelation(promotion.getCompositeRelation().getIdentifier());
/*
* Validate the source's and composite's relations are compatible.
*
* NOTE This is already validated at build time, but we do the tests again at runtime
*/
if (!relation.getRelationDefinition().matchRelation(client,compositeRelation)) {
logger.error("Promotion is invalid. relation " + relation.getName() + " of component " + client.getName() + " does not match the composite relation " + compositeRelation);
continue search;
}
Resolved<T> candidates = getPromotionCandidates(client, relation, compositeRelation);
if (candidates != null && !candidates.isEmpty()) {
/*
* Create the promotion links and return
*/
updateModel(client, relation, candidates, relation.hasConstraints() || compositeRelation.hasConstraints(), true);
/*
* NOTE IMPORTAN SPECIAL CASE for relations with cardinality multiple, we allow merging the result of
* several promotions
*/