Hi all -
I have the following challenge with data mapping. I'm trying to decide if
DROOLS is the appropriate solution to this problem - please help me decide.
I have a Source object and Target object. Both objects have the same field
names - the goal is to map data across from Source object to Target object
by apply a set of rules to object's fields. More than one rule may need to
be activated for each field. Results of previous mapping operation may
affect later mapping operations further 'downstream' - so it's important to
process fields in a specific sequence and for each field evaluate rules in a
specific order - (not sure, can rule Salience accomplish both?)
About the rules: There may be several rules in affect for each field -
which must be executed in specific order top to bottom. Rules should be
applied until the target field is mapped - until the target field is
non-blank. Same rule may be applied to more than one field from the Source
object. Rules will be maintain by a Customer Service Reps and will change
I would envision the rule setup to be something like this:
Rule "Setup variables"
$source : SOURCE (rec_type == "PARTNER", $s_loc : location,
$s_op : operator, $s_wo : workorder)
$target : TARGET ($t_loc : location, $t_op : operator, $t_wo :
# Simple mapping for Location field...
$target($t_loc == "") // if blank
# Simple mapping for Operator field...
$target($t_op == "") // if blank...
... rules continue for the rest of the fields... There are about 150-200
fields to map. Some rules will define simple straight across mappings,
other rules will need to fetch values from objects from DB (using 'from'
keyword). Here are some questions:
1) Opinion please: Would the outlined approach work in this case given the
number of fields to process and the required sequence for processing. Seems
that rule management may be a bit difficult...
2) Is there a way to define functions that could take field names, and then
apply common operations using dynamic field names - i.e. function
simple_map(fieldName) would source data from Source.fieldName and map it to
Tartget.fieldName - this would require that get/set methods be dynamic - is
3) Is there another approach that would be better suited in this case that
View this message in context:
Sent from the drools - user mailing list archive at Nabble.com