Revision 44374 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
DefaultFeatureType.java | ||
---|---|---|
327 | 327 |
rules.validate(feature, mode); |
328 | 328 |
} |
329 | 329 |
|
330 |
public FeatureType getSubtype() throws DataException { |
|
331 |
return new SubtypeFeatureType(this, null, null, true); |
|
332 |
} |
|
333 |
|
|
330 | 334 |
public FeatureType getSubtype(String[] names) throws DataException { |
331 |
if (names == null || names.length < 1) { |
|
332 |
return (FeatureType) this.clone(); |
|
333 |
} |
|
334 |
return new SubtypeFeatureType(this, names, null); |
|
335 |
return this.getSubtype(names, null, true); |
|
335 | 336 |
} |
336 | 337 |
|
337 | 338 |
public FeatureType getSubtype(String[] names, String[] constantsNames) throws DataException { |
339 |
return this.getSubtype(names, constantsNames, true); |
|
340 |
} |
|
341 |
|
|
342 |
public FeatureType getSubtype(String[] names, String[] constantsNames, boolean includePk) throws DataException { |
|
338 | 343 |
if (ArrayUtils.isEmpty(names) && ArrayUtils.isEmpty(constantsNames)) { |
339 | 344 |
return (FeatureType) this.clone(); |
340 | 345 |
} |
341 |
return new SubtypeFeatureType(this, names, constantsNames); |
|
346 |
return new SubtypeFeatureType(this, names, constantsNames,includePk);
|
|
342 | 347 |
} |
343 | 348 |
|
344 |
public FeatureType getSubtype() throws DataException { |
|
345 |
return new SubtypeFeatureType(this, null, null); |
|
346 |
} |
|
347 |
|
|
348 | 349 |
public boolean isSubtypeOf(FeatureType featureType) { |
349 | 350 |
return false; |
350 | 351 |
} |
... | ... | |
382 | 383 |
private static final long serialVersionUID = 6913732960073922540L; |
383 | 384 |
WeakReference parent; |
384 | 385 |
|
385 |
SubtypeFeatureType(DefaultFeatureType parent, String[] names, String[] constantsNames) |
|
386 |
SubtypeFeatureType(DefaultFeatureType parent, String[] names, String[] constantsNames, boolean includePk)
|
|
386 | 387 |
throws DataException { |
387 | 388 |
super(parent, false); |
388 | 389 |
DefaultFeatureAttributeDescriptor attrcopy; |
... | ... | |
411 | 412 |
} |
412 | 413 |
} |
413 | 414 |
// Add missing pk fiels |
414 |
if (!parent.hasOID()) { |
|
415 |
if (includePk && !parent.hasOID()) {
|
|
415 | 416 |
for (FeatureAttributeDescriptor attrdesc : parent) { |
416 | 417 |
if (attrdesc.isPrimaryKey()) { |
417 | 418 |
attrnames.add(attrdesc.getName()); |
... | ... | |
453 | 454 |
this.parent = new WeakReference(parent); |
454 | 455 |
} |
455 | 456 |
|
456 |
public FeatureType getSubtype(String[] names) throws DataException { |
|
457 |
public FeatureType getSubtype(String[] names, boolean includePk) throws DataException {
|
|
457 | 458 |
return new SubtypeFeatureType((DefaultFeatureType) this.parent |
458 |
.get(), names, null); |
|
459 |
.get(), names, null, includePk);
|
|
459 | 460 |
} |
460 | 461 |
|
461 | 462 |
public boolean isSubtypeOf(FeatureType featureType) { |
Also available in: Unified diff