Revision 2702
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/java/org/gvsig/vcsgis/lib/impl/Test08Update.java | ||
---|---|---|
135 | 135 |
// ------------------------------------------------------------ |
136 | 136 |
// Actualizamos (update) la tabla "test" en el workspace2 |
137 | 137 |
// y comprobamos que tiene lo que toca. |
138 |
r = ws2.updatePrepare("test"); |
|
139 |
assertEquals("ws2.update-prepare-1 status", 0, r); |
|
140 |
VCSGisWorkspaceChanges<VCSGisRepositoryChange> remoteChanges = ws2.getRemoteChanges(); |
|
141 |
assertEquals("ws2.update-prepare-1 remoteChanges size", 2L, remoteChanges.size64()); |
|
142 |
|
|
138 | 143 |
r = ws2.update("test"); |
139 | 144 |
assertEquals("ws2.update-1 status", 0, r); |
140 | 145 |
store2 = ws2.getFeatureStore("test"); |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/lib/workspace/tables/RemoteChangesTable.java | ||
---|---|---|
202 | 202 |
} |
203 | 203 |
return this.getDataAsJson().getString(this.getEntity().getFieldForLabel(), null); |
204 | 204 |
} |
205 |
|
|
206 |
@Override |
|
207 |
public String toString() { |
|
208 |
switch (this.getOperation()) { |
|
209 |
case OP_INSERT: |
|
210 |
return "{ OP:'INSERT', ENTITYCODE:'"+this.getEntityCode()+"', FEATURECODE:'"+this.getRelatedFeatureCode()+"', DATA:'"+this.getData()+"' }"; |
|
211 |
case OP_UPDATE: |
|
212 |
return "{ OP:'UPDATE', ENTITYCODE:'"+this.getEntityCode()+"', FEATURECODE:'"+this.getRelatedFeatureCode()+"', DATA:'"+this.getData()+"' }"; |
|
213 |
case OP_DELETE: |
|
214 |
return "{ OP:'DELETE', ENTITYCODE:'"+this.getEntityCode()+"', FEATURECODE:'"+this.getRelatedFeatureCode()+"' }"; |
|
215 |
default: |
|
216 |
return "{ OP:'"+this.getOperation()+"', ENTITYCODE:'"+this.getEntityCode()+"', FEATURECODE:'"+this.getRelatedFeatureCode()+"' }"; |
|
217 |
} |
|
218 |
} |
|
205 | 219 |
|
220 |
|
|
206 | 221 |
} |
207 | 222 |
|
208 | 223 |
public RemoteChangesTable() { |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/lib/workspace/tables/WorkspaceChangesTable.java | ||
---|---|---|
117 | 117 |
FeatureStore store = workspace.getFeatureStore(entityName); |
118 | 118 |
Feature f = store.findFirst("\""+this.getEntity().getFeatureIdFieldName()+"\"='"+code+"'"); |
119 | 119 |
if( f==null ) { |
120 |
throw new RuntimeException("Feature '"+entityName+"/"+code+"'not found."); |
|
120 |
return null; |
|
121 |
// throw new RuntimeException("Feature '"+entityName+"/"+code+"'not found."); |
|
121 | 122 |
} |
122 | 123 |
return f.toJson().toString(); |
123 | 124 |
} catch (Exception ex) { |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/lib/workspace/VCSGisWorkspaceImpl.java | ||
---|---|---|
823 | 823 |
target.insert(f); |
824 | 824 |
} |
825 | 825 |
target.finishEditing(); |
826 |
|
|
827 |
lentity.setLocalRevisionCode(rentity.getRepositoryRevisionCode()); |
|
828 |
lentity.update(); |
|
829 |
this.reloadEntities(); |
|
830 |
|
|
826 | 831 |
request.dispose(); |
827 | 832 |
return ERR_NO_ERROR; |
828 | 833 |
} catch (Exception ex) { |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/lib/repository/localdb/requests/CommitRequestLocaldb.java | ||
---|---|---|
161 | 161 |
String data = change.getData(); |
162 | 162 |
Geometry geom = null; |
163 | 163 |
String geometryFieldName = localentity.getGeometryFieldName(); |
164 |
if( !StringUtils.isBlank(geometryFieldName) ) { |
|
164 |
if( data != null && !StringUtils.isBlank(geometryFieldName) ) {
|
|
165 | 165 |
JsonObject dataJson = Json.createObject(data); |
166 | 166 |
geom = this.geometryManager.createFromQuietly( |
167 | 167 |
dataJson.getString(geometryFieldName, null) |
Also available in: Unified diff