Revision 45387 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.dbf/src/main/java/org/gvsig/fmap/dal/store/dbf/DBFStoreProvider.java

View differences:

DBFStoreProvider.java
29 29
import java.util.ArrayList;
30 30
import java.util.Iterator;
31 31
import java.util.List;
32
import java.util.logging.Level;
32 33

  
33 34
import org.apache.commons.io.FileUtils;
35
import org.apache.commons.lang3.StringUtils;
34 36

  
35 37
import org.gvsig.fmap.dal.DALLocator;
36 38
import org.gvsig.fmap.dal.DataManager;
......
62 64
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
63 65
import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
64 66
import org.gvsig.fmap.dal.feature.spi.FeatureSetProvider;
67
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices;
65 68
import org.gvsig.fmap.dal.resource.ResourceAction;
66 69
import org.gvsig.fmap.dal.resource.exception.ResourceException;
67 70
import org.gvsig.fmap.dal.resource.exception.ResourceExecuteException;
......
112 115

  
113 116
    private boolean allowDuplicatedFieldNames;
114 117
    private FilteredLogger logger;
118
    
119
    protected FeatureType featureType;
115 120

  
121

  
116 122
    protected static void registerMetadataDefinition() throws MetadataException {
117 123
        MetadataManager manager = MetadataLocator.getMetadataManager();
118 124
        if (manager.getDefinition(METADATA_DEFINITION_NAME) == null) {
......
361 367

  
362 368
    protected void initFeatureType() throws InitializeException {
363 369
        FeatureType defaultType = this.getTheFeatureType().getNotEditableCopy();
364
        List types = new ArrayList(1);
365
        types.add(defaultType);
366
        getStoreServices().setFeatureTypes(types, defaultType);
370
        this.setFeatureType(defaultType);
367 371
    }
368 372

  
373
    private void setFeatureType(FeatureType ftype) {
374
        FeatureStoreProviderServices store = this.getStoreServices();
375
        List<FeatureType> ftypes = new ArrayList<>();
376
        ftypes.add(ftype);
377
        this.featureType = ftype;
378
        store.setFeatureTypes(ftypes, ftype);
379
    }
380
        
369 381
    protected EditableFeatureType getTheFeatureType() throws InitializeException {
370 382
        try {
371 383
            this.open();
......
769 781
    public ResourceProvider getResource() {
770 782
        return dbfResource;
771 783
    }
784
    
785
    @Override
786
    public void fixFeatureTypeFromParameters() {
787
        FeatureStoreProviderServices store = this.getStoreServices();
788
        try {
789
            int sizeWithoutComputed = 0;
790
            for (FeatureAttributeDescriptor featureAttributeDescriptor : store.getDefaultFeatureType()) {
791
                if (featureAttributeDescriptor.isComputed()) {
792
                    continue;
793
                }
794
                sizeWithoutComputed +=1;
795
            }
796
            if(this.featureType.size()!=sizeWithoutComputed) {
797
                this.setFeatureType(featureType);
798
            }
799
        } catch (DataException ex) {
800
            
801
        }
802
    }
772 803

  
773 804
}

Also available in: Unified diff