Revision 44801 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/java/org/gvsig/export/impl/service/DefaultExportAttributes.java
DefaultExportAttributes.java | ||
---|---|---|
12 | 12 |
import org.gvsig.export.ExportAttributes; |
13 | 13 |
import org.gvsig.export.spi.AttributeNamesTranslator; |
14 | 14 |
import org.gvsig.export.spi.DummyAttributeNamesTranslator; |
15 |
import org.gvsig.fmap.dal.DALLocator; |
|
15 | 16 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
16 | 17 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
17 | 18 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
... | ... | |
46 | 47 |
ArrayList attrs = new ArrayList(); |
47 | 48 |
if (ftype != null) { |
48 | 49 |
for (FeatureAttributeDescriptor fad : ftype) { |
49 |
DefaultExportAttribute exportAttribute = new DefaultExportAttribute(fad); |
|
50 |
DefaultExportAttribute exportAttribute = new DefaultExportAttribute(fad.getCopy());
|
|
50 | 51 |
String newName = this.getNamesTranslator().getNameSuggestion(fad.getName()); |
51 | 52 |
exportAttribute.setNewName(newName); |
52 | 53 |
exportAttribute.setNewType(fad.getDataType().getType()); |
... | ... | |
66 | 67 |
|
67 | 68 |
if (query!=null && query.getExtraColumn().getColumns()!=null && !query.getExtraColumn().getColumns().isEmpty() ) { |
68 | 69 |
for (FeatureAttributeDescriptor fad : query.getExtraColumn().getColumns()) { |
69 |
DefaultExportAttribute exportAttribute = new DefaultExportAttribute(fad); |
|
70 |
DefaultExportAttribute exportAttribute = new DefaultExportAttribute(fad.getCopy());
|
|
70 | 71 |
String newName = this.getNamesTranslator().getNameSuggestion(fad.getName()); |
71 | 72 |
exportAttribute.setNewName(newName); |
72 | 73 |
exportAttribute.setNewType(fad.getDataType().getType()); |
... | ... | |
173 | 174 |
eAttr.setSize(size); |
174 | 175 |
} |
175 | 176 |
if (this.query!=null && this.query.getExtraColumn().getColumns()!=null && !this.query.getExtraColumn().getColumns().isEmpty()) { |
176 |
for (EditableFeatureAttributeDescriptor attrExtra : this.query.getExtraColumn().getColumns()) { |
|
177 |
//FeatureAttributeDescriptor attr = targetFeatureType.getAttributeDescriptor(attrSource.getName()); |
|
177 |
for (EditableFeatureAttributeDescriptor attrExtraOriginal : this.query.getExtraColumn().getColumns()) { |
|
178 |
EditableFeatureAttributeDescriptor attrExtra = DALLocator.getDataManager().createFeatureAttributeDescriptor(); |
|
179 |
attrExtra.copyFrom(attrExtraOriginal); |
|
178 | 180 |
String name = attrExtra.getName(); |
179 | 181 |
ExportAttribute exportAttr = this.getExportAttribute(name); |
180 | 182 |
if (!exportAttr.isExported()) { |
181 | 183 |
//targetFeatureType.remove(name); |
182 | 184 |
continue; |
183 |
} |
|
184 |
//EditableFeatureAttributeDescriptor eAttr = targetFeatureType.getEditableAttributeDescriptor(name); |
|
185 |
// if( eAttr.isComputed() && !exportAttr.isComputed() ) { |
|
186 |
// eAttr.setFeatureAttributeEmulator((FeatureAttributeEmulator)null); |
|
187 |
// } |
|
185 |
} |
|
188 | 186 |
if (this.getTargetName(name) == null && name != null && !this.getTargetName(name).equals(name)) { |
189 | 187 |
attrExtra.setName(this.getTargetName(name)); |
190 | 188 |
} |
... | ... | |
195 | 193 |
} |
196 | 194 |
int size = exportAttr.getSize(); |
197 | 195 |
attrExtra.setSize(size); |
196 |
if (!exportAttr.isComputed()) { |
|
197 |
attrExtra.setFeatureAttributeEmulator((FeatureAttributeEmulator)null); |
|
198 |
if (size==0) { |
|
199 |
attrExtra.setSize(50);//TODO default value para valor 0 de size |
|
200 |
} |
|
201 |
} |
|
202 |
EditableFeatureAttributeDescriptor addedAttributeDescriptor = |
|
203 |
targetFeatureType.add(attrExtra.getName(), attrExtra.getType()); |
|
204 |
addedAttributeDescriptor.copyFrom(attrExtra); |
|
198 | 205 |
} |
199 | 206 |
} |
200 | 207 |
|
Also available in: Unified diff