jeudi 2 novembre 2017

Drools merge data design pattern

I'm trying to find out the best way to merge data using drools. Basically i have a fact "Card" which looks like :

Card {
  String name;
  String description;
  String tel;
  [...]
  List < Source > sources;
}

and Source {
  String providerId;
  String providerRef;
  String name;
  String description;
  [...]
}

For some source provider 'X', the name should be use first if not null. Otherwise use the name from another source.

But for other provider 'Y' the phone has to be used. And so on for other fields.

So the fields to merge from the source into the main card depend on their provider and the target field.

What would be the best way to do it ?

Thanks a lot!

Aucun commentaire:

Enregistrer un commentaire