1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 package nl.openedge.baritus.population;
32
33 import nl.openedge.baritus.FormBeanContext;
34
35 import org.infohazard.maverick.flow.ControllerContext;
36
37 /***
38 * Ignores the population of fields.
39 * Register IgnoreFieldPopulators if you want to ignore the population of certain properties,
40 * for instance id's of persistent objects.
41 * @author Eelco Hillenius
42 */
43 public final class IgnoreFieldPopulator implements FieldPopulator
44 {
45
46 private boolean fail;
47
48 /***
49 * construct.
50 * fail is false
51 */
52 public IgnoreFieldPopulator()
53 {
54 setFail(false);
55 }
56
57 /***
58 * construct with parameter fail
59 * @param fail If fail == true, setProperty will allways return false,
60 * and thus the population process is flagged as failed, if fail == false,
61 * setProperty will allways return true, and thus has no effect on the total population.
62 */
63 public IgnoreFieldPopulator(boolean fail)
64 {
65 setFail(fail);
66 }
67
68 /***
69 * Does nothing at all.
70 * Register IgnoreFieldPopulators if you want to ignore the population of certain properties,
71 * for instance id's of persistent objects.
72 */
73 public boolean setProperty(
74 ControllerContext cctx,
75 FormBeanContext form,
76 String name,
77 Object value)
78 throws Exception
79 {
80 return (!fail);
81 }
82
83 /***
84 * get the value of property fail
85 * @return boolean value of property fail. By default fail == false, which means that this method
86 * allways returns true. If you set fail to true, this method will allways return false,
87 * and thus the population process is flagged as failed.
88 */
89 public boolean isFail()
90 {
91 return fail;
92 }
93
94 /***
95 * set the value of property fail
96 * @param b value of property fail. By default fail == false, which means that this method
97 * allways returns true. If you set fail to true, this method will allways return false,
98 * and thus the population process is flagged as failed.
99 */
100 public void setFail(boolean b)
101 {
102 fail = b;
103 }
104
105 }