root / branches / v2_0_0_prep / libraries / libRemoteServices / src / org / gvsig / remoteclient / wfs / wfs_1_0_0 / request / WFSTLockFeatureRequest1_0_0.java @ 34026
History | View | Annotate | Download (5.08 KB)
1 | 31769 | jpiera | package org.gvsig.remoteclient.wfs.wfs_1_0_0.request; |
---|---|---|---|
2 | |||
3 | import org.gvsig.remoteclient.utils.CapabilitiesTags; |
||
4 | import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
||
5 | import org.gvsig.remoteclient.wfs.WFSStatus; |
||
6 | import org.gvsig.remoteclient.wfs.edition.WFSTTags; |
||
7 | import org.gvsig.remoteclient.wfs.request.WFSTLockFeatureRequest; |
||
8 | |||
9 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
10 | *
|
||
11 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
12 | *
|
||
13 | * This program is free software; you can redistribute it and/or
|
||
14 | * modify it under the terms of the GNU General Public License
|
||
15 | * as published by the Free Software Foundation; either version 2
|
||
16 | * of the License, or (at your option) any later version.
|
||
17 | *
|
||
18 | * This program is distributed in the hope that it will be useful,
|
||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
21 | * GNU General Public License for more details.
|
||
22 | *
|
||
23 | * You should have received a copy of the GNU General Public License
|
||
24 | * along with this program; if not, write to the Free Software
|
||
25 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
26 | *
|
||
27 | * For more information, contact:
|
||
28 | *
|
||
29 | * Generalitat Valenciana
|
||
30 | * Conselleria d'Infraestructures i Transport
|
||
31 | * Av. Blasco Ib??ez, 50
|
||
32 | * 46010 VALENCIA
|
||
33 | * SPAIN
|
||
34 | *
|
||
35 | * +34 963862235
|
||
36 | * gvsig@gva.es
|
||
37 | * www.gvsig.gva.es
|
||
38 | *
|
||
39 | * or
|
||
40 | *
|
||
41 | * IVER T.I. S.A
|
||
42 | * Salamanca 50
|
||
43 | * 46005 Valencia
|
||
44 | * Spain
|
||
45 | *
|
||
46 | * +34 963163400
|
||
47 | * dac@iver.es
|
||
48 | */
|
||
49 | /* CVS MESSAGES:
|
||
50 | *
|
||
51 | * $Id$
|
||
52 | * $Log$
|
||
53 | *
|
||
54 | */
|
||
55 | /**
|
||
56 | * @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
||
57 | */
|
||
58 | public class WFSTLockFeatureRequest1_0_0 extends WFSTLockFeatureRequest{ |
||
59 | |||
60 | public WFSTLockFeatureRequest1_0_0(WFSStatus status,
|
||
61 | WFSProtocolHandler protocolHandler) { |
||
62 | super(status, protocolHandler);
|
||
63 | } |
||
64 | |||
65 | /*
|
||
66 | * (non-Javadoc)
|
||
67 | * @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getHttpGetRequest(java.lang.String)
|
||
68 | */
|
||
69 | protected String getHttpGetRequest(String onlineResource) { |
||
70 | StringBuffer req = new StringBuffer(); |
||
71 | req.append(onlineResource); |
||
72 | req.append("REQUEST=LockFeature&SERVICE=WFS&");
|
||
73 | req.append("TYPENAME=").append(status.getFeatureName()).append("&"); |
||
74 | req.append("LOCKACTION=" + status.getLockAction() + "&"); |
||
75 | if (status.getFilterQueryLocked() != null){ |
||
76 | req.append("FILTER=");
|
||
77 | req.append(status.getFilterQueryLocked() + "&");
|
||
78 | } |
||
79 | if (status.getExpiry() > 0){ |
||
80 | req.append("EXPIRY=" + status.getExpiry() + "&"); |
||
81 | } |
||
82 | req.append("VERSION=").append(protocolHandler.getVersion()).append("&EXCEPTIONS=XML"); |
||
83 | 34026 | jpiera | req.append("&MAXFEATURES=").append(status.getMaxFeatures());
|
84 | 31769 | jpiera | return req.toString();
|
85 | } |
||
86 | |||
87 | /*
|
||
88 | * (non-Javadoc)
|
||
89 | * @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getHttpPostRequest(java.lang.String)
|
||
90 | */
|
||
91 | protected String getHttpPostRequest(String onlineResource) { |
||
92 | StringBuffer request = new StringBuffer(); |
||
93 | request.append(WFSTTags.XML_ROOT); |
||
94 | request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
||
95 | request.append(CapabilitiesTags.WFS_LOCKFEATURE + " ");
|
||
96 | request.append(CapabilitiesTags.VERSION + "=\"" + protocolHandler.getVersion() + "\" "); |
||
97 | request.append(WFSTTags.WFST_SERVICE + "=\"WFS\" ");
|
||
98 | if (status.getExpiry() > 0){ |
||
99 | request.append(WFSTTags.WFST_EXPIRYTIME + "=\"" + status.getExpiry() + "\" "); |
||
100 | } |
||
101 | request.append(WFSTTags.XMLNS + ":" + WFSTTags.OGC_NAMESPACE_PREFIX);
|
||
102 | request.append("=\"" + WFSTTags.OGC_NAMESPACE + "\" "); |
||
103 | request.append(WFSTTags.XMLNS + ":" + WFSTTags.WFS_NAMESPACE_PREFIX);
|
||
104 | request.append("=\"" + WFSTTags.WFS_NAMESPACE + "\" "); |
||
105 | request.append(WFSTTags.XMLNS + ":" + WFSTTags.XML_NAMESPACE_PREFIX);
|
||
106 | request.append("=\"" + WFSTTags.XML_NAMESPACE + "\" "); |
||
107 | request.append(WFSTTags.XMLNS + ":" + WFSTTags.GML_NAMESPACE_PREFIX);
|
||
108 | request.append("=\"" + WFSTTags.GML_NAMESPACE + "\" "); |
||
109 | request.append(WFSTTags.XMLNS + ":" + status.getNamespacePrefix());
|
||
110 | 34026 | jpiera | request.append("=\"" + status.getNamespaceLocation() + "\" "); |
111 | 31769 | jpiera | request.append(WFSTTags.XML_NAMESPACE_PREFIX + ":" + WFSTTags.XML_SCHEMALOCATION);
|
112 | request.append("=\"" + WFSTTags.WFS_NAMESPACE + " "); |
||
113 | request.append(getSchemaLocation()); |
||
114 | request.append("\">");
|
||
115 | request.append(getLockPostRequest()); |
||
116 | request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
||
117 | request.append(CapabilitiesTags.WFS_LOCKFEATURE + ">");
|
||
118 | return request.toString();
|
||
119 | } |
||
120 | |||
121 | /**
|
||
122 | * Creates a Lock query for a HTTP Post request
|
||
123 | * @return
|
||
124 | */
|
||
125 | private String getLockPostRequest(){ |
||
126 | StringBuffer request = new StringBuffer(); |
||
127 | request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
||
128 | request.append(WFSTTags.WFST_LOCK); |
||
129 | request.append(" typeName=\"" + status.getFeatureName() + "\""); |
||
130 | request.append(">");
|
||
131 | String filter = status.getFilterQueryLocked();
|
||
132 | if (filter != null){ |
||
133 | request.append(status.getFilterQueryLockedPost()); |
||
134 | } |
||
135 | request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
||
136 | request.append(WFSTTags.WFST_LOCK + ">");
|
||
137 | return request.toString();
|
||
138 | } |
||
139 | |||
140 | /*
|
||
141 | * (non-Javadoc)
|
||
142 | * @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getSchemaLocation()
|
||
143 | */
|
||
144 | protected String getSchemaLocation() { |
||
145 | return "../wfs/1.0.0/WFS-transaction.xsd"; |
||
146 | } |
||
147 | |||
148 | } |