svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.remoteclient / src / main / java / org / gvsig / remoteclient / wfs / wfs_1_0_0 / request / WFSGetFeatureRequest1_0_0.java @ 40559
History | View | Annotate | Download (4.23 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
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 | 40435 | jjdelcerro | package org.gvsig.remoteclient.wfs.wfs_1_0_0.request; |
25 | |||
26 | import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
||
27 | import org.gvsig.remoteclient.wfs.WFSStatus; |
||
28 | import org.gvsig.remoteclient.wfs.filters.filterencoding.FilterEncoding; |
||
29 | import org.gvsig.remoteclient.wfs.request.WFSGetFeatureRequest; |
||
30 | |||
31 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
32 | *
|
||
33 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
34 | *
|
||
35 | * This program is free software; you can redistribute it and/or
|
||
36 | * modify it under the terms of the GNU General Public License
|
||
37 | * as published by the Free Software Foundation; either version 2
|
||
38 | * of the License, or (at your option) any later version.
|
||
39 | *
|
||
40 | * This program is distributed in the hope that it will be useful,
|
||
41 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
42 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
43 | * GNU General Public License for more details.
|
||
44 | *
|
||
45 | * You should have received a copy of the GNU General Public License
|
||
46 | * along with this program; if not, write to the Free Software
|
||
47 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
48 | *
|
||
49 | * For more information, contact:
|
||
50 | *
|
||
51 | * Generalitat Valenciana
|
||
52 | * Conselleria d'Infraestructures i Transport
|
||
53 | * Av. Blasco Ib??ez, 50
|
||
54 | * 46010 VALENCIA
|
||
55 | * SPAIN
|
||
56 | *
|
||
57 | * +34 963862235
|
||
58 | * gvsig@gva.es
|
||
59 | * www.gvsig.gva.es
|
||
60 | *
|
||
61 | * or
|
||
62 | *
|
||
63 | * IVER T.I. S.A
|
||
64 | * Salamanca 50
|
||
65 | * 46005 Valencia
|
||
66 | * Spain
|
||
67 | *
|
||
68 | * +34 963163400
|
||
69 | * dac@iver.es
|
||
70 | */
|
||
71 | /* CVS MESSAGES:
|
||
72 | *
|
||
73 | * $Id$
|
||
74 | * $Log$
|
||
75 | *
|
||
76 | */
|
||
77 | /**
|
||
78 | * @author Jorge Piera Llodr? (jorge.piera@iver.es)
|
||
79 | */
|
||
80 | public class WFSGetFeatureRequest1_0_0 extends WFSGetFeatureRequest{ |
||
81 | |||
82 | public WFSGetFeatureRequest1_0_0(WFSStatus status,
|
||
83 | WFSProtocolHandler protocolHandler) { |
||
84 | super(status, protocolHandler);
|
||
85 | } |
||
86 | |||
87 | |||
88 | /*
|
||
89 | * (non-Javadoc)
|
||
90 | * @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getHttpGetRequest(java.lang.String)
|
||
91 | */
|
||
92 | protected String getHttpGetRequest(String onlineResource) { |
||
93 | StringBuffer req = new StringBuffer(); |
||
94 | req.append(onlineResource); |
||
95 | req.append("REQUEST=GetFeature&SERVICE=WFS&");
|
||
96 | req.append("TYPENAME=").append(status.getFeatureFullName()).append("&"); |
||
97 | String[] fields = status.getFields(); |
||
98 | addPropertyName(req); |
||
99 | if ((status.getFilterByAttribute() != null) || (status.getFilterByArea() != null)){ |
||
100 | FilterEncoding filterEncoding = new FilterEncoding(status);
|
||
101 | req.append("FILTER=" + filterEncoding.toString(protocolHandler.getVersion()) + "&"); |
||
102 | } |
||
103 | req.append("VERSION=").append(protocolHandler.getVersion()).append("&EXCEPTIONS=XML"); |
||
104 | req.append("&MAXFEATURES=").append(status.getMaxFeatures());
|
||
105 | req.append("&SRSNAME=").append(status.getSrs());
|
||
106 | |||
107 | return req.toString();
|
||
108 | } |
||
109 | |||
110 | /**
|
||
111 | * Adds the "PROPERTYNAME" attribute
|
||
112 | * @param req
|
||
113 | * The current request
|
||
114 | */
|
||
115 | protected void addPropertyName(StringBuffer req){ |
||
116 | String[] fields = status.getFields(); |
||
117 | if (fields.length > 0){ |
||
118 | req.append("PROPERTYNAME=");
|
||
119 | |||
120 | // opening parenthesis (march 2013)
|
||
121 | req.append("(");
|
||
122 | |||
123 | req.append(fields[0]);
|
||
124 | for (int i=1 ; i<fields.length ; i++){ |
||
125 | req.append("," + fields[i]);
|
||
126 | } |
||
127 | |||
128 | // closing parenthesis (march 2013)
|
||
129 | req.append(")");
|
||
130 | |||
131 | req.append("&");
|
||
132 | } |
||
133 | } |
||
134 | |||
135 | protected String getSchemaLocation() { |
||
136 | return "../wfs/1.0.0/WFS-basic.xsd"; |
||
137 | } |
||
138 | } |