Revision 47323

View differences:

tags/org.gvsig.desktop-2.0.421/license.txt
1
gvSIG. Desktop Geographic Information System.
2

  
3
Copyright (C) 2007-2023 gvSIG Association.
4

  
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; either version 3
8
of the License, or (at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14

  
15
 You should have received a copy of the GNU General Public License 
16
along with this program. If not, see <https://www.gnu.org/licenses/>. 
17

  
18
For any additional information, do not hesitate to contact us
19
at info AT gvsig.com, or visit our website www.gvsig.com.
tags/org.gvsig.desktop-2.0.421/org.gvsig.desktop.library/org.gvsig.exportto/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4
  <modelVersion>4.0.0</modelVersion>
5
  <artifactId>org.gvsig.exportto</artifactId>
6
  <packaging>pom</packaging>
7
  <name>${project.artifactId}</name>
8
  <description>Exportto project</description>
9
  
10
  <parent>
11
    <groupId>org.gvsig</groupId>
12
    <artifactId>org.gvsig.desktop.library</artifactId>
13
    <version>2.0.421</version>
14
  </parent>
15

  
16
  <dependencies>
17
    <dependency>
18
      <groupId>org.gvsig</groupId>
19
      <artifactId>org.gvsig.tools.lib</artifactId>
20
    </dependency>
21
    <dependency>
22
      <groupId>org.gvsig</groupId>
23
      <artifactId>org.gvsig.tools.lib</artifactId>
24
      <type>test-jar</type>
25
      <scope>test</scope>
26
    </dependency>
27
  </dependencies>
28
  
29
  <modules>
30
    <module>org.gvsig.exportto.lib</module>
31
    <module>org.gvsig.exportto.swing</module>
32
  </modules>
33
</project>
34

  
35

  
36

  
0 37

  
tags/org.gvsig.desktop-2.0.421/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/resources/filters.txt
1
point_geometries_only=
2
curve_geometries_only=
3
surface_geometries_only=
0 4

  
tags/org.gvsig.desktop-2.0.421/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.export.ExportLibrary
tags/org.gvsig.desktop-2.0.421/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/export/ExportLocator.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.export;
25

  
26
import org.gvsig.export.spi.ExportServiceManager;
27
import org.gvsig.tools.locator.BaseLocator;
28
import org.gvsig.tools.locator.Locator;
29
import org.gvsig.tools.locator.LocatorException;
30

  
31
/**
32
 * This locator is the entry point for the Exportto library, providing
33
 * access to all Exportto services through the {@link ExportManager} .
34
 * 
35
 * @author gvSIG team
36
 * @version $Id$
37
 */
38
public class ExportLocator extends BaseLocator {
39

  
40
    public static final String MANAGER_NAME = "Export.manager";
41
    public static final String MANAGER_DESCRIPTION = "Export Manager";
42
    
43
    public static final String ENTRIES_MANAGER_NAME = "Export.entriesManager";
44
    public static final String ENTRIES_MANAGER_DESCRIPTION = "Export Entries Manager";
45
    
46
    public static final String SERVICE_MANAGER_NAME = "Export.serviceManager";
47
    public static final String SERVICE_MANAGER_DESCRIPTION = "Export Service Manager";
48

  
49
    private static final String LOCATOR_NAME = "Export.locator";
50

  
51
    /**
52
     * Unique instance.
53
     */
54
    private static final ExportLocator INSTANCE = new ExportLocator();
55

  
56
    /**
57
     * Return the singleton instance.
58
     * 
59
     * @return the singleton instance
60
     */
61
    public static ExportLocator getInstance() {
62
        return INSTANCE;
63
    }
64

  
65
    /**
66
     * Return the Locator's name.
67
     * 
68
     * @return a String with the Locator's name
69
     */
70
    @Override
71
    public final String getLocatorName() {
72
        return LOCATOR_NAME;
73
    }
74

  
75
    /**
76
     * Return a reference to the ExportManager.
77
     * 
78
     * @return a reference to the ExportManager
79
     * @throws LocatorException
80
     *             if there is no access to the class or the class cannot be
81
     *             instantiated
82
     * @see Locator#get(String)
83
     */
84
    public static ExportManager getManager() throws LocatorException {
85
        return (ExportManager) getInstance().get(MANAGER_NAME);
86
    }
87

  
88
    /**
89
     * Registers the Class implementing the ExportManager interface.
90
     * 
91
     * @param clazz
92
     *            implementing the ExportManager interface
93
     */
94
    public static void registerManager(Class<? extends ExportManager> clazz) {
95
        getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
96
    }
97

  
98
    /**
99
     * Return a reference to the ExportServiceMnager.
100
     * 
101
     * @return a reference to the ExportServiceMnager
102
     * @throws LocatorException
103
     *             if there is no access to the class or the class cannot be
104
     *             instantiated
105
     * @see Locator#get(String)
106
     */
107
    public static ExportServiceManager getServiceManager() throws LocatorException {
108
        return (ExportServiceManager) getInstance().get(SERVICE_MANAGER_NAME);
109
    }
110

  
111
    /**
112
     * Registers the Class implementing the ExportServiceManager interface.
113
     * 
114
     * @param clazz
115
     *            implementing the ExportServiceManager interface
116
     */
117
    public static void registerServiceManager(Class<? extends ExportServiceManager> clazz) {
118
        getInstance().register(SERVICE_MANAGER_NAME, SERVICE_MANAGER_DESCRIPTION, clazz);
119
    }
120
    
121
}
0 122

  
tags/org.gvsig.desktop-2.0.421/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/export/ExportParameters.java
1
package org.gvsig.export;
2

  
3
import java.util.Date;
4
import org.gvsig.export.spi.ExportServiceFactory;
5
import org.gvsig.expressionevaluator.Expression;
6
import org.gvsig.fmap.dal.feature.FeatureQuery;
7
import org.gvsig.fmap.dal.feature.FeatureStore;
8
import org.gvsig.fmap.dal.feature.FeatureType;
9
import org.gvsig.tools.persistence.Persistent;
10
import org.gvsig.tools.util.LabeledValue;
11

  
12
/**
13
 *
14
 * @author jjdelcerro
15
 */
16
public interface ExportParameters extends Cloneable, LabeledValue, Persistent  {
17

  
18
    public static final int USE_ALL_FEATURES = 0;
19
    public static final int USE_SELECTED_FEATURES = 1;
20
    public static final int USE_FILTERED_FEATURES = 2;
21

  
22
    public String getServiceName();
23

  
24
    public boolean needsSelectTargetProjection();
25

  
26
    public FeatureType getSourceFeatureType();
27

  
28
    public void setSourceFeatureType(FeatureType sourceFeatureType);
29

  
30
    public void setSourceFeatureStore(FeatureStore sourceFeatureStore);
31

  
32
    public FeatureStore getSourceFeatureStore();
33

  
34
    public int getFeaturesToUse();
35

  
36
    public void setFeaturesToUse(int feturesToUse);
37

  
38
    public Expression getFilterExpresion();
39

  
40
    public void setFilterExpresion(Expression expression);
41
    
42
    public FeatureQuery getFeatureQuery();
43
    
44
    public void setFeatureQuery(FeatureQuery query);
45

  
46
    public Object getContext();
47

  
48
    public void setContext(Object context);
49

  
50
    public ExportAttributes getExportAttributes();
51

  
52
    public void setExportAttributes(ExportAttributes exportAttributes);
53
    
54
    public Date getCreationDate();
55
    
56
    public void setCreationDate(Date date);
57
    
58
    public ExportParameters clone() throws CloneNotSupportedException;
59
    
60
    public ExportServiceFactory getFactory();
61
    
62
    public FeatureType getTargetFeatureType();
63
    
64
    public void resetVolatileValues();
65

  
66
}
tags/org.gvsig.desktop-2.0.421/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/export/ExportParametersFile.java
1
package org.gvsig.export;
2

  
3
import java.io.File;
4
import org.gvsig.tools.util.HasAFile;
5

  
6
/**
7
 *
8
 * @author jjdelcerro
9
 */
10
public interface ExportParametersFile extends HasAFile {
11
    
12
    @Override
13
    public File getFile();
14

  
15
    @Override
16
    public void setFile(File file);
17
    
18
    public File getEvaluatedFile();
19
    
20
    public String getFileExtension();
21
    
22
}
tags/org.gvsig.desktop-2.0.421/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/export/Filter.java
1
package org.gvsig.export;
2

  
3
/**
4
 *
5
 * @author jjdelcerro
6
 */
7
public interface Filter<T> {
8
    
9
    public boolean apply(T obj);
10
}
tags/org.gvsig.desktop-2.0.421/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/export/ExportLibrary.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.export;
25

  
26
import org.gvsig.export.spi.AbstractExportParameters;
27
import org.gvsig.export.spi.AbstractExportParametersFile;
28
import org.gvsig.export.spi.AbstractExportParametersFile.ExportParametersFileHelper;
29
import org.gvsig.export.spi.AbstractExportParametersGeometry;
30
import org.gvsig.export.spi.AbstractExportParametersGeometryFile;
31
import org.gvsig.tools.library.AbstractLibrary;
32
import org.gvsig.tools.library.LibraryException;
33
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
34

  
35
/**
36
 * Library for API initialization and configuration.
37
 * 
38
 * @author gvSIG team
39
 * @version $Id$
40
 */
41
public class ExportLibrary extends AbstractLibrary {
42

  
43
    @Override
44
    public void doRegistration() {
45
        registerAsAPI(ExportLibrary.class);
46
    }
47

  
48
    @Override
49
    protected void doInitialize() throws LibraryException {
50
        // Do nothing
51
    }
52

  
53
    @Override
54
    protected void doPostInitialize() throws LibraryException {
55
        // Validate there is any implementation registered.
56
        ExportManager manager = ExportLocator.getManager();
57
        if (manager == null) {
58
            throw new ReferenceNotRegisteredException(
59
                ExportLocator.MANAGER_NAME, ExportLocator.getInstance());
60
        }
61
        
62
        AbstractExportParameters.registerPersistence();
63
        AbstractExportParametersGeometry.registerPersistence();
64
        AbstractExportParametersFile.registerPersistence();
65
        AbstractExportParametersGeometryFile.registerPersistence();
66
        ExportParametersFileHelper.registerPersistence();
67
        
68
    }
69

  
70
}
0 71

  
tags/org.gvsig.desktop-2.0.421/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/export/ExportAttributes.java
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.export;
7

  
8
import java.util.List;
9
import org.gvsig.export.ExportAttributes.ExportAttribute;
10
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
11
import org.gvsig.fmap.dal.feature.FeatureQuery;
12
import org.gvsig.fmap.dal.feature.FeatureType;
13
import org.gvsig.tools.namestranslator.NamesTranslator;
14
import org.gvsig.tools.persistence.Persistent;
15
import org.gvsig.tools.util.UnmodifiableBasicList;
16

  
17
/**
18
 *
19
 * @author osc
20
 */
21
public interface ExportAttributes extends UnmodifiableBasicList<ExportAttribute>, Cloneable, Persistent {
22

  
23
    public ExportAttributes clone() throws CloneNotSupportedException;
24

  
25
    public void setActive(boolean b);
26
    
27
    public boolean isActive();
28

  
29
    public interface ExportAttribute extends Cloneable, Persistent {
30
        
31
        public FeatureAttributeDescriptor getDescriptor();
32

  
33
        public String getName();
34

  
35
        public String getNewName();
36
        
37
        public int getDataType();
38
        
39
        public int getNewDataType();
40

  
41
        public boolean isExported();
42

  
43
        public boolean isComputed();
44
        
45
        public int getSize();
46
        
47
        public void setSize(int size);
48

  
49
        public int setNewName(String name);
50
        
51
        public void setNewType(int dataType);
52

  
53
        public void setExported(boolean exported);
54
        
55
        public void setComputed(boolean computed);
56
        
57
        public boolean isFromQuery();
58
        
59
        public ExportAttribute clone() throws CloneNotSupportedException;
60
    }
61

  
62
    public ExportAttribute getExportAttribute(String name);
63
    
64
    public FeatureType getTargetFeatureType();
65
    
66
    public void setSourceFeatureType(FeatureType sourceFeatureType, FeatureQuery query);
67
    
68
    public FeatureType getSourceFeatureType();
69

  
70
    public String getTargetName(String name);
71

  
72
    public String getSourceName(String name);
73
    
74
    public int getTargetType(String name);
75

  
76
    public int getSourceType(String name);
77
    
78
    public void setNamesTranslator(NamesTranslator attnt);
79

  
80
    public NamesTranslator getNamesTranslator();
81
    
82
    public void setExportAttributes(List<ExportAttribute>  exportAttributes);
83

  
84
    public boolean isQueryAttribute(FeatureAttributeDescriptor attr);
85

  
86
}
tags/org.gvsig.desktop-2.0.421/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/export/spi/AbstractExportServiceFactory.java
1
package org.gvsig.export.spi;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5
import org.gvsig.tools.ToolsLocator;
6
import org.gvsig.tools.i18n.I18nManager;
7

  
8
/**
9
 *
10
 * @author jjdelcerro
11
 */
12
public abstract class AbstractExportServiceFactory implements ExportServiceFactory {
13

  
14
    private final String name;
15
    private final String description;
16

  
17
    private static final Map<ExportServiceFactory, Boolean>serviceEnabled = new HashMap<>();
18
    private final String label;
19

  
20
    public AbstractExportServiceFactory(
21
            String name,
22
            String label,
23
            String description
24
        ) {
25
        I18nManager i18n = ToolsLocator.getI18nManager();
26
        this.name = name;
27
        this.label = i18n.getTranslation(label);
28
        this.description = i18n.getTranslation(description);
29
    }
30

  
31
    @Override
32
    public String getName() {
33
        return name;
34
    }
35

  
36
    @Override
37
    public String getLabel() {
38
        return label;
39
    }
40
    
41
    @Override
42
    public String getDescription() {
43
        return description;
44
    }
45

  
46
    @Override
47
    public boolean isEnabled() {
48
        Boolean enabled = serviceEnabled.getOrDefault(this, true);
49
        return enabled;
50
    }
51

  
52
    @Override
53
    public void setEnabled(boolean value) {
54
        serviceEnabled.put(this, value);
55
    }
56
    
57
}
tags/org.gvsig.desktop-2.0.421/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/export/spi/ExportService.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.export.spi;
25

  
26
import java.util.List;
27
import org.gvsig.export.ExportException;
28
import org.gvsig.export.ExportParameters;
29
import org.gvsig.fmap.dal.OpenDataStoreParameters;
30
import org.gvsig.fmap.dal.feature.FeatureSet;
31
import org.gvsig.fmap.dal.feature.FeatureStore;
32
import org.gvsig.tools.task.MonitorableTask;
33
import org.gvsig.tools.task.SimpleTaskStatus;
34

  
35
/**
36
 * <p>
37
 * This service is used to export a source {@link FeatureStore} to a target
38
 * {@link FeatureStore}.
39
 * </p>
40
 * <p>
41
 * It inherits if {@link MonitorableTask}, and it means that the export process
42
 * can be monitorized by one or more observers that can listen all the export
43
 * events.
44
 * <p>
45
 * 
46
 * @author gvSIG team
47
 * @version $Id$
48
 */
49
public interface ExportService extends MonitorableTask {
50

  
51
    public interface ExportFinishListener {
52

  
53
        public void cancelled(ExportService exportService);
54
        
55
        public void finished(ExportService exportService);
56
    }
57

  
58
    public ExportServiceFactory getFactory();
59
    
60
    public ExportParameters getParameters() ;
61
    
62
    public void addFinishListener(ExportFinishListener listener);
63

  
64
//    public AttributeNamesTranslator getAttributeNamesTranslator();
65
    
66
    public void export(FeatureSet featureSet) throws ExportException;
67

  
68
    public List<OpenDataStoreParameters> getTargetOpenStoreParameters() throws ExportException;     
69

  
70
    public void setTaskStatus(SimpleTaskStatus taskStatus);
71
    
72
}
0 73

  
tags/org.gvsig.desktop-2.0.421/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/export/spi/AbstractExportParametersGeometry.java
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.export.spi;
7

  
8
import org.cresques.cts.ICoordTrans;
9
import org.cresques.cts.IProjection;
10
import org.gvsig.export.ExportParameters;
11
import org.gvsig.fmap.geom.GeometryLocator;
12
import org.gvsig.fmap.geom.GeometryManager;
13
import org.gvsig.fmap.geom.type.GeometryType;
14
import org.gvsig.export.ExportParametersGeometry;
15
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
16
import org.gvsig.fmap.geom.Geometry;
17
import org.gvsig.tools.ToolsLocator;
18
import org.gvsig.tools.dynobject.DynStruct;
19
import org.gvsig.tools.persistence.PersistenceManager;
20
import org.gvsig.tools.persistence.PersistentState;
21
import org.gvsig.tools.persistence.exception.PersistenceException;
22

  
23
/**
24
 *
25
 * @author jjdelcerro
26
 */
27
public abstract class AbstractExportParametersGeometry
28
        extends AbstractExportParameters
29
        implements ExportParametersGeometry {
30

  
31
    private IProjection contextProjection;
32
    private IProjection sourceProjection;
33
    private IProjection targetProjection;
34

  
35
    private ICoordTrans sourceTransformation;
36
    private ICoordTrans targetTransformation;
37

  
38
    private int geometryChecks;
39
    private int geometryChecksAction;
40
    private boolean tryToFixGeometry;
41
    private String geometryFieldName;
42
    private int geometryType;
43
    private int geometrySubtype;
44

  
45
    public AbstractExportParametersGeometry(ExportServiceFactory factory) {
46
        super(factory);
47
    }
48

  
49
    @Override
50
    public boolean needsSelectTargetProjection() {
51
        return true;
52
    }
53

  
54
    @Override
55
    public void setContextProjection(IProjection projection) {
56
        this.contextProjection = projection;
57
    }
58

  
59
    @Override
60
    public IProjection getContextProjection() {
61
        return this.contextProjection;
62
    }
63

  
64
    @Override
65
    public void setSourceProjection(IProjection sourceProjection) {
66
        this.sourceProjection = sourceProjection;
67
    }
68

  
69
    @Override
70
    public IProjection getSourceProjection() {
71
        return sourceProjection;
72
    }
73

  
74
    @Override
75
    public ICoordTrans getSourceTransformation() {
76
        return sourceTransformation;
77
    }
78

  
79
    @Override
80
    public void setSourceTransformation(ICoordTrans contextTransformation) {
81
        this.sourceTransformation = contextTransformation;
82
    }
83

  
84
    @Override
85
    public void setTargetProjection(IProjection targetProjection) {
86
        this.targetProjection = targetProjection;
87
    }
88

  
89
    @Override
90
    public IProjection getTargetProjection() {
91
        if (this.targetProjection == null) {
92
            return this.sourceProjection;
93
        }
94
        return this.targetProjection;
95
    }
96

  
97
    @Override
98
    public void setTargetTransformation(ICoordTrans transformation) {
99
        this.targetTransformation = transformation;
100
    }
101

  
102
    @Override
103
    public ICoordTrans getTargetTransformation() {
104
        return targetTransformation;
105
    }
106

  
107
    @Override
108
    public int getGeometryChecks() {
109
        return this.geometryChecks;
110
    }
111

  
112
    @Override
113
    public int getGeometryChecksAction() {
114
        return this.geometryChecksAction;
115
    }
116

  
117
    @Override
118
    public boolean getTryToFixGeometry() {
119
        return this.tryToFixGeometry;
120
    }
121

  
122
    @Override
123
    public void setGeometryChecks(int geometryChecks) {
124
        this.geometryChecks = geometryChecks;
125
    }
126

  
127
    @Override
128
    public void setGeometryChecksAction(int geometryChecksAction) {
129
        this.geometryChecksAction = geometryChecksAction;
130
    }
131

  
132
    @Override
133
    public void setTryToFixGeometry(boolean tryToFixGeometry) {
134
        this.tryToFixGeometry = tryToFixGeometry;
135
    }
136

  
137
    @Override
138
    public String getSourceGeometryFieldName() {
139
        return this.geometryFieldName;
140
    }
141

  
142
    @Override
143
    public void setSourceGeometryFieldName(String geometryFieldName) {
144
        this.geometryFieldName = geometryFieldName;
145
    }
146

  
147
    @Override
148
    public int getTargetGeometryTypeAsInt() {
149
        return geometryType;
150
    }
151

  
152
    @Override
153
    public int getTargetGeometrySubtype() {
154
        return geometrySubtype;
155
    }
156

  
157
    @Override
158
    public void setTargetGeometryType(int geometryType) {
159
        this.geometryType = geometryType;
160
    }
161

  
162
    @Override
163
    public void setTargetGeometrySubtype(int subtype) {
164
        this.geometrySubtype = subtype;
165
    }
166

  
167
    @Override
168
    public void setTargetGeometryType(GeometryType type) {
169
        this.geometryType = type.getType();
170
        this.geometrySubtype = type.getSubType();
171
    }
172

  
173
    @Override
174
    public GeometryType getTargetGeometryType() {
175
        try {
176
            GeometryManager geomManager = GeometryLocator.getGeometryManager();
177
            GeometryType type = geomManager.getGeometryType(
178
                    geometryType,
179
                    geometrySubtype
180
            );
181
            return type;
182
        } catch (Exception ex) {
183
            throw new RuntimeException("Can't create geoemtry type from type " + geometryType + ", subtype " + geometrySubtype + ".", ex);
184
        }
185
    }
186

  
187
    @Override
188
    public ExportParameters clone() throws CloneNotSupportedException {
189
        AbstractExportParametersGeometry clone = (AbstractExportParametersGeometry) super.clone();
190
        clone.setContextProjection(this.contextProjection);
191
        clone.setSourceProjection(this.sourceProjection);
192
        clone.setTargetProjection(this.targetProjection);
193
        clone.setSourceTransformation(this.sourceTransformation);
194
        clone.setTargetTransformation(this.targetTransformation);
195
        clone.setSourceGeometryFieldName(this.geometryFieldName);
196
        clone.setGeometryChecks(this.geometryChecks);
197
        clone.setGeometryChecksAction(this.geometryChecksAction);
198
        clone.setTryToFixGeometry(this.tryToFixGeometry);
199
        clone.setTargetGeometryType(this.geometryType);
200
        clone.setTargetGeometrySubtype(this.geometrySubtype);
201
        return clone;
202
    }
203

  
204
    public static void registerPersistence() {
205

  
206
        PersistenceManager manager = ToolsLocator.getPersistenceManager();
207
        if (manager.getDefinition("AbstractExportParametersGeometry") == null) {
208
            DynStruct definition = manager.addDefinition(AbstractExportParametersGeometry.class,
209
                    "AbstractExportParametersGeometry", "AbstractExportParametersGeometry persistence definition", null, null);
210
            definition.addDynFieldObject("contextProjection").setClassOfValue(IProjection.class);
211
            definition.addDynFieldObject("sourceProjection").setClassOfValue(IProjection.class);
212
            definition.addDynFieldObject("targetProjection").setClassOfValue(IProjection.class);
213
            definition.addDynFieldObject("sourceTransformation").setClassOfValue(ICoordTrans.class);
214
            definition.addDynFieldObject("targetTransformation").setClassOfValue(ICoordTrans.class);
215
            definition.addDynFieldInt("geometryChecks");
216
            definition.addDynFieldInt("geometryChecksAction");
217
            definition.addDynFieldBoolean("tryToFixGeometry");
218
            definition.addDynFieldString("geometryFieldName");
219
            definition.addDynFieldInt("geometryType");
220
            definition.addDynFieldInt("geometrySubtype");
221
            definition.extend(manager.getDefinition("AbstractExportParameters"));
222
        }
223
    }
224

  
225
    public void saveToState(PersistentState state) throws PersistenceException {
226
        super.saveToState(state);
227
        state.set("contextProjection", this.contextProjection);
228
        state.set("sourceProjection", this.sourceProjection);
229
        state.set("targetProjection", this.targetProjection);
230
        state.set("sourceTransformation", this.sourceTransformation);
231
        state.set("targetTransformation", this.targetTransformation);
232
        state.set("geometryChecks", this.geometryChecks);
233
        state.set("geometryChecksAction", this.geometryChecksAction);
234
        state.set("tryToFixGeometry", this.tryToFixGeometry);
235
        state.set("geometryFieldName", this.geometryFieldName);
236
        state.set("geometryType", this.geometryType);
237
        state.set("geometrySubtype", this.geometrySubtype);
238
    }
239

  
240
    public void loadFromState(PersistentState state) throws PersistenceException {
241
        super.loadFromState(state);
242
        this.contextProjection = (IProjection) state.get("contextProjection");
243
        this.sourceProjection = (IProjection) state.get("sourceProjection");
244
        this.targetProjection = (IProjection) state.get("targetProjection");
245
        this.sourceTransformation = (ICoordTrans) state.get("sourceTransformation");
246
        this.targetTransformation = (ICoordTrans) state.get("targetTransformation");
247
        this.geometryChecks = state.getInt("geometryChecks");
248
        this.geometryChecksAction = state.getInt("geometryChecksAction");
249
        this.tryToFixGeometry = state.getBoolean("tryToFixGeometry");
250
        this.geometryFieldName = state.getString("geometryFieldName");
251
        this.geometryType = state.getInt("geometryType");
252
        this.geometrySubtype = state.getInt("geometrySubtype");
253
    }
254

  
255
    @Override
256
    public ICoordTrans getTransformationToUse() {
257
        FeatureAttributeDescriptor geo_att = this.getSourceFeatureType().getDefaultGeometryAttribute();
258

  
259
        IProjection sourceProjection;
260
        ICoordTrans coord_trans = null;
261
        Geometry reproj_geom;
262
        IProjection targetProjection = this.getTargetProjection();
263
        if (geo_att != null) {
264
            sourceProjection = geo_att.getSRS();
265
            // this comparison is perhaps too preventive
266
            // we could  have two instances of same projection
267
            // so we would do more computations than needed
268
            if (sourceProjection != null && targetProjection != null && sourceProjection != targetProjection) {
269
                if (this.getTargetTransformation() != null) {
270
                    coord_trans = this.getTargetTransformation();
271
                } else {
272
                    coord_trans = sourceProjection.getCT(targetProjection);
273
                }
274
            }
275

  
276
        }
277
        return coord_trans;
278
    }
279
}
tags/org.gvsig.desktop-2.0.421/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/export/spi/AbstractExportParametersGeometryFile.java
1
package org.gvsig.export.spi;
2

  
3
import java.io.File;
4
import org.gvsig.export.ExportParametersFile;
5
import org.gvsig.export.spi.AbstractExportParametersFile.ExportParametersFileHelper;
6
import org.gvsig.tools.ToolsLocator;
7
import org.gvsig.tools.dynobject.DynStruct;
8
import org.gvsig.tools.persistence.PersistenceManager;
9
import org.gvsig.tools.persistence.PersistentState;
10
import org.gvsig.tools.persistence.exception.PersistenceException;
11

  
12
/**
13
 *
14
 * @author jjdelcerro
15
 */
16
public abstract class AbstractExportParametersGeometryFile 
17
        extends AbstractExportParametersGeometry
18
        implements ExportParametersFile 
19
    {
20
    protected AbstractExportParametersFile.ExportParametersFileHelper fileHelper;
21
    
22
    public AbstractExportParametersGeometryFile(ExportServiceFactory factory) {
23
        super(factory);
24
        this.fileHelper = new ExportParametersFileHelper();
25
    }
26

  
27
    @Override
28
    public File getFile() {
29
        return this.fileHelper.getFile();
30
    }
31

  
32
    @Override
33
    public void setFile(File file) {
34
        this.fileHelper.setFile(file);
35
    }
36

  
37
    @Override
38
    public File getEvaluatedFile() {
39
        return this.fileHelper.getEvaluatedFile();
40
    }
41

  
42
    @Override
43
    public void saveToState(PersistentState state) throws PersistenceException {
44
        super.saveToState(state);
45
        state.set("fileHelper", this.fileHelper);
46
    }
47

  
48
    @Override
49
    public void loadFromState(PersistentState state) throws PersistenceException {
50
        super.loadFromState(state);
51
        this.fileHelper = (ExportParametersFileHelper) state.get("fileHelper");
52
    }
53

  
54
    public static void registerPersistence() {
55

  
56
        PersistenceManager manager = ToolsLocator.getPersistenceManager();
57
        if (manager.getDefinition("AbstractExportParametersGeometryFile") == null) {
58
            DynStruct definition = manager.addDefinition(AbstractExportParametersGeometryFile.class,
59
                    "AbstractExportParametersGeometryFile", "AbstractExportParametersGeometryFile persistence definition", null, null);
60
            definition.addDynFieldObject("fileHelper");
61
            definition.extend(manager.getDefinition("AbstractExportParametersGeometry"));
62
        }
63
    }
64

  
65
    @Override
66
    public final String getFileExtension() {
67
        return this.fileHelper.getFileExtension();
68
    }
69
    
70
    
71
    @Override
72
    public void resetVolatileValues() {
73
        this.fileHelper.resetVolatileValues();
74
    }
75
    
76
}
tags/org.gvsig.desktop-2.0.421/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/export/spi/AbstractExportService.java
1
package org.gvsig.export.spi;
2

  
3
import java.util.ArrayList;
4
import java.util.HashSet;
5
import java.util.List;
6
import java.util.Objects;
7
import java.util.Set;
8
import org.apache.commons.lang3.StringUtils;
9
import org.gvsig.export.ExportAttributes;
10
import org.gvsig.export.ExportException;
11
import org.gvsig.export.ExportLocator;
12
import org.gvsig.export.ExportParameters;
13
import org.gvsig.export.ExportParametersGeometry;
14
import org.gvsig.export.spi.ExportServiceManager.FixGeometryStatus;
15
import org.gvsig.fmap.dal.DALLocator;
16
import org.gvsig.fmap.dal.DataManager;
17
import org.gvsig.fmap.dal.DataServerExplorer;
18
import org.gvsig.fmap.dal.NewDataStoreParameters;
19
import org.gvsig.fmap.dal.OpenDataStoreParameters;
20
import org.gvsig.fmap.dal.feature.EditableFeature;
21
import org.gvsig.fmap.dal.feature.Feature;
22
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
23
import org.gvsig.fmap.dal.feature.FeatureSet;
24
import org.gvsig.fmap.dal.feature.FeatureStore;
25
import org.gvsig.fmap.dal.feature.FeatureType;
26
import org.gvsig.tools.ToolsLocator;
27
import org.gvsig.tools.dispose.DisposableIterator;
28
import org.gvsig.tools.dispose.DisposeUtils;
29
import org.gvsig.tools.task.SimpleTaskStatus;
30
import org.slf4j.Logger;
31
import org.slf4j.LoggerFactory;
32

  
33
/**
34
 *
35
 * @author jjdelcerro
36
 */
37
public abstract class AbstractExportService
38
        implements ExportService {
39

  
40
    protected static final Logger LOG = LoggerFactory.getLogger(AbstractExportService.class);
41

  
42
    private final ExportParameters parameters;
43
    private final Set<ExportFinishListener> finishListeners;
44
//    protected AttributeNamesTranslator attributeNamesTranslator;
45
    private SimpleTaskStatus taskStatus;
46
    private final ExportServiceFactory factory;
47

  
48
    protected AbstractExportService(ExportServiceFactory factory, ExportParameters parameters) {
49
        this.factory = factory;
50
        this.parameters = parameters;
51
        this.finishListeners = new HashSet<>();
52
    }
53

  
54
    @Override
55
    public ExportParameters getParameters() {
56
        return this.parameters;
57
    }
58

  
59
    @Override
60
    public ExportServiceFactory getFactory() {
61
        return factory;
62
    }
63

  
64
    @Override
65
    public void addFinishListener(ExportFinishListener listener) {
66
        this.finishListeners.add(listener);
67
    }
68

  
69
    protected void fireFinishedListener() {
70
        for (ExportFinishListener listener : finishListeners) {
71
            try {
72
                listener.finished(this);
73
            } catch (Exception ex) {
74

  
75
            }
76
        }
77
    }
78

  
79
    protected void fireCancelledListeners() {
80
        for (ExportFinishListener listener : finishListeners) {
81
            try {
82
                listener.cancelled(this);
83
            } catch (Exception ex) {
84

  
85
            }
86
        }
87
    }
88

  
89
    @Override
90
    public SimpleTaskStatus getTaskStatus() {
91
        if (this.taskStatus == null) {
92
            this.taskStatus = ToolsLocator.getTaskStatusManager().createDefaultSimpleTaskStatus("Export");
93
        }
94
        return this.taskStatus;
95
    }
96

  
97
    @Override
98
    public void setTaskStatus(SimpleTaskStatus taskStatus) {
99
        this.taskStatus = taskStatus;
100
    }
101

  
102
    @Override
103
    public boolean isCancellationRequested() {
104
        return this.getTaskStatus().isCancellationRequested();
105
    }
106

  
107
    @Override
108
    public void cancelRequest() {
109
        this.getTaskStatus().cancelRequest();
110
    }
111

  
112
//    @Override
113
//    public AttributeNamesTranslator getAttributeNamesTranslator() {
114
//        if (attributeNamesTranslator == null) {
115
//            this.attributeNamesTranslator = ExportLocator.getServiceManager().createAttributeNamesTranslator();
116
//        }
117
//        return this.attributeNamesTranslator;
118
//    }
119
    @Override
120
    public List<OpenDataStoreParameters> getTargetOpenStoreParameters() throws ExportException {
121
        List<OpenDataStoreParameters> r = new ArrayList<>();
122
        r.add(this.createTargetOpenStoreParameters());
123
        return r;
124
    }
125

  
126
    abstract protected DataServerExplorer createServerExplorer() throws ExportException;
127

  
128
    abstract protected NewDataStoreParameters createTargetNewStoreParameters() throws ExportException;
129

  
130
    abstract protected OpenDataStoreParameters createTargetOpenStoreParameters() throws ExportException;
131

  
132
    protected static class InvalidGeometryException extends ExportException {
133

  
134
        public InvalidGeometryException(Feature feature, String checkMessage) {
135
            super(checkMessage, feature);
136
        }
137
    }
138

  
139
    @Override
140
    public void export(FeatureSet featureSet) throws ExportException {
141
        DataServerExplorer explorer = createServerExplorer();
142
        NewDataStoreParameters newStoreParameters = createTargetNewStoreParameters();
143
        OpenDataStoreParameters openStoreParameters = createTargetOpenStoreParameters();
144

  
145
        String providerName = newStoreParameters.getDataStoreName();
146
        String explorerName = explorer.getProviderName();
147

  
148
        DisposableIterator it = null;
149
        FeatureStore target = null;
150
        EditableFeature targetFeature = null;
151
        try {
152
            try {
153
                 LOG.info("Start export "+Objects.toString(openStoreParameters));
154
            } catch (Throwable t){
155
                 LOG.info("Start export");              
156
            }
157
            this.getTaskStatus().setRangeOfValues(0, featureSet.getSize());
158

  
159
            DataManager dataManager = DALLocator.getDataManager();
160

  
161
            dataManager.newStore(explorerName, providerName, newStoreParameters, true);
162
            target = (FeatureStore) dataManager.openStore(providerName, openStoreParameters);
163

  
164
            FeatureType theTargetFeatureType;
165
            if (this.getParameters().getExportAttributes().isActive()) {
166
                theTargetFeatureType = this.getParameters().getExportAttributes().getTargetFeatureType();
167
            } else {
168
                theTargetFeatureType = target.getDefaultFeatureType();
169
            }
170
            FeatureType theSourceFeatureType = featureSet.getDefaultFeatureType();
171

  
172
            ExportGeometryHelper geomHelper = null;
173
            if (this.getParameters() instanceof ExportParametersGeometry) {
174
                geomHelper = ExportLocator.getServiceManager().createGeometryHelper(
175
                        (ExportParametersGeometry) this.getParameters(),
176
                        theTargetFeatureType,
177
                        theSourceFeatureType
178
                );
179
                if (!geomHelper.canProcessGeometry()) {
180
                    geomHelper = null;
181
                }
182
            }
183
            // ============================================
184

  
185
            target.edit(FeatureStore.MODE_APPEND);
186
            it = featureSet.fastIterator();
187

  
188
            LOG.info("Created target");
189
            long featureCount = 1;
190
            while (it.hasNext()) {
191
                this.getTaskStatus().setCurValue(featureCount);
192

  
193
                Feature sourceFeature = (Feature) it.next();
194
                targetFeature = target.createNewFeature(true); //theTargetFeatureType, true);
195
                copyValues(sourceFeature, targetFeature);
196

  
197
                if (geomHelper != null) {
198
                    switch (geomHelper.copyGeometry(sourceFeature, targetFeature)) {
199
                        case FixGeometryStatus.STATE_OK:
200
                            break;
201
                        case FixGeometryStatus.STATE_SKIP:
202
                            continue;
203
                        case FixGeometryStatus.STATE_ABORT:
204
                            throw new InvalidGeometryException(targetFeature, geomHelper.getLastErrorMessage());
205
                    }
206
                }
207

  
208
                target.insert(targetFeature);
209

  
210
                featureCount++;
211

  
212
                if (this.getTaskStatus().isCancellationRequested()) {
213
                    LOG.info("Export cancelled by user.");
214
                    this.getTaskStatus().abort();
215
                    FeatureStore.cancelEditingQuietly(target);
216
                    fireCancelledListeners();
217
                    return;
218
                }
219
            }
220
            target.finishEditing();
221
            this.getTaskStatus().terminate();
222
            this.getTaskStatus().remove();
223
            fireFinishedListener();
224
            LOG.info("End export");
225
        } catch (Throwable e) {
226
            LOG.warn("Can't export", e);
227
            FeatureStore.cancelEditingQuietly(target);
228
            fireCancelledListeners();
229
            throw new ExportException(e, targetFeature);
230
        } finally {
231
            DisposeUtils.dispose(it);
232
            DisposeUtils.dispose(featureSet);
233
            DisposeUtils.dispose(target);
234
        }
235
    }
236

  
237
    protected void copyValues(Feature source, EditableFeature target) {
238
        FeatureType sourceType = source.getType();
239
        FeatureType targetType = target.getType();
240
        ExportAttributes exp = this.getParameters().getExportAttributes();
241
        boolean isActive = exp.isActive();
242
        for (FeatureAttributeDescriptor targetAttr : targetType) {
243
            if( !target.canSetValue(targetAttr, null) ) {
244
//            if (targetAttr.isReadOnly() || targetAttr.isComputed()) {
245
                continue;
246
            }
247
            String targetAttrName = targetAttr.getName();
248
            //translate field
249
            FeatureAttributeDescriptor sourceAttr;
250
            String sourceAttrName;            
251
            if (isActive) {
252
                sourceAttrName = exp.getSourceName(targetAttrName);
253
                for (ExportAttributes.ExportAttribute exportAttribute : exp) {
254
                    if (StringUtils.equals(exportAttribute.getNewName(), targetAttrName)) {
255
                        sourceAttrName = exportAttribute.getName();
256
                        break;
257
                    }
258
                }
259

  
260
                sourceAttr = sourceType.getAttributeDescriptorFromAll(sourceAttrName);
261
            } else {
262
                sourceAttrName = targetAttrName;
263
                sourceAttr = sourceType.getAttributeDescriptorFromAll(targetAttrName);
264
            }            
265
            if (sourceAttr != null) {
266
                Object value = source.get(sourceAttrName);                
267
                if (value == null) {
268
                    if (targetAttr.allowNull()) {
269
                        target.set(targetAttrName, null);
270
                    }
271
                } else {
272
                    target.set(targetAttrName, value);
273
                }
274
            } else if (sourceAttr==null && source.hasValue(sourceAttrName)) {
275
                    Object value = source.get(sourceAttrName);
276
                    target.set(targetAttrName, value);
277
                }
278
            }
279
        }
280
    }
281

  
282

  
tags/org.gvsig.desktop-2.0.421/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/export/spi/AbstractExportParameters.java
1
package org.gvsig.export.spi;
2

  
3
import java.text.DateFormat;
4
import java.text.SimpleDateFormat;
5
import java.util.Date;
6
import org.gvsig.export.ExportAttributes;
7
import org.gvsig.export.ExportLocator;
8
import org.gvsig.fmap.dal.exception.DataException;
9
import org.gvsig.fmap.dal.feature.FeatureStore;
10
import org.gvsig.fmap.dal.feature.FeatureType;
11
import org.gvsig.export.ExportParameters;
12
import org.gvsig.expressionevaluator.Expression;
13
import org.gvsig.fmap.dal.feature.FeatureQuery;
14
import org.gvsig.tools.ToolsLocator;
15
import org.gvsig.tools.dynobject.DynStruct;
16
import org.gvsig.tools.persistence.PersistenceManager;
17
import org.gvsig.tools.persistence.PersistentState;
18
import org.gvsig.tools.persistence.exception.PersistenceException;
19
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21

  
22
/**
23
 *
24
 * @author jjdelcerro
25
 */
26
public abstract class AbstractExportParameters implements ExportParameters {
27

  
28
    private FeatureStore sourceFeatureStore;
29
    private Expression filterExpression;
30
    private int featuresToUse;
31
    private Object context;
32
    protected ExportAttributes exportAttributes = null;
33
    private Date date = new Date();
34
    public ExportServiceFactory factory;
35

  
36
    protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractExportParameters.class);
37
    private FeatureQuery featureQuery;
38

  
39
    public AbstractExportParameters(ExportServiceFactory factory) {
40
        this.factory = factory;
41
        this.exportAttributes = ExportLocator.getServiceManager().createExportAttributes();
42
    }
43

  
44
    @Override
45
    public boolean needsSelectTargetProjection() {
46
        return false;
47
    }
48

  
49
    @Override
50
    public FeatureType getSourceFeatureType() {
51
        if (!(this.exportAttributes == null)) {
52
            return this.exportAttributes.getSourceFeatureType();
53
        } else {
54
            return null;
55
        }
56
    }
57

  
58
    @Override
59
    public void setSourceFeatureType(FeatureType sourceFeatureType) {
60
        this.exportAttributes.setSourceFeatureType(sourceFeatureType, this.featureQuery);
61
    }
62

  
63
    @Override
64
    public void setSourceFeatureStore(FeatureStore sourceFeatureStore) {
65
        this.sourceFeatureStore = sourceFeatureStore;
66
        try {
67
            FeatureType sourceFeatureType = sourceFeatureStore.getDefaultFeatureType();
68
            this.exportAttributes.setSourceFeatureType(sourceFeatureType, this.featureQuery);
69
        } catch (DataException ex) {
70
            throw new RuntimeException("Can't set feature type", ex);
71
        }
72
    }
73

  
74
    @Override
75
    public FeatureStore getSourceFeatureStore() {
76
        return this.sourceFeatureStore;
77
    }
78

  
79
    @Override
80
    public Expression getFilterExpresion() {
81
        return this.filterExpression;
82
    }
83

  
84
    @Override
85
    public void setFilterExpresion(Expression expression) {
86
        this.filterExpression = expression;
87
    }
88
    
89
    @Override
90
    public FeatureQuery getFeatureQuery() {
91
        return this.featureQuery;
92
    }
93

  
94
    @Override
95
    public void setFeatureQuery(FeatureQuery query) {
96
        this.featureQuery = query;
97
    }
98

  
99
    @Override
100
    public int getFeaturesToUse() {
101
        return featuresToUse;
102
    }
103

  
104
    @Override
105
    public void setFeaturesToUse(int featuresToUse) {
106
        this.featuresToUse = featuresToUse;
107
    }
108

  
109
    @Override
110
    public Object getContext() {
111
        return context;
112
    }
113

  
114
    @Override
115
    public void setContext(Object context) {
116
        this.context = context;
117
    }
118

  
119
    @Override
120
    public ExportAttributes getExportAttributes() {
121
        return this.exportAttributes;
122
    }
123

  
124
    @Override
125
    public void setExportAttributes(ExportAttributes export) {
126
        this.exportAttributes = export;
127
    }
128

  
129
    @Override
130
    public ExportParameters clone() throws CloneNotSupportedException {
131
        ExportParameters clone = (ExportParameters) super.clone();
132

  
133
        if (this.filterExpression != null) {
134
            clone.setFilterExpresion(this.filterExpression.clone());
135
        }
136
        if (this.featureQuery!=null) {
137
            clone.setFeatureQuery(this.featureQuery.getCopy());
138
        }
139
        if (this.exportAttributes != null) {
140
            clone.setExportAttributes(this.exportAttributes.clone());
141
        }
142

  
143
        return clone;
144
    }
145

  
146
    @Override
147
    public Date getCreationDate() {
148
        return this.date;
149
    }
150

  
151
    public void setCreationDate(Date date) {
152
        this.date = date;
153
    }
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff