Revision 3310
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.api/src/main/java/org/gvsig/vcsgis/lib/repository/requests/VCSGisCommitRequest.java | ||
---|---|---|
24 | 24 |
import java.sql.Timestamp; |
25 | 25 |
import java.util.List; |
26 | 26 |
import org.gvsig.tools.dispose.DisposableIterable; |
27 |
import org.gvsig.vcsgis.lib.VCSGisChange; |
|
27 | 28 |
import org.gvsig.vcsgis.lib.VCSGisEntity; |
28 | 29 |
import org.gvsig.vcsgis.lib.VCSGisEntityEditable; |
29 |
import org.gvsig.vcsgis.lib.VCSGisChange;
|
|
30 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntity;
|
|
30 | 31 |
|
31 | 32 |
/** |
32 | 33 |
* |
... | ... | |
47 | 48 |
|
48 | 49 |
public void setComment(String comment); |
49 | 50 |
|
50 |
public VCSGisEntityEditable createEntity(String code, String name);
|
|
51 |
public VCSGisWorkspaceEntity createEntity(String code, String name);
|
|
51 | 52 |
|
52 |
public VCSGisEntityEditable createEntity(VCSGisEntity entity);
|
|
53 |
public VCSGisWorkspaceEntity createEntity(VCSGisWorkspaceEntity entity);
|
|
53 | 54 |
|
54 |
public void add(VCSGisEntityEditable entity);
|
|
55 |
public void add(VCSGisWorkspaceEntity entity);
|
|
55 | 56 |
|
56 | 57 |
public void add(DisposableIterable<VCSGisChange> changes); |
57 | 58 |
|
... | ... | |
60 | 61 |
public void markAsNew(String entityCode); |
61 | 62 |
|
62 | 63 |
// out |
63 |
public List<VCSGisEntityEditable> getChangedLocalEntities();
|
|
64 |
public List<VCSGisWorkspaceEntity> getChangedLocalEntities();
|
|
64 | 65 |
|
65 | 66 |
} |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/lib/requests/CommitRequestHelper.java | ||
---|---|---|
30 | 30 |
import org.apache.commons.lang3.StringUtils; |
31 | 31 |
import org.gvsig.tools.dispose.DisposableIterable; |
32 | 32 |
import org.gvsig.tools.dispose.DisposeUtils; |
33 |
import org.gvsig.vcsgis.lib.EntityEditableImpl;
|
|
33 |
import org.gvsig.vcsgis.lib.VCSGisChange;
|
|
34 | 34 |
import org.gvsig.vcsgis.lib.VCSGisEntity; |
35 | 35 |
import org.gvsig.vcsgis.lib.VCSGisEntityEditable; |
36 | 36 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
37 |
import org.gvsig.vcsgis.lib.VCSGisChange; |
|
38 | 37 |
import org.gvsig.vcsgis.lib.repository.requests.VCSGisCommitRequest; |
38 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntity; |
|
39 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntityImpl; |
|
39 | 40 |
|
40 | 41 |
|
41 | 42 |
/** |
... | ... | |
54 | 55 |
public DisposableIterable<VCSGisChange> changes; |
55 | 56 |
|
56 | 57 |
// out |
57 |
public List<VCSGisEntityEditable> changedLocalEntities;
|
|
58 |
public List<VCSGisWorkspaceEntity> changedLocalEntities;
|
|
58 | 59 |
|
59 | 60 |
|
60 | 61 |
public CommitRequestHelper(VCSGisRepository repository) { |
... | ... | |
68 | 69 |
} |
69 | 70 |
|
70 | 71 |
@Override |
71 |
public VCSGisEntityEditable createEntity(String code, String name) {
|
|
72 |
VCSGisEntityEditable entity = new EntityEditableImpl();
|
|
72 |
public VCSGisWorkspaceEntity createEntity(String code, String name) {
|
|
73 |
VCSGisWorkspaceEntity entity = new VCSGisWorkspaceEntityImpl();
|
|
73 | 74 |
entity.setEntityCode(code); |
74 | 75 |
entity.setEntityName(name); |
75 | 76 |
return entity; |
76 | 77 |
} |
77 | 78 |
|
78 | 79 |
@Override |
79 |
public VCSGisEntityEditable createEntity(VCSGisEntity fromEntity) {
|
|
80 |
VCSGisEntityEditable entity = new EntityEditableImpl();
|
|
80 |
public VCSGisWorkspaceEntity createEntity(VCSGisWorkspaceEntity fromEntity) {
|
|
81 |
VCSGisWorkspaceEntity entity = new VCSGisWorkspaceEntityImpl();
|
|
81 | 82 |
entity.copyfrom(fromEntity); |
82 | 83 |
return entity; |
83 | 84 |
} |
84 | 85 |
|
85 | 86 |
@Override |
86 |
public List<VCSGisEntityEditable> getChangedLocalEntities() {
|
|
87 |
public List<VCSGisWorkspaceEntity> getChangedLocalEntities() {
|
|
87 | 88 |
return this.changedLocalEntities; |
88 | 89 |
} |
89 | 90 |
|
... | ... | |
122 | 123 |
} |
123 | 124 |
|
124 | 125 |
@Override |
125 |
public void add(VCSGisEntityEditable entity) {
|
|
126 |
public void add(VCSGisWorkspaceEntity entity) {
|
|
126 | 127 |
if (this.getChangedLocalEntityByCode(entity.getEntityCode()) != null) { |
127 | 128 |
if (this.newLocalEntities.contains(entity.getEntityCode())) { |
128 | 129 |
return; |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/lib/repository/remoteclient/requests/CommitRequestClient.java | ||
---|---|---|
56 | 56 |
import org.gvsig.vcsgis.lib.repository.remoteclient.VCSGisRepositoryClient; |
57 | 57 |
import org.gvsig.vcsgis.lib.repository.requests.VCSGisCommitRequest; |
58 | 58 |
import org.gvsig.vcsgis.lib.requests.CommitRequestHelper; |
59 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntity; |
|
60 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntityImpl; |
|
59 | 61 |
|
60 | 62 |
/** |
61 | 63 |
* |
... | ... | |
107 | 109 |
} |
108 | 110 |
|
109 | 111 |
@Override |
110 |
public VCSGisEntityEditable createEntity(String code, String name) {
|
|
112 |
public VCSGisWorkspaceEntity createEntity(String code, String name) {
|
|
111 | 113 |
return helper().createEntity(code, name); |
112 | 114 |
} |
113 | 115 |
|
114 | 116 |
@Override |
115 |
public VCSGisEntityEditable createEntity(VCSGisEntity entity) {
|
|
117 |
public VCSGisWorkspaceEntity createEntity(VCSGisWorkspaceEntity entity) {
|
|
116 | 118 |
return helper().createEntity(entity); |
117 | 119 |
} |
118 | 120 |
|
119 | 121 |
@Override |
120 |
public void add(VCSGisEntityEditable entity) {
|
|
122 |
public void add(VCSGisWorkspaceEntity entity) {
|
|
121 | 123 |
helper().add(entity); |
122 | 124 |
} |
123 | 125 |
|
... | ... | |
137 | 139 |
} |
138 | 140 |
|
139 | 141 |
@Override |
140 |
public List<VCSGisEntityEditable> getChangedLocalEntities() {
|
|
142 |
public List<VCSGisWorkspaceEntity> getChangedLocalEntities() {
|
|
141 | 143 |
return helper().getChangedLocalEntities(); |
142 | 144 |
} |
143 | 145 |
|
... | ... | |
270 | 272 |
} |
271 | 273 |
|
272 | 274 |
LOGGER.debug("===: ["+this.getRequestName()+"] responseConsumer 3"); |
273 |
List<VCSGisEntityEditable> changedEntities = new ArrayList<>();
|
|
275 |
List<VCSGisWorkspaceEntity> changedEntities = new ArrayList<>();
|
|
274 | 276 |
JsonArray jsonChangedLocalEntities = jsonParameters.getJsonArray("Entities"); |
275 | 277 |
for (JsonValue jsonEntity : jsonChangedLocalEntities) { |
276 |
VCSGisEntityEditable rentity = new EntityEditableImpl();
|
|
278 |
VCSGisWorkspaceEntity rentity = new VCSGisWorkspaceEntityImpl();
|
|
277 | 279 |
rentity.fromJson((JsonObject) jsonEntity); |
278 | 280 |
LOGGER.debug("===: ["+this.getRequestName()+"] responseConsumer 4 entity " + rentity.getEntityName()); |
279 | 281 |
changedEntities.add(rentity); |
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/tables/EntitiesRepoTable.java | ||
---|---|---|
407 | 407 |
ft.add(FEATURETYPE, DataTypes.STRING) |
408 | 408 |
.setSize(10240) |
409 | 409 |
.setLabel("Feature type"); |
410 |
ft.add(TOPOLOGYPLAN_MODE, DataTypes.INTEGER) |
|
411 |
.setLabel("Topology plan mode"); |
|
412 |
|
|
410 | 413 |
|
411 | 414 |
return ft.getNotEditableCopy(); |
412 | 415 |
} |
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 | ||
---|---|---|
60 | 60 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.RevisionsRepoTable.RevisionRepoRow; |
61 | 61 |
import org.gvsig.vcsgis.lib.repository.requests.VCSGisCommitRequest; |
62 | 62 |
import org.gvsig.vcsgis.lib.requests.CommitRequestHelper; |
63 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntity; |
|
63 | 64 |
|
64 | 65 |
/** |
65 | 66 |
* |
... | ... | |
112 | 113 |
} |
113 | 114 |
|
114 | 115 |
@Override |
115 |
public VCSGisEntityEditable createEntity(String code, String name) {
|
|
116 |
public VCSGisWorkspaceEntity createEntity(String code, String name) {
|
|
116 | 117 |
return helper().createEntity(code, name); |
117 | 118 |
} |
118 | 119 |
|
119 | 120 |
@Override |
120 |
public VCSGisEntityEditable createEntity(VCSGisEntity entity) {
|
|
121 |
public VCSGisWorkspaceEntity createEntity(VCSGisWorkspaceEntity entity) {
|
|
121 | 122 |
return helper().createEntity(entity); |
122 | 123 |
} |
123 | 124 |
|
124 | 125 |
@Override |
125 |
public void add(VCSGisEntityEditable entity) {
|
|
126 |
public void add(VCSGisWorkspaceEntity entity) {
|
|
126 | 127 |
helper().add(entity); |
127 | 128 |
} |
128 | 129 |
|
... | ... | |
142 | 143 |
} |
143 | 144 |
|
144 | 145 |
@Override |
145 |
public List<VCSGisEntityEditable> getChangedLocalEntities() {
|
|
146 |
public List<VCSGisWorkspaceEntity> getChangedLocalEntities() {
|
|
146 | 147 |
return helper().getChangedLocalEntities(); |
147 | 148 |
} |
148 | 149 |
|
... | ... | |
182 | 183 |
} |
183 | 184 |
} |
184 | 185 |
} |
185 |
for (VCSGisEntity changedLocalEntity : helper().changedLocalEntities) { |
|
186 |
for (VCSGisWorkspaceEntity changedLocalEntity : helper().changedLocalEntities) {
|
|
186 | 187 |
if( helper().newLocalEntities.contains(changedLocalEntity.getEntityCode()) ) { |
187 | 188 |
continue; |
188 | 189 |
} |
... | ... | |
190 | 191 |
if( entity == null ) { |
191 | 192 |
return error(ERR_CANT_COMMIT_WORKSPACE_OUTDATED, "Entity '"+changedLocalEntity.getEntityCode()+"' not exists in repository, workspace out of date."); |
192 | 193 |
} |
193 |
if( !StringUtils.equalsIgnoreCase(entity.getRepositoryRevisionCode(), changedLocalEntity.getRepositoryRevisionCode()) ) {
|
|
194 |
return error(ERR_CANT_COMMIT_WORKSPACE_OUTDATED, "Revision 'REVISION["+changedLocalEntity.getRepositoryRevisionCode()+"]' in 'ENTITY["+changedLocalEntity.getEntityCode()+"]' not in head, workspace out of date.");
|
|
194 |
if( !StringUtils.equalsIgnoreCase(entity.getRepositoryRevisionCode(), changedLocalEntity.getLocalRevisionCode()) ) {
|
|
195 |
return error(ERR_CANT_COMMIT_WORKSPACE_OUTDATED, "Revision 'REVISION["+changedLocalEntity.getLocalRevisionCode()+"]' in 'ENTITY["+changedLocalEntity.getEntityCode()+"]' not in head, workspace out of date.");
|
|
195 | 196 |
} |
196 | 197 |
} |
197 | 198 |
|
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/EntitiesTable.java | ||
---|---|---|
560 | 560 |
ft.add(FEATURETYPE, DataTypes.STRING) |
561 | 561 |
.setSize(10240) |
562 | 562 |
.setLabel("Feature type"); |
563 |
ft.add(TOPOLOGYPLAN_MODE, DataTypes.INTEGER) |
|
564 |
.setLabel("Topology plan mode"); |
|
563 | 565 |
|
564 | 566 |
return ft.getNotEditableCopy(); |
565 | 567 |
} |
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 | ||
---|---|---|
278 | 278 |
} |
279 | 279 |
|
280 | 280 |
public DisposableFeatureSetIterable getByOperation(VCSGisWorkspace workspace, int op) { |
281 |
return getByOperation(workspace, null, op); |
|
282 |
// FeatureStore store = null; |
|
283 |
// try { |
|
284 |
// store = workspace.getFeatureStore(TABLE_NAME); |
|
285 |
// FeatureQuery query = store.createFeatureQuery(); |
|
286 |
// query.addFilter("\""+WorkspaceChangesTable.OPERATION+"\"="+op); |
|
287 |
// query.retrievesAllAttributes(); |
|
288 |
// DisposableFeatureSetIterable changes = store.getFeatureSet(query).iterable(); |
|
289 |
// return changes; |
|
290 |
// } catch (Exception ex) { |
|
291 |
// throw new RuntimeException("Can't retrieve changes for operartion "+op+".", ex); |
|
292 |
// } finally { |
|
293 |
// if( store!=null ) { |
|
294 |
// DisposeUtils.dispose(store); |
|
295 |
// } |
|
296 |
// } |
|
297 |
} |
|
298 |
|
|
299 |
public DisposableFeatureSetIterable getByOperation(VCSGisWorkspace workspace, String entityCode, int op) { |
|
281 | 300 |
FeatureStore store = null; |
282 | 301 |
try { |
283 | 302 |
store = workspace.getFeatureStore(TABLE_NAME); |
284 | 303 |
FeatureQuery query = store.createFeatureQuery(); |
285 |
query.addFilter("\""+WorkspaceChangesTable.OPERATION+"\"="+op); |
|
304 |
if( !StringUtils.isBlank(entityCode) ) { |
|
305 |
query.addFilter("\""+COD_ENTITY+"\" ='"+entityCode+"' AND \""+WorkspaceChangesTable.OPERATION+"\"="+op); |
|
306 |
} else { |
|
307 |
query.addFilter("\""+WorkspaceChangesTable.OPERATION+"\"="+op); |
|
308 |
} |
|
309 |
|
|
286 | 310 |
query.retrievesAllAttributes(); |
287 | 311 |
DisposableFeatureSetIterable changes = store.getFeatureSet(query).iterable(); |
288 | 312 |
return changes; |
... | ... | |
295 | 319 |
} |
296 | 320 |
} |
297 | 321 |
|
322 |
|
|
298 | 323 |
public DisposableFeatureSetIterable getGroupedByEntity(VCSGisWorkspace workspace) { |
299 | 324 |
FeatureStore store = null; |
300 | 325 |
try { |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/lib/workspace/VCSGisWorkspaceEntityImpl.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package org.gvsig.vcsgis.lib.workspace; |
|
7 |
|
|
8 |
import javax.json.JsonObject; |
|
9 |
import org.apache.commons.lang3.StringUtils; |
|
10 |
import org.gvsig.vcsgis.lib.EntityEditableImpl; |
|
11 |
import org.gvsig.vcsgis.lib.VCSGisManager; |
|
12 |
|
|
13 |
/** |
|
14 |
* |
|
15 |
* @author fdiaz |
|
16 |
*/ |
|
17 |
public class VCSGisWorkspaceEntityImpl extends EntityEditableImpl implements VCSGisWorkspaceEntity{ |
|
18 |
|
|
19 |
private String localRevisionCode; |
|
20 |
|
|
21 |
public VCSGisWorkspaceEntityImpl() { |
|
22 |
super(); |
|
23 |
} |
|
24 |
|
|
25 |
public VCSGisWorkspaceEntityImpl(JsonObject jsonObject) { |
|
26 |
super(jsonObject); |
|
27 |
} |
|
28 |
|
|
29 |
@Override |
|
30 |
public String getLocalRevisionCode() { |
|
31 |
return this.localRevisionCode; |
|
32 |
} |
|
33 |
|
|
34 |
@Override |
|
35 |
public VCSGisWorkspaceEntity setLocalRevisionCode(String revisionCode) { |
|
36 |
this.localRevisionCode = revisionCode; |
|
37 |
return this; |
|
38 |
} |
|
39 |
|
|
40 |
@Override |
|
41 |
public long getCountLocalChanges() { |
|
42 |
return -1; |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
public int getState() { |
|
47 |
return VCSGisManager.STATE_UNKNOWN; |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public boolean isOutdated() { |
|
52 |
final String repositoryRevisionCode = this.getRepositoryRevisionCode(); |
|
53 |
if(StringUtils.isBlank(repositoryRevisionCode)){ |
|
54 |
return false; |
|
55 |
} |
|
56 |
return !StringUtils.equalsIgnoreCase(repositoryRevisionCode,this.getLocalRevisionCode()); |
|
57 |
} |
|
58 |
|
|
59 |
} |
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 | ||
---|---|---|
14 | 14 |
import java.util.Map; |
15 | 15 |
import java.util.Objects; |
16 | 16 |
import java.util.Set; |
17 |
import java.util.function.Consumer; |
|
17 | 18 |
import javax.json.JsonObject; |
18 | 19 |
import org.apache.commons.lang3.StringUtils; |
19 | 20 |
import org.apache.commons.lang3.mutable.MutableObject; |
... | ... | |
1419 | 1420 |
status.setCurValue(0); |
1420 | 1421 |
for (Feature fchange : changesGroupedByEntity) { |
1421 | 1422 |
WorkspaceChangeRow change = new WorkspaceChangeRow(this, fchange); |
1422 |
VCSGisEntity localEntity = change.getEntity(); |
|
1423 |
VCSGisWorkspaceEntity localEntity = change.getEntity();
|
|
1423 | 1424 |
LOGGER.debug("===: COMMIT: add used entity = " + fchange.toJson().toString().replace('\n', ' ')); |
1424 | 1425 |
if (change.isSelected()) { |
1425 | 1426 |
request.add(request.createEntity(localEntity)); |
... | ... | |
1479 | 1480 |
|
1480 | 1481 |
LOGGER.debug("===: COMMIT: Adding changed local entities"); |
1481 | 1482 |
status.message("Searching changed entities"); |
1482 |
//TODO: |
|
1483 |
// adicionamos las entidades que vamos a actualizar con las revisiones que tenemos. |
|
1484 |
DisposableFeatureSetIterable changesGroupedByEntity = changesTable.getGroupedByEntity(this); |
|
1485 |
// status.setRangeOfValues(0, changesGroupedByEntity.size64()); |
|
1486 |
status.setCurValue(0); |
|
1487 |
for (Feature fchange : changesGroupedByEntity) { |
|
1488 |
WorkspaceChangeRow change = new WorkspaceChangeRow(this, fchange); |
|
1489 |
VCSGisEntity localEntity = change.getEntity(); |
|
1490 |
LOGGER.debug("===: COMMIT: add used entity = " + fchange.toJson().toString().replace('\n', ' ')); |
|
1491 |
if (change.isSelected()) { |
|
1492 |
request.add(request.createEntity(localEntity)); |
|
1493 |
} |
|
1494 |
status.incrementCurrentValue(); |
|
1495 |
} |
|
1496 |
changesGroupedByEntity.dispose(); |
|
1497 | 1483 |
|
1484 |
VCSGisWorkspaceEntity localEntity = this.getWorkspaceEntity(entity); |
|
1485 |
request.add(request.createEntity(localEntity)); |
|
1486 |
|
|
1498 | 1487 |
LOGGER.debug("===: COMMIT: Mark new local entities"); |
1499 | 1488 |
status.message("Searching new entities"); |
1500 |
//TODO |
|
1489 |
|
|
1501 | 1490 |
// Marcamos como nuevas las entidades que se han dado de alta. |
1502 |
DisposableFeatureSetIterable changesOfAddEntities = changesTable.getByOperation(this, OP_ADD_ENTITY); |
|
1491 |
DisposableFeatureSetIterable changesOfAddEntities = changesTable.getByOperation(this, localEntity.getEntityCode(), OP_ADD_ENTITY);
|
|
1503 | 1492 |
for (Feature fchange : changesOfAddEntities) { |
1504 | 1493 |
WorkspaceChangeRow change = new WorkspaceChangeRow(this, fchange); |
1505 | 1494 |
if (change.isSelected()) { |
... | ... | |
1512 | 1501 |
status.message("Searching changed data"); |
1513 | 1502 |
// adicionamos los datos |
1514 | 1503 |
boolean useSeleccion = true; |
1515 |
//TODO |
|
1516 |
DisposableFeatureSetIterable changes = changesTable.getSelectedsWithoutAddEntity(this, entity);
|
|
1504 |
|
|
1505 |
DisposableFeatureSetIterable changes = changesTable.getSelectedsWithoutAddEntity(this, localEntity.getEntityCode());
|
|
1517 | 1506 |
if (changes != null) { |
1518 | 1507 |
request.add(new DisposableIterableAdapter( |
1519 | 1508 |
changes, |
... | ... | |
1646 | 1635 |
try { |
1647 | 1636 |
entitiesStore = this.openFeatureStore(EntitiesTable.TABLE_NAME); |
1648 | 1637 |
entitiesStore.edit(FeatureStore.MODE_FULLEDIT); |
1649 |
List<VCSGisEntityEditable> changedLocalentities = request.getChangedLocalEntities();
|
|
1638 |
List<VCSGisWorkspaceEntity> changedLocalentities = request.getChangedLocalEntities();
|
|
1650 | 1639 |
status.setRangeOfValues(0, changedLocalentities.size()); |
1651 | 1640 |
status.setCurValue(0); |
1652 | 1641 |
for (VCSGisEntity rentity : changedLocalentities) { |
... | ... | |
1721 | 1710 |
try { |
1722 | 1711 |
entitiesStore = this.openFeatureStore(EntitiesTable.TABLE_NAME); |
1723 | 1712 |
entitiesStore.edit(FeatureStore.MODE_FULLEDIT); |
1724 |
List<VCSGisEntityEditable> changedLocalentities = request.getChangedLocalEntities();
|
|
1713 |
List<VCSGisWorkspaceEntity> changedLocalentities = request.getChangedLocalEntities();
|
|
1725 | 1714 |
status.setRangeOfValues(0, changedLocalentities.size()); |
1726 | 1715 |
status.setCurValue(0); |
1727 |
for (VCSGisEntity rentity : changedLocalentities) { |
|
1716 |
for (VCSGisWorkspaceEntity rentity : changedLocalentities) {
|
|
1728 | 1717 |
EntityRow entityRow = entitiesTable.getByEntityName(this, rentity.getEntityName()); |
1729 | 1718 |
if (entityRow != null) { |
1730 | 1719 |
entityRow.copyfrom(rentity); |
... | ... | |
2360 | 2349 |
case STATE_CONFLICT: |
2361 | 2350 |
DisposableFeatureSetIterable feats = getUserFeaturesConflictWithRemoteChange(lentity, remoteChangeRow, userStore); |
2362 | 2351 |
if (feats != null) { |
2352 |
List<Feature> featuresToDelete = new ArrayList<Feature>(); |
|
2363 | 2353 |
for (Feature feat : feats) { |
2364 | 2354 |
if (feat != null) { |
2365 |
userStore.delete(feat); |
|
2355 |
// userStore.delete(feat); |
|
2356 |
featuresToDelete.add(feat); |
|
2366 | 2357 |
workspaceChangesStore.delete("\"" + WorkspaceChangesTable.FEATUREID + "\" = '" + feat.getString(lentity.getFeatureIdFieldName()) + "'"); |
2367 | 2358 |
} |
2368 | 2359 |
} |
2360 |
for (Feature feat : featuresToDelete) { |
|
2361 |
userStore.delete(feat); |
|
2362 |
} |
|
2369 | 2363 |
DisposeUtils.disposeQuietly(feats); |
2370 | 2364 |
} |
2371 | 2365 |
//Don't break to do the default case |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/lib/VCSGisUtils.java | ||
---|---|---|
94 | 94 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_OUTDATED_AND_MODIFIED; |
95 | 95 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_UNMODIFIED; |
96 | 96 |
import static org.gvsig.vcsgis.lib.VCSGisManager.TOPOLOGYPLAN_MODE_RECOMMENDED; |
97 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntity; |
|
97 | 98 |
|
98 | 99 |
/** |
99 | 100 |
* |
... | ... | |
116 | 117 |
public static final String ENTITY_LABEL = "Label"; |
117 | 118 |
public static final String ENTITY_AUTHORIZATIONS = "Autorizations"; |
118 | 119 |
public static final String ENTITY_TOPOLOGYPLANMODE = "TopologyPlanMode"; |
120 |
public static final String ENTITY_LOCALREVISIONCODE = "LocalRevisionCode"; |
|
119 | 121 |
|
120 | 122 |
// private static final String[] JSONENTITY_ATTRNAMES = new String[] { |
121 | 123 |
// ENTITY_DATATABLENAME, |
... | ... | |
223 | 225 |
target.setLabel(source.getLabel()); |
224 | 226 |
target.setAuthorizations(source.getAuthorizations()); |
225 | 227 |
target.setTopologyPlanMode(source.getTopologyPlanMode()); |
228 |
if(source instanceof VCSGisWorkspaceEntity && target instanceof VCSGisWorkspaceEntity){ |
|
229 |
((VCSGisWorkspaceEntity)target).setLocalRevisionCode(((VCSGisWorkspaceEntity)source).getLocalRevisionCode()); |
|
230 |
} |
|
226 | 231 |
} |
227 | 232 |
public static JsonObjectBuilder toJsonBuilder(VCSGisEntity entity, Predicate<String> excludes) { |
228 | 233 |
JsonObjectBuilder jsonEntity = Json.createObjectBuilder(); |
... | ... | |
272 | 277 |
jsonEntity.add(ENTITY_TOPOLOGYPLANMODE, entity.getTopologyPlanMode()); |
273 | 278 |
} |
274 | 279 |
|
280 |
if( entity instanceof VCSGisWorkspaceEntity ) { |
|
281 |
if( excludes==null || !excludes.test(ENTITY_LOCALREVISIONCODE) ) { |
|
282 |
jsonEntity.add(ENTITY_LOCALREVISIONCODE, ((VCSGisWorkspaceEntity) entity).getLocalRevisionCode()); |
|
283 |
} |
|
284 |
} |
|
285 |
|
|
286 |
|
|
275 | 287 |
return jsonEntity; |
276 | 288 |
} |
277 | 289 |
|
... | ... | |
321 | 333 |
if( jsonEntity.containsKey(ENTITY_TOPOLOGYPLANMODE) ) { |
322 | 334 |
entity.setTopologyPlanMode(jsonEntity.getInt(ENTITY_TOPOLOGYPLANMODE, TOPOLOGYPLAN_MODE_RECOMMENDED)); |
323 | 335 |
} |
336 |
if( entity instanceof VCSGisWorkspaceEntity ) { |
|
337 |
if( jsonEntity.containsKey(ENTITY_LOCALREVISIONCODE) ) { |
|
338 |
((VCSGisWorkspaceEntity) entity).setLocalRevisionCode(jsonEntity.getString(ENTITY_LOCALREVISIONCODE, null)); |
|
339 |
} |
|
340 |
} |
|
324 | 341 |
} |
325 | 342 |
|
326 | 343 |
public static boolean isAuthoriced(VCSGisEntity entity, String operation, String userid) { |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/lib/server/handlers/CommitHandler.java | ||
---|---|---|
41 | 41 |
import org.gvsig.json.JsonArrayBuilder; |
42 | 42 |
import org.gvsig.json.JsonObjectBuilder; |
43 | 43 |
import org.gvsig.vcsgis.lib.ChangeImpl; |
44 |
import org.gvsig.vcsgis.lib.EntityEditableImpl; |
|
45 | 44 |
import org.gvsig.vcsgis.lib.PipedIterator; |
46 | 45 |
import org.gvsig.vcsgis.lib.SAJParserImpl; |
47 | 46 |
import org.gvsig.vcsgis.lib.VCSGisChange; |
... | ... | |
51 | 50 |
import org.gvsig.vcsgis.lib.repository.requests.VCSGisCommitRequest; |
52 | 51 |
import org.gvsig.vcsgis.lib.repository.requests.VCSGisRequest; |
53 | 52 |
import static org.gvsig.vcsgis.lib.server.handlers.AbstractVCSGisServertHandler.LOGGER; |
53 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntity; |
|
54 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntityImpl; |
|
54 | 55 |
|
55 | 56 |
/** |
56 | 57 |
* |
... | ... | |
103 | 104 |
} |
104 | 105 |
if( !jsonParams.isNull("Entities") ) { |
105 | 106 |
for (JsonValue jsonvEntity : jsonParams.getJsonArray("Entities")) { |
106 |
VCSGisEntityEditable entity = new EntityEditableImpl((JsonObject) jsonvEntity);
|
|
107 |
VCSGisWorkspaceEntity entity = new VCSGisWorkspaceEntityImpl((JsonObject) jsonvEntity);
|
|
107 | 108 |
request.add(entity); |
108 | 109 |
} |
109 | 110 |
} |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/resources/org/gvsig/vcsgis/lib/impl/expecteds/S03Checkout.txt | ||
---|---|---|
34 | 34 |
"TopologyPlanCode":null, |
35 | 35 |
"UserCode":null, |
36 | 36 |
"Category":null, |
37 |
"Label":"test" |
|
37 |
"Label":"test", |
|
38 |
"Autorizations":null, |
|
39 |
"TopologyPlanMode":0 |
|
38 | 40 |
} |
39 | 41 |
}, |
40 | 42 |
"Data":[ |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/resources/org/gvsig/vcsgis/lib/impl/expecteds/S02Commit.txt | ||
---|---|---|
25 | 25 |
"TopologyPlanCode":null, |
26 | 26 |
"UserCode":null, |
27 | 27 |
"Category":null, |
28 |
"Label":"test" |
|
28 |
"Label":"test", |
|
29 |
"Autorizations":null, |
|
30 |
"TopologyPlanMode":-1, |
|
31 |
"LocalRevisionCode":null |
|
29 | 32 |
} |
30 | 33 |
], |
31 | 34 |
"NewEntityCodes":[ |
... | ... | |
77 | 80 |
"TopologyPlanCode":null, |
78 | 81 |
"UserCode":null, |
79 | 82 |
"Category":null, |
80 |
"Label":"test" |
|
83 |
"Label":"test", |
|
84 |
"Autorizations":null, |
|
85 |
"TopologyPlanMode":-1, |
|
86 |
"LocalRevisionCode":null |
|
81 | 87 |
} |
82 | 88 |
] |
83 | 89 |
} |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/resources/org/gvsig/vcsgis/lib/impl/expecteds/S01Entities.txt | ||
---|---|---|
27 | 27 |
"TopologyPlanCode":null, |
28 | 28 |
"UserCode":null, |
29 | 29 |
"Category":null, |
30 |
"Label":"test" |
|
30 |
"Label":"test", |
|
31 |
"Autorizations":null, |
|
32 |
"TopologyPlanMode":0 |
|
31 | 33 |
} |
32 | 34 |
] |
33 | 35 |
} |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/resources/org/gvsig/vcsgis/lib/impl/expecteds/S05Update.txt | ||
---|---|---|
33 | 33 |
"TopologyPlanCode":null, |
34 | 34 |
"UserCode":null, |
35 | 35 |
"Category":null, |
36 |
"Label":"test" |
|
36 |
"Label":"test", |
|
37 |
"Autorizations":null, |
|
38 |
"TopologyPlanMode":0 |
|
37 | 39 |
} |
38 | 40 |
}, |
39 | 41 |
"Data":[ |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.swing/org.gvsig.vcsgis.swing.impl/pom.xml | ||
---|---|---|
51 | 51 |
<dependency> |
52 | 52 |
<groupId>org.gvsig</groupId> |
53 | 53 |
<artifactId>org.gvsig.topology.swing.api</artifactId> |
54 |
<version>1.0.15-SNAPSHOT</version> |
|
55 |
<type>jar</type> |
|
54 |
<scope>compile</scope> |
|
56 | 55 |
</dependency> |
57 | 56 |
</dependencies> |
58 | 57 |
</project> |
Also available in: Unified diff