Revision 6951

View differences:

org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.136/org.gvsig.busquedacatastral.lib/org.gvsig.busquedacatastral.lib.impl/src/main/java/org/gvsig/busquedacatastral/lib/impl/ViasFactory.java
1
package org.gvsig.busquedacatastral.lib.impl;
2

  
3
import java.io.ByteArrayInputStream;
4
import java.io.File;
5
import java.io.InputStream;
6
import java.rmi.RemoteException;
7
import java.util.List;
8

  
9
import javax.xml.bind.JAXBContext;
10
import javax.xml.bind.Unmarshaller;
11

  
12
import org.apache.axis.message.MessageElement;
13
import org.apache.commons.lang3.StringUtils;
14

  
15
import org.gvsig.busquedacatastral.lib.api.BusquedaCatastralManager;
16
import org.gvsig.busquedacatastral.lib.api.QueryCatastral;
17
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralException;
18
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralGettingParamsException;
19
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralRemoteServiceException;
20
import org.gvsig.busquedacatastral.lib.impl.ws.classes.CallejeroWSResponse;
21
import org.gvsig.busquedacatastral.lib.impl.ws.classes.MunicipiosWSResponse;
22
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Callejero;
23
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.ConsultaCallejero;
24
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.ConsultaMunicipieror;
25
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Df;
26
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Muni;
27
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Municipiero;
28
import org.gvsig.fmap.dal.DataTypes;
29
import org.gvsig.fmap.dal.exception.DataException;
30
import org.gvsig.fmap.dal.feature.EditableFeature;
31
import org.gvsig.fmap.dal.feature.EditableFeatureType;
32
import org.gvsig.fmap.dal.feature.FeatureStore;
33
import org.gvsig.tools.ToolsLocator;
34
import org.gvsig.tools.dynobject.DynObject;
35
import org.gvsig.tools.exception.BaseException;
36
import org.gvsig.tools.i18n.I18nManager;
37

  
38
import org.slf4j.Logger;
39
import org.slf4j.LoggerFactory;
40

  
41
public class ViasFactory extends WSObjectsFactory{
42

  
43
    private static final Logger logger = LoggerFactory
44
        .getLogger(ViasFactory.class);
45

  
46
    private final static String VIAS_FILENAME="callejero.dbf";
47

  
48

  
49
    public ViasFactory(BusquedaCatastralManager manager){
50
        super(manager);
51
    }
52

  
53
    private Callejero callejero=null;
54
    private QueryCatastral query;
55
    private String filtro;
56
    public  List<DynObject> getVias(QueryCatastral query) throws BusquedaCatastralException{
57
        this.query=query;
58
        this.filtro=null;
59
        return getVias();
60
    }
61

  
62
    public  List<DynObject> getVias(QueryCatastral query, String filtro) throws BusquedaCatastralException{
63
        this.query=query;
64
        this.filtro=filtro;
65
        return getVias();
66
    }
67

  
68
    private List<DynObject>getVias() throws BusquedaCatastralException{
69
        File viasFile=null;
70

  
71
        try {
72
            if (query==null||query.getProvincia()==null){
73
                logger.error("Provincia no informada");
74
                I18nManager i18nManager = ToolsLocator.getI18nManager();
75
                throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_provincia_not_informed"), null);
76
            }
77
            if (query.getMunicipio()==null){
78
                logger.error("Municipio no informado");
79
                I18nManager i18nManager = ToolsLocator.getI18nManager();
80
                throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_municipio_not_informed"), null);
81
            }
82

  
83
            DynObject provincia=query.getProvincia();
84
            DynObject municipio=query.getMunicipio();
85
            String codProvincia=(String) provincia.getDynValue(BusquedaCatastralManager.CAMPO_PROVINCIA_CODIGO);
86
            String codMunicipio=(String) municipio.getDynValue(BusquedaCatastralManager.CAMPO_MUNICIPIO_MUNICIPIO_INE);
87
            File provinciaFolder=new File(manager.getCacheFolder(),codProvincia);
88
            if (!provinciaFolder.exists()){
89
                provinciaFolder.mkdirs();
90
            }
91
            File municipioFolder=new File(provinciaFolder,codMunicipio);
92
            if (!municipioFolder.exists()){
93
                municipioFolder.mkdirs();
94
            }
95
            viasFile = new File(municipioFolder,VIAS_FILENAME);
96
            if (!viasFile.exists()){
97
                createDBF(viasFile);
98
            }
99
            return this.getListFromDBF(viasFile);
100
        } catch ( BusquedaCatastralException e) {
101
            throw e;
102
        } catch ( Exception e) {
103
            logger.warn("Error getting vias from file '"+viasFile.getAbsolutePath()+"'.",e);
104
            throw new BusquedaCatastralGettingParamsException(e);
105
        }
106
    }
107

  
108
    @Override
109
    protected void defineType(EditableFeatureType type) throws BusquedaCatastralException {
110
        callejero=getCallejero(query);
111
        int maxCodProvINE=1;
112
        int maxCodMuniINE=1;
113
        int maxNombre=1;
114
        int maxTipoVia=1;
115
        int maxCodDGC=1;
116

  
117
        for( Df calle:callejero.getCalle()){
118
            if(StringUtils.isNotEmpty(calle.getLoine().getCp()) && calle.getLoine().getCp().length()>maxCodProvINE){
119
                maxCodProvINE=calle.getLoine().getCp().length();
120
            }
121
            if(StringUtils.isNotEmpty(calle.getLoine().getCm()) && calle.getLoine().getCm().length()>maxCodMuniINE){
122
                maxCodMuniINE=calle.getLoine().getCp().length();
123
            }
124
            if(StringUtils.isNotEmpty(calle.getDir().getNv()) && calle.getDir().getNv().length()>maxNombre){
125
                maxNombre=calle.getDir().getNv().length();
126
            }
127
            if(StringUtils.isNotEmpty(calle.getDir().getTv()) && calle.getDir().getTv().length()>maxTipoVia){
128
                maxTipoVia=calle.getDir().getTv().length();
129
            }
130
            if(StringUtils.isNotEmpty(calle.getDir().getCv()) && calle.getDir().getCv().length()>maxCodDGC){
131
                maxCodDGC=calle.getDir().getCv().length();
132
            }
133

  
134
        }
135
        type.add(BusquedaCatastralManager.CAMPO_VIA_PROV_INE, DataTypes.STRING,
136
            maxCodProvINE).setAllowNull(true);
137
        type.add(BusquedaCatastralManager.CAMPO_VIA_MUNI_INE, DataTypes.STRING,
138
            maxCodMuniINE).setAllowNull(true);
139
        type.add(BusquedaCatastralManager.CAMPO_VIA_NOMBRE, DataTypes.STRING,
140
            maxNombre);
141
        type.add(BusquedaCatastralManager.CAMPO_VIA_TIPOVIA, DataTypes.STRING,
142
            maxTipoVia).setAllowNull(true);
143
        type.add(BusquedaCatastralManager.CAMPO_VIA_COD_DGC, DataTypes.STRING,
144
            maxCodDGC).setAllowNull(true);
145
    }
146

  
147
    @Override
148
    protected void writeFileData(FeatureStore featureStore) throws BusquedaCatastralException, DataException {
149
        callejero=getCallejero(query);
150
        for( Df calle:callejero.getCalle()){
151
            EditableFeature ef;
152
            ef = featureStore.createNewFeature().getEditable();
153
            ef.set(BusquedaCatastralManager.CAMPO_VIA_PROV_INE, calle.getLoine().getCp());
154
            ef.set(BusquedaCatastralManager.CAMPO_VIA_MUNI_INE, calle.getLoine().getCm());
155
            ef.set(BusquedaCatastralManager.CAMPO_VIA_NOMBRE, calle.getDir().getNv());
156
            ef.set(BusquedaCatastralManager.CAMPO_VIA_TIPOVIA, calle.getDir().getTv());
157
            ef.set(BusquedaCatastralManager.CAMPO_VIA_COD_DGC, calle.getDir().getCv());
158
            featureStore.insert(ef);
159
        }
160
        callejero = null;
161
    }
162

  
163
    private Callejero getCallejero(QueryCatastral query) throws BusquedaCatastralException{
164
        if( callejero == null ) {
165
            try {
166
                DynObject provincia=query.getProvincia();
167
                DynObject municipio=query.getMunicipio();
168
                String nombreProvincia=(String) provincia.getDynValue(BusquedaCatastralManager.CAMPO_PROVINCIA_NOMBRE);
169
                String nombreMunicipio=(String) municipio.getDynValue(BusquedaCatastralManager.CAMPO_MUNICIPIO_NOMBRE);
170
                String codProvincia=(String) provincia.getDynValue(BusquedaCatastralManager.CAMPO_PROVINCIA_CODIGO);
171
                CallejeroWSResponse callejeroResponse =getCatastroWS().obtenerCallejero(nombreProvincia, nombreMunicipio, "", "");
172
                if (callejeroResponse!=null){
173
                    MessageElement[] any = callejeroResponse.get_any();
174
                    MessageElement me=any[0];
175
                    JAXBContext jaxbContext = JAXBContext.newInstance(ConsultaCallejero.class);
176

  
177
                    Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
178
                    InputStream input = new ByteArrayInputStream(me.getAsString().getBytes());
179
                    ConsultaCallejero cc = (ConsultaCallejero) jaxbUnmarshaller.unmarshal(input);
180

  
181
                    if (cc!=null && cc.getLerr()!=null){
182
                        webserviceErrors(cc.getLerr().getErr());
183
                    }
184

  
185
                    callejero =  cc.getCallejero();
186
                }else{
187
                    logger.error("Webservice response is empty");
188
                    I18nManager i18nManager = ToolsLocator.getI18nManager();
189
                    throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_reading_response_from_ws"),null);
190
                }
191

  
192
            } catch (RemoteException e) {
193
                logger.error("Error accesing webservice",e);
194
                I18nManager i18nManager = ToolsLocator.getI18nManager();
195
                throw new BusquedaCatastralRemoteServiceException(i18nManager.getTranslation("_error_obtaining_catastro_webservice"), e);
196
            } catch (Exception e) {
197
                logger.error("Error marshalling response from webservice",e);
198
                I18nManager i18nManager = ToolsLocator.getI18nManager();
199
                throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_reading_response_from_ws"), e);
200
            }
201
        }
202
        return callejero;
203
    }
204

  
205
    @Override
206
    protected String getExpressionQuery() {
207
        if (query.getTipoVia()!=null){
208
            StringBuilder strb=new StringBuilder();
209
            String tipoViaAbrev=query.getTipoVia().getAbrev();
210
            strb.append(BusquedaCatastralManager.CAMPO_VIA_TIPOVIA);
211
            strb.append(" like '");
212
            strb.append(tipoViaAbrev+"'");
213
            if (StringUtils.isNotEmpty(filtro)){
214
                strb.append(" and ");
215
                strb.append(BusquedaCatastralManager.CAMPO_VIA_NOMBRE);
216
                strb.append(" like '%");
217
                strb.append(filtro.toUpperCase()+"%'");
218
            }
219
            return strb.toString();
220
        }
221

  
222
        return null;
223
    }
224

  
225

  
226
}
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.136/org.gvsig.busquedacatastral.lib/org.gvsig.busquedacatastral.lib.impl/src/main/java/org/gvsig/busquedacatastral/lib/impl/WSObjectsFactory.java
1
package org.gvsig.busquedacatastral.lib.impl;
2

  
3
import java.io.File;
4
import java.util.List;
5

  
6
import javax.xml.rpc.ServiceException;
7

  
8
import org.apache.commons.lang3.StringUtils;
9

  
10
import org.gvsig.busquedacatastral.lib.api.BusquedaCatastralManager;
11
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralException;
12
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralGettingParamsException;
13
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralRemoteServiceException;
14
import org.gvsig.busquedacatastral.lib.impl.ws.CallejeroCatastroWSLocator;
15
import org.gvsig.busquedacatastral.lib.impl.ws.CallejeroCatastroWSSoap;
16
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Err;
17
import org.gvsig.fmap.dal.DALLocator;
18
import org.gvsig.fmap.dal.DataManager;
19
import org.gvsig.fmap.dal.DataServerExplorerParameters;
20
import org.gvsig.fmap.dal.DataStoreParameters;
21
import org.gvsig.fmap.dal.exception.DataException;
22
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
23
import org.gvsig.fmap.dal.feature.EditableFeatureType;
24
import org.gvsig.fmap.dal.feature.FeatureQuery;
25
import org.gvsig.fmap.dal.feature.FeatureSet;
26
import org.gvsig.fmap.dal.feature.FeatureStore;
27
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
28
import org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper;
29
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
30
import org.gvsig.tools.ToolsLocator;
31
import org.gvsig.tools.dynobject.DynObject;
32
import org.gvsig.tools.exception.BaseException;
33
import org.gvsig.tools.i18n.I18nManager;
34
import org.gvsig.tools.locator.LocatorException;
35

  
36
import org.slf4j.Logger;
37
import org.slf4j.LoggerFactory;
38

  
39

  
40
/**
41
 * Used for classes wich need data from the webservice.
42
 * Offers methods to manage webservice and cache files
43
 * @author dmartinezizquierdo
44
 *
45
 */
46
public  abstract class WSObjectsFactory {
47

  
48
    private static final Logger logger = LoggerFactory
49
        .getLogger(WSObjectsFactory.class);
50

  
51
    private final static String DBF_PROVIDER_NAME="DBF";
52

  
53
    protected BusquedaCatastralManager manager;
54

  
55
    protected WSObjectsFactory(BusquedaCatastralManager manager){
56
        this.manager=manager;
57
    }
58

  
59

  
60
    protected CallejeroCatastroWSSoap getCatastroWS() throws BusquedaCatastralException{
61
        try {
62
            CallejeroCatastroWSLocator locator=
63
                new CallejeroCatastroWSLocator();
64
            CallejeroCatastroWSSoap callejeroWS =
65
                locator.getCallejeroCatastroSoap();
66
            return callejeroWS;
67
        } catch (ServiceException e) {
68
            logger.error("Error obtaining webservice",e);
69
            I18nManager i18nManager = ToolsLocator.getI18nManager();
70
            throw new BusquedaCatastralRemoteServiceException(i18nManager.getTranslation("_error_obtaining_catastro_webservice"), e);
71
        }
72
    }
73

  
74
    protected void createDBF(File file)
75
        throws BusquedaCatastralException{
76

  
77
        FeatureStore dbfStore = null;
78
        try {
79
            if (!file.exists()) {
80
                File folder=file.getParentFile();
81
                if (!folder.exists()){
82
                    folder.mkdirs();
83
                }
84
            }
85

  
86
            DataManager datamanager = DALLocator.getDataManager();
87
            DataServerExplorerParameters explorerParameters =
88
                (DataServerExplorerParameters) datamanager
89
                    .createServerExplorerParameters(FilesystemServerExplorer.NAME);
90
            FilesystemServerExplorer explorer =
91
                (FilesystemServerExplorer) datamanager.openServerExplorer(
92
                    FilesystemServerExplorer.NAME, explorerParameters
93
                    );
94

  
95
            NewFeatureStoreParameters addParams = (NewFeatureStoreParameters) explorer.getAddParameters(DBF_PROVIDER_NAME);
96
            addParams.setDynValue("DbfFile",file);
97
            EditableFeatureType type = addParams.getDefaultFeatureType();
98
            defineType(type);
99
            explorer.add(DBF_PROVIDER_NAME, addParams, true);
100

  
101
            DataStoreParameters parameters = datamanager.createStoreParameters(DBF_PROVIDER_NAME);
102
            parameters.setDynValue("DbfFile", file);
103
            dbfStore =
104
                (FeatureStore) datamanager.openStore(DBF_PROVIDER_NAME, parameters);
105
            dbfStore.edit(FeatureStore.MODE_APPEND);
106
            writeFileData(dbfStore);
107

  
108
            dbfStore.finishEditing();
109
            dbfStore.dispose();
110
        } catch (BusquedaCatastralException  e) {
111
            logger.error("Error getting feature store");
112
            I18nManager i18nManager = ToolsLocator.getI18nManager();
113
            if(dbfStore!=null && dbfStore.isEditing()) {
114
                try {
115
                    dbfStore.cancelEditing();
116
                } catch (DataException e1) {
117
                    logger.error("Error cancelling edition of feature store");
118
                    throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_cancelling_edition_of_feature_store"),e);
119
                }
120
            }
121
            throw e;
122
        } catch (Exception  e) {
123
            logger.error("Error getting feature store");
124
            I18nManager i18nManager = ToolsLocator.getI18nManager();
125
            if(dbfStore!=null && dbfStore.isEditing()) {
126
                try {
127
                    dbfStore.cancelEditing();
128
                } catch (DataException e1) {
129
                    logger.error("Error cancelling edition of feature store");
130
                    throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_cancelling_edition_of_feature_store"),e);
131
                }
132
            }
133
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_getting_feature_store"),e);
134
        }
135
    }
136

  
137

  
138
    protected List<DynObject> getListFromDBF(File file) throws BaseException {
139
        DataManager datamanager = DALLocator.getDataManager();
140
        DataStoreParameters parameters = datamanager.createStoreParameters(DBF_PROVIDER_NAME);
141
        parameters.setDynValue("DbfFile", file);
142

  
143
        FeatureStore dbf = (FeatureStore) datamanager.openStore(DBF_PROVIDER_NAME, parameters);
144

  
145
        String expressionQuery=getExpressionQuery();
146

  
147
        FeaturePagingHelper pager;
148
        if(StringUtils.isEmpty(expressionQuery)){
149
            pager = datamanager.createFeaturePagingHelper(dbf, 500);
150
        }else{
151
            FeatureQuery featureQuery = dbf.createFeatureQuery();
152
            featureQuery.setFilter( datamanager.createExpresion(expressionQuery) );
153
            pager = datamanager.createFeaturePagingHelper(dbf,featureQuery, 500);
154
        }
155
        return pager.asListOfDynObjects();
156
    }
157

  
158
    protected void webserviceErrors(List<Err>errores) throws BusquedaCatastralException{
159
        if (errores!=null && !errores.isEmpty()){
160
            StringBuilder descErrores=new StringBuilder();
161
            I18nManager i18nManager = ToolsLocator.getI18nManager();
162
            descErrores.append(i18nManager.getTranslation("_errors_found_by_ws")+":");
163
            for (Err error:errores){
164
                descErrores.append("\n"+error.getDes());
165
                logger.error(descErrores.toString());
166
                throw new BusquedaCatastralGettingParamsException(descErrores.toString(), null);
167
            }
168
        }
169
    }
170

  
171
    abstract protected void defineType(EditableFeatureType type) throws BusquedaCatastralException;
172

  
173
    abstract protected void writeFileData(FeatureStore featureStore) throws BusquedaCatastralException, DataException;
174

  
175
    abstract protected String getExpressionQuery();
176
}
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.136/org.gvsig.busquedacatastral.lib/org.gvsig.busquedacatastral.lib.impl/src/main/java/org/gvsig/busquedacatastral/lib/impl/NumerosFactory.java
1
package org.gvsig.busquedacatastral.lib.impl;
2

  
3
import java.io.ByteArrayInputStream;
4
import java.io.File;
5
import java.io.InputStream;
6
import java.rmi.RemoteException;
7
import java.util.ArrayList;
8
import java.util.HashSet;
9
import java.util.List;
10
import java.util.Set;
11

  
12
import javax.xml.bind.JAXBContext;
13
import javax.xml.bind.Unmarshaller;
14

  
15
import org.apache.axis.message.MessageElement;
16
import org.apache.commons.lang3.StringUtils;
17

  
18
import org.gvsig.busquedacatastral.lib.api.BusquedaCatastralManager;
19
import org.gvsig.busquedacatastral.lib.api.QueryCatastral;
20
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralException;
21
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralGettingParamsException;
22
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralRemoteServiceException;
23
import org.gvsig.busquedacatastral.lib.impl.ws.classes.CallejeroWSResponse;
24
import org.gvsig.busquedacatastral.lib.impl.ws.classes.MunicipiosWSResponse;
25
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Callejero;
26
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.ConsultaCallejero;
27
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.ConsultaMunicipieror;
28
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.ConsultaNumereror;
29
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Df;
30
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Muni;
31
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Municipiero;
32
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Numereror;
33
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Nump;
34
import org.gvsig.fmap.dal.DataTypes;
35
import org.gvsig.fmap.dal.exception.DataException;
36
import org.gvsig.fmap.dal.feature.EditableFeature;
37
import org.gvsig.fmap.dal.feature.EditableFeatureType;
38
import org.gvsig.fmap.dal.feature.FeatureStore;
39
import org.gvsig.tools.ToolsLocator;
40
import org.gvsig.tools.dynobject.DynObject;
41
import org.gvsig.tools.exception.BaseException;
42
import org.gvsig.tools.i18n.I18nManager;
43

  
44
import org.slf4j.Logger;
45
import org.slf4j.LoggerFactory;
46

  
47
public class NumerosFactory extends WSObjectsFactory{
48

  
49
    private static final Logger logger = LoggerFactory
50
        .getLogger(NumerosFactory.class);
51

  
52

  
53
    public NumerosFactory(BusquedaCatastralManager manager){
54
        super(manager);
55
    }
56

  
57
    private QueryCatastral query;
58
    private String ini;
59
    private String fin;
60

  
61
    public List<String> getNumeros(QueryCatastral query, String ini, String fin) throws BusquedaCatastralException{
62
        if (query==null||query.getProvincia()==null){
63
            logger.error("Provincia no informada");
64
            I18nManager i18nManager = ToolsLocator.getI18nManager();
65
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_provincia_not_informed"), null);
66
        }
67
        if (query.getMunicipio()==null){
68
            logger.error("Municipio no informado");
69
            I18nManager i18nManager = ToolsLocator.getI18nManager();
70
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_municipio_not_informed"), null);
71
        }
72
        if (query.getTipoVia()==null){
73
            logger.error("Tipo Via no informado");
74
            I18nManager i18nManager = ToolsLocator.getI18nManager();
75
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_tipo_via_not_informed"), null);
76
        }
77
        if (query.getVia()==null){
78
            logger.error("Via no informado");
79
            I18nManager i18nManager = ToolsLocator.getI18nManager();
80
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_via_not_informed"), null);
81
        }
82
        if (StringUtils.isEmpty(ini) && StringUtils.isEmpty(fin)){
83
            logger.error("Numeros no informado");
84
            I18nManager i18nManager = ToolsLocator.getI18nManager();
85
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_numero_not_informed"), null);
86
        }
87
        this.query=query;
88
        this.ini=ini;
89
        this.fin=fin;
90
        Set<String> numeros=getNumeros(ini,fin);
91
        Set<String> results = new HashSet<>();
92
        for (String numero:numeros){
93

  
94
            Set<String> consulta=null;
95
            try {
96
                consulta = consultaNumerero(numero);
97
            } catch (Exception e) {
98
                //Do nothing; It is possible that there is not a given number in the interval
99
                //So no exception is thrown.
100
                logger.warn("No se ha podido encontar el n?mero: "+numero, e);
101
            }
102

  
103
            if (consulta!=null){
104
                results.addAll(consulta);
105
            }
106
        }
107
        if (results==null || results.isEmpty()){
108
            logger.error("No se ha encontrado ningun numero");
109
            I18nManager i18nManager = ToolsLocator.getI18nManager();
110
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_numero_not_found_for_parameters"), null);
111
        }
112
        return new ArrayList<String>(results);
113
    }
114

  
115
    private Set<String> getNumeros(String ini,String fin){
116
        Set<String> numeros = new HashSet<>();
117
        if (StringUtils.isNotEmpty(ini) && StringUtils.isNotEmpty(fin)){
118
            numeros.add(ini);
119
            numeros.add(fin);
120
            try {
121
                int numIni=Integer.valueOf(ini);
122
                int numFin=Integer.valueOf(fin);
123
                if (numIni<numFin){
124
                    for (int i=numIni+1;i<numFin;i++){
125
                        numeros.add(String.valueOf(i));
126
                    }
127
                }
128
            } catch (NumberFormatException e) {
129
                // Do nothing
130
            }
131
        }else{
132
            if (StringUtils.isNotEmpty(ini)){
133
                numeros.add(ini);
134
            }else if (StringUtils.isNotEmpty(fin)){
135
                numeros.add(fin);
136
            }
137
        }
138
        return numeros;
139
    }
140

  
141
    private Set<String> consultaNumerero(String numero) throws BusquedaCatastralException{
142
        try {
143
            DynObject provincia=query.getProvincia();
144
            DynObject municipio=query.getMunicipio();
145
            DynObject via=query.getVia();
146
            String nombreProvincia=(String) provincia.getDynValue(BusquedaCatastralManager.CAMPO_PROVINCIA_NOMBRE);
147
            String nombreMunicipio=(String) municipio.getDynValue(BusquedaCatastralManager.CAMPO_MUNICIPIO_NOMBRE);
148
            String tipoViaAbrev=query.getTipoVia().getAbrev();
149
            String nombreVia=(String)via.getDynValue(BusquedaCatastralManager.CAMPO_VIA_NOMBRE);
150

  
151
            CallejeroWSResponse callejeroResponse = getCatastroWS().
152
                 obtenerNumerero(nombreProvincia, nombreMunicipio, tipoViaAbrev, nombreVia, numero);
153
            if (callejeroResponse!=null){
154
                MessageElement[] any = callejeroResponse.get_any();
155
                MessageElement me=any[0];
156
                JAXBContext jaxbContext = JAXBContext.newInstance(ConsultaNumereror.class);
157

  
158
                Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
159
                InputStream input = new ByteArrayInputStream(me.getAsString().getBytes());
160
                ConsultaNumereror cn = (ConsultaNumereror) jaxbUnmarshaller.unmarshal(input);
161

  
162
                if (cn!=null && cn.getLerr()!=null){
163
                    webserviceErrors(cn.getLerr().getErr());
164
                }
165

  
166
                Numereror numerero = cn.getNumerero();
167
                return numereroToListString(numerero);
168
            }else{
169
                logger.error("Webservice response is empty");
170
                I18nManager i18nManager = ToolsLocator.getI18nManager();
171
                throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_reading_response_from_ws"),null);
172
            }
173

  
174
        } catch (RemoteException e) {
175
            logger.error("Error accesing webservice",e);
176
            I18nManager i18nManager = ToolsLocator.getI18nManager();
177
            throw new BusquedaCatastralRemoteServiceException(i18nManager.getTranslation("_error_obtaining_catastro_webservice"), e);
178
        } catch (Exception e) {
179
            logger.error("Error marshalling response from webservice",e);
180
            I18nManager i18nManager = ToolsLocator.getI18nManager();
181
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_reading_response_from_ws"), e);
182
        }
183

  
184
    }
185

  
186
    private Set<String> numereroToListString(Numereror numerero){
187
        if (numerero==null){
188
            return null;
189
        }
190
        Set<String> numeros=new HashSet<>();
191
        for (Nump nump:numerero.getNump()){
192
            String num = nump.getNum().getPnp();
193
            numeros.add(num);
194
        }
195
        return numeros;
196
    }
197

  
198
    @Override
199
    protected void defineType(EditableFeatureType type)
200
        throws BusquedaCatastralException {
201
        // Do Nothing
202

  
203
    }
204

  
205
    @Override
206
    protected void writeFileData(FeatureStore featureStore)
207
        throws BusquedaCatastralException, DataException {
208
      // Do Nothing
209

  
210
    }
211

  
212
    @Override
213
    protected String getExpressionQuery() {
214
     // Do Nothing
215
        return null;
216
    }
217

  
218

  
219
}
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.136/org.gvsig.busquedacatastral.lib/org.gvsig.busquedacatastral.lib.impl/src/main/java/org/gvsig/busquedacatastral/lib/impl/PointFactory.java
1
package org.gvsig.busquedacatastral.lib.impl;
2

  
3
import java.io.ByteArrayInputStream;
4
import java.io.InputStream;
5
import java.rmi.RemoteException;
6
import java.util.List;
7

  
8
import javax.xml.bind.JAXBContext;
9
import javax.xml.bind.Unmarshaller;
10
import javax.xml.rpc.ServiceException;
11

  
12
import org.apache.axis.message.MessageElement;
13
import org.apache.commons.lang3.StringUtils;
14

  
15
import org.gvsig.busquedacatastral.lib.api.ReferenciaCatastral;
16
import org.gvsig.busquedacatastral.lib.api.SRSCatastro;
17
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralException;
18
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralGettingDataException;
19
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralGettingParamsException;
20
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralInvalidSRSException;
21
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralRemoteServiceException;
22
import org.gvsig.busquedacatastral.lib.impl.ws.OVCCoordenadasLocator;
23
import org.gvsig.busquedacatastral.lib.impl.ws.OVCCoordenadasSoap;
24
import org.gvsig.busquedacatastral.lib.impl.ws.classes.Consulta_Coordenadas;
25
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.ConsultaCoord;
26
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Coord;
27
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Coords;
28
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Err;
29
import org.gvsig.fmap.geom.Geometry;
30
import org.gvsig.fmap.geom.GeometryLocator;
31
import org.gvsig.fmap.geom.exception.CreateGeometryException;
32
import org.gvsig.fmap.geom.primitive.Point;
33
import org.gvsig.tools.ToolsLocator;
34
import org.gvsig.tools.i18n.I18nManager;
35
import org.gvsig.tools.locator.LocatorException;
36

  
37
import org.slf4j.Logger;
38
import org.slf4j.LoggerFactory;
39

  
40
public class PointFactory {
41

  
42
    private static final Logger logger = LoggerFactory
43
        .getLogger(PointFactory.class);
44

  
45
    public Point getPoint(String referenciacatastral, SRSCatastro srs)
46
        throws BusquedaCatastralException {
47

  
48
        if (StringUtils.isEmpty(referenciacatastral)){
49
            logger.error("Referencia Catastral no valida");
50
            I18nManager i18nManager = ToolsLocator.getI18nManager();
51
            throw new BusquedaCatastralGettingDataException(i18nManager.getTranslation("_error_refCatastral_not_informed"), null);
52
        }else if (srs==null){
53
            logger.error("SRS de catastro no valido");
54
            I18nManager i18nManager = ToolsLocator.getI18nManager();
55
            throw new BusquedaCatastralInvalidSRSException(i18nManager.getTranslation("_error_SRS"), null);
56
        }else{
57
            Coords coords=getCoords(referenciacatastral,srs);
58
            if (coords!=null){
59
                return getPointFromCoords(coords);
60
            }else{
61
                logger.error("No se pudieron encontrar las coordenadas para la RC: "+referenciacatastral);
62
                I18nManager i18nManager = ToolsLocator.getI18nManager();
63
                throw new BusquedaCatastralGettingDataException(i18nManager.getTranslation("_error_couldnt_get_coords"), null);
64
            }
65

  
66
        }
67
    }
68

  
69

  
70
    public Point getPoint(ReferenciaCatastral referenciacatastral, SRSCatastro srs)
71
        throws BusquedaCatastralException {
72
        if (referenciacatastral==null){
73
            logger.error("Referencia Catastral no valida");
74
            I18nManager i18nManager = ToolsLocator.getI18nManager();
75
            throw new BusquedaCatastralGettingDataException(i18nManager.getTranslation("_error_refCatastral_not_informed"), null);
76
        }else{
77
            return getPoint(referenciacatastral.getRCParcial(),srs);
78
        }
79
    }
80

  
81
    private Point getPointFromCoords(Coords coords){
82
        double x;
83
        double y;
84
        for (Coord coord:coords.getCoord()){
85
            x=Double.valueOf(coord.getGeo().getXcen());
86
            y=Double.valueOf(coord.getGeo().getYcen());
87
            Point point=null;
88
            try {
89
                point= GeometryLocator.getGeometryManager().createPoint(x, y, Geometry.SUBTYPES.GEOM2D);
90
            } catch (CreateGeometryException | LocatorException e) {
91
                logger.error("Error getting center point "+e.getMessage());
92
            }
93
            return point;
94
        }
95
        return null;
96
    }
97

  
98
    private OVCCoordenadasSoap getCoordenadasWS() throws BusquedaCatastralGettingDataException{
99
        try {
100
            OVCCoordenadasLocator locator=
101
                new OVCCoordenadasLocator();
102
            OVCCoordenadasSoap coordenadasWS =
103
                locator.getOVCCoordenadasSoap();
104
            return coordenadasWS;
105
        } catch (ServiceException e) {
106
            logger.error("Error obtaining webservice",e);
107
            I18nManager i18nManager = ToolsLocator.getI18nManager();
108
            throw new BusquedaCatastralGettingDataException(i18nManager.getTranslation("_error_obtaining_catastro_webservice"), e);
109
        }
110

  
111
    }
112

  
113

  
114

  
115
    private Coords getCoords(String rc,SRSCatastro srs) throws BusquedaCatastralException{
116
        try {
117
              Consulta_Coordenadas consultaCoord = getCoordenadasWS().consulta_CPMRC("", "", srs.getCod(), rc);
118

  
119
            if (consultaCoord!=null){
120
                MessageElement[] any = consultaCoord.get_any();
121
                MessageElement me=any[0];
122
                JAXBContext jaxbContext = JAXBContext.newInstance(ConsultaCoord.class);
123

  
124
                Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
125
                InputStream input = new ByteArrayInputStream(me.getAsString().getBytes());
126
                ConsultaCoord ccord = (ConsultaCoord) jaxbUnmarshaller.unmarshal(input);
127

  
128
                if (ccord!=null && ccord.getLerr()!=null){
129
                    webserviceErrors(ccord.getLerr().getErr());
130
                }
131

  
132
                return ccord.getCoordenadas();
133
            }else{
134
                logger.error("Webservice response is empty");
135
                I18nManager i18nManager = ToolsLocator.getI18nManager();
136
                throw new BusquedaCatastralGettingDataException(i18nManager.getTranslation("_error_reading_response_from_ws"),null);
137
            }
138

  
139
        } catch (RemoteException e) {
140
            logger.error("Error accesing webservice",e);
141
            I18nManager i18nManager = ToolsLocator.getI18nManager();
142
            throw new BusquedaCatastralRemoteServiceException(i18nManager.getTranslation("_error_obtaining_catastro_webservice"), e);
143
        } catch (Exception e) {
144
            logger.error("Error marshalling response from webservice",e);
145
            I18nManager i18nManager = ToolsLocator.getI18nManager();
146
            throw new BusquedaCatastralGettingDataException(i18nManager.getTranslation("_error_reading_response_from_ws"), e);
147
        }
148

  
149
    }
150

  
151
    private void webserviceErrors(List<Err>errores) throws BusquedaCatastralException{
152
        if (errores!=null && !errores.isEmpty()){
153
            StringBuilder descErrores=new StringBuilder();
154
            I18nManager i18nManager = ToolsLocator.getI18nManager();
155
            descErrores.append(i18nManager.getTranslation("_errors_found_by_ws")+":");
156
            for (Err error:errores){
157
                descErrores.append("\n"+error.getDes());
158
                logger.error(descErrores.toString());
159
                throw new BusquedaCatastralGettingParamsException(descErrores.toString(), null);
160
            }
161
        }
162
    }
163

  
164

  
165
}
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.136/org.gvsig.busquedacatastral.lib/org.gvsig.busquedacatastral.lib.impl/src/main/java/org/gvsig/busquedacatastral/lib/impl/DefaultBusquedaCatastralLibrary.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2016 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 2
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, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.busquedacatastral.lib.impl;
24

  
25
import org.gvsig.busquedacatastral.lib.api.BusquedaCatastralLibrary;
26
import org.gvsig.busquedacatastral.lib.api.BusquedaCatastralLocator;
27
import org.gvsig.tools.library.AbstractLibrary;
28
import org.gvsig.tools.library.LibraryException;
29

  
30

  
31
/**
32
 * Defines library for busqueda catastral
33
 * @author daniel
34
 *
35
 */
36
public class DefaultBusquedaCatastralLibrary  extends AbstractLibrary{
37
    @Override
38
    public void doRegistration() {
39
        registerAsImplementationOf(BusquedaCatastralLibrary.class);
40
    }
41

  
42
    @Override
43
    protected void doInitialize() throws LibraryException {
44
        BusquedaCatastralLocator.registerManager(DefaultBusquedaCatastralManager.class);
45
    }
46

  
47
    @Override
48
    protected void doPostInitialize() throws LibraryException {
49
        //Do nothing
50
    }
51
}
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.136/org.gvsig.busquedacatastral.lib/org.gvsig.busquedacatastral.lib.impl/src/main/java/org/gvsig/busquedacatastral/lib/impl/Main.java
1
package org.gvsig.busquedacatastral.lib.impl;
2
import java.io.ByteArrayInputStream;
3
import java.io.InputStream;
4
import java.rmi.RemoteException;
5

  
6
import javax.xml.bind.JAXBContext;
7
import javax.xml.bind.JAXBException;
8
import javax.xml.bind.Unmarshaller;
9
import javax.xml.rpc.ServiceException;
10

  
11
import org.apache.axis.message.MessageElement;
12
import org.gvsig.busquedacatastral.lib.impl.ws.CallejeroCatastroWSLocator;
13
import org.gvsig.busquedacatastral.lib.impl.ws.CallejeroCatastroWSSoap;
14
import org.gvsig.busquedacatastral.lib.impl.ws.classes.MunicipiosWSResponse;
15
import org.gvsig.busquedacatastral.lib.impl.ws.classes.ProvinciasWSResponse;
16
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.ConsultaMunicipieror;
17
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.ConsultaProvincieror;
18
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.ObjectFactory;
19

  
20

  
21
/*
22
 * Copyright 2016 DiSiD Technologies S.L.L. All rights reserved.
23
 *
24
 * Project  : DiSiD WebServiceProject
25
 * SVN Id   : $Id$
26
 */
27

  
28
public class Main {
29

  
30
    public static void main(String[] args)  {
31
        try {
32
            CallejeroCatastroWSLocator locator=
33
                new CallejeroCatastroWSLocator();
34
            CallejeroCatastroWSSoap callejeroWS =
35
                locator.getCallejeroCatastroSoap();
36
            ProvinciasWSResponse provincias = callejeroWS.obtenerProvincias();
37

  
38
            ObjectFactory objfactory=new ObjectFactory();
39
            if (provincias!=null){
40
                MessageElement[] any = provincias.get_any();
41
                MessageElement me=any[0];
42
                JAXBContext jaxbContext = JAXBContext.newInstance(ConsultaProvincieror.class);
43

  
44
                Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
45
                InputStream input = new ByteArrayInputStream(me.getAsString().getBytes());
46
                ConsultaProvincieror cp = (ConsultaProvincieror) jaxbUnmarshaller.unmarshal(input);
47
                cp.getProvinciero();
48
            }
49
            MunicipiosWSResponse municipios = callejeroWS.obtenerMunicipios("VALENCIA", "");
50
            if (municipios!=null){
51
                MessageElement[] any = municipios.get_any();
52
                MessageElement me=any[0];
53
                JAXBContext jaxbContext = JAXBContext.newInstance(ConsultaMunicipieror.class);
54

  
55
                Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
56
                InputStream input = new ByteArrayInputStream(me.getAsString().getBytes());
57
                ConsultaMunicipieror cm = (ConsultaMunicipieror) jaxbUnmarshaller.unmarshal(input);
58
                cm.getMunicipiero();
59
            }
60

  
61

  
62
        } catch (ServiceException e) {
63
            // TODO Auto-generated catch block
64
            e.printStackTrace();
65
        } catch (RemoteException e) {
66
            // TODO Auto-generated catch block
67
            e.printStackTrace();
68
        } catch (JAXBException e) {
69
            // TODO Auto-generated catch block
70
            e.printStackTrace();
71
        } catch (Exception e) {
72
            // TODO Auto-generated catch block
73
            e.printStackTrace();
74
        }
75

  
76

  
77

  
78
    }
79

  
80
}
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.136/org.gvsig.busquedacatastral.lib/org.gvsig.busquedacatastral.lib.impl/src/main/java/org/gvsig/busquedacatastral/lib/impl/ProvinciasFactory.java
1
package org.gvsig.busquedacatastral.lib.impl;
2

  
3
import java.io.ByteArrayInputStream;
4
import java.io.File;
5
import java.io.IOException;
6
import java.io.InputStream;
7
import java.rmi.RemoteException;
8
import java.util.List;
9

  
10
import javax.xml.bind.JAXBContext;
11
import javax.xml.bind.Unmarshaller;
12

  
13
import org.apache.axis.message.MessageElement;
14
import org.apache.commons.lang3.StringUtils;
15

  
16
import org.gvsig.busquedacatastral.lib.api.BusquedaCatastralManager;
17
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralException;
18
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralGettingParamsException;
19
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralRemoteServiceException;
20
import org.gvsig.busquedacatastral.lib.impl.ws.classes.ProvinciasWSResponse;
21
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.ConsultaProvincieror;
22
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Err;
23
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Prov;
24
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Provinciero;
25
import org.gvsig.fmap.dal.DataTypes;
26
import org.gvsig.fmap.dal.exception.DataException;
27
import org.gvsig.fmap.dal.feature.EditableFeature;
28
import org.gvsig.fmap.dal.feature.EditableFeatureType;
29
import org.gvsig.fmap.dal.feature.FeatureStore;
30
import org.gvsig.tools.ToolsLocator;
31
import org.gvsig.tools.dynobject.DynObject;
32
import org.gvsig.tools.exception.BaseException;
33
import org.gvsig.tools.i18n.I18nManager;
34

  
35
import org.slf4j.Logger;
36
import org.slf4j.LoggerFactory;
37

  
38
public class ProvinciasFactory extends WSObjectsFactory{
39

  
40
    private static final Logger logger = LoggerFactory
41
        .getLogger(ProvinciasFactory.class);
42

  
43
    private final static String PROVINCIAS_FILENAME="provincias.dbf";
44

  
45

  
46
    public ProvinciasFactory(BusquedaCatastralManager manager){
47
        super(manager);
48
    }
49

  
50
    private Provinciero provinciero=null;
51
    public  List<DynObject> getProvincias() throws BusquedaCatastralException{
52
        //TODO
53
        //1.-Ver si existe fichero en tmp
54
        //2.- Si no existe
55
        //  2.1.- consulta web para obtener provinciero
56
        //  2.2.- generar archivo a partir de provinciero
57
        //3.-Leer fichero con listado de provincias
58
        //  3.1.- Por cada registro en provincia, construir un DynObject
59
        //4.-Devolver listado de DynObject
60

  
61
        File provinciasFile=null;
62

  
63
        try {
64
            provinciasFile = new File(manager.getCacheFolder(),PROVINCIAS_FILENAME);
65
            if (!provinciasFile.exists()){
66
                createDBF(provinciasFile);
67
            }
68
            return this.getListFromDBF(provinciasFile);
69
        } catch ( BusquedaCatastralException e) {
70
            throw e;
71
        } catch ( Exception e) {
72
            logger.warn("Error getting provincias from file '"+provinciasFile.getAbsolutePath()+"'.",e);
73
            throw new BusquedaCatastralGettingParamsException(e);
74
        }
75
    }
76

  
77

  
78
    @Override
79
    protected void defineType(EditableFeatureType type) throws BusquedaCatastralException {
80
        provinciero=getProvinciero();
81
        int maxNombre=0;
82
        int maxCodigo=0;
83
        for(Prov prov:provinciero.getProv()){
84
            if(StringUtils.isNotEmpty(prov.getNp()) && prov.getNp().length()>maxNombre){
85
                maxNombre=prov.getNp().length();
86
            }
87
            if(StringUtils.isNotEmpty(prov.getCpine()) && prov.getCpine().length()>maxCodigo){
88
                maxCodigo=prov.getCpine().length();
89
            }
90
        }
91
        type.add(BusquedaCatastralManager.CAMPO_PROVINCIA_NOMBRE, DataTypes.STRING,
92
            maxNombre);
93
        type.add(BusquedaCatastralManager.CAMPO_PROVINCIA_CODIGO, DataTypes.STRING,
94
            maxCodigo);
95
    }
96

  
97
    @Override
98
    protected void writeFileData(FeatureStore featureStore) throws DataException, BusquedaCatastralException {
99
        provinciero=getProvinciero();
100
        for(Prov prov:provinciero.getProv()){
101
            EditableFeature ef;
102
            ef = featureStore.createNewFeature().getEditable();
103
            ef.set(BusquedaCatastralManager.CAMPO_PROVINCIA_NOMBRE, prov.getNp());
104
            ef.set(BusquedaCatastralManager.CAMPO_PROVINCIA_CODIGO, prov.getCpine());
105
            featureStore.insert(ef);
106
        }
107
        provinciero = null;
108
    }
109

  
110
    private Provinciero getProvinciero() throws BusquedaCatastralException{
111
        if( provinciero == null ) {
112
            try {
113
                ProvinciasWSResponse provincias = getCatastroWS().obtenerProvincias();
114
                if (provincias!=null){
115
                    MessageElement[] any = provincias.get_any();
116
                    MessageElement me=any[0];
117
                    JAXBContext jaxbContext = JAXBContext.newInstance(ConsultaProvincieror.class);
118

  
119
                    Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
120
                    InputStream input = new ByteArrayInputStream(me.getAsString().getBytes());
121
                    ConsultaProvincieror cp = (ConsultaProvincieror) jaxbUnmarshaller.unmarshal(input);
122

  
123
                    if (cp!=null && cp.getLerr()!=null){
124
                        webserviceErrors(cp.getLerr().getErr());
125
                    }
126

  
127
                    provinciero =  cp.getProvinciero();
128
                }else{
129
                    logger.error("Webservice response is empty");
130
                    I18nManager i18nManager = ToolsLocator.getI18nManager();
131
                    throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_reading_response_from_ws"),null);
132
                }
133

  
134
            } catch (BusquedaCatastralRemoteServiceException e) {
135
                logger.error("Error accesing webservice",e);
136
                I18nManager i18nManager = ToolsLocator.getI18nManager();
137
                throw e;
138
            } catch (RemoteException e) {
139
                logger.error("Error marshalling response from webservice",e);
140
                I18nManager i18nManager = ToolsLocator.getI18nManager();
141
                throw new BusquedaCatastralRemoteServiceException(i18nManager.getTranslation("_error_reading_response_from_ws"), e);
142
            } catch (Exception e) {
143
                logger.error("Error marshalling response from webservice",e);
144
                I18nManager i18nManager = ToolsLocator.getI18nManager();
145
                throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_reading_response_from_ws"), e);
146
            }
147
        }
148
        return provinciero;
149
    }
150

  
151

  
152
    @Override
153
    protected String getExpressionQuery() {
154
        return null;
155
    }
156

  
157

  
158
}
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.136/org.gvsig.busquedacatastral.lib/org.gvsig.busquedacatastral.lib.impl/src/main/java/org/gvsig/busquedacatastral/lib/impl/ReferenciasCatastralesFactory.java
1
package org.gvsig.busquedacatastral.lib.impl;
2

  
3
import java.io.ByteArrayInputStream;
4
import java.io.InputStream;
5
import java.rmi.RemoteException;
6
import java.util.ArrayList;
7
import java.util.HashSet;
8
import java.util.List;
9
import java.util.Set;
10

  
11
import javax.xml.bind.JAXBContext;
12
import javax.xml.bind.Unmarshaller;
13

  
14
import org.apache.axis.message.MessageElement;
15
import org.apache.commons.lang3.StringUtils;
16

  
17
import org.gvsig.busquedacatastral.lib.api.BusquedaCatastralManager;
18
import org.gvsig.busquedacatastral.lib.api.QueryCatastral;
19
import org.gvsig.busquedacatastral.lib.api.QueryCatastral.TipoParcela;
20
import org.gvsig.busquedacatastral.lib.api.QueryCatastral.TipoQuery;
21
import org.gvsig.busquedacatastral.lib.api.ReferenciaCatastral;
22
import org.gvsig.busquedacatastral.lib.api.TipoVia;
23
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralException;
24
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralGettingParamsException;
25
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralRemoteServiceException;
26
import org.gvsig.busquedacatastral.lib.impl.ws.classes.ConsultaDNPPPWSResponse;
27
import org.gvsig.busquedacatastral.lib.impl.ws.classes.ConsultaDNPWSResponse;
28
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Bico;
29
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.ConsultaDnp;
30
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Dt;
31
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Lors;
32
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Lorus;
33
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Lourb;
34
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Lous;
35
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Lrcdnp;
36
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Rc;
37
import org.gvsig.busquedacatastral.lib.impl.ws.classes.cxf.Rcdnp;
38
import org.gvsig.fmap.dal.exception.DataException;
39
import org.gvsig.fmap.dal.feature.EditableFeatureType;
40
import org.gvsig.fmap.dal.feature.FeatureStore;
41
import org.gvsig.tools.ToolsLocator;
42
import org.gvsig.tools.dynobject.DynObject;
43
import org.gvsig.tools.i18n.I18nManager;
44

  
45
import org.slf4j.Logger;
46
import org.slf4j.LoggerFactory;
47

  
48
public class ReferenciasCatastralesFactory extends WSObjectsFactory{
49

  
50
    private static final Logger logger = LoggerFactory
51
        .getLogger(ReferenciasCatastralesFactory.class);
52

  
53

  
54
    public ReferenciasCatastralesFactory(BusquedaCatastralManager manager){
55
        super(manager);
56
    }
57

  
58

  
59
    public List<ReferenciaCatastral> getReferencias(QueryCatastral query) throws BusquedaCatastralException{
60
        ConsultaDnp consultaDatosNoPrivados=null;
61

  
62
        if (query==null){
63
            logger.error("Query no valida");
64
            I18nManager i18nManager = ToolsLocator.getI18nManager();
65
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_invalid_query"), null);
66
        }else{
67
            if ( TipoQuery.POR_RC.equals(query.getTipoQuery()) ){
68
                consultaDatosNoPrivados =getReferenciasByRC(query.getReferenciaCatastral());
69
            }else if( TipoQuery.POR_LOCALIZACION.equals(query.getTipoQuery()) ){
70
                if (TipoParcela.URBANA.equals(query.getTipoParcela())){
71
                    consultaDatosNoPrivados =getReferenciasUrbanas(query);
72
                }else if (TipoParcela.RUSTICA.equals(query.getTipoParcela())){
73
                    consultaDatosNoPrivados =getReferenciasRusticas(query);
74
                }else{
75
                    logger.error("Tipo parcela invalido");
76
                    I18nManager i18nManager = ToolsLocator.getI18nManager();
77
                    throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_tipo_parcela_not_informed"), null);
78
                }
79
            } else{
80
                logger.error("Tipo query invalido");
81
                I18nManager i18nManager = ToolsLocator.getI18nManager();
82
                throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_tipo_query_not_informed"), null);
83
            }
84

  
85
            if (consultaDatosNoPrivados!=null && consultaDatosNoPrivados.getLerr()!=null){
86
                webserviceErrors(consultaDatosNoPrivados.getLerr().getErr());
87
            }
88

  
89
            return  new ArrayList( createReferenciasCatastrales( consultaDatosNoPrivados) );
90

  
91
        }
92
    }
93

  
94
    private Set<ReferenciaCatastral> createReferenciasCatastrales(ConsultaDnp consultaDatosNoPrivados){
95
        Set<ReferenciaCatastral> results=new HashSet<ReferenciaCatastral>();
96
        if ( consultaDatosNoPrivados.getLrcdnp()!=null ){
97
            getReferenciasCatastralesFrom(consultaDatosNoPrivados.getLrcdnp());
98
            results.addAll( getReferenciasCatastralesFrom(consultaDatosNoPrivados.getLrcdnp()) );
99
        }
100
        if ( consultaDatosNoPrivados.getBico()!=null ){
101
            DefaultReferenciaCatastral refCatastral=getReferenciaCatastralFrom(consultaDatosNoPrivados.getBico());
102
            if (refCatastral!=null){
103
                results.add(refCatastral);
104
            }
105
        }
106
        return results;
107
    }
108

  
109
    private DefaultReferenciaCatastral getReferenciaCatastralFrom(Bico bico){
110
        if ( bico!=null ){
111
            DefaultReferenciaCatastral refCatastral=new DefaultReferenciaCatastral();
112
            if (bico.getBi()!=null){
113
                if( bico.getBi().getIdbi()!=null ){
114
                    fillReferenciaCatastralFrom(bico.getBi().getIdbi().getRc(), refCatastral);
115
                }
116
                if ( bico.getBi().getDt()!=null ){
117
                    fillReferenciaCatastralFrom(bico.getBi().getDt(), refCatastral);
118
                }
119
            }
120
            return refCatastral;
121
        }else{
122
            return null;
123
        }
124
    }
125

  
126
    private Set<ReferenciaCatastral> getReferenciasCatastralesFrom(Lrcdnp lrcdnp){
127
        Set<ReferenciaCatastral> results=new HashSet<ReferenciaCatastral>();
128
        for ( Rcdnp rcdnp:lrcdnp.getRcdnp()){
129
            if(rcdnp!=null){
130
                DefaultReferenciaCatastral refCatastral=new DefaultReferenciaCatastral();
131
                if (rcdnp.getRc()!=null){
132
                    fillReferenciaCatastralFrom(rcdnp.getRc(), refCatastral);
133
                }
134
                if (rcdnp.getDt()!=null){
135
                    fillReferenciaCatastralFrom(rcdnp.getDt(), refCatastral);
136
                }
137
            results.add(refCatastral);
138
            }
139
        }
140
        return results;
141
    }
142

  
143
    private void fillReferenciaCatastralFrom(Rc rc, DefaultReferenciaCatastral refCatastral){
144
        if (rc!=null){
145
            refCatastral.setPc1(rc.getPc1());
146
            refCatastral.setPc2(rc.getPc2());
147
            refCatastral.setCar(rc.getCar());
148
            refCatastral.setDc1(rc.getCc1());
149
            refCatastral.setDc2(rc.getCc2());
150
        }
151
    }
152

  
153
    private void fillReferenciaCatastralFrom(Dt dt, DefaultReferenciaCatastral refCatastral){
154
        if (dt!=null){
155
            refCatastral.setProvincia(dt.getNp());
156
            refCatastral.setMunicipio(dt.getNm());
157
            if (dt.getLocs()!=null){
158
                if (dt.getLocs().getLous()!=null){
159
                    Lous lous=dt.getLocs().getLous();
160
                    if (lous.getLourb()!=null){
161
                        //Urbana
162
                        Lourb lourb=lous.getLourb();
163
                        fillReferenciaCatastralFrom(lourb, refCatastral);
164
                    }
165
                    if(lous.getLorus()!=null && lous.getLorus().getCpp()!=null){
166
                        Lorus lorus=lous.getLorus();
167
                        fillReferenciaCatastralFrom(lorus, refCatastral);;
168
                    }
169
                }
170
                if (dt.getLocs().getLors()!=null){
171
                    Lors lors=dt.getLocs().getLors();
172
                    if (lors.getLourb()!=null){
173
                        //Urbana
174
                        Lourb lourb=lors.getLourb();
175
                        fillReferenciaCatastralFrom(lourb, refCatastral);
176
                    }
177
                    if(lors.getLorus()!=null && lors.getLorus().getCpp()!=null){
178
                        Lorus lorus=lors.getLorus();
179
                        fillReferenciaCatastralFrom(lorus, refCatastral);
180
                    }
181
                }
182
            }
183
        }
184
    }
185

  
186
    private void fillReferenciaCatastralFrom(Lorus lorus, DefaultReferenciaCatastral refCatastral){
187
        if(lorus!=null && lorus.getCpp()!=null){
188
            refCatastral.setPoligono(lorus.getCpp().getCpo());
189
            refCatastral.setParcela(lorus.getCpp().getCpa());
190
            refCatastral.setParaje(lorus.getNpa());
191
        }
192
    }
193

  
194
    private void fillReferenciaCatastralFrom(Lourb lourb, DefaultReferenciaCatastral refCatastral){
195
        if (lourb.getDir()!=null){
196
            if (lourb.getDir().getTv()!=null){
197
                TipoVia tipoVia=TipoVia.getTipoViaByAbrev(lourb.getDir().getTv());
198
                refCatastral.setTipoVia(tipoVia);
199
            }
200
            refCatastral.setVia(lourb.getDir().getNv());
201
            refCatastral.setPatio(lourb.getDir().getPnp());
202
            refCatastral.setKm(lourb.getDir().getKm());
203
            if (lourb.getLoint()!=null){
204
                refCatastral.setBloque(lourb.getLoint().getBq());
205
                refCatastral.setEscalera(lourb.getLoint().getEs());
206
                refCatastral.setPlanta(lourb.getLoint().getPt());
207
                refCatastral.setPuerta(lourb.getLoint().getPu());
208
            }
209
        }
210
    }
211

  
212

  
213
    private ConsultaDnp getReferenciasByRC(String rc) throws BusquedaCatastralException{
214
        try {
215
             ConsultaDNPWSResponse dnpResponse = getCatastroWS().
216
                 consulta_DNPRC("", "", rc);
217
            if (dnpResponse!=null){
218
                MessageElement[] any = dnpResponse.get_any();
219
                MessageElement me=any[0];
220
                JAXBContext jaxbContext = JAXBContext.newInstance(ConsultaDnp.class);
221

  
222
                Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
223
                InputStream input = new ByteArrayInputStream(me.getAsString().getBytes());
224
                ConsultaDnp cdnp = (ConsultaDnp) jaxbUnmarshaller.unmarshal(input);
225

  
226
                return cdnp;
227
            }else{
228
                logger.error("Webservice response is empty");
229
                I18nManager i18nManager = ToolsLocator.getI18nManager();
230
                throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_reading_response_from_ws"),null);
231
            }
232

  
233
        } catch (RemoteException e) {
234
            logger.error("Error accesing webservice",e);
235
            I18nManager i18nManager = ToolsLocator.getI18nManager();
236
            throw new BusquedaCatastralRemoteServiceException(i18nManager.getTranslation("_error_obtaining_catastro_webservice"), e);
237
        } catch (Exception e) {
238
            logger.error("Error marshalling response from webservice",e);
239
            I18nManager i18nManager = ToolsLocator.getI18nManager();
240
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_reading_response_from_ws"), e);
241
        }
242

  
243
    }
244

  
245
    private ConsultaDnp getReferenciasUrbanas(QueryCatastral query) throws BusquedaCatastralException{
246
        validateQueryUrbana(query);
247
        try {
248
            DynObject provincia=query.getProvincia();
249
            DynObject municipio=query.getMunicipio();
250
            DynObject via=query.getVia();
251
            String nombreProvincia=(String) provincia.getDynValue(BusquedaCatastralManager.CAMPO_PROVINCIA_NOMBRE);
252
            String nombreMunicipio=(String) municipio.getDynValue(BusquedaCatastralManager.CAMPO_MUNICIPIO_NOMBRE);
253
            String tipoViaAbrev=query.getTipoVia().getAbrev();
254
            String nombreVia=(String)via.getDynValue(BusquedaCatastralManager.CAMPO_VIA_NOMBRE);
255

  
256
            ConsultaDNPWSResponse dnpResponse = getCatastroWS().
257
                 consulta_DNPLOC(nombreProvincia, nombreMunicipio, tipoViaAbrev, nombreVia,
258
                     query.getNumero(), query.getBloque(), query.getEscalera(), query.getPlanta(), query.getPuerta());
259
            if (dnpResponse!=null){
260
                MessageElement[] any = dnpResponse.get_any();
261
                MessageElement me=any[0];
262
                JAXBContext jaxbContext = JAXBContext.newInstance(ConsultaDnp.class);
263

  
264
                Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
265
                InputStream input = new ByteArrayInputStream(me.getAsString().getBytes());
266
                ConsultaDnp cdnp = (ConsultaDnp) jaxbUnmarshaller.unmarshal(input);
267

  
268
                return cdnp;
269
            }else{
270
                logger.error("Webservice response is empty");
271
                I18nManager i18nManager = ToolsLocator.getI18nManager();
272
                throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_reading_response_from_ws"),null);
273
            }
274

  
275
        } catch (RemoteException e) {
276
            logger.error("Error accesing webservice",e);
277
            I18nManager i18nManager = ToolsLocator.getI18nManager();
278
            throw new BusquedaCatastralRemoteServiceException(i18nManager.getTranslation("_error_obtaining_catastro_webservice"), e);
279
        } catch (Exception e) {
280
            logger.error("Error marshalling response from webservice",e);
281
            I18nManager i18nManager = ToolsLocator.getI18nManager();
282
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_reading_response_from_ws"), e);
283
        }
284
    }
285

  
286

  
287
    private ConsultaDnp getReferenciasRusticas(QueryCatastral query) throws BusquedaCatastralException{
288
        validateQueryRustica(query);
289
        try {
290
            DynObject provincia=query.getProvincia();
291
            DynObject municipio=query.getMunicipio();
292
            String nombreProvincia=(String) provincia.getDynValue(BusquedaCatastralManager.CAMPO_PROVINCIA_NOMBRE);
293
            String nombreMunicipio=(String) municipio.getDynValue(BusquedaCatastralManager.CAMPO_MUNICIPIO_NOMBRE);
294

  
295

  
296
            ConsultaDNPPPWSResponse dnpResponse = getCatastroWS().
297
                 consulta_DNPPP(nombreProvincia, nombreMunicipio, query.getPoligono(), query.getParcela());
298
            if (dnpResponse!=null){
299
                MessageElement[] any = dnpResponse.get_any();
300
                MessageElement me=any[0];
301
                JAXBContext jaxbContext = JAXBContext.newInstance(ConsultaDnp.class);
302

  
303
                Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
304
                InputStream input = new ByteArrayInputStream(me.getAsString().getBytes());
305
                ConsultaDnp cdnp = (ConsultaDnp) jaxbUnmarshaller.unmarshal(input);
306

  
307
                return cdnp;
308
            }else{
309
                logger.error("Webservice response is empty");
310
                I18nManager i18nManager = ToolsLocator.getI18nManager();
311
                throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_reading_response_from_ws"),null);
312
            }
313

  
314
        } catch (RemoteException e) {
315
            logger.error("Error accesing webservice",e);
316
            I18nManager i18nManager = ToolsLocator.getI18nManager();
317
            throw new BusquedaCatastralRemoteServiceException(i18nManager.getTranslation("_error_obtaining_catastro_webservice"), e);
318
        } catch (Exception e) {
319
            logger.error("Error marshalling response from webservice",e);
320
            I18nManager i18nManager = ToolsLocator.getI18nManager();
321
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_reading_response_from_ws"), e);
322
        }
323
    }
324

  
325

  
326
    private void validateQueryUrbana(QueryCatastral query) throws BusquedaCatastralException{
327
        if (query.getProvincia()==null){
328
            logger.error("Provincia no informada");
329
            I18nManager i18nManager = ToolsLocator.getI18nManager();
330
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_provincia_not_informed"), null);
331
        }
332
        if (query.getMunicipio()==null){
333
            logger.error("Municipio no informado");
334
            I18nManager i18nManager = ToolsLocator.getI18nManager();
335
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_municipio_not_informed"), null);
336
        }
337
        if (query.getTipoVia()==null){
338
            logger.error("Tipo Via no informado");
339
            I18nManager i18nManager = ToolsLocator.getI18nManager();
340
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_tipo_via_not_informed"), null);
341
        }
342
        if (query.getVia()==null){
343
            logger.error("Via no informado");
344
            I18nManager i18nManager = ToolsLocator.getI18nManager();
345
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_via_not_informed"), null);
346
        }
347
        if (query.getNumero()==null){
348
            logger.error("Numero no informado");
349
            I18nManager i18nManager = ToolsLocator.getI18nManager();
350
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_numero_not_informed"), null);
351
        }
352
    }
353

  
354

  
355
    private void validateQueryRustica(QueryCatastral query) throws BusquedaCatastralException{
356
        if (query.getProvincia()==null){
357
            logger.error("Provincia no informada");
358
            I18nManager i18nManager = ToolsLocator.getI18nManager();
359
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_provincia_not_informed"), null);
360
        }
361
        if (query.getMunicipio()==null){
362
            logger.error("Municipio no informado");
363
            I18nManager i18nManager = ToolsLocator.getI18nManager();
364
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_municipio_not_informed"), null);
365
        }
366
        if (query.getPoligono()==null){
367
            logger.error("Poligono no informado");
368
            I18nManager i18nManager = ToolsLocator.getI18nManager();
369
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_poligono_not_informed"), null);
370
        }
371
        if (query.getParcela()==null){
372
            logger.error("Municipio no informado");
373
            I18nManager i18nManager = ToolsLocator.getI18nManager();
374
            throw new BusquedaCatastralGettingParamsException(i18nManager.getTranslation("_error_parcela_not_informed"), null);
375
        }
376
    }
377

  
378
    @Override
379
    protected void defineType(EditableFeatureType type)
380
        throws BusquedaCatastralException {
381
        // Do Nothing
382

  
383
    }
384

  
385
    @Override
386
    protected void writeFileData(FeatureStore featureStore)
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff