Statistics
| Revision:

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

History | View | Annotate | Download (4.2 KB)

1 24496 jmvivo
package org.gvsig.fmap.dal.feature.impl;
2 23754 jjdelcerro
3 26717 jmvivo
import org.cresques.cts.IProjection;
4 24496 jmvivo
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
5 24505 jmvivo
import org.gvsig.fmap.dal.feature.exception.AttributeFeatureTypeIntegrityException;
6
import org.gvsig.fmap.dal.feature.exception.AttributeFeatureTypeSizeException;
7 23754 jjdelcerro
import org.gvsig.tools.evaluator.Evaluator;
8
9
public class DefaultEditableFeatureAttributeDescriptor extends
10
                DefaultFeatureAttributeDescriptor implements
11
                EditableFeatureAttributeDescriptor {
12
13
        private DefaultFeatureAttributeDescriptor source;
14
        private boolean hasStrongChanges;
15
16
        protected DefaultEditableFeatureAttributeDescriptor(
17
                        DefaultFeatureAttributeDescriptor other) {
18
                super(other);
19
                this.source = other;
20
                hasStrongChanges=false;
21
        }
22
23
        protected DefaultEditableFeatureAttributeDescriptor(
24
                        DefaultEditableFeatureAttributeDescriptor other) {
25
                super(other);
26
                this.source = other.getSource();
27
                hasStrongChanges = false;
28
        }
29
30
        public DefaultEditableFeatureAttributeDescriptor() {
31
                super();
32
                this.source = null;
33
                hasStrongChanges = false;
34
        }
35
36
        public DefaultFeatureAttributeDescriptor getSource() {
37
                return this.source;
38
        }
39
40
        public void fixAll() {
41
        }
42
43 23772 jjdelcerro
        public void checkIntegrity() throws AttributeFeatureTypeIntegrityException {
44
                AttributeFeatureTypeIntegrityException ex = new AttributeFeatureTypeIntegrityException(
45
                                getName());
46
                if (this.size < 0) {
47
                        ex.add(new AttributeFeatureTypeSizeException(this.size));
48
                }
49
50
                // TODO: a?adir resto de comprobaciones de integridad.
51
52
                if (ex.size() > 0) {
53
                        throw ex;
54
                }
55 23754 jjdelcerro
        }
56
57
        public EditableFeatureAttributeDescriptor setAllowNull(boolean allowNull) {
58
                this.allowNull = allowNull;
59
                if( this.evaluator != null ) {
60
                        hasStrongChanges=true;
61
                }
62
                return this;
63
        }
64
65
        public EditableFeatureAttributeDescriptor setDataType(int type) {
66
                this.dataType  = type;
67
                if( this.evaluator != null ) {
68
                        hasStrongChanges=true;
69
                }
70
                return this;
71
        }
72
73
        public EditableFeatureAttributeDescriptor setDefaultValue(
74
                        Object defaultValue) {
75
                this.defaultValue = defaultValue;
76
                if( this.evaluator != null ) {
77
                        hasStrongChanges=true;
78
                }
79
                return this;
80
        }
81
82
        public EditableFeatureAttributeDescriptor setEvaluator(Evaluator evaluator) {
83
                this.evaluator = evaluator;
84
                if( this.evaluator != null ) {
85
                        hasStrongChanges=true;
86
                }
87
                return this;
88
        }
89
90
        public EditableFeatureAttributeDescriptor setGeometryType(int geometryType) {
91
                this.geometryType= geometryType;
92
                if( this.evaluator != null ) {
93
                        hasStrongChanges=true;
94
                }
95
                return this;
96
        }
97
98
        public EditableFeatureAttributeDescriptor setIsPrimaryKey(
99
                        boolean isPrimaryKey) {
100
                this.primaryKey = isPrimaryKey;
101
                if( this.evaluator != null ) {
102
                        hasStrongChanges=true;
103
                }
104
                return this;
105
        }
106
107
        public EditableFeatureAttributeDescriptor setIsReadOnly(boolean isReadOnly) {
108
                this.readOnly = isReadOnly;
109
                if( this.evaluator != null ) {
110
                        hasStrongChanges=true;
111
                }
112
                return this;
113
        }
114
115
        public EditableFeatureAttributeDescriptor setMaximumOccurrences(
116
                        int maximumOccurrences) {
117
                this.maximumOccurrences = maximumOccurrences;
118
                if( this.evaluator != null ) {
119
                        hasStrongChanges=true;
120
                }
121
                return this;
122
        }
123
124
        public EditableFeatureAttributeDescriptor setMinimumOccurrences(
125
                        int minimumOccurrences) {
126
                this.minimumOccurrences = minimumOccurrences;
127
                if( this.evaluator != null ) {
128
                        hasStrongChanges=true;
129
                }
130
                return this;
131
        }
132
133
        public EditableFeatureAttributeDescriptor setName(String name) {
134
                this.name = name;
135
                if( this.evaluator != null ) {
136
                        hasStrongChanges=true;
137
                }
138
                return this;
139
        }
140
141
        public EditableFeatureAttributeDescriptor setObjectClass(Class theClass) {
142
                this.objectClass = theClass;
143
                if( this.evaluator != null ) {
144
                        hasStrongChanges=true;
145
                }
146
                return this;
147
        }
148
149
        public EditableFeatureAttributeDescriptor setPrecision(int precision) {
150
                this.precision = precision;
151
                if( this.evaluator != null ) {
152
                        hasStrongChanges=true;
153
                }
154
                return this;
155
        }
156
157 26717 jmvivo
        public EditableFeatureAttributeDescriptor setSRS(IProjection SRS) {
158 23754 jjdelcerro
                this.SRS = SRS;
159
                if( this.evaluator != null ) {
160
                        hasStrongChanges=true;
161
                }
162
                return this;
163
        }
164
165
        public EditableFeatureAttributeDescriptor setSize(int size) {
166
                this.size = size;
167
                if( this.evaluator != null ) {
168
                        hasStrongChanges=true;
169
                }
170
                return this;
171
        }
172
173
        public boolean hasStrongChanges() {
174
                return hasStrongChanges;
175
        }
176
177
}