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