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 / DefaultFeatureType.java @ 43377
History | View | Annotate | Download (22.2 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.fmap.dal.feature.impl; |
25 |
|
26 |
import java.lang.ref.WeakReference; |
27 |
import java.util.ArrayList; |
28 |
import java.util.Arrays; |
29 |
import java.util.Collections; |
30 |
import java.util.Iterator; |
31 |
import java.util.List; |
32 |
import org.apache.commons.lang3.ArrayUtils; |
33 |
import org.apache.commons.lang3.StringUtils; |
34 |
|
35 |
import org.cresques.cts.IProjection; |
36 |
|
37 |
import org.gvsig.fmap.dal.DataTypes; |
38 |
import org.gvsig.fmap.dal.exception.DataException; |
39 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
40 |
import org.gvsig.fmap.dal.feature.Feature; |
41 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
42 |
import org.gvsig.fmap.dal.feature.FeatureAttributeEmulator; |
43 |
import org.gvsig.fmap.dal.feature.FeatureRules; |
44 |
import org.gvsig.fmap.dal.feature.FeatureType; |
45 |
import org.gvsig.tools.dynobject.DynClass; |
46 |
import org.gvsig.tools.dynobject.DynField; |
47 |
import org.gvsig.tools.dynobject.DynMethod; |
48 |
import org.gvsig.tools.dynobject.DynObject; |
49 |
import org.gvsig.tools.dynobject.DynObjectValueItem; |
50 |
import org.gvsig.tools.dynobject.DynStruct; |
51 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
52 |
import org.gvsig.tools.dynobject.exception.DynObjectValidateException; |
53 |
|
54 |
public class DefaultFeatureType extends ArrayList<FeatureAttributeDescriptor> implements FeatureType, |
55 |
DynClass, org.gvsig.tools.lang.Cloneable { |
56 |
|
57 |
/**
|
58 |
*
|
59 |
*/
|
60 |
private static final long serialVersionUID = -7988721447349282215L; |
61 |
|
62 |
private DefaultFeatureRules rules;
|
63 |
protected boolean hasEvaluators; |
64 |
protected boolean hasEmulators; |
65 |
protected String defaultGeometryAttributeName; |
66 |
protected int defaultGeometryAttributeIndex; |
67 |
protected int defaultTimeAttributeIndex; |
68 |
private String id; |
69 |
protected boolean hasOID; |
70 |
protected boolean allowAtomaticValues; |
71 |
protected FeatureAttributeDescriptor[] pk = null; |
72 |
protected String internalID = null; |
73 |
|
74 |
private List srsList = null; |
75 |
|
76 |
protected DefaultFeatureType(String id) { |
77 |
if( StringUtils.isEmpty(id) ) {
|
78 |
id = "default";
|
79 |
} |
80 |
this.internalID = Integer.toHexString((int) (Math.random()*100000)).toUpperCase(); |
81 |
this.id = id;
|
82 |
this.rules = new DefaultFeatureRules(); |
83 |
this.hasEvaluators = false; |
84 |
this.hasEmulators = false; |
85 |
this.defaultGeometryAttributeName = null; |
86 |
this.defaultGeometryAttributeIndex = -1; |
87 |
this.defaultTimeAttributeIndex = -1; |
88 |
this.allowAtomaticValues = false; |
89 |
} |
90 |
|
91 |
protected DefaultFeatureType() {
|
92 |
this((String)null); |
93 |
} |
94 |
|
95 |
protected DefaultFeatureType(DefaultFeatureType other) {
|
96 |
this((String)null); |
97 |
initialize(other, true);
|
98 |
} |
99 |
|
100 |
protected DefaultFeatureType(DefaultFeatureType other,
|
101 |
boolean copyAttributes) {
|
102 |
this((String)null); |
103 |
initialize(other, copyAttributes); |
104 |
} |
105 |
|
106 |
protected void initialize(DefaultFeatureType other, boolean copyAttributes) { |
107 |
this.id = other.getId();
|
108 |
if (copyAttributes) {
|
109 |
Iterator iter = other.iterator();
|
110 |
DefaultFeatureAttributeDescriptor attr; |
111 |
while (iter.hasNext()) {
|
112 |
attr = (DefaultFeatureAttributeDescriptor) iter.next(); |
113 |
this.intitalizeAddAttibute(attr);
|
114 |
} |
115 |
if( other.pk!=null ) { |
116 |
this.pk = new FeatureAttributeDescriptor[other.pk.length]; |
117 |
for( int i=0; i<other.pk.length; i++ ) { |
118 |
this.pk[i] = other.pk[i].getCopy();
|
119 |
} |
120 |
} |
121 |
} |
122 |
this.defaultGeometryAttributeName = other.defaultGeometryAttributeName;
|
123 |
this.hasEvaluators = other.hasEvaluators;
|
124 |
this.hasEmulators = other.hasEmulators;
|
125 |
this.rules = (DefaultFeatureRules) other.rules.getCopy();
|
126 |
this.defaultGeometryAttributeIndex = other.defaultGeometryAttributeIndex;
|
127 |
this.defaultTimeAttributeIndex = other.defaultTimeAttributeIndex;
|
128 |
this.hasOID = other.hasOID;
|
129 |
this.id = other.id; // XXX ???? copiar o no esto???? |
130 |
this.internalID = other.internalID;
|
131 |
} |
132 |
|
133 |
protected void intitalizeAddAttibute(DefaultFeatureAttributeDescriptor attr) { |
134 |
super.add(attr.getCopy());
|
135 |
} |
136 |
|
137 |
public String getId() { |
138 |
return this.id; |
139 |
} |
140 |
|
141 |
public Object get(String name) { |
142 |
FeatureAttributeDescriptor attr; |
143 |
Iterator iter = this.iterator(); |
144 |
while (iter.hasNext()) {
|
145 |
attr = (FeatureAttributeDescriptor) iter.next(); |
146 |
if (attr.getName().equalsIgnoreCase(name)) {
|
147 |
return attr;
|
148 |
} |
149 |
} |
150 |
return null; |
151 |
} |
152 |
|
153 |
public FeatureAttributeDescriptor getAttributeDescriptor(String name) { |
154 |
FeatureAttributeDescriptor attr; |
155 |
Iterator iter = this.iterator(); |
156 |
while (iter.hasNext()) {
|
157 |
attr = (FeatureAttributeDescriptor) iter.next(); |
158 |
if (attr.getName().equalsIgnoreCase(name)) {
|
159 |
return attr;
|
160 |
} |
161 |
} |
162 |
return null; |
163 |
} |
164 |
|
165 |
public FeatureAttributeDescriptor getAttributeDescriptor(int index) { |
166 |
return (FeatureAttributeDescriptor) super.get(index); |
167 |
} |
168 |
|
169 |
public FeatureType getCopy() {
|
170 |
return new DefaultFeatureType(this); |
171 |
} |
172 |
|
173 |
public Object clone() { |
174 |
return this.getCopy(); |
175 |
} |
176 |
|
177 |
public int getDefaultGeometryAttributeIndex() { |
178 |
return this.defaultGeometryAttributeIndex; |
179 |
} |
180 |
|
181 |
public String getDefaultGeometryAttributeName() { |
182 |
return this.defaultGeometryAttributeName; |
183 |
} |
184 |
|
185 |
public EditableFeatureType getEditable() {
|
186 |
return new DefaultEditableFeatureType(this); |
187 |
} |
188 |
|
189 |
public int getIndex(String name) { |
190 |
FeatureAttributeDescriptor attr; |
191 |
Iterator iter = this.iterator(); |
192 |
while (iter.hasNext()) {
|
193 |
attr = (FeatureAttributeDescriptor) iter.next(); |
194 |
if (attr.getName().equalsIgnoreCase(name)) {
|
195 |
return attr.getIndex();
|
196 |
} |
197 |
} |
198 |
return -1; |
199 |
} |
200 |
|
201 |
public FeatureRules getRules() {
|
202 |
return this.rules; |
203 |
} |
204 |
|
205 |
public boolean hasEvaluators() { |
206 |
return this.hasEvaluators; |
207 |
} |
208 |
|
209 |
public boolean hasEmulators() { |
210 |
return this.hasEmulators; |
211 |
} |
212 |
|
213 |
public List getSRSs() { |
214 |
if (this.srsList == null) { |
215 |
ArrayList tmp = new ArrayList(); |
216 |
Iterator iter = iterator();
|
217 |
Iterator tmpIter;
|
218 |
boolean allreadyHave;
|
219 |
IProjection tmpSRS; |
220 |
FeatureAttributeDescriptor attr; |
221 |
while (iter.hasNext()){
|
222 |
attr = (FeatureAttributeDescriptor) iter.next(); |
223 |
if (attr.getDataType().getType() == DataTypes.GEOMETRY
|
224 |
&& attr.getSRS() != null) {
|
225 |
allreadyHave = false;
|
226 |
tmpIter = tmp.iterator(); |
227 |
while (tmpIter.hasNext()) {
|
228 |
tmpSRS = (IProjection) tmpIter.next(); |
229 |
if (tmpSRS.getAbrev().equals(attr.getSRS().getAbrev())) {
|
230 |
allreadyHave = true;
|
231 |
break;
|
232 |
} |
233 |
} |
234 |
if (!allreadyHave) {
|
235 |
tmp.add(attr.getSRS()); |
236 |
} |
237 |
} |
238 |
} |
239 |
this.srsList = Collections.unmodifiableList(tmp); |
240 |
} |
241 |
return this.srsList; |
242 |
} |
243 |
|
244 |
public IProjection getDefaultSRS() {
|
245 |
if (this.getDefaultGeometryAttributeIndex() < 0) { |
246 |
return null; |
247 |
} |
248 |
return this.getAttributeDescriptor( |
249 |
this.getDefaultGeometryAttributeIndex()).getSRS();
|
250 |
} |
251 |
|
252 |
public void validateFeature(Feature feature, int mode) throws DataException { |
253 |
DefaultFeatureRules rules = (DefaultFeatureRules) this.getRules();
|
254 |
rules.validate(feature,mode); |
255 |
} |
256 |
|
257 |
public FeatureType getSubtype(String[] names) throws DataException { |
258 |
if( names==null || names.length <1) { |
259 |
return (FeatureType) this.clone(); |
260 |
} |
261 |
return new SubtypeFeatureType(this, names, null); |
262 |
} |
263 |
|
264 |
public FeatureType getSubtype(String[] names, String[] constantsNames) throws DataException { |
265 |
if( ArrayUtils.isEmpty(names) && ArrayUtils.isEmpty(constantsNames) ) {
|
266 |
return (FeatureType) this.clone(); |
267 |
} |
268 |
return new SubtypeFeatureType(this, names,constantsNames); |
269 |
} |
270 |
|
271 |
public boolean isSubtypeOf(FeatureType featureType) { |
272 |
return false; |
273 |
} |
274 |
|
275 |
|
276 |
|
277 |
class SubtypeFeatureType extends DefaultFeatureType { |
278 |
/**
|
279 |
*
|
280 |
*/
|
281 |
private static final long serialVersionUID = 6913732960073922540L; |
282 |
WeakReference parent;
|
283 |
|
284 |
SubtypeFeatureType(DefaultFeatureType parent, String[] names, String[] constantsNames) |
285 |
throws DataException {
|
286 |
super(parent, false); |
287 |
DefaultFeatureAttributeDescriptor attrcopy; |
288 |
DefaultFeatureAttributeDescriptor attr; |
289 |
List attrnames = null; |
290 |
|
291 |
// Copy attributes
|
292 |
if ( names != null && names.length > 0 ) { |
293 |
attrnames = new ArrayList(); |
294 |
attrnames.addAll(Arrays.asList(names));
|
295 |
if ( parent.hasEmulators ) {
|
296 |
for ( int i = 0; i < parent.size(); i++ ) { |
297 |
attr = (DefaultFeatureAttributeDescriptor) parent.getAttributeDescriptor(i); |
298 |
FeatureAttributeEmulator emulator = attr.getFeatureAttributeEmulator(); |
299 |
if ( emulator != null ) { |
300 |
String ss[] = emulator.getRequiredFieldNames(); |
301 |
if ( ss != null ) { |
302 |
attrnames.addAll(Arrays.asList(ss));
|
303 |
} |
304 |
} |
305 |
} |
306 |
} |
307 |
Iterator it = attrnames.iterator();
|
308 |
int i = 0; |
309 |
while ( it.hasNext() ) {
|
310 |
String name = (String) it.next(); |
311 |
attr = (DefaultFeatureAttributeDescriptor) parent |
312 |
.getAttributeDescriptor(name); |
313 |
if ( attr == null ) { |
314 |
throw new SubtypeFeatureTypeNameException(name, parent |
315 |
.getId()); |
316 |
} |
317 |
attrcopy = new DefaultFeatureAttributeDescriptor(attr);
|
318 |
this.add(attrcopy);
|
319 |
attrcopy.index = i++; |
320 |
} |
321 |
|
322 |
} else {
|
323 |
for ( int i = 0; i < parent.size(); i++ ) { |
324 |
attr = (DefaultFeatureAttributeDescriptor) parent.getAttributeDescriptor(i); |
325 |
attrcopy = new DefaultFeatureAttributeDescriptor(attr);
|
326 |
this.add(attrcopy);
|
327 |
attrcopy.index = i; |
328 |
} |
329 |
} |
330 |
|
331 |
// Set the consttants attributes.
|
332 |
if ( !ArrayUtils.isEmpty(constantsNames) ) {
|
333 |
for ( int i = 0; i < constantsNames.length; i++ ) { |
334 |
if ( attrnames != null && attrnames.contains(constantsNames[i]) ) { |
335 |
continue;
|
336 |
} |
337 |
attr = (DefaultFeatureAttributeDescriptor) this.getAttributeDescriptor(constantsNames[i]);
|
338 |
attr.setConstantValue(true);
|
339 |
} |
340 |
} |
341 |
|
342 |
// Add missing pk fiels if any
|
343 |
if ( !parent.hasOID() ) {
|
344 |
Iterator iter = parent.iterator();
|
345 |
while ( iter.hasNext() ) {
|
346 |
attr = (DefaultFeatureAttributeDescriptor) iter.next(); |
347 |
if ( attr.isPrimaryKey() && this.getIndex(attr.getName()) < 0 ) { |
348 |
attrcopy = new DefaultFeatureAttributeDescriptor(attr);
|
349 |
this.add(attrcopy);
|
350 |
attrcopy.index = this.size() - 1; |
351 |
} |
352 |
} |
353 |
} |
354 |
|
355 |
this.defaultGeometryAttributeIndex = this |
356 |
.getIndex(this.defaultGeometryAttributeName);
|
357 |
if ( this.defaultGeometryAttributeIndex < 0 ) { |
358 |
this.defaultGeometryAttributeName = null; |
359 |
} |
360 |
this.parent = new WeakReference(parent); |
361 |
} |
362 |
|
363 |
public FeatureType getSubtype(String[] names) throws DataException { |
364 |
return new SubtypeFeatureType((DefaultFeatureType) this.parent |
365 |
.get(), names, null);
|
366 |
} |
367 |
|
368 |
public boolean isSubtypeOf(FeatureType featureType) { |
369 |
if (featureType == null) { |
370 |
return false; |
371 |
} |
372 |
FeatureType parent = (FeatureType) this.parent.get();
|
373 |
return featureType.equals(parent);
|
374 |
} |
375 |
|
376 |
public EditableFeatureType getEditable() {
|
377 |
throw new UnsupportedOperationException(); |
378 |
} |
379 |
} |
380 |
|
381 |
public class SubtypeFeatureTypeNameException extends DataException { |
382 |
|
383 |
/**
|
384 |
*
|
385 |
*/
|
386 |
private static final long serialVersionUID = -4414242486723260101L; |
387 |
private final static String MESSAGE_FORMAT = "Attribute name '%(name)s' not found in type (%(type)s)."; |
388 |
private final static String MESSAGE_KEY = "_SubtypeFeatureTypeNameException"; |
389 |
|
390 |
public SubtypeFeatureTypeNameException(String name, String type) { |
391 |
super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
|
392 |
setValue("name", name);
|
393 |
setValue("type", type);
|
394 |
} |
395 |
} |
396 |
|
397 |
public boolean hasOID() { |
398 |
return hasOID;
|
399 |
} |
400 |
public String toString(){ |
401 |
StringBuffer s = new StringBuffer(); |
402 |
s.append(this.getId());
|
403 |
s.append(":[");
|
404 |
String attName;
|
405 |
for (int i = 0; i < size(); i++) { |
406 |
attName =((FeatureAttributeDescriptor)get(i)).getName().toString(); |
407 |
s.append(attName); |
408 |
if (i < size() - 1) { |
409 |
s.append(',');
|
410 |
} |
411 |
} |
412 |
s.append(']');
|
413 |
return s.toString();
|
414 |
} |
415 |
|
416 |
public Iterator iterator() { |
417 |
return getIterator(super.iterator()); |
418 |
} |
419 |
|
420 |
protected Iterator getIterator(Iterator iter) { |
421 |
return new DelegatedIterator(iter); |
422 |
} |
423 |
|
424 |
protected class DelegatedIterator implements Iterator { |
425 |
|
426 |
protected Iterator iterator; |
427 |
|
428 |
public DelegatedIterator(Iterator iter) { |
429 |
this.iterator = iter;
|
430 |
} |
431 |
|
432 |
public boolean hasNext() { |
433 |
return iterator.hasNext();
|
434 |
} |
435 |
|
436 |
public Object next() { |
437 |
return iterator.next();
|
438 |
} |
439 |
|
440 |
public void remove() { |
441 |
throw new UnsupportedOperationException(); |
442 |
} |
443 |
|
444 |
} |
445 |
|
446 |
public boolean allowAutomaticValues() { |
447 |
return this.allowAtomaticValues; |
448 |
} |
449 |
|
450 |
public FeatureAttributeDescriptor[] getAttributeDescriptors() { |
451 |
return (FeatureAttributeDescriptor[]) super |
452 |
.toArray(new FeatureAttributeDescriptor[super.size()]); |
453 |
} |
454 |
|
455 |
public FeatureAttributeDescriptor[] getPrimaryKey() { |
456 |
if (pk == null) { |
457 |
List pks = new ArrayList(); |
458 |
Iterator iter = super.iterator(); |
459 |
FeatureAttributeDescriptor attr; |
460 |
while (iter.hasNext()){
|
461 |
attr = (FeatureAttributeDescriptor) iter.next(); |
462 |
if (attr.isPrimaryKey()){
|
463 |
pks.add(attr); |
464 |
} |
465 |
} |
466 |
if( pks.isEmpty() ) {
|
467 |
pk = new FeatureAttributeDescriptor[0]; |
468 |
} else {
|
469 |
pk = (FeatureAttributeDescriptor[])pks.toArray(new FeatureAttributeDescriptor[pks.size()]); |
470 |
} |
471 |
} |
472 |
return pk;
|
473 |
} |
474 |
|
475 |
public FeatureAttributeDescriptor getDefaultGeometryAttribute() {
|
476 |
if (this.defaultGeometryAttributeIndex < 0) { |
477 |
return null; |
478 |
} |
479 |
return (FeatureAttributeDescriptor) super |
480 |
.get(this.defaultGeometryAttributeIndex);
|
481 |
} |
482 |
|
483 |
|
484 |
|
485 |
public boolean equals(Object other) { |
486 |
if (this == other) { |
487 |
return true; |
488 |
} |
489 |
if (!(other instanceof DefaultFeatureType)) { |
490 |
return false; |
491 |
} |
492 |
DefaultFeatureType otherType = (DefaultFeatureType) other; |
493 |
if (!this.id.equals(otherType.id)) { |
494 |
return false; |
495 |
} |
496 |
if (this.size() != otherType.size()) { |
497 |
return false; |
498 |
} |
499 |
FeatureAttributeDescriptor attr,attrOther; |
500 |
Iterator iter,iterOther;
|
501 |
iter = this.iterator();
|
502 |
iterOther = otherType.iterator(); |
503 |
while (iter.hasNext()) {
|
504 |
attr = (FeatureAttributeDescriptor) iter.next(); |
505 |
attrOther = (FeatureAttributeDescriptor) iterOther.next(); |
506 |
if (!attr.equals(attrOther)) {
|
507 |
return false; |
508 |
} |
509 |
} |
510 |
|
511 |
if (defaultGeometryAttributeName != otherType.defaultGeometryAttributeName) {
|
512 |
if (defaultGeometryAttributeName == null) { |
513 |
return false; |
514 |
} |
515 |
return defaultGeometryAttributeName
|
516 |
.equals(otherType.defaultGeometryAttributeName); |
517 |
|
518 |
} |
519 |
return true; |
520 |
|
521 |
} |
522 |
|
523 |
/**
|
524 |
* Start of DynClass interface implementation
|
525 |
* READONLY
|
526 |
*/
|
527 |
|
528 |
public DynField addDynField(String name) { |
529 |
throw new UnsupportedOperationException(); |
530 |
} |
531 |
|
532 |
public DynField getDeclaredDynField(String name) { |
533 |
return (DynField) getAttributeDescriptor(name);
|
534 |
} |
535 |
|
536 |
public DynField[] getDeclaredDynFields() { |
537 |
return (DynField[]) getAttributeDescriptors(); |
538 |
} |
539 |
|
540 |
public String getDescription() { |
541 |
return null; |
542 |
} |
543 |
|
544 |
public DynField getDynField(String name) { |
545 |
return (DynField) getAttributeDescriptor(name);
|
546 |
} |
547 |
|
548 |
public DynField[] getDynFields() { |
549 |
return (DynField[]) getAttributeDescriptors(); |
550 |
} |
551 |
|
552 |
public String getName() { |
553 |
return this.id + "_" + internalID; |
554 |
} |
555 |
|
556 |
public void removeDynField(String name) { |
557 |
throw new UnsupportedOperationException(); |
558 |
|
559 |
} |
560 |
|
561 |
public void addDynMethod(DynMethod dynMethod) { |
562 |
throw new UnsupportedOperationException(); |
563 |
|
564 |
} |
565 |
|
566 |
public void extend(DynClass dynClass) { |
567 |
throw new UnsupportedOperationException(); |
568 |
|
569 |
} |
570 |
|
571 |
public void extend(String dynClassName) { |
572 |
throw new UnsupportedOperationException(); |
573 |
|
574 |
} |
575 |
|
576 |
public void extend(String namespace, String dynClassName) { |
577 |
throw new UnsupportedOperationException(); |
578 |
|
579 |
} |
580 |
|
581 |
public DynMethod getDeclaredDynMethod(String name) |
582 |
throws DynMethodException {
|
583 |
return null; |
584 |
} |
585 |
|
586 |
public DynMethod[] getDeclaredDynMethods() throws DynMethodException { |
587 |
return null; |
588 |
} |
589 |
|
590 |
public DynMethod getDynMethod(String name) throws DynMethodException { |
591 |
return null; |
592 |
} |
593 |
|
594 |
public DynMethod getDynMethod(int code) throws DynMethodException { |
595 |
return null; |
596 |
} |
597 |
|
598 |
public DynMethod[] getDynMethods() throws DynMethodException { |
599 |
return null; |
600 |
} |
601 |
|
602 |
public DynClass[] getSuperDynClasses() { |
603 |
return null; |
604 |
} |
605 |
|
606 |
public boolean isInstance(DynObject dynObject) { |
607 |
if (dynObject.getDynClass().getName() == getName()) {
|
608 |
return true; |
609 |
} |
610 |
return false; |
611 |
} |
612 |
|
613 |
public DynObject newInstance() {
|
614 |
|
615 |
throw new UnsupportedOperationException(); |
616 |
} |
617 |
|
618 |
public void removeDynMethod(String name) { |
619 |
throw new UnsupportedOperationException(); |
620 |
|
621 |
} |
622 |
|
623 |
public DynField addDynFieldChoice(String name, int type, |
624 |
Object defaultValue, DynObjectValueItem[] values, |
625 |
boolean mandatory, boolean persistent) { |
626 |
throw new UnsupportedOperationException(); |
627 |
} |
628 |
|
629 |
public DynField addDynFieldRange(String name, int type, |
630 |
Object defaultValue, Object min, Object max, boolean mandatory, |
631 |
boolean persistent) {
|
632 |
throw new UnsupportedOperationException(); |
633 |
} |
634 |
|
635 |
public DynField addDynFieldSingle(String name, int type, |
636 |
Object defaultValue, boolean mandatory, boolean persistent) { |
637 |
throw new UnsupportedOperationException(); |
638 |
} |
639 |
|
640 |
public void validate(DynObject object) throws DynObjectValidateException { |
641 |
//FIXME: not sure it's the correct code
|
642 |
if (object instanceof Feature) { |
643 |
Feature fea = (Feature) object; |
644 |
if (fea.getType().equals(this)) { |
645 |
return;
|
646 |
} |
647 |
} |
648 |
throw new DynObjectValidateException(this.id); |
649 |
} |
650 |
|
651 |
public DynField addDynFieldLong(String name) { |
652 |
throw new UnsupportedOperationException(); |
653 |
} |
654 |
|
655 |
public DynField addDynFieldChoice(String name, int type, |
656 |
Object defaultValue, DynObjectValueItem[] values) { |
657 |
throw new UnsupportedOperationException(); |
658 |
} |
659 |
|
660 |
public DynField addDynFieldRange(String name, int type, |
661 |
Object defaultValue, Object min, Object max) { |
662 |
throw new UnsupportedOperationException(); |
663 |
} |
664 |
|
665 |
public DynField addDynFieldSingle(String name, int type, Object defaultValue) { |
666 |
throw new UnsupportedOperationException(); |
667 |
} |
668 |
|
669 |
public DynField addDynFieldString(String name) { |
670 |
throw new UnsupportedOperationException(); |
671 |
} |
672 |
|
673 |
public DynField addDynFieldInt(String name) { |
674 |
throw new UnsupportedOperationException(); |
675 |
} |
676 |
|
677 |
public DynField addDynFieldDouble(String name) { |
678 |
throw new UnsupportedOperationException(); |
679 |
} |
680 |
|
681 |
public DynField addDynFieldFloat(String name) { |
682 |
throw new UnsupportedOperationException(); |
683 |
} |
684 |
|
685 |
public DynField addDynFieldBoolean(String name) { |
686 |
throw new UnsupportedOperationException(); |
687 |
} |
688 |
|
689 |
public DynField addDynFieldList(String name) { |
690 |
throw new UnsupportedOperationException(); |
691 |
} |
692 |
|
693 |
public DynField addDynFieldMap(String name) { |
694 |
throw new UnsupportedOperationException(); |
695 |
} |
696 |
|
697 |
public DynField addDynFieldObject(String name) { |
698 |
throw new UnsupportedOperationException(); |
699 |
} |
700 |
|
701 |
public DynField addDynFieldSet(String name) { |
702 |
throw new UnsupportedOperationException(); |
703 |
} |
704 |
|
705 |
public DynField addDynFieldArray(String name) { |
706 |
throw new UnsupportedOperationException(); |
707 |
} |
708 |
|
709 |
public DynField addDynFieldDate(String name) { |
710 |
throw new UnsupportedOperationException(); |
711 |
} |
712 |
|
713 |
public void extend(DynStruct struct) { |
714 |
throw new UnsupportedOperationException(); |
715 |
} |
716 |
|
717 |
public String getFullName() { |
718 |
// TODO: usar el DynClassName
|
719 |
return this.id; |
720 |
} |
721 |
|
722 |
public String getNamespace() { |
723 |
return "DALFeature"; |
724 |
} |
725 |
|
726 |
public DynStruct[] getSuperDynStructs() { |
727 |
return null; |
728 |
} |
729 |
|
730 |
public void setDescription(String description) { |
731 |
throw new UnsupportedOperationException(); |
732 |
} |
733 |
|
734 |
public void setNamespace(String namespace) { |
735 |
throw new UnsupportedOperationException(); |
736 |
} |
737 |
|
738 |
public DynField addDynFieldFile(String name) { |
739 |
throw new UnsupportedOperationException(); |
740 |
} |
741 |
|
742 |
public DynField addDynFieldFolder(String name) { |
743 |
throw new UnsupportedOperationException(); |
744 |
} |
745 |
|
746 |
public DynField addDynFieldURL(String name) { |
747 |
throw new UnsupportedOperationException(); |
748 |
} |
749 |
|
750 |
public DynField addDynFieldURI(String name) { |
751 |
throw new UnsupportedOperationException(); |
752 |
} |
753 |
|
754 |
public boolean isExtendable(DynStruct dynStruct) { |
755 |
return false; |
756 |
} |
757 |
|
758 |
public void extend(DynStruct[] structs) { |
759 |
// TODO Auto-generated method stub
|
760 |
|
761 |
} |
762 |
|
763 |
public void remove(DynStruct superDynStruct) { |
764 |
// TODO Auto-generated method stub
|
765 |
|
766 |
} |
767 |
|
768 |
public void removeAll(DynStruct[] superDynStruct) { |
769 |
// TODO Auto-generated method stub
|
770 |
|
771 |
} |
772 |
|
773 |
public FeatureAttributeDescriptor getDefaultTimeAttribute() {
|
774 |
if (this.defaultTimeAttributeIndex < 0) { |
775 |
return null; |
776 |
} |
777 |
return (FeatureAttributeDescriptor) super |
778 |
.get(this.defaultTimeAttributeIndex);
|
779 |
} |
780 |
} |