svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.impl / src / main / java / org / gvsig / fmap / dal / feature / impl / DefaultFeatureRules.java @ 40435
History | View | Annotate | Download (1.14 KB)
1 | 40435 | jjdelcerro | package org.gvsig.fmap.dal.feature.impl; |
---|---|---|---|
2 | |||
3 | import java.util.ArrayList; |
||
4 | import java.util.Iterator; |
||
5 | |||
6 | import org.gvsig.fmap.dal.exception.DataException; |
||
7 | import org.gvsig.fmap.dal.feature.Feature; |
||
8 | import org.gvsig.fmap.dal.feature.FeatureRule; |
||
9 | import org.gvsig.fmap.dal.feature.FeatureRules; |
||
10 | |||
11 | public class DefaultFeatureRules extends ArrayList implements FeatureRules { |
||
12 | |||
13 | /**
|
||
14 | *
|
||
15 | */
|
||
16 | private static final long serialVersionUID = -8084546505498274121L; |
||
17 | |||
18 | public FeatureRule add(FeatureRule rule) {
|
||
19 | if (super.add(rule)) { |
||
20 | return rule;
|
||
21 | } |
||
22 | return null; |
||
23 | } |
||
24 | |||
25 | public FeatureRule getRule(int index) { |
||
26 | return (FeatureRule) super.get(index); |
||
27 | } |
||
28 | |||
29 | public boolean remove(FeatureRule rule) { |
||
30 | return super.remove(rule); |
||
31 | } |
||
32 | |||
33 | public FeatureRules getCopy() {
|
||
34 | DefaultFeatureRules copy = new DefaultFeatureRules();
|
||
35 | copy.addAll(this);
|
||
36 | return copy;
|
||
37 | } |
||
38 | |||
39 | public void validate(Feature feature) { |
||
40 | Iterator featureRules=iterator();
|
||
41 | while (featureRules.hasNext()) {
|
||
42 | FeatureRule rule = (FeatureRule) featureRules.next(); |
||
43 | try {
|
||
44 | rule.validate(feature, ((DefaultFeature)feature).getStore()); |
||
45 | } catch (DataException e) {
|
||
46 | e.printStackTrace(); |
||
47 | } |
||
48 | } |
||
49 | |||
50 | } |
||
51 | |||
52 | |||
53 | |||
54 | |||
55 | } |