Statistics
| Revision:

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 @ 40559

History | View | Annotate | Download (6.01 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
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
33
 *
34
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
35
 *
36
 * This program is free software; you can redistribute it and/or
37
 * modify it under the terms of the GNU General Public License
38
 * as published by the Free Software Foundation; either version 2
39
 * of the License, or (at your option) any later version.
40
 *
41
 * This program is distributed in the hope that it will be useful,
42
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
43
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
44
 * GNU General Public License for more details.
45
 *
46
 * You should have received a copy of the GNU General Public License
47
 * along with this program; if not, write to the Free Software
48
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
49
 *
50
 * For more information, contact:
51
 *
52
 *  Generalitat Valenciana
53
 *   Conselleria d'Infraestructures i Transport
54
 *   Av. Blasco Ib??ez, 50
55
 *   46010 VALENCIA
56
 *   SPAIN
57
 *
58
 *      +34 963862235
59
 *   gvsig@gva.es
60
 *      www.gvsig.gva.es
61
 *
62
 *    or
63
 *
64
 *   IVER T.I. S.A
65
 *   Salamanca 50
66
 *   46005 Valencia
67
 *   Spain
68
 *
69
 *   +34 963163400
70
 *   dac@iver.es
71
 */
72
/* CVS MESSAGES:
73
 *
74
 * $Id$
75
 * $Log$
76
 *
77
 */
78
/**
79
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
80
 */
81
public class WFSTLockFeatureRequest1_0_0 extends WFSTLockFeatureRequest{
82

    
83
        public WFSTLockFeatureRequest1_0_0(WFSStatus status,
84
                        WFSProtocolHandler protocolHandler) {
85
                super(status, protocolHandler);                
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=LockFeature&SERVICE=WFS&");
96
                req.append("TYPENAME=").append(status.getFeatureName()).append("&");
97
                req.append("LOCKACTION=" + status.getLockAction() + "&");                
98
                if (status.getFilterQueryLocked() != null){
99
                        req.append("FILTER=");
100
                        req.append(status.getFilterQueryLocked() + "&");
101
                }                
102
                if (status.getExpiry() > 0){
103
                        req.append("EXPIRY=" + status.getExpiry() + "&");
104
                }
105
                req.append("VERSION=").append(protocolHandler.getVersion()).append("&EXCEPTIONS=XML");
106
                req.append("&MAXFEATURES=").append(status.getMaxFeatures());
107
                return req.toString();
108
        }
109

    
110
        /*
111
         * (non-Javadoc)
112
         * @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getHttpPostRequest(java.lang.String)
113
         */
114
        protected String getHttpPostRequest(String onlineResource) {
115
                StringBuffer request = new StringBuffer();
116
                request.append(WFSTTags.XML_ROOT);
117
                request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":");
118
                request.append(CapabilitiesTags.WFS_LOCKFEATURE + " ");
119
                request.append(CapabilitiesTags.VERSION + "=\"" + protocolHandler.getVersion() + "\" ");
120
                request.append(WFSTTags.WFST_SERVICE + "=\"WFS\" ");
121
                if (status.getExpiry() > 0){
122
                        request.append(WFSTTags.WFST_EXPIRYTIME + "=\"" + status.getExpiry() + "\" ");
123
                }
124
                request.append(WFSTTags.XMLNS + ":" + WFSTTags.OGC_NAMESPACE_PREFIX);
125
                request.append("=\"" + WFSTTags.OGC_NAMESPACE + "\" ");
126
                request.append(WFSTTags.XMLNS + ":" + WFSTTags.WFS_NAMESPACE_PREFIX);
127
                request.append("=\"" + WFSTTags.WFS_NAMESPACE + "\" ");
128
                request.append(WFSTTags.XMLNS + ":" + WFSTTags.XML_NAMESPACE_PREFIX);
129
                request.append("=\"" + WFSTTags.XML_NAMESPACE + "\" ");
130
                request.append(WFSTTags.XMLNS + ":" + WFSTTags.GML_NAMESPACE_PREFIX);
131
                request.append("=\"" + WFSTTags.GML_NAMESPACE + "\" ");
132
                request.append(WFSTTags.XMLNS + ":" + status.getNamespacePrefix());
133
                request.append("=\"" + status.getNamespaceLocation() + "\" ");
134
                request.append(WFSTTags.XML_NAMESPACE_PREFIX + ":" + WFSTTags.XML_SCHEMALOCATION);
135
                request.append("=\"" + WFSTTags.WFS_NAMESPACE + " ");
136
                request.append(getSchemaLocation());
137
                request.append("\">");
138
                request.append(getLockPostRequest());
139
                request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":");
140
                request.append(CapabilitiesTags.WFS_LOCKFEATURE + ">");
141
                return request.toString();
142
        }
143

    
144
        /**
145
         * Creates a Lock query for a HTTP Post request
146
         * @return
147
         */
148
        private String getLockPostRequest(){
149
                StringBuffer request = new StringBuffer();
150
                request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":");
151
                request.append(WFSTTags.WFST_LOCK);
152
                request.append(" typeName=\"" + status.getFeatureName() + "\"");
153
                request.append(">");
154
                String filter = status.getFilterQueryLocked();
155
                if (filter != null){
156
                        request.append(status.getFilterQueryLockedPost());
157
                }
158
                request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":");
159
                request.append(WFSTTags.WFST_LOCK + ">");
160
                return request.toString();
161
        }
162
        
163
        /*
164
         * (non-Javadoc)
165
         * @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getSchemaLocation()
166
         */
167
        protected String getSchemaLocation() {
168
                return "../wfs/1.0.0/WFS-transaction.xsd";
169
        }
170

    
171
}