Revision 46093

View differences:

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/CSVStoreParameters.java
284 284
        }
285 285
        return gsubtype;
286 286
    }
287
    
288
    public static boolean isBlankOrDefaultLocale(DynObject dynobj) {
289
        String s = (String) dynobj.getDynValue(LOCALE);
290
        if (StringUtils.isBlank(s)) {
291
            return true;
292
        }
293
        return StringUtils.equalsIgnoreCase("DEFAULT",s.trim());
294
    }
287 295

  
288 296
    public static Locale getLocale(DynObject dynobj) {
289 297
        try {
290 298
            String s = (String) dynobj.getDynValue(LOCALE);
291
            if ( s.trim().length() == 0 ) {
299
            if ( StringUtils.isBlank(s) ) {
292 300
                return null;
293 301
            }
294
            if ( "DEFAULT".equalsIgnoreCase(s.trim()) ) {
302
            if (StringUtils.equalsIgnoreCase("DEFAULT",s.trim())) {
295 303
                return Locale.getDefault();
296 304
            }
297 305
            Locale locale;
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/CSVUtils.java
310 310
                if( fType.getDefaultGeometryAttributeName() == null ) {
311 311
                    fType.setDefaultGeometryAttributeName(fieldType.name);
312 312
                }
313
            } 
314
            Locale locale = null;
315
            if (fieldType.type == DataTypes.TIMESTAMP ) {
316
                if(!CSVStoreParameters.isBlankOrDefaultLocale(parameters)){
317
                    locale = CSVStoreParameters.getLocale(parameters);
318
                }
319
            } else {
320
                locale = CSVStoreParameters.getLocale(parameters);
313 321
            }
314
            Locale locale = CSVStoreParameters.getLocale(parameters);
315 322
            fad.setLocale(locale);
316 323
            for (Map.Entry<String, String> entry : fieldType.assignments.entrySet()) {
317 324
                try {
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/DefaultFeatureAttributeDescriptor.java
527 527
                context.setGeometryType(this.getGeomType());
528 528
                context.setMode(GeometryCoercionContext.MODE_ONERROR_DONTCONVERT);
529 529
                this.coerceContext = context;
530
            } else if (this.getType() == DataTypes.TIMESTAMP) {
531
//                if(this.locale != null){
532
                    this.coerceContext = DataTypeUtils.coerceContextLocale(
533
                            this.locale
534
                    );
535
//                }
530 536
            } else {
531 537
                this.coerceContext = DataTypeUtils.coerceContextLocale(
532 538
                        this.getLocale()
......
2048 2054
                break;
2049 2055
            case DataTypes.FLOAT:
2050 2056
            case DataTypes.DOUBLE:
2051
                builder.set("locale", this.getLocale());
2057
                if(this.locale != null){
2058
                    builder.set("locale", this.getLocale());
2059
                }
2052 2060
                break;
2053 2061
            case DataTypes.DECIMAL:
2054 2062
                builder.set("precision", this.precision);
2055 2063
                builder.set("scale", this.scale);
2056 2064
                builder.set("roundMode", this.getRoundMode());
2057
                builder.set("locale", this.getLocale());
2065
                if(this.locale != null){
2066
                    builder.set("locale", this.getLocale());
2067
                }
2058 2068
                break;
2059 2069
            case DataTypes.DATE:
2060 2070
            case DataTypes.TIME:
2061 2071
            case DataTypes.TIMESTAMP:
2062
                builder.set("locale", this.getLocale());
2072
                if(this.locale != null){
2073
                    builder.set("locale", this.getLocale());
2074
                }
2063 2075
                break;
2064 2076
            case DataTypes.GEOMETRY:
2065 2077
                IProjection proj = this.getSRS();
......
2232 2244

  
2233 2245
        builder.add("relationType", this.relationType);
2234 2246
        builder.add("displaySize", this.displaySize);
2235
        builder.add("locale", this.getLocale());
2247
        if(this.locale == null){ //!this.hasLocale()
2248
            builder.addNull("locale");
2249
        } else {
2250
            builder.add("locale", this.getLocale());
2251
        }
2236 2252
        builder.add("expression", this.getFeatureAttributeEmulator());
2237 2253
        if (this.isForeingKey()) {
2238 2254
            builder.add("fk", this.isForeingKey());

Also available in: Unified diff