Revision 39125 branches/v2_0_0_prep/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/project/documents/table/TableOperations.java

View differences:

TableOperations.java
49 49
import org.gvsig.fmap.dal.feature.FeatureSet;
50 50
import org.gvsig.fmap.dal.feature.FeatureStore;
51 51
import org.gvsig.fmap.dal.feature.FeatureType;
52
import org.gvsig.fmap.dal.feature.exception.StoreUpdateFeatureTypeException;
52 53
import org.gvsig.fmap.mapcontrol.dal.feature.swing.FeatureTable;
53 54
import org.gvsig.fmap.mapcontrol.dal.feature.swing.table.FeatureTableModel;
54 55
import org.gvsig.i18n.Messages;
......
299 300
     * @param name
300 301
     * @param newName
301 302
     */
302
    private void renameAttribute(FeatureStore fs, String name, String newName) {
303
    private static void renameAttribute(FeatureStore fs, String name, String newName) {
303 304

  
304 305
        try {
305 306
            
......
337 338
        }
338 339

  
339 340
    }
341
    
342
    /**
343
     * Renames field in feature store
344
     * 
345
     * @param fs
346
     * @param oldname
347
     * @param newname
348
     * @return 
349
     * @throws DataException
350
     */
351
    public static void renameColumn(FeatureStore fs,
352
        String oldname, String newname) throws DataException {
353
        
354
        FeatureType _ft = fs.getDefaultFeatureType();
355
        if (_ft.getIndex(newname) != -1) {
356
            throw new StoreUpdateFeatureTypeException(
357
                new Exception("Attribute name already existed."),
358
                fs.getName());
359
        }
360
        renameAttribute(fs, oldname, newname);
361
        fs.finishEditing();
362
    }
340 363

  
341 364
}

Also available in: Unified diff