Wiki source code of D2W Rules Reference - Cookbook - FAQ
Version 93.1 by Greg.Brown on 2009/09/26 18:49
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | === Rule Lists === | ||
2 | |||
3 | Below are some commonly used rules and information on keys which control D2W templates. You may wish to keep your own library of commonly used D2W rules, something like "D2WRuleLibrary.d2wmodel", which can then be used to copy and paste rules into your projects. | ||
4 | |||
5 | ==== For quick reference: ==== | ||
6 | |||
7 | ~1. How do I make my attributes and entities editable? | ||
8 | |||
9 | {{noformat}} | ||
10 | |||
11 | |||
12 | 100: true => isEntityEditable = true [com.webobjects.directtoweb.BooleanAssignment] | ||
13 | |||
14 | |||
15 | {{/noformat}} | ||
16 | |||
17 | |||
18 | |||
19 | 2. How do I make my relationships editable in ERD2W? (They all ready are editable in D2W.) | ||
20 | Add two rules. This: | ||
21 | |||
22 | {{noformat}} | ||
23 | |||
24 | |||
25 | 90: task = 'edit' and smartRelationship.isToMany = 1 => componentName = ERD2WEditToManyFault | ||
26 | [com.webobjects.directtoweb.Assignment] | ||
27 | |||
28 | |||
29 | {{/noformat}} | ||
30 | |||
31 | and the below: | ||
32 | |||
33 | {{noformat}} | ||
34 | |||
35 | |||
36 | 90: task = 'edit' and smartRelationship != null and not (smartRelationship.isToMany = 1) => componentName = "ERD2WEditToOneRelationship" | ||
37 | [com.webobjects.directtoweb.Assignment] | ||
38 | |||
39 | |||
40 | {{/noformat}} | ||
41 | |||
42 | 3. I don't like the defaults for attributes that D2W chooses. Sometimes it chooses wisely, but not always. How do I change what gets displayed for an entity's attributes? | ||
43 | |||
44 | The key is: displayPropertyKeys. This key represents a list of attributes to display for an entity. An example rule: | ||
45 | |||
46 | {{noformat}} | ||
47 | |||
48 | |||
49 | 100: entity.name = 'MyEntity' => displayPropertyKeys = ("attribute1","attribute2", "relationship1","relationship2.attribute3") [Assignment] | ||
50 | |||
51 | |||
52 | {{/noformat}} | ||
53 | |||
54 | Note that you can pick attributes across relationships. You now have total control of what gets displayed. |