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 / WFSTLockFeatureRequest1_0_0.java @ 40596
History | View | Annotate | Download (4.78 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.wfs_1_0_0.request; |
25 |
|
26 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
27 |
import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
28 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
29 |
import org.gvsig.remoteclient.wfs.edition.WFSTTags; |
30 |
import org.gvsig.remoteclient.wfs.request.WFSTLockFeatureRequest; |
31 |
|
32 |
/**
|
33 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
34 |
*/
|
35 |
public class WFSTLockFeatureRequest1_0_0 extends WFSTLockFeatureRequest{ |
36 |
|
37 |
public WFSTLockFeatureRequest1_0_0(WFSStatus status,
|
38 |
WFSProtocolHandler protocolHandler) { |
39 |
super(status, protocolHandler);
|
40 |
} |
41 |
|
42 |
/*
|
43 |
* (non-Javadoc)
|
44 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getHttpGetRequest(java.lang.String)
|
45 |
*/
|
46 |
protected String getHttpGetRequest(String onlineResource) { |
47 |
StringBuffer req = new StringBuffer(); |
48 |
req.append(onlineResource); |
49 |
req.append("REQUEST=LockFeature&SERVICE=WFS&");
|
50 |
req.append("TYPENAME=").append(status.getFeatureName()).append("&"); |
51 |
req.append("LOCKACTION=" + status.getLockAction() + "&"); |
52 |
if (status.getFilterQueryLocked() != null){ |
53 |
req.append("FILTER=");
|
54 |
req.append(status.getFilterQueryLocked() + "&");
|
55 |
} |
56 |
if (status.getExpiry() > 0){ |
57 |
req.append("EXPIRY=" + status.getExpiry() + "&"); |
58 |
} |
59 |
req.append("VERSION=").append(protocolHandler.getVersion()).append("&EXCEPTIONS=XML"); |
60 |
req.append("&MAXFEATURES=").append(status.getMaxFeatures());
|
61 |
return req.toString();
|
62 |
} |
63 |
|
64 |
/*
|
65 |
* (non-Javadoc)
|
66 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getHttpPostRequest(java.lang.String)
|
67 |
*/
|
68 |
protected String getHttpPostRequest(String onlineResource) { |
69 |
StringBuffer request = new StringBuffer(); |
70 |
request.append(WFSTTags.XML_ROOT); |
71 |
request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
72 |
request.append(CapabilitiesTags.WFS_LOCKFEATURE + " ");
|
73 |
request.append(CapabilitiesTags.VERSION + "=\"" + protocolHandler.getVersion() + "\" "); |
74 |
request.append(WFSTTags.WFST_SERVICE + "=\"WFS\" ");
|
75 |
if (status.getExpiry() > 0){ |
76 |
request.append(WFSTTags.WFST_EXPIRYTIME + "=\"" + status.getExpiry() + "\" "); |
77 |
} |
78 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.OGC_NAMESPACE_PREFIX);
|
79 |
request.append("=\"" + WFSTTags.OGC_NAMESPACE + "\" "); |
80 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.WFS_NAMESPACE_PREFIX);
|
81 |
request.append("=\"" + WFSTTags.WFS_NAMESPACE + "\" "); |
82 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.XML_NAMESPACE_PREFIX);
|
83 |
request.append("=\"" + WFSTTags.XML_NAMESPACE + "\" "); |
84 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.GML_NAMESPACE_PREFIX);
|
85 |
request.append("=\"" + WFSTTags.GML_NAMESPACE + "\" "); |
86 |
request.append(WFSTTags.XMLNS + ":" + status.getNamespacePrefix());
|
87 |
request.append("=\"" + status.getNamespaceLocation() + "\" "); |
88 |
request.append(WFSTTags.XML_NAMESPACE_PREFIX + ":" + WFSTTags.XML_SCHEMALOCATION);
|
89 |
request.append("=\"" + WFSTTags.WFS_NAMESPACE + " "); |
90 |
request.append(getSchemaLocation()); |
91 |
request.append("\">");
|
92 |
request.append(getLockPostRequest()); |
93 |
request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
94 |
request.append(CapabilitiesTags.WFS_LOCKFEATURE + ">");
|
95 |
return request.toString();
|
96 |
} |
97 |
|
98 |
/**
|
99 |
* Creates a Lock query for a HTTP Post request
|
100 |
* @return
|
101 |
*/
|
102 |
private String getLockPostRequest(){ |
103 |
StringBuffer request = new StringBuffer(); |
104 |
request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
105 |
request.append(WFSTTags.WFST_LOCK); |
106 |
request.append(" typeName=\"" + status.getFeatureName() + "\""); |
107 |
request.append(">");
|
108 |
String filter = status.getFilterQueryLocked();
|
109 |
if (filter != null){ |
110 |
request.append(status.getFilterQueryLockedPost()); |
111 |
} |
112 |
request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
113 |
request.append(WFSTTags.WFST_LOCK + ">");
|
114 |
return request.toString();
|
115 |
} |
116 |
|
117 |
/*
|
118 |
* (non-Javadoc)
|
119 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getSchemaLocation()
|
120 |
*/
|
121 |
protected String getSchemaLocation() { |
122 |
return "../wfs/1.0.0/WFS-transaction.xsd"; |
123 |
} |
124 |
|
125 |
} |