Revision 47378 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/AbstractFeatureRule.java
AbstractFeatureRule.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.gvsig.fmap.dal.feature; |
25 | 25 |
|
26 |
import org.gvsig.tools.util.Bitmask; |
|
26 | 27 |
|
28 |
|
|
27 | 29 |
/** |
28 | 30 |
* Abstract feature rule intended for giving a partial default implementation |
29 | 31 |
* of the {@link FeatureRule} interface to other rule implementations. It is recommended |
... | ... | |
34 | 36 |
public abstract class AbstractFeatureRule implements FeatureRule { |
35 | 37 |
protected String name; |
36 | 38 |
protected String description; |
37 |
protected boolean checkAtUpdate; |
|
38 |
protected boolean checkAtFinishEdition; |
|
39 |
protected Bitmask checkwhen; |
|
39 | 40 |
|
40 | 41 |
protected AbstractFeatureRule(String name, String description) { |
41 |
this(name,description,true,true); |
|
42 |
this( |
|
43 |
name, |
|
44 |
description, |
|
45 |
FeatureRule.CHECK_WHEN_FINISH_EDITING | |
|
46 |
FeatureRule.CHECK_WHEN_INSERT_OR_UPDATE_FEATURE |
|
47 |
); |
|
42 | 48 |
} |
43 | 49 |
|
44 | 50 |
protected AbstractFeatureRule(String name, String description, |
45 | 51 |
boolean checkAtUpdate, boolean checkAtFinishEdition) { |
52 |
this( |
|
53 |
name, |
|
54 |
description, |
|
55 |
(checkAtUpdate? FeatureRule.CHECK_WHEN_FINISH_EDITING:0) | |
|
56 |
(checkAtFinishEdition? FeatureRule.CHECK_WHEN_INSERT_OR_UPDATE_FEATURE:0) |
|
57 |
); |
|
58 |
} |
|
59 |
|
|
60 |
protected AbstractFeatureRule(String name, String description, |
|
61 |
int checkwhenmask) { |
|
46 | 62 |
this.name=name; |
47 | 63 |
this.description=description; |
48 |
this.checkAtUpdate = checkAtUpdate; |
|
49 |
this.checkAtFinishEdition = checkAtFinishEdition; |
|
64 |
this.checkwhen = Bitmask.createBitmask(checkwhenmask); |
|
50 | 65 |
} |
51 | 66 |
|
52 | 67 |
@Override |
... | ... | |
61 | 76 |
|
62 | 77 |
@Override |
63 | 78 |
public boolean checkAtFinishEditing() { |
64 |
return this.checkAtFinishEdition;
|
|
79 |
return this.checkwhen.isSetBits(CHECK_WHEN_FINISH_EDITING);
|
|
65 | 80 |
} |
66 | 81 |
|
67 | 82 |
@Override |
68 | 83 |
public boolean checkAtUpdate() { |
69 |
return this.checkAtUpdate;
|
|
84 |
return this.checkwhen.isSetBits(CHECK_WHEN_INSERT_OR_UPDATE_FEATURE);
|
|
70 | 85 |
} |
71 | 86 |
|
87 |
@Override |
|
88 |
public boolean checkWhen(int mask) { |
|
89 |
return this.checkwhen.isSetBits(mask); |
|
90 |
} |
|
91 |
|
|
92 |
protected void setCheckWhen(int mask) { |
|
93 |
this.checkwhen.setBits(mask); |
|
94 |
} |
|
72 | 95 |
} |
Also available in: Unified diff