Statistics
| Revision:

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

History | View | Annotate | Download (5.83 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.edition;
25

    
26
import java.util.ArrayList;
27
import java.util.List;
28

    
29
import org.gvsig.remoteclient.wfs.WFSStatus;
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 WFSTTransaction {
81
    private List insertOperations = null;
82
    private List updateOperations = null;
83
    private List deleteOperations = null;
84
    private WFSStatus wfsStatus;
85

    
86
    public WFSTTransaction(WFSStatus wfsStatus){       
87
        insertOperations = new ArrayList();
88
        updateOperations = new ArrayList();
89
        deleteOperations = new ArrayList();
90
        this.wfsStatus = wfsStatus;        
91
    }
92

    
93
    /**
94
     * Adds a delete operation
95
     * @param ids
96
     * The identifiers of the features to delete
97
     */
98
    public WFSTDeleteOperation createDeleteOperation(String id){
99
        WFSTDeleteOperation deleteOperation = new WFSTDeleteOperation(wfsStatus, id);
100
        deleteOperations.add(deleteOperation);
101
        return deleteOperation;        
102
    }
103

    
104
    /**
105
     * Adds a insert operation
106
     * @param gml
107
     * The new Feature
108
     */
109
    public WFSTInsertOperation createInsertOperation(){
110
        WFSTInsertOperation insertOperation = new WFSTInsertOperation(wfsStatus);
111
        insertOperations.add(insertOperation);        
112
        return insertOperation;
113
    }
114

    
115
    /**
116
     * Adds a update operation
117
     * @param id
118
     * The identifier of the features to update
119
     * @param values
120
     * A map with key equals to the property and the value equals to the value to update
121
     * The update operation
122
     */
123
    public WFSTUpdateOperation createUpdateOperation(String id){
124
        WFSTUpdateOperation updateOperation = new WFSTUpdateOperation(wfsStatus, id);
125
        updateOperations.add(updateOperation);  
126
        return updateOperation;    
127
    }
128

    
129
    /**
130
     * Create the lockID request
131
     * @return
132
     */
133
    private Object getWFSTRequestLockID() {
134
        StringBuffer request = new StringBuffer();
135
        //                for (int i=0 ; i<featuresLocked.size() ; i++){
136
        //                        request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":" + WFSTTags.WFST_LOCKID + ">" );
137
        //                        request.append(featuresLocked.get(i));
138
        //                        request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":" + WFSTTags.WFST_LOCKID + ">" );
139
        //                }
140
        return request.toString();
141
    }
142

    
143
    /**
144
     * @return the insert operations size
145
     */
146
    public int getInsertOperationSize() {
147
        return insertOperations.size();
148
    }
149

    
150
    /**
151
     * Gets an insert operation
152
     * @param i
153
     * Operation position
154
     * @return
155
     * A operation
156
     */
157
    public WFSTInsertOperation getInseOperationAt(int i){
158
        if (i >= insertOperations.size()){
159
            return null;
160
        }
161
        return (WFSTInsertOperation)insertOperations.get(i);
162
    }
163

    
164
    /**
165
     * @return the update operations size
166
     */
167
    public int getUpdateOperationSize() {
168
        return updateOperations.size();
169
    }
170

    
171
    /**
172
     * Gets an update operation
173
     * @param i
174
     * Operation position
175
     * @return
176
     * A operation
177
     */
178
    public WFSTUpdateOperation getUpdateOperationAt(int i){
179
        if (i >= updateOperations.size()){
180
            return null;
181
        }
182
        return (WFSTUpdateOperation)updateOperations.get(i);
183
    }
184

    
185
    /**
186
     * @return the delete operations size
187
     */
188
    public int getDeleteOperationSize() {
189
        return deleteOperations.size();
190
    }
191

    
192
    /**
193
     * Gets an delete operation
194
     * @param i
195
     * Operation position
196
     * @return
197
     * A operation
198
     */
199
    public WFSTDeleteOperation getDeleteOperationAt(int i){
200
        if (i >= deleteOperations.size()){
201
            return null;
202
        }
203
        return (WFSTDeleteOperation)deleteOperations.get(i);
204
    }      
205
}