Revision 43739 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 | ||
---|---|---|
42 | 42 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
43 | 43 |
import org.gvsig.fmap.dal.feature.FeatureAttributeEmulator; |
44 | 44 |
import org.gvsig.fmap.dal.feature.FeatureRules; |
45 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
45 | 46 |
import org.gvsig.fmap.dal.feature.FeatureType; |
46 | 47 |
import org.gvsig.tools.dynobject.DynClass; |
47 | 48 |
import org.gvsig.tools.dynobject.DynField; |
... | ... | |
73 | 74 |
protected String internalID = null; |
74 | 75 |
|
75 | 76 |
private List srsList = null; |
77 |
private WeakReference storeRef; |
|
76 | 78 |
|
77 |
protected DefaultFeatureType(String id) { |
|
78 |
if( StringUtils.isEmpty(id) ) { |
|
79 |
id = "default"; |
|
80 |
} |
|
81 |
this.internalID = Integer.toHexString((int) (Math.random()*100000)).toUpperCase(); |
|
82 |
this.id = id; |
|
83 |
this.rules = new DefaultFeatureRules(); |
|
84 |
this.hasEvaluators = false; |
|
85 |
this.hasEmulators = false; |
|
86 |
this.defaultGeometryAttributeName = null; |
|
87 |
this.defaultGeometryAttributeIndex = -1; |
|
88 |
this.defaultTimeAttributeIndex = -1; |
|
89 |
this.allowAtomaticValues = false; |
|
79 |
protected DefaultFeatureType(FeatureStore store, String id) { |
|
80 |
if (StringUtils.isEmpty(id)) { |
|
81 |
id = "default"; |
|
82 |
} |
|
83 |
if( store == null ) { |
|
84 |
this.storeRef = null; |
|
85 |
} else { |
|
86 |
this.storeRef = new WeakReference(store); |
|
87 |
} |
|
88 |
this.internalID = Integer.toHexString((int) (Math.random() * 100000)).toUpperCase(); |
|
89 |
this.id = id; |
|
90 |
this.rules = new DefaultFeatureRules(); |
|
91 |
this.hasEvaluators = false; |
|
92 |
this.hasEmulators = false; |
|
93 |
this.defaultGeometryAttributeName = null; |
|
94 |
this.defaultGeometryAttributeIndex = -1; |
|
95 |
this.defaultTimeAttributeIndex = -1; |
|
96 |
this.allowAtomaticValues = false; |
|
90 | 97 |
} |
91 | 98 |
|
92 |
protected DefaultFeatureType() { |
|
93 |
this((String)null); |
|
99 |
protected DefaultFeatureType(FeatureStore store) {
|
|
100 |
this(store, (String)null);
|
|
94 | 101 |
} |
95 | 102 |
|
96 | 103 |
protected DefaultFeatureType(DefaultFeatureType other) { |
97 |
this((String)null); |
|
104 |
this(other.getStore(), (String)null);
|
|
98 | 105 |
initialize(other, true); |
99 | 106 |
} |
100 | 107 |
|
101 | 108 |
protected DefaultFeatureType(DefaultFeatureType other, |
102 | 109 |
boolean copyAttributes) { |
103 |
this((String)null); |
|
110 |
this(other.getStore(), (String)null);
|
|
104 | 111 |
initialize(other, copyAttributes); |
105 | 112 |
} |
106 | 113 |
|
... | ... | |
835 | 842 |
crc.update(data); |
836 | 843 |
return crc.getValue(); |
837 | 844 |
} |
845 |
|
|
846 |
@Override |
|
847 |
public FeatureStore getStore() { |
|
848 |
if( this.storeRef == null ) { |
|
849 |
return null; |
|
850 |
} |
|
851 |
return (FeatureStore) this.storeRef.get(); |
|
852 |
} |
|
853 |
|
|
838 | 854 |
} |
Also available in: Unified diff