Revision 42027 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/DefaultEditableFeatureType.java
DefaultEditableFeatureType.java | ||
---|---|---|
26 | 26 |
import java.text.MessageFormat; |
27 | 27 |
|
28 | 28 |
import java.util.Iterator; |
29 |
import java.util.zip.CRC32; |
|
29 | 30 |
|
30 | 31 |
import org.gvsig.fmap.dal.DataTypes; |
31 | 32 |
import org.gvsig.fmap.dal.exception.DataListException; |
... | ... | |
139 | 140 |
return source; |
140 | 141 |
} |
141 | 142 |
|
142 |
public FeatureType getNotEditableCopy() { |
|
143 |
private long getCRC() { |
|
144 |
StringBuffer buffer = new StringBuffer(); |
|
145 |
for( int i=0; i< this.size(); i++) { |
|
146 |
FeatureAttributeDescriptor x = this.getAttributeDescriptor(i); |
|
147 |
buffer.append(x.getName()); |
|
148 |
buffer.append(x.getDataTypeName()); |
|
149 |
buffer.append(x.getSize()); |
|
150 |
} |
|
151 |
CRC32 crc = new CRC32(); |
|
152 |
byte[] data = buffer.toString().getBytes(); |
|
153 |
crc.update(data); |
|
154 |
return crc.getValue(); |
|
155 |
} |
|
156 |
|
|
157 |
|
|
158 |
public FeatureType getNotEditableCopy() { |
|
143 | 159 |
this.fixAll(); |
144 | 160 |
DefaultFeatureType copy = new DefaultFeatureType(this, false); |
145 | 161 |
Iterator iter = this.iterator(); |
... | ... | |
259 | 275 |
if (this.defaultGeometryAttributeName != null) { |
260 | 276 |
this.defaultGeometryAttributeIndex = this.getIndex(this.defaultGeometryAttributeName); |
261 | 277 |
} |
278 |
this.internalID = Long.toHexString(this.getCRC()); |
|
262 | 279 |
} |
263 | 280 |
|
264 | 281 |
public void checkIntegrity() throws DataListException { |
Also available in: Unified diff