Revision 45359 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/csv/CSVStoreProvider.java

View differences:

CSVStoreProvider.java
127 127
    private boolean need_calculate_envelope = false;
128 128
    private final SimpleTaskStatus taskStatus;
129 129
    private final CSVFeatureWriter writer;
130
    private FeatureType featureType;
130 131

  
131 132
    public CSVStoreProvider(CSVStoreParameters parameters,
132 133
            DataStoreProviderServices storeServices) throws InitializeException {
......
694 695
                            // ya que pueden requerir campos que aun no se han definido.
695 696
                            break;
696 697
                        default:
697
                            fad.set(entry.getKey(), entry.getValue());
698
                    }
698
                                fad.set(entry.getKey(), entry.getValue());
699
                            }
699 700
                } catch (Exception ex) {
700 701
                    LOGGER.warn("Can't set property '"+entry.getKey()+"' of '"+fad.getName()+"'.", ex);
701 702
                }
......
1015 1016
            // Initialize the feature types
1016 1017
            EditableFeatureType edftype = this.getFeatureType(headers, detectedTypes);
1017 1018
            FeatureType ftype = edftype.getNotEditableCopy();
1018
            List<FeatureType> ftypes = new ArrayList<>();
1019
            ftypes.add(ftype);
1020
            store.setFeatureTypes(ftypes, ftype);
1019
            this.setFeatureType(ftype);
1021 1020

  
1022 1021
            Coercion coercion[] = new Coercion[ftype.size()];
1023 1022
            CoercionContext coercionContext[] = new CoercionContext[ftype.size()];
......
1112 1111
            // Volvemos a asignar al store el featuretype, ya que puede
1113 1112
            // haber cambiado.
1114 1113
            ftype = edftype.getNotEditableCopy();
1115
            ftypes = new ArrayList<>();
1116
            ftypes.add(ftype);
1117
            store.setFeatureTypes(ftypes, ftype);
1114
            this.setFeatureType(ftype);
1115
            
1118 1116

  
1119 1117
            taskStatus.terminate();
1120 1118
        } catch (Throwable ex) {
......
1179 1177
        }
1180 1178
        return types;
1181 1179
    }
1180
    
1181
    @Override
1182
    public void fixFeatureTypeFromParameters() {
1183
        String param_types_def = CSVStoreParameters.getRawFieldTypes(this.getParameters());
1184
        String[] pointDimensionNames = CSVStoreParameters.getPointDimensionNames(this.getParameters());
1185
        String geometry_column = CSVStoreParameters.getGeometryColumn(this.getParameters());
1186
        if (StringUtils.isNotBlank(param_types_def) || 
1187
                pointDimensionNames != null || 
1188
                !StringUtils.isBlank(geometry_column)) {
1189
            this.setFeatureType(featureType);
1190
        }
1191
    }
1192
    
1193
    private void setFeatureType(FeatureType ftype) {
1194
        FeatureStoreProviderServices store = this.getStoreServices();
1195
        List<FeatureType> ftypes = new ArrayList<>();
1196
        ftypes.add(ftype);
1197
        this.featureType = ftype;
1198
        store.setFeatureTypes(ftypes, ftype);
1199
    }
1182 1200

  
1183 1201
}

Also available in: Unified diff