Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / feature / impl / DefaultFeatureRules.java @ 37327

History | View | Annotate | Download (1.14 KB)

1 24496 jmvivo
package org.gvsig.fmap.dal.feature.impl;
2 23754 jjdelcerro
3
import java.util.ArrayList;
4 25609 vcaballero
import java.util.Iterator;
5 23754 jjdelcerro
6 25609 vcaballero
import org.gvsig.fmap.dal.exception.DataException;
7
import org.gvsig.fmap.dal.feature.Feature;
8 24496 jmvivo
import org.gvsig.fmap.dal.feature.FeatureRule;
9
import org.gvsig.fmap.dal.feature.FeatureRules;
10 23754 jjdelcerro
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 25609 vcaballero
        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 23754 jjdelcerro
50 25609 vcaballero
        }
51 23754 jjdelcerro
52
53 25609 vcaballero
54
55 23754 jjdelcerro
}