How to Write D2W Rules

Last modified by Ravi Mendis on 2009/11/12 16:52

The quick answer is...

Use Convention Over Configuration

We may use convention over configuration to set up default D2W rules.

In D2W, rules with a higher priority take precedence.
 e.g:


100: entity.name = 'Father' and task = 'edit' and propertyKey = 'firstName' => componentName = "D2WEditString"

The above will override, or take precedence over the following:


75: task = 'edit' and propertyKey = 'firstName' => componentName = "D2WEditString"

We may exploit this feature of D2W to set up a set of rules as conventions or defaults.
 As an example, the above rule may be set up to be a default for the editing of the key firstName instead of having to define separate rules for every entity that has a firstName. In other words you may define the one rule (above) instead of the following three rules:


100: entity.name = 'Father' and task = 'edit' and propertyKey = 'firstName' => componentName = "D2WEditString"
100: entity.name = 'Mother' and task = 'edit' and propertyKey = 'firstName' => componentName = "D2WEditString"
100: entity.name = 'Child' and task = 'edit' and propertyKey = 'firstName' => componentName = "D2WEditString"

In this manner we can keep the number of D2W rules down to a minimum - which vastly improves maintainability.

Rule of Thumb

Set a lower priority to generic rules.