Revision 44411 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/DefaultExportAttribute.java

View differences:

DefaultExportAttribute.java
7 7

  
8 8
import org.gvsig.export.ExportAttributes;
9 9
import org.gvsig.export.ExportAttributes.ExportAttribute;
10
import org.gvsig.export.spi.AbstractExportParameters;
10 11
import org.gvsig.export.spi.AttributeNamesTranslator;
12
import org.gvsig.export.spi.ExportServiceFactory;
13
import org.gvsig.expressionevaluator.Expression;
11 14
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
15
import org.gvsig.tools.ToolsLocator;
16
import org.gvsig.tools.dynobject.DynStruct;
17
import org.gvsig.tools.persistence.PersistenceManager;
18
import org.gvsig.tools.persistence.PersistentState;
19
import org.gvsig.tools.persistence.exception.PersistenceException;
12 20

  
13 21
public class DefaultExportAttribute implements ExportAttributes.ExportAttribute {
14 22

  
15
    private final FeatureAttributeDescriptor fad;
23
    private FeatureAttributeDescriptor fad;
16 24
    private String newName = null;
17 25
    private int newDataType;
18 26
    private int size;
......
21 29

  
22 30
    public DefaultExportAttribute(FeatureAttributeDescriptor fad) {
23 31
        this.fad = fad;
32
    }
24 33

  
34
    public DefaultExportAttribute() {
35

  
25 36
    }
26 37

  
27 38
    @Override
......
84 95

  
85 96
    @Override
86 97
    public ExportAttribute clone() throws CloneNotSupportedException {
87
       DefaultExportAttribute clone = new DefaultExportAttribute((FeatureAttributeDescriptor) fad.clone());
88
       clone.setExported(this.exported);
89
       clone.setNewName(this.newName);
90
       clone.setNewType(this.newDataType);
91
       clone.setSize(this.size);
92
       return clone;
98
        DefaultExportAttribute clone = new DefaultExportAttribute((FeatureAttributeDescriptor) fad.clone());
99
        clone.setExported(this.exported);
100
        clone.setNewName(this.newName);
101
        clone.setNewType(this.newDataType);
102
        clone.setSize(this.size);
103
        return clone;
93 104
    }
94
    
105

  
106
    public static void registerPersistence() {
107
        PersistenceManager manager = ToolsLocator.getPersistenceManager();
108
        if (manager.getDefinition("ExportAttribute") == null) {
109
            DynStruct definition = manager.addDefinition(DefaultExportAttribute.class,
110
                    "ExportAttribute", "ExportAttribute persistence definition", null, null);
111
            definition.addDynFieldObject("fad").setClassOfValue(FeatureAttributeDescriptor.class);
112
            definition.addDynFieldString("newName").setMandatory(false);
113
            definition.addDynFieldInt("newDataType").setMandatory(false);
114
            definition.addDynFieldInt("size").setMandatory(false);
115
            definition.addDynFieldBoolean("exported").setMandatory(false);
116
        }
117
    }
118

  
119
    public void saveToState(PersistentState state) throws PersistenceException {
120
        state.set("fad", this.fad);
121
        state.set("newName", this.newName);
122
        state.set("newDataType", this.newDataType);
123
        state.set("size", this.size);
124
        state.set("exported", this.exported);
125

  
126
    }
127

  
128
    public void loadFromState(PersistentState state) throws PersistenceException {
129
        FeatureAttributeDescriptor stateFad = (FeatureAttributeDescriptor) state.get("fad");
130
        this.fad = stateFad;
131
        this.newName = state.getString("newName");
132
        this.newDataType = state.getInt("newDataType");
133
        this.size = state.getInt("size");
134
        this.exported = state.getBoolean("exported");
135
    }
136

  
95 137
}

Also available in: Unified diff