Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.remoteclient / src / main / java / org / gvsig / remoteclient / wfs / request / WFSGetFeatureRequest.java @ 40559

History | View | Annotate | Download (6.2 KB)

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.remoteclient.wfs.request;
25

    
26
import org.gvsig.remoteclient.utils.CapabilitiesTags;
27
import org.gvsig.remoteclient.wfs.WFSProtocolHandler;
28
import org.gvsig.remoteclient.wfs.WFSRequestInformation;
29
import org.gvsig.remoteclient.wfs.WFSStatus;
30
import org.gvsig.remoteclient.wfs.edition.WFSTTags;
31
import org.gvsig.remoteclient.wfs.filters.filterencoding.FilterEncoding;
32

    
33
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
34
 *
35
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
36
 *
37
 * This program is free software; you can redistribute it and/or
38
 * modify it under the terms of the GNU General Public License
39
 * as published by the Free Software Foundation; either version 2
40
 * of the License, or (at your option) any later version.
41
 *
42
 * This program is distributed in the hope that it will be useful,
43
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
44
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
45
 * GNU General Public License for more details.
46
 *
47
 * You should have received a copy of the GNU General Public License
48
 * along with this program; if not, write to the Free Software
49
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
50
 *
51
 * For more information, contact:
52
 *
53
 *  Generalitat Valenciana
54
 *   Conselleria d'Infraestructures i Transport
55
 *   Av. Blasco Ib??ez, 50
56
 *   46010 VALENCIA
57
 *   SPAIN
58
 *
59
 *      +34 963862235
60
 *   gvsig@gva.es
61
 *      www.gvsig.gva.es
62
 *
63
 *    or
64
 *
65
 *   IVER T.I. S.A
66
 *   Salamanca 50
67
 *   46005 Valencia
68
 *   Spain
69
 *
70
 *   +34 963163400
71
 *   dac@iver.es
72
 */
73
/* CVS MESSAGES:
74
 *
75
 * $Id$
76
 * $Log$
77
 *
78
 */
79
/**
80
 * The GetFeature operation allows retrieval of features from a 
81
 * web feature service. A GetFeature request is processed by
82
 * a WFS and when the value of the outputFormat attribute is 
83
 * set to text/gml a GML instance document, containing the 
84
 * result set, is returned to the client.
85
 * @see http://www.opengeospatial.org/standards/wfs
86
 * @author Jorge Piera Llodrá (jorge.piera@iver.es)
87
 */
88
public abstract class WFSGetFeatureRequest extends WFSRequest{
89

    
90
        public WFSGetFeatureRequest(WFSStatus status,
91
                        WFSProtocolHandler protocolHandler) {
92
                super(status, protocolHandler);
93
        }
94

    
95
        /*
96
         * (non-Javadoc)
97
         * @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getHttpPostRequest(java.lang.String)
98
         */
99
        protected String getHttpPostRequest(String onlineResource) {
100
                StringBuffer request = new StringBuffer();
101
                request.append(WFSTTags.XML_ROOT);
102
                request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":");
103
                request.append(CapabilitiesTags.WFS_GETFEATURE + " ");
104
                request.append(CapabilitiesTags.VERSION + "=\"" + protocolHandler.getVersion() + "\" ");
105
                request.append(WFSTTags.WFST_SERVICE + "=\"WFS\" ");
106
                if (status.getMaxFeatures().longValue() > 0){
107
            request.append(CapabilitiesTags.MAXFEATURES + "=\"" + status.getMaxFeatures() + "\" ");
108
        }
109
                if (status.getResultType() == WFSStatus.RESULTYPE_HITS){
110
                        request.append(WFSTTags.WFS_RESULTTYPE + "=\"" + WFSTTags.WFS_HITS + "\" ");
111
                }
112
                request.append(WFSTTags.XMLNS + ":" + WFSTTags.OGC_NAMESPACE_PREFIX);
113
                request.append("=\"" + WFSTTags.OGC_NAMESPACE + "\" ");
114
                request.append(WFSTTags.XMLNS + ":" + WFSTTags.WFS_NAMESPACE_PREFIX);
115
                request.append("=\"" + WFSTTags.WFS_NAMESPACE + "\" ");
116
                request.append(WFSTTags.XMLNS + ":" + WFSTTags.XML_NAMESPACE_PREFIX);
117
                request.append("=\"" + WFSTTags.XML_NAMESPACE + "\" ");
118
                request.append(WFSTTags.XMLNS + ":" + WFSTTags.GML_NAMESPACE_PREFIX);
119
                request.append("=\"" + WFSTTags.GML_NAMESPACE + "\" ");
120
                request.append(WFSTTags.XMLNS + ":" + status.getNamespacePrefix());
121
                request.append("=\"" + status.getNamespaceLocation() + "\" ");
122
                request.append(WFSTTags.XML_NAMESPACE_PREFIX + ":" + WFSTTags.XML_SCHEMALOCATION);
123
                request.append("=\"" + WFSTTags.WFS_NAMESPACE + " ");
124
                request.append(getSchemaLocation());
125
                request.append("\">");
126
                request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":");
127
                request.append(WFSTTags.WFS_QUERY);
128
                request.append(" typeName=\"" + status.getFeatureFullName() + "\"");
129
                request.append(">");
130
                if ((status.getFilterByAttribute() != null) || (status.getFilterByArea() != null)){                        
131
                        FilterEncoding filterEncoding = new FilterEncoding(status);
132
                        request.append(filterEncoding.toString(protocolHandler.getVersion()));                
133
                }
134
                request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":");
135
                request.append(WFSTTags.WFS_QUERY);
136
                request.append(">");
137
                request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":");
138
                request.append(CapabilitiesTags.WFS_GETFEATURE + ">");
139
                return request.toString();
140
        }
141

    
142
        /*
143
         * (non-Javadoc)
144
         * @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getOperationCode()
145
         */
146
        protected String getOperationName() {
147
                return CapabilitiesTags.WFS_GETFEATURE;
148
        }
149

    
150
        /*
151
         * (non-Javadoc)
152
         * @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getSchemaLocation()
153
         */
154
        protected String getSchemaLocation() {
155
                return null;
156
        }
157

    
158
        /*
159
         * (non-Javadoc)
160
         * @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getTempFilePrefix()
161
         */
162
        protected String getTempFilePrefix() {
163
                return "wfs_getFeature.gml";
164
        }
165

    
166
        /*
167
         * (non-Javadoc)
168
         * @see org.gvsig.remoteclient.wfs.request.WFSRequest#createRequestInformation()
169
         */
170
        public WFSRequestInformation createRequestInformation() {
171
                return new WFSGetFeatureRequestInformation();
172
        }
173
        
174
        
175
}