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 @ 40769
History | View | Annotate | Download (4.6 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.edition; |
25 | |||
26 | import java.util.ArrayList; |
||
27 | import java.util.List; |
||
28 | |||
29 | import org.gvsig.remoteclient.wfs.WFSStatus; |
||
30 | |||
31 | /**
|
||
32 | * @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
||
33 | */
|
||
34 | public class WFSTTransaction { |
||
35 | private List insertOperations = null; |
||
36 | private List updateOperations = null; |
||
37 | private List deleteOperations = null; |
||
38 | private WFSStatus wfsStatus;
|
||
39 | |||
40 | public WFSTTransaction(WFSStatus wfsStatus){
|
||
41 | insertOperations = new ArrayList(); |
||
42 | updateOperations = new ArrayList(); |
||
43 | deleteOperations = new ArrayList(); |
||
44 | this.wfsStatus = wfsStatus;
|
||
45 | } |
||
46 | |||
47 | /**
|
||
48 | * Adds a delete operation
|
||
49 | * @param ids
|
||
50 | * The identifiers of the features to delete
|
||
51 | */
|
||
52 | public WFSTDeleteOperation createDeleteOperation(String id){ |
||
53 | WFSTDeleteOperation deleteOperation = new WFSTDeleteOperation(wfsStatus, id);
|
||
54 | deleteOperations.add(deleteOperation); |
||
55 | return deleteOperation;
|
||
56 | } |
||
57 | |||
58 | /**
|
||
59 | * Adds a insert operation
|
||
60 | * @param gml
|
||
61 | * The new Feature
|
||
62 | */
|
||
63 | public WFSTInsertOperation createInsertOperation(){
|
||
64 | WFSTInsertOperation insertOperation = new WFSTInsertOperation(wfsStatus);
|
||
65 | insertOperations.add(insertOperation); |
||
66 | return insertOperation;
|
||
67 | } |
||
68 | |||
69 | /**
|
||
70 | * Adds a update operation
|
||
71 | * @param id
|
||
72 | * The identifier of the features to update
|
||
73 | * @param values
|
||
74 | * A map with key equals to the property and the value equals to the value to update
|
||
75 | * The update operation
|
||
76 | */
|
||
77 | public WFSTUpdateOperation createUpdateOperation(String id){ |
||
78 | WFSTUpdateOperation updateOperation = new WFSTUpdateOperation(wfsStatus, id);
|
||
79 | updateOperations.add(updateOperation); |
||
80 | return updateOperation;
|
||
81 | } |
||
82 | |||
83 | /**
|
||
84 | * Create the lockID request
|
||
85 | * @return
|
||
86 | */
|
||
87 | private Object getWFSTRequestLockID() { |
||
88 | StringBuffer request = new StringBuffer(); |
||
89 | // for (int i=0 ; i<featuresLocked.size() ; i++){
|
||
90 | // request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":" + WFSTTags.WFST_LOCKID + ">" );
|
||
91 | // request.append(featuresLocked.get(i));
|
||
92 | // request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":" + WFSTTags.WFST_LOCKID + ">" );
|
||
93 | // }
|
||
94 | return request.toString();
|
||
95 | } |
||
96 | |||
97 | /**
|
||
98 | * @return the insert operations size
|
||
99 | */
|
||
100 | public int getInsertOperationSize() { |
||
101 | return insertOperations.size();
|
||
102 | } |
||
103 | |||
104 | /**
|
||
105 | * Gets an insert operation
|
||
106 | * @param i
|
||
107 | * Operation position
|
||
108 | * @return
|
||
109 | * A operation
|
||
110 | */
|
||
111 | public WFSTInsertOperation getInseOperationAt(int i){ |
||
112 | if (i >= insertOperations.size()){
|
||
113 | return null; |
||
114 | } |
||
115 | return (WFSTInsertOperation)insertOperations.get(i);
|
||
116 | } |
||
117 | |||
118 | /**
|
||
119 | * @return the update operations size
|
||
120 | */
|
||
121 | public int getUpdateOperationSize() { |
||
122 | return updateOperations.size();
|
||
123 | } |
||
124 | |||
125 | /**
|
||
126 | * Gets an update operation
|
||
127 | * @param i
|
||
128 | * Operation position
|
||
129 | * @return
|
||
130 | * A operation
|
||
131 | */
|
||
132 | public WFSTUpdateOperation getUpdateOperationAt(int i){ |
||
133 | if (i >= updateOperations.size()){
|
||
134 | return null; |
||
135 | } |
||
136 | return (WFSTUpdateOperation)updateOperations.get(i);
|
||
137 | } |
||
138 | |||
139 | /**
|
||
140 | * @return the delete operations size
|
||
141 | */
|
||
142 | public int getDeleteOperationSize() { |
||
143 | return deleteOperations.size();
|
||
144 | } |
||
145 | |||
146 | /**
|
||
147 | * Gets an delete operation
|
||
148 | * @param i
|
||
149 | * Operation position
|
||
150 | * @return
|
||
151 | * A operation
|
||
152 | */
|
||
153 | public WFSTDeleteOperation getDeleteOperationAt(int i){ |
||
154 | if (i >= deleteOperations.size()){
|
||
155 | return null; |
||
156 | } |
||
157 | return (WFSTDeleteOperation)deleteOperations.get(i);
|
||
158 | } |
||
159 | } |