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