Revision 2701 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
VCSGisWorkspaceImpl.java | ||
---|---|---|
41 | 41 |
import static org.gvsig.vcsgis.lib.VCSGisManagerImpl.INTERNAL_TABLES; |
42 | 42 |
import org.gvsig.vcsgis.lib.workspace.tables.EntitiesTable; |
43 | 43 |
import org.gvsig.vcsgis.lib.workspace.tables.EntitiesTable.EntityRow; |
44 |
import org.gvsig.vcsgis.lib.workspace.tables.LocalChangesTable;
|
|
45 |
import org.gvsig.vcsgis.lib.workspace.tables.LocalChangesTable.LocalChangeRow;
|
|
44 |
import org.gvsig.vcsgis.lib.workspace.tables.WorkspaceChangesTable;
|
|
45 |
import org.gvsig.vcsgis.lib.workspace.tables.WorkspaceChangesTable.WorkspaceChangeRow;
|
|
46 | 46 |
import org.gvsig.vcsgis.lib.workspace.tables.LocalRevisionsTable; |
47 | 47 |
import org.gvsig.vcsgis.lib.workspace.tables.LocalRevisionsTable.LocalRevisionRow; |
48 | 48 |
import org.gvsig.vcsgis.lib.workspace.tables.RemoteChangesTable; |
... | ... | |
376 | 376 |
return ERR_NO_ERROR; |
377 | 377 |
} |
378 | 378 |
EntityRow entity = this.getWorkspaceEntityByName(entityName); |
379 |
LocalChangeRow change = new LocalChangeRow(this);
|
|
379 |
WorkspaceChangeRow change = new WorkspaceChangeRow(this);
|
|
380 | 380 |
change.setEntityCode(entity.getCode()); |
381 | 381 |
change.setFeatureCode(feature.getString(entity.getFeatureIdFieldName())); |
382 | 382 |
change.setOperation(operation); |
... | ... | |
434 | 434 |
err = ERR_CANT_INSERT_CHANGE; |
435 | 435 |
|
436 | 436 |
entity = this.getWorkspaceEntityByName(name); |
437 |
LocalChangeRow change = new LocalChangeRow(this);
|
|
437 |
WorkspaceChangeRow change = new WorkspaceChangeRow(this);
|
|
438 | 438 |
change.setEntityCode(entity.getCode()); |
439 | 439 |
change.setFeatureCode(null); |
440 | 440 |
change.setOperation(OP_ADD_ENTITY); |
... | ... | |
476 | 476 |
if (entity == null) { |
477 | 477 |
return ERR_STORE_NOT_IN_VERSION_CONTROL; |
478 | 478 |
} |
479 |
LocalChangesTable changesTable = new LocalChangesTable();
|
|
479 |
WorkspaceChangesTable changesTable = new WorkspaceChangesTable();
|
|
480 | 480 |
FeatureStore changes_store = null; |
481 | 481 |
int err = ERR_CANT_OPEN_CHANGES; |
482 | 482 |
try { |
483 |
changes_store = this.getFeatureStore(LocalChangesTable.TABLE_NAME);
|
|
483 |
changes_store = this.getFeatureStore(WorkspaceChangesTable.TABLE_NAME);
|
|
484 | 484 |
err = ERR_CANT_INSERT_CHANGE; |
485 | 485 |
changes_store.edit(FeatureStore.MODE_PASS_THROUGH); |
486 | 486 |
if (insertedsFeatures != null) { |
... | ... | |
489 | 489 |
if (f == null) { |
490 | 490 |
continue; |
491 | 491 |
} |
492 |
LocalChangeRow change = new LocalChangeRow(this);
|
|
492 |
WorkspaceChangeRow change = new WorkspaceChangeRow(this);
|
|
493 | 493 |
change.setEntityCode(entity.getCode()); |
494 | 494 |
change.setFeatureCode(f.getString(entity.getFeatureIdFieldName())); |
495 | 495 |
change.setOperation(OP_INSERT); |
... | ... | |
504 | 504 |
if (f == null) { |
505 | 505 |
continue; |
506 | 506 |
} |
507 |
LocalChangeRow change = new LocalChangeRow(this);
|
|
507 |
WorkspaceChangeRow change = new WorkspaceChangeRow(this);
|
|
508 | 508 |
String featureCode = f.getString(entity.getFeatureIdFieldName()); |
509 |
LocalChangeRow previousChange = changesTable.find(this, changes_store, entity.getCode(), featureCode);
|
|
509 |
WorkspaceChangeRow previousChange = changesTable.find(this, changes_store, entity.getCode(), featureCode);
|
|
510 | 510 |
if(previousChange == null) { |
511 | 511 |
change.setEntityCode(entity.getCode()); |
512 | 512 |
change.setFeatureCode(f.getString(entity.getFeatureIdFieldName())); |
... | ... | |
527 | 527 |
if (f == null) { |
528 | 528 |
continue; |
529 | 529 |
} |
530 |
LocalChangeRow change = new LocalChangeRow(this);
|
|
530 |
WorkspaceChangeRow change = new WorkspaceChangeRow(this);
|
|
531 | 531 |
String featureCode = f.getString(entity.getFeatureIdFieldName()); |
532 |
LocalChangeRow previousChange = changesTable.find(this, changes_store, entity.getCode(), featureCode);
|
|
532 |
WorkspaceChangeRow previousChange = changesTable.find(this, changes_store, entity.getCode(), featureCode);
|
|
533 | 533 |
if(previousChange == null) { |
534 | 534 |
change.setEntityCode(entity.getCode()); |
535 | 535 |
change.setFeatureCode(f.getString(entity.getFeatureIdFieldName())); |
... | ... | |
606 | 606 |
|
607 | 607 |
@Override |
608 | 608 |
public VCSGisWorkspaceChanges<VCSGisWorkspaceChange> getLocalChanges() { |
609 |
LocalChangesTable changesTable = new LocalChangesTable();
|
|
610 |
ChangesImpl changes = new ChangesImpl<LocalChangeRow>(changesTable.getByEntityCode(this,null), LocalChangesTable.SELECTED) {
|
|
609 |
WorkspaceChangesTable changesTable = new WorkspaceChangesTable();
|
|
610 |
ChangesImpl changes = new ChangesImpl<WorkspaceChangeRow>(changesTable.getByEntityCode(this,null), WorkspaceChangesTable.SELECTED) {
|
|
611 | 611 |
@Override |
612 |
protected LocalChangeRow createChange(Feature f) {
|
|
613 |
return new LocalChangeRow(VCSGisWorkspaceImpl.this, f);
|
|
612 |
protected WorkspaceChangeRow createChange(Feature f) {
|
|
613 |
return new WorkspaceChangeRow(VCSGisWorkspaceImpl.this, f);
|
|
614 | 614 |
} |
615 | 615 |
|
616 | 616 |
@Override |
617 |
protected void updateChange(FeatureStore store, LocalChangeRow change) {
|
|
617 |
protected void updateChange(FeatureStore store, WorkspaceChangeRow change) {
|
|
618 | 618 |
change.update(store); |
619 | 619 |
} |
620 | 620 |
|
... | ... | |
630 | 630 |
|
631 | 631 |
@Override |
632 | 632 |
public VCSGisWorkspaceChanges<VCSGisWorkspaceChange> getLocalChangesByEntityCode(String entityCode) { |
633 |
LocalChangesTable changesTable = new LocalChangesTable();
|
|
634 |
ChangesImpl changes = new ChangesImpl<LocalChangeRow>(changesTable.getByEntityCode(this,entityCode),LocalChangesTable.SELECTED) {
|
|
633 |
WorkspaceChangesTable changesTable = new WorkspaceChangesTable();
|
|
634 |
ChangesImpl changes = new ChangesImpl<WorkspaceChangeRow>(changesTable.getByEntityCode(this,entityCode),WorkspaceChangesTable.SELECTED) {
|
|
635 | 635 |
@Override |
636 |
protected LocalChangeRow createChange(Feature f) {
|
|
637 |
return new LocalChangeRow(VCSGisWorkspaceImpl.this, f);
|
|
636 |
protected WorkspaceChangeRow createChange(Feature f) {
|
|
637 |
return new WorkspaceChangeRow(VCSGisWorkspaceImpl.this, f);
|
|
638 | 638 |
} |
639 | 639 |
|
640 | 640 |
@Override |
641 |
protected void updateChange(FeatureStore store, LocalChangeRow change) {
|
|
641 |
protected void updateChange(FeatureStore store, WorkspaceChangeRow change) {
|
|
642 | 642 |
change.update(store); |
643 | 643 |
} |
644 | 644 |
|
... | ... | |
701 | 701 |
request = this.repository.createCommitRequest(); |
702 | 702 |
request.setEfectiveDate(efectivedate); |
703 | 703 |
request.setComment(comment); |
704 |
LocalChangesTable changesTable = new LocalChangesTable();
|
|
704 |
WorkspaceChangesTable changesTable = new WorkspaceChangesTable();
|
|
705 | 705 |
EntitiesTable entitiesTable = new EntitiesTable(); |
706 | 706 |
|
707 | 707 |
LOGGER.debug("===: COMMIT: Adding changed local entities"); |
708 | 708 |
// A?adimos las entidades que vamos a actualizar con las revisiones que tenemos. |
709 | 709 |
DisposableFeatureSetIterable changesGroupedByEntity = changesTable.getGroupedByEntity(this); |
710 | 710 |
for (Feature fchange : changesGroupedByEntity) { |
711 |
LocalChangeRow change = new LocalChangeRow(this, fchange);
|
|
711 |
WorkspaceChangeRow change = new WorkspaceChangeRow(this, fchange);
|
|
712 | 712 |
EntityRow localEntity = change.getEntity(); |
713 | 713 |
// LOGGER.debug("===: COMMIT: add used entity = "+fchange.toJson().toString().replace('\n', ' ')); |
714 | 714 |
request.add(request.createEntity(localEntity)); |
... | ... | |
719 | 719 |
// Marcamos como nuevas las entidades que se han dado de alta. |
720 | 720 |
DisposableFeatureSetIterable changesOfAddEntities = changesTable.getByOperation(this, OP_ADD_ENTITY); |
721 | 721 |
for (Feature fchange : changesOfAddEntities) { |
722 |
LocalChangeRow change = new LocalChangeRow(this, fchange);
|
|
722 |
WorkspaceChangeRow change = new WorkspaceChangeRow(this, fchange);
|
|
723 | 723 |
request.markAsNew(change.getEntity()); |
724 | 724 |
} |
725 | 725 |
changesOfAddEntities.dispose(); |
... | ... | |
732 | 732 |
changes = changesTable.getAll(this); |
733 | 733 |
useSeleccion = false; |
734 | 734 |
} |
735 |
request.add( |
|
736 |
new DisposableIterableAdapter( |
|
735 |
request.add(new DisposableIterableAdapter( |
|
737 | 736 |
changes, |
738 | 737 |
new DisposableIterableAdapter.ItemConverter<Feature, VCSGisChange>() { |
739 | 738 |
@Override |
740 | 739 |
public VCSGisChange convert(Feature f) { |
741 |
return new LocalChangeRow(VCSGisWorkspaceImpl.this, f);
|
|
740 |
return new WorkspaceChangeRow(VCSGisWorkspaceImpl.this, f);
|
|
742 | 741 |
} |
743 | 742 |
} |
744 | 743 |
) |
... | ... | |
898 | 897 |
LOGGER.debug("===: UPDATE_PREPARE: Delete updates table"); |
899 | 898 |
updatesTable.delete(this, lentity.getCode()); |
900 | 899 |
|
901 |
LocalChangesTable changesTable = new LocalChangesTable();
|
|
900 |
WorkspaceChangesTable changesTable = new WorkspaceChangesTable();
|
|
902 | 901 |
String entityCode = lentity.getCode(); |
903 | 902 |
|
904 | 903 |
updates = request.getRepositoryData(); |
... | ... | |
927 | 926 |
case STATE_NEW: |
928 | 927 |
case STATE_OUTDATED_AND_MODIFIED: |
929 | 928 |
case STATE_MODIFIED: |
930 |
LocalChangeRow change = changesTable.getByEntityAndDataCode(
|
|
929 |
WorkspaceChangeRow change = changesTable.getByEntityAndDataCode(
|
|
931 | 930 |
this, |
932 | 931 |
entityCode, |
933 | 932 |
updateRow.getDataCode() |
Also available in: Unified diff