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