Revision 2381 org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/client/FeatureStoreObserver.java
FeatureStoreObserver.java | ||
---|---|---|
1 |
package org.gvsig.cvsgis.client;
|
|
1 |
package org.gvsig.vcsgis.client;
|
|
2 | 2 |
|
3 | 3 |
import org.apache.commons.lang3.StringUtils; |
4 |
import static org.gvsig.cvsgis.lib.CvsGisManager.OP_DELETE;
|
|
5 |
import static org.gvsig.cvsgis.lib.CvsGisManager.OP_INSERT;
|
|
6 |
import static org.gvsig.cvsgis.lib.CvsGisManager.OP_UPDATE;
|
|
4 |
import static org.gvsig.vcsgis.lib.VCSGisManager.OP_DELETE;
|
|
5 |
import static org.gvsig.vcsgis.lib.VCSGisManager.OP_INSERT;
|
|
6 |
import static org.gvsig.vcsgis.lib.VCSGisManager.OP_UPDATE;
|
|
7 | 7 |
import org.gvsig.fmap.dal.DALLocator; |
8 | 8 |
import org.gvsig.fmap.dal.DataManager; |
9 | 9 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
... | ... | |
22 | 22 |
public void update(Observable observable, Object notification) { |
23 | 23 |
FeatureStoreNotification n = (FeatureStoreNotification) notification; |
24 | 24 |
FeatureStore store = (FeatureStore) n.getSource(); |
25 |
CvsGisWorkspaceEx workspace;
|
|
25 |
VCSGisWorkspaceEx workspace;
|
|
26 | 26 |
switch(n.getType()) { |
27 | 27 |
case FeatureStoreNotification.BEFORE_INSERT: |
28 |
workspace = CvsGisWorkspaceImpl.workspace(store);
|
|
28 |
workspace = VCSGisWorkspaceImpl.workspace(store);
|
|
29 | 29 |
if( workspace!=null ) { |
30 | 30 |
EditableFeature feature = (EditableFeature) n.getFeature(); |
31 |
if( StringUtils.isBlank(feature.getString("CVSGISID")) ) {
|
|
32 |
feature.set("CVSGISID", workspace.createUniqueID());
|
|
31 |
if( StringUtils.isBlank(feature.getString("vcsgisID")) ) {
|
|
32 |
feature.set("vcsgisID", workspace.createUniqueID());
|
|
33 | 33 |
} |
34 | 34 |
if( store.isAppending() ) { |
35 | 35 |
workspace.add_change(OP_INSERT, store, feature); |
... | ... | |
38 | 38 |
break; |
39 | 39 |
case FeatureStoreNotification.AFTER_UPDATE: |
40 | 40 |
if( store.isAppending() ) { |
41 |
workspace = CvsGisWorkspaceImpl.workspace(store);
|
|
41 |
workspace = VCSGisWorkspaceImpl.workspace(store);
|
|
42 | 42 |
if( workspace!=null ) { |
43 | 43 |
workspace.add_change(OP_UPDATE, store, n.getFeature()); |
44 | 44 |
} |
... | ... | |
46 | 46 |
break; |
47 | 47 |
case FeatureStoreNotification.AFTER_DELETE: |
48 | 48 |
if( store.isAppending() ) { |
49 |
workspace = CvsGisWorkspaceImpl.workspace(store);
|
|
49 |
workspace = VCSGisWorkspaceImpl.workspace(store);
|
|
50 | 50 |
if( workspace!=null ) { |
51 | 51 |
workspace.add_change(OP_DELETE, store, n.getFeature()); |
52 | 52 |
} |
... | ... | |
59 | 59 |
break; |
60 | 60 |
case FeatureStoreNotification.BEFORE_FINISHEDITING: |
61 | 61 |
if( store.isEditing() ) { |
62 |
workspace = CvsGisWorkspaceImpl.workspace(store);
|
|
62 |
workspace = VCSGisWorkspaceImpl.workspace(store);
|
|
63 | 63 |
if( workspace!=null ) { |
64 | 64 |
workspace.add_changes( |
65 | 65 |
store, |
Also available in: Unified diff